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


C# Stream.WriteInt方法代码示例

本文整理汇总了C#中Stream.WriteInt方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.WriteInt方法的具体用法?C# Stream.WriteInt怎么用?C# Stream.WriteInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream.WriteInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteToStream

 public override void WriteToStream(Stream aStream)
 {
     base.WriteToStream (aStream);
     aStream.WriteInt (EntityID);
     aStream.WriteByte ((byte)Type);
     aStream.WriteInt (X);
     aStream.WriteInt (Y);
     aStream.WriteInt (Z);
 }
开发者ID:rbrian,项目名称:mccslib,代码行数:9,代码来源:Packets.cs

示例2: Serialize

 public override void Serialize(Stream stream, Type type, object value)
 {
     var array = value as Array;
     var elementType = type.GetElementType();
     stream.WriteInt(array.Length);
     for (int i = 0; i < array.Length; i++)
         ctx.Serializer.Serialize_Main(stream, elementType, array.GetValue(i));
 }
开发者ID:srndpty,项目名称:VFW,代码行数:8,代码来源:ArraySerializer.cs

示例3: Serialize

        public override void Serialize(Stream stream, Type type, object value)
        {
            var collection = (ICollection)value;
            Type elementType = GetElementType(type);
            stream.WriteInt(collection.Count);

            foreach (var item in collection)
                ctx.Serializer.Serialize_Main(stream, elementType, item);
        }
开发者ID:flatlineteam,项目名称:relic-rush,代码行数:9,代码来源:CollectionSerializer.cs

示例4: Stream

 public static void Stream(IEnumerable<HashBlock> hashBlocks, Stream outputStream)
 {
     outputStream.WriteUInt((uint) hashBlocks.Count());
     foreach (HashBlock block in hashBlocks)
     {
         outputStream.Write(block.Hash, 0, 16);
         outputStream.WriteInt(block.Length);
         outputStream.WriteLong(block.Offset);
         outputStream.WriteUInt(block.Checksum);
     }
 }
开发者ID:billybit,项目名称:RsyncNet,代码行数:11,代码来源:HashBlockStreamer.cs

示例5: WriteQueryParameters

        /// <summary>
        /// Writes the query parameters.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        protected void WriteQueryParameters(Stream buffer)
        {
            buffer.WriteConsistency(CqlConsistency);

            var flags = (byte)((Parameters != null ? 1 : 0) |
                               (SkipMetaData ? 2 : 0) |
                               (PageSize.HasValue ? 4 : 0) |
                               (PagingState != null ? 8 : 0) |
                               (SerialConsistency.HasValue ? 16 : 0) |
                               (ProtocolVersion >= 3 && Timestamp.HasValue ? 32 : 0));

            buffer.WriteByte(flags);

            if(Parameters != null)
            {
                buffer.WriteShort((ushort)Parameters.Count);
                foreach(var value in Parameters)
                    buffer.WriteByteArray(value);
            }

            if(PageSize.HasValue)
                buffer.WriteInt(PageSize.Value);

            if(PagingState != null)
                buffer.WriteByteArray(PagingState);

            if(SerialConsistency.HasValue)
                buffer.WriteShort((ushort)SerialConsistency.Value);

            if(ProtocolVersion >= 3 && Timestamp.HasValue)
                buffer.WriteLong(Timestamp.Value.ToTimestamp()*1000); //convert milliseconds to microseconds
        }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:36,代码来源:QueryFrameBase.cs

示例6: SendCopyDelta

 private void SendCopyDelta(CopyDelta delta, Stream inputStream, Stream outputStream)
 {
     if (inputStream.CanSeek == false) throw new IOException("inputStream not seekable");
     outputStream.WriteByte(DeltaStreamConstants.COPY_BLOCK_START_MARKER);
     outputStream.WriteLong(delta.Offset);
     outputStream.WriteInt(delta.Length);
     inputStream.Seek(delta.Length, SeekOrigin.Current);
 }
开发者ID:billybit,项目名称:RsyncNet,代码行数:8,代码来源:DeltaStreamer.cs

示例7: WriteTo

        public override void WriteTo(Stream stream, bool writeType, bool writeName)
        {
            base.WriteTo(stream, writeType, writeName);

            stream.WriteByte(ItemType);
            stream.WriteInt(Length);

            for (int i = 0; i < Length; ++i)
            {
                Items[i].WriteTo(stream, false, false);
            }
        }
开发者ID:andywhite37,项目名称:NCraft,代码行数:12,代码来源:ListTag.cs

示例8: SendByteDelta

 private void SendByteDelta(ByteDelta delta, Stream inputStream, Stream outputStream)
 {
     outputStream.WriteByte(DeltaStreamConstants.NEW_BLOCK_START_MARKER);
     outputStream.WriteInt(delta.Length);
     var buffer = new byte[delta.Length];
     inputStream.Seek(delta.Offset, SeekOrigin.Begin);
     long totalRead = 0;
     while (totalRead < delta.Length)
     {
         var toRead = (int) MathEx.Bounded(0, StreamChunkSize, delta.Length - totalRead);
         int readLength = inputStream.Read(buffer, 0, toRead);
         if (readLength == 0 && totalRead < delta.Length)
             throw new IOException("Input stream offset out of bounds, or not enough data available");
         outputStream.Write(buffer, 0, readLength);
         totalRead += readLength;
     }
 }
开发者ID:billybit,项目名称:RsyncNet,代码行数:17,代码来源:DeltaStreamer.cs

示例9: EncodeDisp32

 void EncodeDisp32(Stream buffer, byte constant)
 {
     if (indexReg != null) {
     buffer.WriteByte (CombineModRM (MOD_R32_PTR_DISP32, 0x04, constant));
     buffer.WriteByte (CombineSib (baseReg.Index, indexReg.Index, scale));
     } else {
     buffer.WriteByte (CombineModRM (MOD_R32_PTR_DISP32, baseReg.Index, constant));
     if (baseReg == ESP)
         buffer.WriteByte (0x24);
     }
     buffer.WriteInt (disp);
 }
开发者ID:kumpera,项目名称:SimpleJIT,代码行数:12,代码来源:IndirectRegister.cs


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