/// <summary> /// Try loading the jar file to see if we have a stub jar. /// </summary> private void jarLoader_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { importCode = true; libName = string.Empty; var jarPath = (string)e.Argument; try { var hasJarPath = !string.IsNullOrEmpty(jarPath) && File.Exists(jarPath); if (hasJarPath) { var jf = new JarFile(File.OpenRead(jarPath), jarPath, null); ClassFile result; if (jf.TryLoadClass("com/google/android/maps/MapActivity", out result)) { importCode = false; libName = "com.google.android.maps"; } } } catch (Exception) { // Ignore } }
public void Test() { var jf = new JarFile(new MemoryStream(Resources.android), "test", null); foreach (var name in jf.ClassNames) { ClassFile cf; jf.TryLoadClass(name, out cf); } }