Пример #1
0
        public static void WriteJarArchive(this DataOutputStream stream, MetadataJarArchive archive)
        {
            LogVerbose($"Writing {archive.JavaClasses.Count} metadata classes to file.");
            stream.WriteInt(archive.JavaClasses.Count);
            foreach (var(key, value) in archive.JavaClasses)
            {
                LogDebug($"Writing the class {key} to file.");
                stream.WriteJarArchiveClass(key, value);
            }

            LogVerbose($"Finished writing {archive.JavaClasses.Count} metadata classes to file.");
        }
Пример #2
0
        public static MetadataJarArchive ReadJarArchive(this DataInputStream stream)
        {
            var archive = new MetadataJarArchive();
            var length  = stream.ReadInt();

            for (var i = 0; i < length; i++)
            {
                var(key, value)          = stream.ReadJarArchiveClass();
                archive.JavaClasses[key] = value;
            }

            return(archive);
        }
Пример #3
0
        public static JarArchive ToDataClass(this MetadataJarArchive meta)
        {
            var archive     = new JarArchive("Memory-File.jar", new byte[0]);
            var javaClasses = meta.JavaClasses.Select(c => (c.Key, c.Value.ToDataClass()));

            var repository = SyntheticRepository.GetInstance();

            foreach (var(name, clazz) in javaClasses)
            {
                repository.StoreClass(new VirtualDataClass(clazz));
                LoadedClassRepository.Instance.StoreClass(clazz);
                archive.Classes.Add(name, clazz);
            }

            return(archive);
        }