Esempio n. 1
0
        private AsMethodInfo ReadMethodInfo()
        {
            var paramCount = ReadU30();
            var r          = new AsMethodInfo {
                ParamTypes = new uint[paramCount],
                ReturnType = ReadU30()
            };

            r.ParamTypes = ReadMultipleU30(paramCount);
            r.Name       = ReadU30();
            r.Flags      = (AsMethodFlags)ReadU8();
            if (r.HasOptional)
            {
                r.Options = new AsOptionDetailInfo[ReadU30()];
                for (var i = 0; i < r.Options.Length; i++)
                {
                    r.Options[i] = ReadOptionDetail();
                }
            }
            if (r.HasParamNames)
            {
                r.ParamNames = ReadMultipleParamInfo(paramCount);
            }
            return(r);
        }
Esempio n. 2
0
        private void WriteMethodInfo(AsMethodInfo methodInfo)
        {
            var paramCount = methodInfo.ParamTypes.Length;

            WriteU30((uint)paramCount);
            WriteU30(methodInfo.ReturnType);
            WriteMutipleU30(methodInfo.ParamTypes, true);
            WriteU30(methodInfo.Name);
            WriteU8((byte)methodInfo.Flags);
            if (methodInfo.HasOptional)
            {
                WriteU30((uint)methodInfo.Options.Length);
                foreach (var option in methodInfo.Options)
                {
                    WriteOptionDetail(option);
                }
            }
            if (methodInfo.HasParamNames)
            {
                if (methodInfo.ParamNames.Length != methodInfo.ParamTypes.Length)
                {
                    throw new Exception("Mismatching number of parameter names and types");
                }
                foreach (var paramInfo in methodInfo.ParamNames)
                {
                    WriteParamInfo(paramInfo);
                }
            }
        }
Esempio n. 3
0
        private AsMethodInfo[] ReadMultipleMethods()
        {
            var len = ReadU30();
            var res = new AsMethodInfo[len];

            for (var i = 0; i < len; i++)
            {
                res[i] = ReadMethodInfo();
            }
            return(res);
        }
Esempio n. 4
0
 private AsMethodInfo[] ReadMultipleMethods()
 {
     var len = ReadU30();
     var res = new AsMethodInfo[len];
     for (var i = 0; i < len; i++) {
         res[i] = ReadMethodInfo();
     }
     return res;
 }
Esempio n. 5
0
 private AsMethodInfo ReadMethodInfo()
 {
     var paramCount = ReadU30();
     var r = new AsMethodInfo {
         ParamTypes = new uint[paramCount],
         ReturnType = ReadU30()
     };
     r.ParamTypes = ReadMultipleU30(paramCount);
     r.Name = ReadU30();
     r.Flags = (AsMethodFlags)ReadU8();
     if (r.HasOptional) {
         r.Options = new AsOptionDetailInfo[ReadU30()];
         for (var i = 0; i < r.Options.Length; i++) {
             r.Options[i] = ReadOptionDetail();
         }
     }
     if (r.HasParamNames) {
         r.ParamNames = ReadMultipleParamInfo(paramCount);
     }
     return r;
 }
Esempio n. 6
0
 private void WriteMultipleMethods(AsMethodInfo[] methods)
 {
     WriteU30((uint)methods.Length);
     foreach (var value in methods) {
         WriteMethodInfo(value);
     }
 }
Esempio n. 7
0
 private void WriteMethodInfo(AsMethodInfo methodInfo)
 {
     var paramCount = methodInfo.ParamTypes.Length;
     WriteU30((uint)paramCount);
     WriteU30(methodInfo.ReturnType);
     WriteMutipleU30(methodInfo.ParamTypes, true);
     WriteU30(methodInfo.Name);
     WriteU8((byte)methodInfo.Flags);
     if (methodInfo.HasOptional) {
         WriteU30((uint)methodInfo.Options.Length);
         foreach (var option in methodInfo.Options) {
             WriteOptionDetail(option);
         }
     }
     if (methodInfo.HasParamNames) {
         if (methodInfo.ParamNames.Length != methodInfo.ParamTypes.Length) {
             throw new Exception("Mismatching number of parameter names and types");
         }
         foreach (var paramInfo in methodInfo.ParamNames) {
             WriteParamInfo(paramInfo);
         }
     }
 }