コード例 #1
0
 public void Merge(AsmObj it)
 {
     foreach (Type t in it.obj.GetTypes())
     {
         Add(new TypeObj()
         {
             asm_name = it.name,
             cls_name = t.FullName,
         });
     }
 }
コード例 #2
0
        public void RegisterAsm(Assembly asm)
        {
            AsmObj it = AsmMap.Merge(asm);

            TypeMap.Merge(it);
        }
コード例 #3
0
        public void FromZip(byte[] buff)
        {
            using (ZipArchive zip = new ZipArchive(new MemoryStream(buff)))
            {
                ZipArchiveEntry iConfig = zip.GetEntry("config.json");
                if (iConfig != null)
                {
                    using (Stream s = iConfig.Open())
                        using (StreamReader sr = new StreamReader(s, Encoding.UTF8))
                        {
                            Config = new Configuration();
                            Config.FromJson(sr.ReadToEnd());
                        }
                }

                AsmMap = new AsmContainer(this);
                for (int i = 0; i < Config.AssemblyCount; i++)
                {
                    ZipArchiveEntry it = zip.GetEntry("assemblies/" + i.ToString() + ".dll");
                    if (it != null)
                    {
                        using (Stream s = it.Open())
                        {
                            byte[] buffer = new byte[it.Length];
                            s.Read(buffer, 0, buffer.Length);

                            AsmObj add = new AsmObj();
                            add.load(buffer);
                            AsmMap.Add(add);
                        }
                    }
                }

                TypeMap = new TypeContainer();
                foreach (AsmObj it in AsmMap)
                {
                    TypeMap.Merge(it);
                }

                ModelMap = new ModelContainer(this);
                for (int i = 0; i < Config.ModelCount; i++)
                {
                    ZipArchiveEntry it = zip.GetEntry("models/" + i.ToString() + ".json");
                    if (it != null)
                    {
                        using (Stream s = it.Open())
                            using (StreamReader sr = new StreamReader(s, Encoding.UTF8))
                            {
                                ModelObj add = new ModelObj(this);
                                add.FromJson(sr.ReadToEnd());
                                ModelMap.Add(add);
                            }
                    }
                }
            }

            //ZipArchiveEntry iModels = zip.GetEntry("models");
            //if (iModels != null)
            //{
            //    using (MemoryStream ms = iModels.Open() as MemoryStream)
            //    {
            //        ModelMap = new ModelContainer(this);
            //        ModelMap.FromZip(ms.ToArray());
            //    }
            //}

            //ZipArchiveEntry iAssemblies = zip.GetEntry("assemblies");
            //if (iAssemblies != null)
            //{
            //    using (MemoryStream ms = iAssemblies.Open() as MemoryStream)
            //    {
            //        AsmMap = new AsmContainer(this);
            //        AsmMap.FromZip(ms.ToArray());
            //    }
            //}
        }
コード例 #4
0
        //private void LoadFromByte(byte[] buff)
        //{
        //    //FromString(
        //    //    CML.ComUtility.GetString(
        //    //        CML.ComUtility.Decompress(buff)
        //    //        )
        //    //    );
        //    FromJson(UTF8Encoding.UTF8.GetString(buff));
        //}

        public void RegisterAsm(byte[] buff)
        {
            AsmObj it = AsmMap.Merge(buff);

            TypeMap.Merge(it);
        }