当前位置: 首页>>代码示例>>C#>>正文


C# Binary.__BinaryParser类代码示例

本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.__BinaryParser的典型用法代码示例。如果您正苦于以下问题:C# __BinaryParser类的具体用法?C# __BinaryParser怎么用?C# __BinaryParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


__BinaryParser类属于System.Runtime.Serialization.Formatters.Binary命名空间,在下文中一共展示了__BinaryParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

 public void Read(__BinaryParser input)
 {
     this.messageEnum = (MessageEnum) input.ReadInt32();
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.NoReturnValue))
     {
         this.returnValue = null;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueVoid))
     {
         this.returnValue = instanceOfVoid;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInline))
     {
         this.returnValue = IOUtil.ReadWithCode(input);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         this.scallContext = (string) IOUtil.ReadWithCode(input);
         LogicalCallContext context = new LogicalCallContext {
             RemotingData = { LogicalCallID = this.scallContext }
         };
         this.callContext = context;
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         this.args = IOUtil.ReadArgs(input);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:BinaryMethodReturn.cs

示例2: Read

 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.name = input.ReadString();
     this.numMembers = input.ReadInt32();
     this.memberNames = new string[this.numMembers];
     this.binaryTypeEnumA = new BinaryTypeEnum[this.numMembers];
     this.typeInformationA = new object[this.numMembers];
     this.memberAssemIds = new int[this.numMembers];
     for (int i = 0; i < this.numMembers; i++)
     {
         this.memberNames[i] = input.ReadString();
     }
     for (int j = 0; j < this.numMembers; j++)
     {
         this.binaryTypeEnumA[j] = (BinaryTypeEnum) input.ReadByte();
     }
     for (int k = 0; k < this.numMembers; k++)
     {
         if ((this.binaryTypeEnumA[k] != BinaryTypeEnum.ObjectUrt) && (this.binaryTypeEnumA[k] != BinaryTypeEnum.ObjectUser))
         {
             this.typeInformationA[k] = BinaryConverter.ReadTypeInfo(this.binaryTypeEnumA[k], input, out this.memberAssemIds[k]);
         }
         else
         {
             BinaryConverter.ReadTypeInfo(this.binaryTypeEnumA[k], input, out this.memberAssemIds[k]);
         }
     }
     if (this.binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapTypedAssemId)
     {
         this.assemId = input.ReadInt32();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:BinaryObjectWithMapTyped.cs

示例3: ReadArgs

 internal static object[] ReadArgs(__BinaryParser input)
 {
     int num = input.ReadInt32();
     object[] objArray = new object[num];
     for (int i = 0; i < num; i++)
     {
         objArray[i] = ReadWithCode(input);
     }
     return objArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:IOUtil.cs

示例4: Read

        public void Read(__BinaryParser input)
        {
            switch (this.binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ArraySinglePrimitive:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.Primitive;
                    this.typeInformation = (InternalPrimitiveTypeE) input.ReadByte();
                    return;

                case BinaryHeaderEnum.ArraySingleObject:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.Object;
                    this.typeInformation = null;
                    return;

                case BinaryHeaderEnum.ArraySingleString:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.String;
                    this.typeInformation = null;
                    return;
            }
            this.objectId = input.ReadInt32();
            this.binaryArrayTypeEnum = (BinaryArrayTypeEnum) input.ReadByte();
            this.rank = input.ReadInt32();
            this.lengthA = new int[this.rank];
            this.lowerBoundA = new int[this.rank];
            for (int i = 0; i < this.rank; i++)
            {
                this.lengthA[i] = input.ReadInt32();
            }
            if (((this.binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset)) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
            {
                for (int j = 0; j < this.rank; j++)
                {
                    this.lowerBoundA[j] = input.ReadInt32();
                }
            }
            this.binaryTypeEnum = (BinaryTypeEnum) input.ReadByte();
            this.typeInformation = BinaryConverter.ReadTypeInfo(this.binaryTypeEnum, input, out this.assemId);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:BinaryArray.cs

示例5: ReadWithCode

        internal static object ReadWithCode(__BinaryParser input)
        {
            InternalPrimitiveTypeE code = (InternalPrimitiveTypeE) input.ReadByte();
            switch (code)
            {
                case InternalPrimitiveTypeE.Null:
                    return null;

                case InternalPrimitiveTypeE.String:
                    return input.ReadString();
            }
            return input.ReadValue(code);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:IOUtil.cs

示例6: Read

 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.name = input.ReadString();
     this.numMembers = input.ReadInt32();
     this.memberNames = new string[this.numMembers];
     for (int i = 0; i < this.numMembers; i++)
     {
         this.memberNames[i] = input.ReadString();
     }
     if (this.binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapAssemId)
     {
         this.assemId = input.ReadInt32();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:BinaryObjectWithMap.cs

示例7: Read

 public void Read(__BinaryParser input)
 {
     byte[] buffer = input.ReadBytes(0x11);
     if (buffer.Length < 0x11)
     {
         __Error.EndOfFile();
     }
     this.majorVersion = GetInt32(buffer, 9);
     if (this.majorVersion > this.binaryFormatterMajorVersion)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", new object[] { BitConverter.ToString(buffer) }));
     }
     this.binaryHeaderEnum = (BinaryHeaderEnum) buffer[0];
     this.topId = GetInt32(buffer, 1);
     this.headerId = GetInt32(buffer, 5);
     this.minorVersion = GetInt32(buffer, 13);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:SerializationHeaderRecord.cs

示例8: Read

 internal void Read(__BinaryParser input)
 {
     this.messageEnum = (MessageEnum) input.ReadInt32();
     this.methodName = (string) IOUtil.ReadWithCode(input);
     this.typeName = (string) IOUtil.ReadWithCode(input);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         this.scallContext = (string) IOUtil.ReadWithCode(input);
         LogicalCallContext context = new LogicalCallContext {
             RemotingData = { LogicalCallID = this.scallContext }
         };
         this.callContext = context;
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         this.args = IOUtil.ReadArgs(input);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:BinaryMethodCall.cs

示例9: Read

        public void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum)
        {
            switch (binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ObjectNull:
                    this.nullCount = 1;
                    return;

                case BinaryHeaderEnum.MessageEnd:
                case BinaryHeaderEnum.Assembly:
                    break;

                case BinaryHeaderEnum.ObjectNullMultiple256:
                    this.nullCount = input.ReadByte();
                    return;

                case BinaryHeaderEnum.ObjectNullMultiple:
                    this.nullCount = input.ReadInt32();
                    break;

                default:
                    return;
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:ObjectNull.cs

示例10: Read

 public void Read(__BinaryParser input)
 {
     this.assemId = input.ReadInt32();
     this.assemblyString = input.ReadString();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:BinaryAssembly.cs

示例11: ReadArgs

 internal static Object[] ReadArgs(__BinaryParser input)
 { 
     int length = input.ReadInt32();
     Object[] args = new Object[length];
     for (int i=0; i<length; i++)
         args[i] = ReadWithCode(input); 
     return args;
 } 
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:8,代码来源:BinaryCommonClasses.cs

示例12: Read

 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input)
 {
     objectId = input.ReadInt32(); 
     mapId = input.ReadInt32();
 } 
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:6,代码来源:BinaryCommonClasses.cs

示例13: ReadTypeInfo

        internal static object ReadTypeInfo(BinaryTypeEnum binaryTypeEnum, __BinaryParser input, out int assemId)
        {
            object obj2 = null;
            int num = 0;
            switch (binaryTypeEnum)
            {
                case BinaryTypeEnum.Primitive:
                case BinaryTypeEnum.PrimitiveArray:
                    obj2 = (InternalPrimitiveTypeE) input.ReadByte();
                    break;

                case BinaryTypeEnum.String:
                case BinaryTypeEnum.Object:
                case BinaryTypeEnum.ObjectArray:
                case BinaryTypeEnum.StringArray:
                    break;

                case BinaryTypeEnum.ObjectUrt:
                    obj2 = input.ReadString();
                    break;

                case BinaryTypeEnum.ObjectUser:
                    obj2 = input.ReadString();
                    num = input.ReadInt32();
                    break;

                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_TypeRead", new object[] { binaryTypeEnum.ToString() }));
            }
            assemId = num;
            return obj2;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:BinaryConverter.cs

示例14: Deserialize

        internal Object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck)
        {
            if (serParser == null)
                throw new ArgumentNullException("serParser", Environment.GetResourceString("ArgumentNull_WithParamName", serParser)); 
            Contract.EndContractBlock();
 
#if _DEBUG 
            SerTrace.Log( this, "Deserialize Entry handler", handler);
#endif 
            bFullDeserialization = false;
            TopObject = null;
            topId = 0;
#if FEATURE_REMOTING 
            bMethodCall = false;
            bMethodReturn = false; 
            bIsCrossAppDomain = isCrossAppDomain; 
#endif
            bSimpleAssembly =  (formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple); 

            if (fCheck)
            {
                try{ 
                    CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
                }catch(Exception e) 
                { 
                    deserializationSecurityException = e;
                } 
            }

            this.handler = handler;
 

            if (bFullDeserialization) 
            { 
                // Reinitialize
#if FEATURE_REMOTING 
                m_objectManager = new ObjectManager(m_surrogates, m_context, false, bIsCrossAppDomain);
#else
                m_objectManager = new ObjectManager(m_surrogates, m_context, false, false);
#endif 
                serObjectInfoInit = new SerObjectInfoInit();
            } 
 
            // Will call back to ParseObject, ParseHeader for each object found
            serParser.Run(); 

#if _DEBUG
            SerTrace.Log( this, "Deserialize Finished Parsing DoFixups");
#endif 

            if (bFullDeserialization) 
                m_objectManager.DoFixups(); 

 
#if FEATURE_REMOTING
            if (!bMethodCall && !bMethodReturn)
#endif
            { 
                if (TopObject == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_TopObject")); 
 
                //if TopObject has a surrogate then the actual object may be changed during special fixup
                //So refresh it using topID. 
                if (HasSurrogate(TopObject.GetType())  && topId != 0)//Not yet resolved
                    TopObject = m_objectManager.GetObject(topId);

                if (TopObject is IObjectReference) 
                {
                    TopObject = ((IObjectReference)TopObject).GetRealObject(m_context); 
                } 
            }
 
            SerTrace.Log( this, "Deserialize Exit ",TopObject);

            if (bFullDeserialization)
            { 
                m_objectManager.RaiseDeserializationEvent(); // This will raise both IDeserialization and [OnDeserialized] events
            } 
 
            // Return the headers if there is a handler
            if (handler != null) 
            {
                handlerObject = handler(headers);
            }
#if FEATURE_REMOTING 
            if (bMethodCall)
            { 
                Object[] methodCallArray = TopObject as Object[]; 
                TopObject = binaryMethodCall.ReadArray(methodCallArray, handlerObject);
            } 
            else if (bMethodReturn)
            {
                Object[] methodReturnArray = TopObject as Object[];
                TopObject = binaryMethodReturn.ReadArray(methodReturnArray, methodCallMessage, handlerObject); 
            }
#endif 
            return TopObject; 
        }
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:98,代码来源:BinaryObjectReader.cs

示例15: Deserialize

        // Deserialize the stream into an object graph.
        internal Object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck, IMethodCallMessage methodCallMessage)
        {

            SerTrace.Log( this, "Deserialize Entry handler", handler);

            BCLDebug.Assert((IsCrossAppDomain() && (crossAppDomainArray != null))
                            || (!IsCrossAppDomain()),
                             "[System.Runtime.Serialization.Formatters.BinaryObjectReader missing crossAppDomainArray]");

            bFullDeserialization = false;
            bMethodCall = false;
            bMethodReturn = false;
            bSimpleAssembly =  (formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple);

            if (serParser == null)
                throw new ArgumentNullException("serParser", String.Format(Environment.GetResourceString("ArgumentNull_WithParamName"), serParser));

            if (fCheck)
            {
                try{
                    CodeAccessPermission.DemandInternal(PermissionType.SecuritySerialization);          
                }catch(Exception e)
                {
                    deserializationSecurityException = e;
                }
            }

            this.handler = handler;

            if (bFullDeserialization)
            {
                // Reinitialize
                m_objectManager = new ObjectManager(m_surrogates, m_context, false);
                serObjectInfoInit = new SerObjectInfoInit();
            }


            // Will call back to ParseObject, ParseHeader for each object found
            serParser.Run();

            SerTrace.Log( this, "Deserialize Finished Parsing DoFixups");

            if (bFullDeserialization)
                m_objectManager.DoFixups();

            if (!bMethodCall && !bMethodReturn)
            {
                if (topObject == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_TopObject"));

                if (topObject is IObjectReference)
                {
                    topObject = ((IObjectReference)topObject).GetRealObject(m_context);
                }
            }

            SerTrace.Log( this, "Deserialize Exit ",topObject);

            if (bFullDeserialization)
                m_objectManager.RaiseDeserializationEvent();

            // Return the headers if there is a handler
            if (handler != null)
            {
                handlerObject = handler(headers);
            }

            if (bMethodCall)
            {
                Object[] methodCallArray = topObject as Object[];
                topObject = binaryMethodCall.ReadArray(methodCallArray, handlerObject);
            }
            else if (bMethodReturn)
            {
                Object[] methodReturnArray = topObject as Object[];
                topObject = binaryMethodReturn.ReadArray(methodReturnArray, methodCallMessage, handlerObject);
            }

            return topObject;
        }
开发者ID:ArildF,项目名称:masters,代码行数:81,代码来源:binaryobjectreader.cs


注:本文中的System.Runtime.Serialization.Formatters.Binary.__BinaryParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。