// Path: secu3droid/src/org/secu3/android/api/utils/ResourcesUtils.java
// public class ResourcesUtils {
// 	public static boolean isResource (String name) {
// 		return name != null && name.matches("[@]\\d+");
// 	}
// 	
// 	public static int referenceToInt (String reference) {
// 		if (reference == null) return 0;
// 		return Integer.parseInt(reference.replace("@",""));
// 	}
// 	
// 	public static String getReferenceString (Context context,String reference) {
// 		if (reference == null) return null;
// 		return context.getString(Integer.parseInt(reference.replace("@","")));
// 	}
// 	
// 	public static int getReferenceInt (Context context,String reference) {
// 		if (reference == null) return 0;
// 		return context.getResources().getInteger(Integer.parseInt(reference.replace("@","")));
// 	}
// }


import org.secu3.android.R;
import org.secu3.android.api.utils.ResourcesUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import java.io.IOException;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
		String attrValue;
		
		NumberFormat format = NumberFormat.getInstance(Locale.US);
		
		try {
			XmlPullParser xpp = getContext().getResources().getXml(xmlId);
			inputPackets = new SparseArray<> ();
			outputPackets = new SparseArray<> ();
			while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
				switch (xpp.getEventType()) {
				case XmlPullParser.START_TAG:
					name = xpp.getName();
					if (name.equalsIgnoreCase(PROTOCOL)) {
						if (inputPackets.size() != 0) throw new IllegalArgumentException("Pages adapter is non empty, probably nested Protocol element"); 
						if (outputPackets.size() != 0) throw new IllegalArgumentException("Pages adapter is non empty, probably nested Protocol element");
					} else					
					// Found new packet element
					if (name.equalsIgnoreCase(PACKET)) {
						String packetId = null;
						String packetName = null;
						String packetDir = null;
						int minVersion = protocolVersion;
						int maxVersion = protocolVersion;
						int count = xpp.getAttributeCount(); 
						if (count > 0) {
							for (int i = 0; i != count; i++) {
								attr  = xpp.getAttributeName(i);
								attrValue = xpp.getAttributeValue(i);
								switch (attr) {
									case NAME:
// Path: secu3droid/src/org/secu3/android/api/utils/ResourcesUtils.java
// public class ResourcesUtils {
// 	public static boolean isResource (String name) {
// 		return name != null && name.matches("[@]\\d+");
// 	}
// 	
// 	public static int referenceToInt (String reference) {
// 		if (reference == null) return 0;
// 		return Integer.parseInt(reference.replace("@",""));
// 	}
// 	
// 	public static String getReferenceString (Context context,String reference) {
// 		if (reference == null) return null;
// 		return context.getString(Integer.parseInt(reference.replace("@","")));
// 	}
// 	
// 	public static int getReferenceInt (Context context,String reference) {
// 		if (reference == null) return 0;
// 		return context.getResources().getInteger(Integer.parseInt(reference.replace("@","")));
// 	}
// }


// Path: secu3droid/src/org/secu3/android/api/io/Secu3ProtoWrapper.java
import org.secu3.android.R;
import org.secu3.android.api.utils.ResourcesUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import java.io.IOException;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;

		String attrValue;
		
		NumberFormat format = NumberFormat.getInstance(Locale.US);
		
		try {
			XmlPullParser xpp = getContext().getResources().getXml(xmlId);
			inputPackets = new SparseArray<> ();
			outputPackets = new SparseArray<> ();
			while (xpp.getEventType() != XmlPullParser.END_DOCUMENT) {
				switch (xpp.getEventType()) {
				case XmlPullParser.START_TAG:
					name = xpp.getName();
					if (name.equalsIgnoreCase(PROTOCOL)) {
						if (inputPackets.size() != 0) throw new IllegalArgumentException("Pages adapter is non empty, probably nested Protocol element"); 
						if (outputPackets.size() != 0) throw new IllegalArgumentException("Pages adapter is non empty, probably nested Protocol element");
					} else					
					// Found new packet element
					if (name.equalsIgnoreCase(PACKET)) {
						String packetId = null;
						String packetName = null;
						String packetDir = null;
						int minVersion = protocolVersion;
						int maxVersion = protocolVersion;
						int count = xpp.getAttributeCount(); 
						if (count > 0) {
							for (int i = 0; i != count; i++) {
								attr  = xpp.getAttributeName(i);
								attrValue = xpp.getAttributeValue(i);
								switch (attr) {
									case NAME:
										if (!ResourcesUtils.isResource(attrValue))