コード例 #1
0
ファイル: Starter.cs プロジェクト: traien/Virtion.ApkTool
        private static string GetMainClassFromJarManifest(string mainClass)
        {
            JarFile jarFile = new JarFile(mainClass);
            string  result;

            try
            {
                Manifest manifest = jarFile.getManifest();
                if (manifest == null)
                {
                    Console.Error.WriteLine("Jar file doesn't contain manifest");
                    result = null;
                    return(result);
                }
                mainClass = manifest.getMainAttributes().getValue(java.util.jar.Attributes.Name.MAIN_CLASS);
            }
            finally
            {
                jarFile.close();
            }
            if (mainClass == null)
            {
                Console.Error.WriteLine("Manifest doesn't contain a Main-Class.");
                result = null;
            }
            else
            {
                result = mainClass.Replace('/', '.');
            }
            return(result);
        }
コード例 #2
0
    private static string GetMainClassFromJarManifest(string mainClass)
    {
        JarFile jf = new JarFile(mainClass);

        try
        {
            Manifest manifest = jf.getManifest();
            if (manifest == null)
            {
                Console.Error.WriteLine("Jar file doesn't contain manifest");
                return(null);
            }
            mainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
        }
        finally
        {
            jf.close();
        }
        if (mainClass == null)
        {
            Console.Error.WriteLine("Manifest doesn't contain a Main-Class.");
            return(null);
        }
        return(mainClass.Replace('/', '.'));
    }