コード例 #1
0
ファイル: SmokeTest.cs プロジェクト: CptWesley/JavaNet
        public void Bla()
        {
            string file = "C:/Users/Wesley/Desktop/New folder (3)/rt.jar";

            using ZipArchive archive = ZipFile.OpenRead(file);
            AssemblyConverter converter = new AssemblyConverter("Rt");

            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                using Stream stream = entry.Open();
                JavaClass jc = JavaClass.Create(stream);
                converter.Include(jc);
            }

            byte[]        bytes    = converter.Convert();
            Assembly      assembly = Assembly.Load(bytes);
            StringBuilder sb       = new StringBuilder();

            sb.AppendLine();
            foreach (Type t in assembly.GetTypes())
            {
                sb.AppendLine($"Type: {t.FullName}");
            }

            throw new Exception(sb.ToString());
        }
コード例 #2
0
        private static void AddFile(AssemblyConverter converter, Stream stream)
        {
            JavaClass jc = JavaClass.Create(stream);

            Console.WriteLine($"Finished parsing '{jc.GetName()}'");
            converter.Include(jc);
        }
コード例 #3
0
ファイル: SmokeTest.cs プロジェクト: CptWesley/JavaNet
        public void Loading()
        {
            AssemblyConverter converter = new AssemblyConverter("HelloWorld");

            foreach (string file in Resource.GetNames("MultipleTypes"))
            {
                using Stream stream = Resource.Get(file);
                JavaClass jc = JavaClass.Create(stream);
                converter.Include(jc);
            }

            byte[]        bytes    = converter.Convert();
            Assembly      assembly = Assembly.Load(bytes);
            StringBuilder sb       = new StringBuilder();

            sb.AppendLine();
            foreach (Type t in assembly.GetTypes())
            {
                sb.AppendLine($"Type: {t.FullName}");
            }

            throw new Exception(sb.ToString());
        }