Ejemplo n.º 1
0
        public void Read()
        {
            BinaryReader reader = this.Reader;

            if (this.Version == SerializationVersion.V1)
            {
                if (reader.ReadByte() != 0)
                {
                    throw new InvalidDataException();
                }
            }

            // Read virtualized method info
            this.Info = new VirtualizedMethodInfo(reader);

            // Read exception handlers
            Int32 count = (Int32)reader.ReadInt16();

            _exceptionHandlers = new SerializedExceptionHandler[count];
            for (Int32 i = 0; i < _exceptionHandlers.Count; i++)
            {
                _exceptionHandlers[i] = new SerializedExceptionHandler(reader);
            }

            //if (count > 0)
            //{
            //	Console.WriteLine("Exception Handlers ({0}):", count);
            //	for (Int32 i = 0; i < _exceptionHandlers.Count; i++)
            //	{
            //		var handler = _exceptionHandlers[i];
            //		Console.WriteLine(" Exception handler {0}:", i);
            //		Console.WriteLine("  Handler Type:  {0}", handler.VirtualHandlerType);
            //
            //		if(handler.HasCatchType)
            //			Console.WriteLine("  Catch Type:    {0}", this.Resolver.ResolveType(handler.VirtualCatchType).FullName);
            //		else
            //			Console.WriteLine("  Catch Type:    {0}", handler.VirtualCatchType);
            //
            //		Console.WriteLine("  Try start:     {0}", handler.VirtualTryStart);
            //		Console.WriteLine("  Try end:       {0}", handler.VirtualTryEnd);
            //		Console.WriteLine("  Handler start: {0}", handler.VirtualHandlerStart);
            //		Console.WriteLine("  Handler end:   {0}", handler.VirtualHandlerEnd);
            //		Console.WriteLine("  Filter start:  {0}", handler.VirtualFilterStart);
            //	}
            //}

            // Set locals and parameters
            this.SetLocalsAndParameters();

            // Read instructions
            this.CodeSize = reader.ReadInt32();
            this.ReadInstructions();
        }
Ejemplo n.º 2
0
        public void Read()
        {
            BinaryReader reader = this.Reader;

            // VM performs this check..
            if (reader.ReadByte() != 0)
                throw new InvalidDataException();

            // Read virtualized method info
            this.Info = new VirtualizedMethodInfo(reader);

            // Read exception handlers
            Int32 count = (Int32)reader.ReadInt16();
            _exceptionHandlers = new SerializedExceptionHandler[count];
            for (Int32 i = 0; i < _exceptionHandlers.Count; i++)
                _exceptionHandlers[i] = new SerializedExceptionHandler(reader);

            //if (count > 0)
            //{
            //	Console.WriteLine("Exception Handlers ({0}):", count);
            //	for (Int32 i = 0; i < _exceptionHandlers.Count; i++)
            //	{
            //		var handler = _exceptionHandlers[i];
            //		Console.WriteLine(" Exception handler {0}:", i);
            //		Console.WriteLine("  Handler Type:  {0}", handler.VirtualHandlerType);
            //
            //		if(handler.HasCatchType)
            //			Console.WriteLine("  Catch Type:    {0}", this.Resolver.ResolveType(handler.VirtualCatchType).FullName);
            //		else
            //			Console.WriteLine("  Catch Type:    {0}", handler.VirtualCatchType);
            //
            //		Console.WriteLine("  Try start:     {0}", handler.VirtualTryStart);
            //		Console.WriteLine("  Try end:       {0}", handler.VirtualTryEnd);
            //		Console.WriteLine("  Handler start: {0}", handler.VirtualHandlerStart);
            //		Console.WriteLine("  Handler end:   {0}", handler.VirtualHandlerEnd);
            //		Console.WriteLine("  Filter start:  {0}", handler.VirtualFilterStart);
            //	}
            //}

            // Set locals and parameters
            this.SetLocalsAndParameters();

            // Read instructions
            this.CodeSize = reader.ReadInt32();
            this.ReadInstructions();
        }