package malware.android.analysis;

import java.net.URL;

import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import android.malware.detection.logic.Extractortwo;

public class Utility {
	private static final String metamodelsFolder = "metamodels/";
	private static final String resourcesFolder = "res/";
	//private static final String transformationsFolder = "transf/";
	private static final String TransFolder = "Transformations/";
	
	private static final String ModelsFolder = "Models/";
	
	public static final String JAVA_METAMODEL_PATH = "http://www.eclipse.org/MoDisco/Java/0.2.incubation/java";
	public static final String XML_METAMODEL_PATH = "http://www.eclipse.org/MoDisco/Xml/0.1.incubation/XML";
public static final String ANOMALY_METAMODEL_PATH = getLocation() + metamodelsFolder + "ANO.ecore";
	
	
	public static final String ANDROID_SECURITY_METAMODEL_PATH = getLocation() + metamodelsFolder + "ASEC.ecore";
	
	public static final String FEATURE_METAMODEL_PATH = getLocation() + metamodelsFolder + "FeatureModel.ecore";
	
	public static final String ICC_PATTERN_METAMODEL_PATH = getLocation() + metamodelsFolder + "ICC.ecore";
	
	public static final String  KIND_OF_INTENT_SPOOFING = getLocation() + TransFolder + "KindOfIntentSpoofing.asm";
	
	public static final String xml_MODELS = getLocation() + ModelsFolder + "AndroidManifest_xml.xmi";
	public static final String java_MODELS = getLocation() + ModelsFolder + "android app for Smart Keyboard PRO_java.xmi";
	public static final String ANDROID_MODELS = getLocation() + ModelsFolder + "android.xmi";
	public static final String ANomaly_MODELS = getLocation() + ModelsFolder + "androidanomalyy.xmi";
	public static final String EXTRACT_ANDROID_MODELS = getLocation() + ModelsFolder + "androidDDD.xmi";
	public static final String ANomaly2_MODELS = getLocation() + ModelsFolder + "androidanomalyy2222.xmi";
	
	public static final String INTENT_SPOOFING_MODELS = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()+  "/" + "app.android.xmi";
	
	
	//public static final String KIND_OF_INTENT_SPOOFING = g TransFolder + "KindOfIntentSpoofing.asm";

	public static final String EMPTY_XMI_XML_PATH = getLocation().replaceFirst("file:/", "") + resourcesFolder + "empty_xml.xmi";
	public static final String EMPTY_XMI_JAVA_PATH = getLocation().replaceFirst("file:/", "") + resourcesFolder + "empty_java_project.xmi";
	
	public static final String XMI_XML_PATH = getLocation().replaceFirst("file:/", "") + resourcesFolder + "AndroidManifest_xml.xmi";
	public static final String XMI_JAVA_PATH = getLocation().replaceFirst("file:/", "") + resourcesFolder + "android app for Smart Keyboard PRO.xmi";
	
	
	
	public static final String EXTRACTING_ANDROID_SECURITY =getLocation() + TransFolder + "CreateSecurityModel.asm";
	public static final String EXTRACTING_ANDROID_SECURITY1 =EXTRACTING_ANDROID_SECURITY.replace("file:/", "");
	//System.out.print("    "+ this.AndroidManifestDescriptorPath);
	
	
	public static final String DETECTION_MALICIOUS_PERMISSIONS =getLocation() + TransFolder + "DetectionByPermissions.asm";
	public static final String DETECTION_MALICIOUS_PERMISSION1 =DETECTION_MALICIOUS_PERMISSIONS.replace("file:/", "");
	
	public static final String DETECTION_MALICIOUS_ACTIONS =getLocation() + TransFolder + "AnalysisOfActions.asm";
	public static final String DETECTION_MALICIOUS_ACTIONS1 =DETECTION_MALICIOUS_ACTIONS.replace("file:/", "");
	
	//for FeatureModel
	public static final String CREATE_FEATURE_MODE =getLocation() + TransFolder + "CreateFeatureModel.asm";
	public static final String CREATE_FEATURE_MODE1 =CREATE_FEATURE_MODE.replace("file:/", "");
	
	public static final String DETECTION_ICC_PATTERN =getLocation() + TransFolder + "ICCPatternDetection.asm";
	public static final String DETECTION_ICC_PATTERN1 =DETECTION_ICC_PATTERN.replace("file:/", "");
	

	
	
	
	
	public static final String getLocation() {	
		String st ;
		st = "" ;
//		URL url = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID),
//	            new Path("metamodels/ASEC.ecore"), null);
		String t = Platform.getBundle(Activator.PLUGIN_ID).getLocation().replaceFirst("reference:", ""); 
		return t ;
	}

}

