示例#1
0
文件: Class.cs 项目: DatZach/Xi
 public Class(string name, List<Method> methods, List<Variant> fields, Class cBase)
 {
     Module = null;
     Name = name;
     Methods = methods;
     Fields = fields;
     Base = cBase;
 }
示例#2
0
文件: Class.cs 项目: DatZach/Xi
 public Class(Class classHandle)
 {
     Module = null;
     Name = classHandle.Name;
     Methods = classHandle.Methods;
     Fields = classHandle.Fields;
     Base = classHandle.Base;
 }
示例#3
0
文件: Class.cs 项目: DatZach/Xi
 internal Class(string name, Class cBase)
 {
     Module = null;
     Methods = new List<Method>();
     FieldsCompiler = new Dictionary<string, Variant>();
     Fields = new List<Variant>();
     Base = cBase;
     Name = name;
 }
示例#4
0
        private void WriteModule(Module module, BinaryWriter stream)
        {
            stream.Write(module.Name);
            stream.Write((ushort)module.Fields.Count);

            WriteMethod(module.Body, stream);

            stream.Write(module.Classes.Count);
            foreach (Class cClass in module.Classes)
                WriteClass(cClass, stream);

            stream.Write(module.Methods.Count);
            foreach (Method method in module.Methods)
                WriteMethod(method, stream);
        }
示例#5
0
        private Module ReadModule(BinaryReader stream)
        {
            string name = stream.ReadString();
            Module module = new Module(name);

            ushort fieldCount = stream.ReadUInt16();
            for (ushort i = 0; i < fieldCount; ++i)
                module.Fields.Add(new Variant());

            module.Body = ReadMethod(stream);

            uint classCount = stream.ReadUInt32();
            while(classCount-- != 0)
                module.Classes.Add(ReadClass(stream));

            uint methodCount = stream.ReadUInt32();
            while(methodCount-- != 0)
                module.Methods.Add(ReadMethod(stream));

            return module;
        }
示例#6
0
        void AddModule(string name)
        {
            foreach (Module m in Modules)
                if (m.Name == name)
                    Stream.Error("Module \"{0}\" already declared previously.", m.Name);

            Module module = new Module(name);
            moduleStack.Push(module);
            Modules.Add(module);
        }