• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# __BinaryWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Write

 public void Write(__BinaryWriter sout)
 {
     this.majorVersion = this.binaryFormatterMajorVersion;
     this.minorVersion = this.binaryFormatterMinorVersion;
     sout.WriteByte((byte) this.binaryHeaderEnum);
     sout.WriteInt32(this.topId);
     sout.WriteInt32(this.headerId);
     sout.WriteInt32(this.binaryFormatterMajorVersion);
     sout.WriteInt32(this.binaryFormatterMinorVersion);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:SerializationHeaderRecord.cs


示例2: Write

 public  void Write(__BinaryWriter sout) 
 {
     if (nullCount == 1) 
     { 
         sout.WriteByte((Byte)BinaryHeaderEnum.ObjectNull);
     } 
     else if (nullCount < 256)
     {
         sout.WriteByte((Byte)BinaryHeaderEnum.ObjectNullMultiple256);
         sout.WriteByte((Byte)nullCount); 
         //Console.WriteLine("Write nullCount "+nullCount);
     } 
     else 
     {
         sout.WriteByte((Byte)BinaryHeaderEnum.ObjectNullMultiple); 
         sout.WriteInt32(nullCount);
         //Console.WriteLine("Write nullCount "+nullCount);
     }
 } 
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:19,代码来源:BinaryCommonClasses.cs


示例3: Serialize

 internal void Serialize(Stream serializationStream, object graph, Header[] headers, bool fCheck)
 {
     if (serializationStream == null)
     {
         throw new ArgumentNullException("serializationStream", Environment.GetResourceString("ArgumentNull_WithParamName", new object[] { serializationStream }));
     }
     InternalFE formatterEnums = new InternalFE {
         FEtypeFormat = this.m_typeFormat,
         FEserializerTypeEnum = InternalSerializerTypeE.Binary,
         FEassemblyFormat = this.m_assemblyFormat
     };
     ObjectWriter objectWriter = new ObjectWriter(this.m_surrogates, this.m_context, formatterEnums, this.m_binder);
     __BinaryWriter serWriter = new __BinaryWriter(serializationStream, objectWriter, this.m_typeFormat);
     objectWriter.Serialize(graph, headers, serWriter, fCheck);
     this.m_crossAppDomainArray = objectWriter.crossAppDomainArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:BinaryFormatter.cs


示例4: Serialize

        [System.Security.SecurityCritical]  // auto-generated
        internal void Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, bool fCheck)
        {
            if (graph == null)
                throw new ArgumentNullException("graph", Environment.GetResourceString("ArgumentNull_Graph"));

            if (serWriter == null)
                throw new ArgumentNullException("serWriter", Environment.GetResourceString("ArgumentNull_WithParamName", "serWriter"));
            Contract.EndContractBlock();

            SerTrace.Log(this, "Serialize Entry 2 ", graph, ((headers == null) ? " no headers " : "headers "));

            if (fCheck)
            {
                CodeAccessPermission.Demand(PermissionType.SecuritySerialization);          
            }

            this.serWriter = serWriter;
            this.headers = inHeaders;

            SerTrace.Log( this, "Serialize New SerializedTypeTable");
            serWriter.WriteBegin();
            long headerId = 0;
            Object obj;
            long objectId;
            bool isNew;
            bool bMethodCall = false;
            bool bMethodReturn = false;

#if FEATURE_REMOTING        
            // Special case IMethodCallMessage and IMethodReturnMessage for performance
            IMethodCallMessage mess = graph as IMethodCallMessage;
            if (mess != null)
            {
                bMethodCall = true;
                graph = WriteMethodCall(mess);
            }
            else
            {
                IMethodReturnMessage mr = graph as IMethodReturnMessage;
                if (mr != null)
                {
                    bMethodReturn = true;
                    graph = WriteMethodReturn(mr);
                }
            }
#endif // FEATURE_REMOTING        

            if (graph == null)
            {
                WriteSerializedStreamHeader(topId, headerId);

                if (bMethodCall)
                    serWriter.WriteMethodCall();
                else if (bMethodReturn)
                    serWriter.WriteMethodReturn();

                serWriter.WriteSerializationHeaderEnd();
                serWriter.WriteEnd();
                return;
            }

            // allocations if methodCall or methodResponse and no graph
            m_idGenerator = new ObjectIDGenerator();
            m_objectQueue = new Queue();
            m_formatterConverter = new FormatterConverter();
            serObjectInfoInit = new SerObjectInfoInit();        

            topId = InternalGetId(graph, false, null, out isNew);


            if (headers != null)
                headerId = InternalGetId(headers, false, null, out isNew);
            else
                headerId = -1;

            WriteSerializedStreamHeader(topId, headerId);


            if (bMethodCall)
                serWriter.WriteMethodCall();
            else if (bMethodReturn)
                serWriter.WriteMethodReturn();


            SerTrace.Log( this, "Serialize Schedule 0");
            // Write out SerializedStream header
            if ((headers != null) && (headers.Length > 0))
                m_objectQueue.Enqueue(headers);                 

            if (graph != null)
                m_objectQueue.Enqueue(graph);
            while ((obj = GetNext(out objectId))!=null)
            {
                SerTrace.Log( this, "Serialize GetNext ",obj);
                WriteObjectInfo objectInfo = null;

                // GetNext will return either an object or a WriteObjectInfo. 
                // A WriteObjectInfo is returned if this object was member of another object
                if (obj is WriteObjectInfo)
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:BinaryObjectWriter.cs


示例5: WriteWithCode

 internal static void WriteWithCode(Type type, Object value, __BinaryWriter sout)
 {
     if ((object)type == null)
         sout.WriteByte((Byte)InternalPrimitiveTypeE.Null); 
     else if (Object.ReferenceEquals(type, Converter.typeofString))
         WriteStringWithCode((String)value, sout); 
     else 
     {
         InternalPrimitiveTypeE code = Converter.ToCode(type); 
         sout.WriteByte((Byte)code);
         sout.WriteValue(code, value);
     }
 } 
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:13,代码来源:BinaryCommonClasses.cs


示例6: WriteStringWithCode

 internal static void WriteStringWithCode(String value, __BinaryWriter sout)
 { 
     if (value == null)
         sout.WriteByte((Byte)InternalPrimitiveTypeE.Null);
     else
     { 
         sout.WriteByte((Byte)InternalPrimitiveTypeE.String);
         sout.WriteString(value); 
     } 
 }
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:10,代码来源:BinaryCommonClasses.cs


示例7: WriteTypeInfo

        // Writes the type information on the wire 
        internal static void WriteTypeInfo(BinaryTypeEnum binaryTypeEnum, Object typeInformation, int assemId, __BinaryWriter sout)
        {
            SerTrace.Log( "BinaryConverter", "WriteTypeInfo Entry  ",((Enum)binaryTypeEnum).ToString()," ",typeInformation," assemId ",assemId);
 
            switch (binaryTypeEnum)
            { 
                case BinaryTypeEnum.Primitive: 
                case BinaryTypeEnum.PrimitiveArray:
                    Contract.Assert(typeInformation!=null, "[BinaryConverter.WriteTypeInfo]typeInformation!=null"); 
                    sout.WriteByte((Byte)((InternalPrimitiveTypeE)typeInformation));
                    break;
                case BinaryTypeEnum.String:
                case BinaryTypeEnum.Object: 
                case BinaryTypeEnum.StringArray:
                case BinaryTypeEnum.ObjectArray: 
                    break; 
                case BinaryTypeEnum.ObjectUrt:
                    Contract.Assert(typeInformation!=null, "[BinaryConverter.WriteTypeInfo]typeInformation!=null"); 
                    sout.WriteString(typeInformation.ToString());
                    break;
                case BinaryTypeEnum.ObjectUser:
                    Contract.Assert(typeInformation!=null, "[BinaryConverter.WriteTypeInfo]typeInformation!=null"); 
                    sout.WriteString(typeInformation.ToString());
                    sout.WriteInt32(assemId); 
                    break; 
                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_TypeWrite",((Enum)binaryTypeEnum).ToString())); 
            }
            SerTrace.Log( "BinaryConverter", "WriteTypeInfo Exit");
        }
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:31,代码来源:BinaryCommonClasses.cs


示例8: Serialize

        // Commences the process of serializing the entire graph.  All of the data (in the appropriate format
        // is emitted onto the stream).
        internal void Serialize(Stream serializationStream, Object graph, Header[] headers, bool fCheck)
        {
            if (serializationStream==null)
            {
                throw new ArgumentNullException("serializationStream", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentNull_WithParamName"),serializationStream));             
            }
            SerTrace.Log(this, "Serialize Entry");

            InternalFE formatterEnums = new InternalFE();
            formatterEnums.FEtypeFormat = m_typeFormat;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Binary;
            formatterEnums.FEassemblyFormat = m_assemblyFormat;    

            ObjectWriter sow = new ObjectWriter(m_surrogates, m_context, formatterEnums);
            __BinaryWriter binaryWriter = new __BinaryWriter(serializationStream, sow, m_typeFormat); 
            sow.Serialize(graph, headers, binaryWriter, fCheck);
            m_crossAppDomainArray = sow.crossAppDomainArray;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:binaryformatter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# __Native类代码示例发布时间:2022-05-24
下一篇:
C# _System类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap