當前位置: 首頁>>代碼示例>>C#>>正文


C# hsStream.ReadBytes方法代碼示例

本文整理匯總了C#中Plasma.hsStream.ReadBytes方法的典型用法代碼示例。如果您正苦於以下問題:C# hsStream.ReadBytes方法的具體用法?C# hsStream.ReadBytes怎麽用?C# hsStream.ReadBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Plasma.hsStream的用法示例。


在下文中一共展示了hsStream.ReadBytes方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IReadNetCliConnect

        /// <summary>
        /// Reads in a NetCliConnect message from the stream
        /// </summary>
        /// <param name="s">Stream to read the message from</param>
        /// <returns>Connection YData (an array of 64 bytes) or NULL if the message is malformed</returns>
        protected byte[] IReadNetCliConnect(hsStream s)
        {
            byte[] y_data = null;
            try {
                if (s.ReadByte() != plNetCore.kNetCliConnect) return null;
                int size = (int)s.ReadByte() - 2;
                y_data = s.ReadBytes(size);
            } catch (Exception e) {
            #if DEBUG
                throw e;
            #else
                return null;
            #endif
            }

            // Truncate the YData if it's too large
            if (y_data.Length > 64) {
                byte[] old = y_data;
                y_data = new byte[64];
                Buffer.BlockCopy(old, 0, y_data, 0, 64);
            }

            // The client sends us the YData in Little Endian, but
            // BigNum wants Big Endian (because OpenSSL). Let's fix that.
            Array.Reverse(y_data);

            return y_data;
        }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:33,代碼來源:NetServer.cs

示例2: Read

 public override void Read(hsStream s)
 {
     fTransID = s.ReadUInt();
     fAccount = pnHelpers.ReadString(s, 64);
     fHash = s.ReadBytes(20);
     fSrvChg = s.ReadUInt();
     fCliChg = s.ReadUInt();
 }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:8,代碼來源:Cli2Vault.cs

示例3: Read

        public override void Read(hsStream s, hsResMgr mgr)
        {
            fFlags = (BitVectorFlags)s.ReadInt();

            if (HasVersion) {
                fVerMajor = s.ReadByte();
                fVerMinor = s.ReadByte();
            }

            if (HasTimeSent)
                fTimeSent = plUnifiedTime.Read(s);
            if (HasContext)
                fContext = s.ReadUInt();
            if (HasTransID)
                fTransID = s.ReadUInt();
            if (HasPlayerID)
                fPlayerID = s.ReadUInt();
            if (HasAccount)
                fAcctUUID = new Guid(s.ReadBytes(16));
        }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:20,代碼來源:NetMessage.cs

示例4: Read

 public void Read(hsStream s)
 {
     pnVaultNodeFields f = (pnVaultNodeFields)s.ReadULong();
     for (ulong bit = 1; bit != 0 && bit <= (ulong)f; bit <<= 1) {
         switch (f & (pnVaultNodeFields)bit) {
             case pnVaultNodeFields.Blob_1:
                 fBlob[0] = s.ReadBytes(s.ReadInt());
                 break;
             case pnVaultNodeFields.Blob_2:
                 fBlob[1] = s.ReadBytes(s.ReadInt());
                 break;
             case pnVaultNodeFields.CreateAgeName:
                 fCreateAgeName = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.CreateAgeUuid:
                 fCreateAgeGuid = pnHelpers.ReadUuid(s);
                 break;
             case pnVaultNodeFields.CreateTime:
                 fCreateTime = plUnifiedTime.Epoch.AddSeconds((double)s.ReadInt());
                 break;
             case pnVaultNodeFields.CreatorIdx:
                 fCreatorID = s.ReadUInt();
                 break;
             case pnVaultNodeFields.CreatorUuid:
                 fCreatorGuid = pnHelpers.ReadUuid(s);
                 break;
             case pnVaultNodeFields.Int32_1:
                 fInt32[0] = s.ReadInt();
                 break;
             case pnVaultNodeFields.Int32_2:
                 fInt32[1] = s.ReadInt();
                 break;
             case pnVaultNodeFields.Int32_3:
                 fInt32[2] = s.ReadInt();
                 break;
             case pnVaultNodeFields.Int32_4:
                 fInt32[3] = s.ReadInt();
                 break;
             case pnVaultNodeFields.IString64_1:
                 fIString64[0] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.IString64_2:
                 fIString64[1] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.ModifyTime:
                 fModifyTime = plUnifiedTime.Epoch.AddSeconds((double)s.ReadInt());
                 break;
             case pnVaultNodeFields.NodeIdx:
                 fNodeID = s.ReadUInt();
                 break;
             case pnVaultNodeFields.NodeType:
                 fNodeType = (ENodeType)s.ReadUInt();
                 break;
             case pnVaultNodeFields.String64_1:
                 fString64[0] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.String64_2:
                 fString64[1] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.String64_3:
                 fString64[2] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.String64_4:
                 fString64[3] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.String64_5:
                 fString64[4] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.String64_6:
                 fString64[5] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.Text_1:
                 fText[0] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.Text_2:
                 fText[1] = pnHelpers.ReadString(s);
                 break;
             case pnVaultNodeFields.UInt32_1:
                 fUInt32[0] = s.ReadUInt();
                 break;
             case pnVaultNodeFields.UInt32_2:
                 fUInt32[1] = s.ReadUInt();
                 break;
             case pnVaultNodeFields.UInt32_3:
                 fUInt32[2] = s.ReadUInt();
                 break;
             case pnVaultNodeFields.UInt32_4:
                 fUInt32[3] = s.ReadUInt();
                 break;
             case pnVaultNodeFields.Uuid_1:
                 fGuid[0] = pnHelpers.ReadUuid(s);
                 break;
             case pnVaultNodeFields.Uuid_2:
                 fGuid[1] = pnHelpers.ReadUuid(s);
                 break;
             case pnVaultNodeFields.Uuid_3:
                 fGuid[2] = pnHelpers.ReadUuid(s);
                 break;
             case pnVaultNodeFields.Uuid_4:
                 fGuid[3] = pnHelpers.ReadUuid(s);
//.........這裏部分代碼省略.........
開發者ID:Hoikas,項目名稱:PlasmaDotNet,代碼行數:101,代碼來源:VaultNode.cs

示例5: Read

 public override void Read(hsStream s)
 {
     fTransID = s.ReadUInt();
     fPingTimeMs = s.ReadUInt();
     fPayload = s.ReadBytes(s.ReadInt());
 }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:6,代碼來源:Vault2Cli.cs

示例6: Read

        public override void Read(hsStream s, hsResMgr mgr)
        {
            base.Read(s, mgr);

            // Cache it.
            fVersion = mgr.Version;

            // Cyan stores these values, but we're just going to
            //     save the stream and have fun with it...
            fBuffer = new byte[s.ReadInt()];
            Compression type = (Compression)s.ReadByte();
            uint len = s.ReadUInt();

            if (type == Compression.kZlib) {
                short streamType = s.ReadShort();
                byte[] buf = s.ReadBytes((int)len - 2);

                // Create a zlib-compatible inflator
                // Note: incoming has no zlib header/footer
                //       System.IO.Compression sucks.
                Inflater zlib = new Inflater(true);
                zlib.Inflate(buf);

                Buffer.BlockCopy(BitConverter.GetBytes(streamType), 0, fBuffer, 0, 2);
                Buffer.BlockCopy(buf, 0, fBuffer, 2, buf.Length);
            } else
                fBuffer = s.ReadBytes((int)len);
        }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:28,代碼來源:NetMsgStream.cs

示例7: Read

 public override void Read(hsStream s, hsResMgr mgr)
 {
     base.Read(s, mgr);
     fBuffer = s.ReadBytes((int)(s.BaseStream.Length - s.BaseStream.Position));
 }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:5,代碼來源:KeyedObject.cs

示例8: ReadUuid

 public static Guid ReadUuid(hsStream s)
 {
     return new Guid(s.ReadBytes(16));
 }
開發者ID:Hoikas,項目名稱:PlasmaDotNet,代碼行數:4,代碼來源:NetStream.cs

示例9: ReadString

 /// <summary>
 /// Reads in a UTF-16 string with an int16 size and a predefined maximum size
 /// </summary>
 /// <param name="s">Stream to read from</param>
 /// <param name="maxSize">Maximum string size</param>
 /// <returns>Resulting string</returns>
 public static string ReadString(hsStream s, int maxSize)
 {
     int size = (int)s.ReadShort();
     string data = Encoding.Unicode.GetString(s.ReadBytes(size * 2));
     if (data.Length > maxSize)
         return data.Remove(maxSize);
     return data;
 }
開發者ID:Hoikas,項目名稱:PlasmaDotNet,代碼行數:14,代碼來源:NetStream.cs

示例10: IReadHashUInt

 private byte[] IReadHashUInt(hsStream s)
 {
     byte[] buf = s.ReadBytes(4);
     Array.Reverse(buf);
     return buf;
 }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:6,代碼來源:Cli2Auth.cs

示例11: Read

        public override void Read(hsStream s, hsResMgr mgr)
        {
            fFlags = (Flags)s.ReadShort();

            if (HasAccount)
                fAcctUUID = new Guid(s.ReadBytes(16));
            if (HasPlayerID)
                fPlayerID = s.ReadUInt();
            if (HasPlayerName)
                fPlayerName = s.ReadStdString();
            if (HasCCRLevel)
                fCCRLevel = s.ReadByte();
            if (HasProtectedLogin)
                fProtectedLogin = s.ReadBool();
            if (HasBuildType)
                fBuildType = s.ReadByte();
            if (HasSrcAddr)
                fSrcAddr = s.ReadUInt();
            if (HasSrcPort)
                fSrcPort = s.ReadUShort();
            if (HasReserved)
                fReserved = s.ReadUShort();
            if (HasClientKey)
                fClientKey = s.ReadStdString();
        }
開發者ID:branan,項目名稱:PlasmaDotNet,代碼行數:25,代碼來源:ClientGuid.cs


注:本文中的Plasma.hsStream.ReadBytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。