Пример #1
0
        public static ClassMethodGetter LoadClassMethodGetter(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            //protected int indexofMember;
            int indexofMember = reader.ReadInt32();
            //private readonly string _name;
            string _name = reader.ReadString();
            //public readonly int refdefinedinblockid;
            int refdefinedinblockid = reader.ReadInt32();
            //protected int functionid;
            int functionid = reader.ReadInt32();

            ///// <summary>
            ///// 比如说,私有方法就肯定不是虚方法
            ///// </summary>
            //protected bool isNotReadVirtual = false;
            bool isNotReadVirtual = reader.ReadBoolean();

            RunTimeDataType datetype = reader.ReadInt32();

            ClassMethodGetter cg = new ClassMethodGetter(_name, null, indexofMember, refdefinedinblockid);

            serizlized.Add(key, cg);

            //protected readonly ASBinCode.rtti.Class _class;
            ASBinCode.rtti.Class _class = serizlizer.DeserializeObject <rtti.Class>(reader, rtti.Class.LoadClass);

            cg._class = _class;


            cg.functionid       = functionid;
            cg.isNotReadVirtual = isNotReadVirtual;
            cg.valueType        = datetype;

            return(cg);
        }
        public static ISWCSerializable LoadIMember(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            int membertype = reader.ReadInt32();

            if (membertype == 0)
            {
                return(ClassMethodGetter.LoadClassMethodGetter(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 1)
            {
                return(InterfaceMethodGetter.LoadInterfaceMethodGetter(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 2)
            {
                return(ClassPropertyGetter.LoadClassPropertyGetter(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 3)
            {
                return(Variable.LoadVariable(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 4)
            {
                return(Field.LoadField(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 5)
            {
                return(StackSlotAccessor.LoadRegister(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 6)
            {
                return(rtData.RightValue.LoadRightValue(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 7)
            {
                return(StaticClassDataGetter.LoadStaticClassDataGetter(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 8)
            {
                return(ThisPointer.LoadThisPointer(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 9)
            {
                return(SuperPointer.LoadSuperPointer(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 10)
            {
                return(MemRegister_Number.LoadRegister(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 11)
            {
                return(MemRegister_Boolean.LoadRegister(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 12)
            {
                return(MemRegister_Int.LoadRegister(reader, serizlizer, serizlized, key));
            }
            else if (membertype == 13)
            {
                return(MemRegister_UInt.LoadRegister(reader, serizlizer, serizlized, key));
            }
            //else if (membertype == 14)
            //{
            //	return MemRegister_Object.LoadRegister(reader, serizlizer, serizlized, key);
            //}
            else
            {
                throw new IOException("格式异常");
            }
        }