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


C# DataStream.ReadUInt32方法代码示例

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


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

示例1: Deserialize

            internal void Deserialize( DataStream ds )
            {
                Magic = ds.ReadUInt16();

                uint length = ds.ReadUInt32();
                Index = ds.ReadUInt32();

                Data = ds.ReadBytes( length );
            }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:9,代码来源:Steam2Ticket.cs

示例2: Deserialize

                internal void Deserialize( DataStream ds )
                {
                    ChunkGID = ds.ReadBytes( 20 );

                    CRC = ds.ReadBytes( 4 );

                    Offset = ds.ReadUInt64();

                    DecompressedSize = ds.ReadUInt32();
                    CompressedSize = ds.ReadUInt32();
                }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:11,代码来源:Manifest.cs

示例3: Steam2Ticket

        internal Steam2Ticket( byte[] blob )
        {
            Entries = new List<Entry>();

            using ( var ds = new DataStream( blob ) )
            {
                Magic = ds.ReadUInt16();

                Length = ds.ReadUInt32();
                unknown1 = ds.ReadUInt32();

                while ( ds.SizeRemaining() > 0 )
                {
                    var entry = new Entry();
                    entry.Deserialize( ds );

                    Entries.Add( entry );
                }
            }
        }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:20,代码来源:Steam2Ticket.cs

示例4: HandleMulti

        void HandleMulti( IPacketMsg packetMsg )
        {
            if ( !packetMsg.IsProto )
            {
                DebugLog.WriteLine( "CMClient", "HandleMulti got non-proto MsgMulti!!" );
                return;
            }

            var msgMulti = new ClientMsgProtobuf<CMsgMulti>( packetMsg );

            byte[] payload = msgMulti.Body.message_body;

            if ( msgMulti.Body.size_unzipped > 0 )
            {
                try
                {
                    payload = ZipUtil.Decompress( payload );
                }
                catch ( Exception ex )
                {
                    DebugLog.WriteLine( "CMClient", "HandleMulti encountered an exception when decompressing.\n{0}", ex.ToString() );
                    return;
                }
            }

            DataStream ds = new DataStream( payload );

            while ( ds.SizeRemaining() != 0 )
            {
                uint subSize = ds.ReadUInt32();
                byte[] subData = ds.ReadBytes( subSize );

                OnClientMsgReceived( GetPacketMsg( subData ) );
            }

        }
开发者ID:wheybags,项目名称:steamirc,代码行数:36,代码来源:CMClient.cs

示例5: Deserialize

        void Deserialize(byte[] data)
        {
            using ( DataStream ds = new DataStream( data ) )
            {
                while ( ds.SizeRemaining() > 0 )
                {
                    uint magic = ds.ReadUInt32();
                    ds.Seek( -4, SeekOrigin.Current );

                    switch ( magic )
                    {
                        case Steam3Manifest.MAGIC:
                            Steam3Manifest binaryManifest = new Steam3Manifest( ds );
                            ParseBinaryManifest( binaryManifest );
                            break;

                            // todo: handle protobuf manifest?

                        default:
                            throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
                    }

                    uint marker = ds.ReadUInt32();
                    if ( marker != magic )
                        throw new InvalidDataException( "Unable to find end of message marker for depot manifest" );
                }
            }
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:28,代码来源:DepotManifest.cs

示例6: Steam2Manifest

        const uint ENTRY_SIZE = 28; // the size of a single node


        internal Steam2Manifest( byte[] manifestBlob )
        {
            this.Nodes = new List<Node>();

            using ( DataStream ds = new DataStream( manifestBlob ) )
            {
                uint headerVersion = ds.ReadUInt32();

                this.DepotID = ds.ReadUInt32();
                this.DepotVersion = ds.ReadUInt32();

                this.NodeCount = ds.ReadUInt32();
                this.FileCount = ds.ReadUInt32();

                this.BlockSize = ds.ReadUInt32();

                // checksum is the last field in the header
                ds.Seek( HEADER_SIZE - 4, SeekOrigin.Begin );

                this.DepotChecksum = ds.ReadUInt32();

                // the start of the names section is after the header and every node
                uint namesStart = HEADER_SIZE + ( this.NodeCount * ENTRY_SIZE );

                for ( int x = 0 ; x < this.NodeCount ; ++x )
                {
                    ds.Seek( HEADER_SIZE + ( x * ENTRY_SIZE ), SeekOrigin.Begin );

                    // the first value within a node is the offset from the start of the names section
                    uint nameOffset = namesStart + ds.ReadUInt32();

                    Node entry = new Node
                    {
                        SizeOrCount = ds.ReadUInt32(),
                        FileID = ds.ReadInt32(),
                        Attributes = ( Node.Attribs )ds.ReadUInt32(),
                        ParentIndex = ds.ReadInt32(),

                        Parent = this,
                    };

                    ds.Seek( nameOffset, SeekOrigin.Begin );

                    entry.Name = ds.ReadNullTermString( Encoding.ASCII );

                    this.Nodes.Add( entry );
                }
            }

            // now build full names
            for ( int x = 0 ; x < this.NodeCount ; ++x )
            {
                Node entry = this.Nodes[ x ];
                string fullName = entry.Name;

                while ( entry.ParentIndex != -1 )
                {
                    entry = this.Nodes[ entry.ParentIndex ];
                    fullName = Path.Combine( entry.Name, fullName );
                }

                entry = this.Nodes[ x ];
                entry.FullName = fullName;
            }
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:68,代码来源:Manifest.cs

示例7: VACStatusCallback

            internal VACStatusCallback( MsgClientVACBanStatus msg, byte[] payload )
#endif
            {
                var tempList = new List<uint>();

                using ( DataStream ds = new DataStream( payload ) )
                {
                    for ( int x = 0 ; x < msg.NumBans ; x++ )
                    {
                        tempList.Add( ds.ReadUInt32() );
                    }

                    BannedApps = new ReadOnlyCollection<uint>( tempList );
                }
            }
开发者ID:Nightgunner5,项目名称:steamkit-go,代码行数:15,代码来源:Callbacks.cs

示例8: GetServersFromPacket

        static ContentServer[] GetServersFromPacket( TcpPacket packet )
        {
            DataStream ds = new DataStream( packet.GetPayload(), true );

            ushort numAddrs = ds.ReadUInt16();

            ContentServer[] serverList = new ContentServer[ numAddrs ];
            for ( int x = 0 ; x < numAddrs ; ++x )
            {
                uint weighedLoad = ds.ReadUInt32();

                IPAddrPort ipAddr = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );
                IPAddrPort ipAddr2 = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );

                serverList[ x ] = new ContentServer()
                {
                    Load = weighedLoad,
                    PackageServer = ipAddr,
                    StorageServer = ipAddr2,
                };

            }

            return serverList;
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:25,代码来源:ContentServerDSClient.cs

示例9: DownloadUpdates

            /// <summary>
            /// Downloads a list of updated FileIDs since the given version.
            /// </summary>
            /// <param name="oldVersion">The old version to compare to.</param>
            /// <returns>A list of FileIDs that have been updated.</returns>
            public uint[] DownloadUpdates( uint oldVersion )
            {
                bool bRet = this.SendCommand(
                    5, // download updates
                    this.StorageID,
                    this.MessageID,
                    oldVersion
                );

                uint storId = NetHelpers.EndianSwap( this.Socket.Reader.ReadUInt32() );
                uint msgId = NetHelpers.EndianSwap( this.Socket.Reader.ReadUInt32() );

                byte updateState = this.Socket.Reader.ReadByte();

                uint numUpdates = NetHelpers.EndianSwap( this.Socket.Reader.ReadUInt32() );
                if ( numUpdates == 0 )
                    return null;

                uint storId2 = NetHelpers.EndianSwap( this.Socket.Reader.ReadUInt32() );
                uint msgId2 = NetHelpers.EndianSwap( this.Socket.Reader.ReadUInt32() );

                TcpPacket packet = this.Socket.ReceivePacket();
                DataStream ds = new DataStream( packet.GetPayload() );

                uint[] fileIdList = new uint[ numUpdates ];
                for ( int x = 0 ; x < numUpdates ; ++x )
                {
                    fileIdList[ x ] = ds.ReadUInt32();
                }

                this.MessageID++;

                return fileIdList;
            }
开发者ID:hekar,项目名称:Vaporized,代码行数:39,代码来源:ContentServerClient.cs


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