예제 #1
0
        public static MethodInfo GetReadPrimitive(MetadataType type)
        {
            string methodName = "";

            switch (type)
            {
            case MetadataType.Single:
                methodName = "ReadSingle";
                break;

            case MetadataType.Int32:
                methodName = "ReadInt32";
                break;
            }
            return(ReaderType.GetMethod(methodName));
        }
예제 #2
0
        public static void WriteReadClassArray(ILProcessor worker, MethodDefinition method, FieldDefinition f, TypeDefinition t, MethodDefinition read)
        {
            var m = f.Module.ImportReference(ReaderType.GetMethod("ReadPrefixedArray", Type.EmptyTypes));

            // Write the read object line
            var callCode = worker.Create(OpCodes.Call, m.MakeGeneric(t));

            // Duplicate the reference
            worker.Append(worker.Create(OpCodes.Dup));
            // Put the reader onto the stack
            worker.Append(worker.Create(OpCodes.Ldarg, method.Parameters[0]));
            // Call ReadPrefixedArray()
            worker.Append(callCode);
            // Set the field
            worker.Append(worker.Create(OpCodes.Stfld, f));
            //worker.Append(worker.Create(OpCodes.Dup));
        }
예제 #3
0
 public static MethodInfo GetReadPointer()
 {
     return(ReaderType.GetMethod(""));
 }