Esempio n. 1
0
        protected void LoadScopeBase(BinaryReader reader, CSWCSerizlizer serizlizer)
        {
            _parent = serizlizer.DeserializeObject <ScopeBase>(reader, Deserialize);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                memberlist.Add((IMember)serizlizer.DeserializeObject <ISWCSerializable>(reader, ISWCSerializableLoader.LoadIMember));
            }
        }
Esempio n. 2
0
        public static FunctionScope LoadFunctionScope(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            rtti.FunctionDefine function = serizlizer.DeserializeObject <rtti.FunctionDefine>(reader, rtti.FunctionDefine.LoadFunctionDefine);
            FunctionScope       scope    = new FunctionScope(function); serizlized.Add(key, scope);

            scope.LoadScopeBase(reader, serizlizer);
            return(scope);
        }
Esempio n. 3
0
        public static OutPackageMemberScope LoadOutPackageMemberScope(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            OutPackageMemberScope scope = new OutPackageMemberScope(null); serizlized.Add(key, scope);

            rtti.Class mainclass = serizlizer.DeserializeObject <rtti.Class>(reader, rtti.Class.LoadClass);
            scope.mainclass = mainclass;
            scope.LoadScopeBase(reader, serizlizer);
            return(scope);
        }
        public static ObjectInstanceScope LoadObjectInstanceScope(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            ObjectInstanceScope scope = new ObjectInstanceScope(null); serizlized.Add(key, scope);

            rtti.Class _class = serizlizer.DeserializeObject <rtti.Class>(reader, rtti.Class.LoadClass);
            scope._class = _class;

            scope.LoadScopeBase(reader, serizlizer);

            return(scope);
        }
Esempio n. 5
0
        public static RightValue LoadRightValue(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            RunTimeDataType  vtype = reader.ReadInt32();
            RunTimeValueBase v     = serizlizer.DeserializeObject <RunTimeValueBase>(reader, RunTimeValueBase.LoadRunTimeValueBase);

            RightValue rv = new RightValue(v); serizlized.Add(key, rv);

            rv.valueType = vtype;

            return(rv);
        }
Esempio n. 6
0
		public static FunctionSignature LoadSignature(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary<int, object> serizlized, int key)
		{
			FunctionSignature signature = new FunctionSignature();serizlized.Add(key, signature);
			signature.parameters = new List<FunctionParameter>();
			int count = reader.ReadInt32();
			for (int i = 0; i < count; i++)
			{
				signature.parameters.Add(serizlizer.DeserializeObject<FunctionParameter>(reader, FunctionParameter.LoadFunctionParameter ));
			}

			signature.returnType = reader.ReadInt32();
			signature.onStackParameters = reader.ReadInt32();

			return signature;
		}
        public static FunctionParameter LoadFunctionParameter(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            FunctionParameter parameter = new FunctionParameter(); serizlized.Add(key, parameter);

            /// <summary>
            /// 参数名
            /// </summary>
            //public string name;
            parameter.name = reader.ReadString();
            ///// <summary>
            ///// 参数类型
            ///// </summary>
            //public RunTimeDataType type;
            parameter.type = reader.ReadInt32();
            ///// <summary>
            ///// 默认值
            ///// </summary>
            //public RightValueBase defaultValue;
            parameter.defaultValue = (RightValueBase)serizlizer.DeserializeObject <ISWCSerializable>(reader, ISWCSerializableLoader.LoadIMember);
            ///// <summary>
            ///// 是否是参数数组
            ///// </summary>
            //public bool isPara;
            parameter.isPara = reader.ReadBoolean();


            ///// <summary>
            ///// 是否通过栈来传递
            ///// </summary>
            //public bool isOnStack;
            parameter.isOnStack = reader.ReadBoolean();
            //public LeftValueBase varorreg;
            parameter.varorreg = (LeftValueBase)serizlizer.DeserializeObject <ISWCSerializable>(reader, ISWCSerializableLoader.LoadIMember);

            return(parameter);
        }
        public static FunctionDefine LoadFunctionDefine(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            int            functionid     = reader.ReadInt32();
            FunctionDefine functionDefine = new FunctionDefine(functionid); serizlized.Add(key, functionDefine);

            //	public bool IsAnonymous;
            functionDefine.IsAnonymous = reader.ReadBoolean();
            //public string name;
            functionDefine.name = reader.ReadString();
            //public bool isMethod;
            functionDefine.isMethod = reader.ReadBoolean();
            //public bool isStatic;
            functionDefine.isStatic = reader.ReadBoolean();
            //public bool isConstructor;
            functionDefine.isConstructor = reader.ReadBoolean();

            //public int blockid;
            functionDefine.blockid = reader.ReadInt32();

            ///// <summary>
            ///// 是否本地函数
            ///// </summary>
            //public bool isNative;
            functionDefine.isNative = reader.ReadBoolean();
            //public string native_name;
            if (reader.ReadBoolean())
            {
                functionDefine.native_name = reader.ReadString();
            }
            //public int native_index;
            functionDefine.native_index = reader.ReadInt32();
            ///// <summary>
            ///// 是否为yield返回
            ///// </summary>
            //public bool isYield;
            functionDefine.isYield = reader.ReadBoolean();
            //public FunctionSignature signature;

            functionDefine.signature = serizlizer.DeserializeObject <FunctionSignature>(reader, FunctionSignature.LoadSignature);

            return(functionDefine);
        }
Esempio n. 9
0
        public static ClassMember LoadClassMember(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            ///// <summary>
            ///// 成员名
            ///// </summary>
            //public string name;
            string name = reader.ReadString();

            ClassMember classMember = new ClassMember(); serizlized.Add(key, classMember);

            classMember.name = name;
            Class refClass = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass
                                                                  );
            //public readonly IMember bindField;
            IMember bindField = (IMember)serizlizer.DeserializeObject <ISWCSerializable>(reader, ISWCSerializableLoader.LoadIMember
                                                                                         );



            classMember.refClass  = refClass;
            classMember.bindField = bindField;


            //public bool isPublic;
            classMember.isPublic = reader.ReadBoolean();
            //public bool isInternal;
            classMember.isInternal = reader.ReadBoolean();
            //public bool isPrivate;
            classMember.isPrivate = reader.ReadBoolean();
            //public bool isProtectd;
            classMember.isProtectd = reader.ReadBoolean();

            ///// <summary>
            ///// 是否属性读取器
            ///// </summary>
            //public bool isGetter;
            classMember.isGetter = reader.ReadBoolean();
            ///// <summary>
            ///// 是否属性设置器
            ///// </summary>
            //public bool isSetter;
            classMember.isSetter = reader.ReadBoolean();

            ///// <summary>
            ///// 是否覆盖基类方法
            ///// </summary>
            //public bool isOverride;
            classMember.isOverride = reader.ReadBoolean();

            //public bool isFinal;
            classMember.isFinal = reader.ReadBoolean();

            ///// <summary>
            ///// 是否是静态成员
            ///// </summary>
            //public bool isStatic;
            classMember.isStatic = reader.ReadBoolean();
            ///// <summary>
            ///// 是否是常量
            ///// </summary>
            //public bool isConst;
            classMember.isConst = reader.ReadBoolean();
            ///// <summary>
            ///// 是否是构造函数
            ///// </summary>
            //public bool isConstructor;
            classMember.isConstructor = reader.ReadBoolean();

            ///// <summary>
            ///// 成员字面值,比如1000,"aabc"等确定的字面值
            ///// </summary>
            //public RunTimeValueBase defaultValue;
            classMember.defaultValue = serizlizer.DeserializeObject <RunTimeValueBase>(reader, RunTimeValueBase.LoadRunTimeValueBase);

            ///// <summary>
            ///// 从哪个类继承而来
            ///// </summary>
            //public Class inheritFrom;
            classMember.inheritFrom = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);

            ///// <summary>
            ///// 继承源
            ///// </summary>
            //public ClassMember inheritSrcMember;
            classMember.inheritSrcMember = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);

            //public ClassMember virtualLink;
            classMember.virtualLink = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            //public Class virtualLinkFromClass;
            //classMember.virtualLinkFromClass = serizlizer.DeserializeObject<Class>(reader, Class.LoadClass);

            //classMember.overridedMember = serizlizer.DeserializeObject<ClassMember>(reader, ClassMember.LoadClassMember);

            //private RunTimeDataType _type;
            classMember._type = reader.ReadInt32();


            return(classMember);
        }
Esempio n. 10
0
File: Class.cs Progetto: ikvm/ASTool
        public static rtti.Class LoadClass(BinaryReader reader, CSWCSerizlizer serizlizer, IDictionary <int, object> serizlized, int key)
        {
            //	/// <summary>
            //	/// 指明这是否是一个接口定义
            //	/// </summary>
            //public bool isInterface;
            bool isInterface = reader.ReadBoolean();
            ///// <summary>
            ///// 指明这是否是一个包级函数
            ///// </summary>
            //public bool isPackageFunction;
            bool isPackageFunction = reader.ReadBoolean();
            ///// <summary>
            ///// 是否文档类
            ///// </summary>
            //public bool isdocumentclass;
            bool isdocumentclass = reader.ReadBoolean();
            ///// <summary>
            ///// 是否是需要非托管类
            ///// </summary>
            //public bool isUnmanaged;
            bool isUnmanaged = reader.ReadBoolean();
            ///// <summary>
            ///// 链接到的系统对象是否是一个结构体
            ///// </summary>
            //public bool isStruct;
            bool isStruct = reader.ReadBoolean();
            ///// <summary>
            ///// 结构体排序序号(从1开始排起)
            ///// </summary>
            //public int structIndex;
            int structIndex = reader.ReadInt32();
            ///// <summary>
            ///// 是否链接到系统对象
            ///// </summary>
            //public bool isLink_System;
            bool isLink_System = reader.ReadBoolean();

            bool isCrossExtend = reader.ReadBoolean();

            //public readonly string md5key;
            string md5key = reader.ReadString();
            //public readonly int classid;
            int classid = reader.ReadInt32();
            //	/// <summary>
            //	/// 类定义代码所在blockid
            //	/// </summary>
            //public readonly int blockid;
            int blockid = reader.ReadInt32();

            rtti.Class _class = new Class(classid, blockid, serizlizer.loadingSwc, md5key); serizlized.Add(key, _class);
            _class.isInterface       = isInterface;
            _class.isPackageFunction = isPackageFunction;
            _class.isdocumentclass   = isdocumentclass;
            _class.isUnmanaged       = isUnmanaged;
            _class.isStruct          = isStruct;
            _class.structIndex       = structIndex;
            _class.isLink_System     = isLink_System;
            _class.isCrossExtend     = isCrossExtend;

            ///// <summary>
            ///// 系统对象创建器
            ///// </summary>
            //public ClassMember linkObjCreator;
            _class.linkObjCreator = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);

            _class.crossExtendAdapterCreator = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            ///// <summary>
            ///// 是否已编译成功
            ///// </summary>
            //public bool isbuildSuccess;
            _class.isbuildSuccess = reader.ReadBoolean();
            ///// <summary>
            ///// 是否不可实例化
            ///// </summary>
            //public bool no_constructor;
            _class.no_constructor = reader.ReadBoolean();

            ///// <summary>
            ///// 包外代码所在blockid;
            ///// </summary>
            //public int outscopeblockid;
            _class.outscopeblockid = reader.ReadInt32();

            ///// <summary>
            ///// 类名
            ///// </summary>
            //public string name;
            _class.name = reader.ReadString();
            //public string package;
            _class.package = reader.ReadString();
            //public bool dynamic;
            _class.dynamic = reader.ReadBoolean();
            //public bool final;
            _class.final = reader.ReadBoolean();


            ///// <summary>
            ///// 是否公开。如果不是,则只能在相同包内访问
            ///// </summary>
            //public bool isPublic;
            _class.isPublic = reader.ReadBoolean();
            ///// <summary>
            ///// 包含此类的静态成员。
            ///// </summary>
            //public Class staticClass;
            _class.staticClass = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);
            ///// <summary>
            ///// 如果是静态成员类,则指向类的定义
            ///// </summary>
            //public Class instanceClass;
            _class.instanceClass = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);
            ///// <summary>
            ///// 是否包外类
            ///// </summary>
            //public bool ispackageout;
            _class.ispackageout = reader.ReadBoolean();
            ///// <summary>
            ///// 如果是包外类,则显示所从属的主类
            ///// </summary>
            //public Class mainClass;
            _class.mainClass = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);
            ///// <summary>
            ///// 构造函数
            ///// </summary>
            //public ClassMember constructor;
            _class.constructor = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            ///// <summary>
            ///// 构造函数id
            ///// </summary>
            //public int constructor_functionid;
            _class.constructor_functionid = reader.ReadInt32();
            ///// <summary>
            ///// 隐式类型转换到原始类型函数
            ///// </summary>
            //public ClassMember implicit_to;
            _class.implicit_to = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            //public RunTimeDataType implicit_to_type;
            _class.implicit_to_type = reader.ReadInt32();
            //public int implicit_to_functionid;
            _class.implicit_to_functionid = reader.ReadInt32();

            ///// <summary>
            ///// 隐式从原始类型转换过来
            ///// </summary>
            //public ClassMember implicit_from;
            _class.implicit_from = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            //public int implicit_from_functionid;
            _class.implicit_from_functionid = reader.ReadInt32();
            //public RunTimeDataType implicit_from_type;
            _class.implicit_from_type = reader.ReadInt32();

            ///// <summary>
            ///// 显式类型转换
            ///// </summary>
            //public ClassMember explicit_from;
            _class.explicit_from = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);
            //public int explicit_from_functionid;
            _class.explicit_from_functionid = reader.ReadInt32();
            //public RunTimeDataType explicit_from_type;
            _class.explicit_from_type = reader.ReadInt32();

            ///// <summary>
            ///// 索引器 取值
            ///// </summary>
            //public ClassMember get_this_item;
            _class.get_this_item = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);

            ///// <summary>
            ///// 索引器 赋值
            ///// </summary>
            //public ClassMember set_this_item;
            _class.set_this_item = serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember);

            ///// <summary>
            ///// 类成员定义
            ///// </summary>
            //public ClassMemberList classMembers;
            int membercount = reader.ReadInt32();

            for (int i = 0; i < membercount; i++)
            {
                _class.classMembers.Add(serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember));
            }

            ///// <summary>
            ///// 数据字段表
            ///// </summary>
            //public List<ClassMember> fields;
            int fieldscount = reader.ReadInt32();

            for (int i = 0; i < fieldscount; i++)
            {
                _class.fields.Add(serizlizer.DeserializeObject <ClassMember>(reader, ClassMember.LoadClassMember));
            }

            ///// <summary>
            ///// 父类的定义(如果有)
            ///// </summary>
            //public Class super;
            _class.super = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);

            ///// <summary>
            ///// 实现的各种接口
            ///// 记录了接口的一个方法对应类的哪个成员实现
            ///// </summary>
            //public Dictionary<Class, int[]> implements;
            int implementscount = reader.ReadInt32();

            for (int i = 0; i < implementscount; i++)
            {
                Class keyclass = serizlizer.DeserializeObject <Class>(reader, Class.LoadClass);
                int   count    = reader.ReadInt32();
                int[] impls    = new int[count];
                for (int j = 0; j < count; j++)
                {
                    impls[j] = reader.ReadInt32();
                }
                _class.implements.Add(keyclass, impls);
            }

            return(_class);
        }