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


C# hsStream.ReadByte方法代码示例

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


在下文中一共展示了hsStream.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ReadRGBA8

        public static Color ReadRGBA8(hsStream s)
        {
            int r = (int)s.ReadByte();
            int g = (int)s.ReadByte();
            int b = (int)s.ReadByte();
            int a = (int)s.ReadByte();

            return Color.FromArgb(a, r, g, b);
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:9,代码来源:Color.cs

示例3: Read

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

            fFlags = s.ReadByte();
            fNumFrames = s.ReadByte();
            fVoiceData = s.ReadStdString();

            fReceivers.Capacity = (int)s.ReadByte();
            for (int i = 0; i < fReceivers.Capacity; i++)
                fReceivers.Insert(i, s.ReadUInt());
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:12,代码来源:NetMsgVoice.cs

示例4: Read

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

            fSecsRunning = s.ReadDouble();
            fSession = (SessionTypes)s.ReadByte();
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:7,代码来源:NetMsgPing.cs

示例5: Read

 public void Read(hsStream s)
 {
     fType = (ENetProtocol)s.ReadByte();
     if (s.ReadUShort() != kHeaderSize)
         throw new NotSupportedException();
     fBuildID = s.ReadUInt();
     fBuildType = (EBuildType)s.ReadUInt();
     fBranchID = s.ReadUInt();
     fProductUuid = pnHelpers.ReadUuid(s);
 }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:10,代码来源:Cli2Srv.cs

示例6: Read

 public void Read(hsStream s)
 {
     fType = (ENetProtocol)s.ReadByte();
     if (s.ReadUShort() != kHeaderSize)
         throw new NotSupportedException();
     fBuildID = s.ReadUInt();
     fProtocolVer = s.ReadUInt();
     if (fProtocolVer < 50)
         fProtocolVer = 50; // <= 50 are the old "Build Type" values...
     fBranchID = s.ReadUInt();
     fProductUuid = pnHelpers.ReadUuid(s);
 }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:12,代码来源:NsBase.cs

示例7: Read

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

            fType = (NotificationType)s.ReadInt();
            fState = s.ReadFloat();
            if (s.Version < plVersion.EndOfAges)
                fID = s.ReadInt();
            else
                fID = (int)s.ReadByte();

            fEvents.Capacity = s.ReadInt();
            for (int i = 0; i < fEvents.Capacity; i++)
                fEvents.Add(proEventData.Read(s, mgr));
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:15,代码来源:NotifyMsg.cs

示例8: Read

 public void Read(hsStream s)
 {
     byte mask = s.ReadByte();
     fQuality[0] = (byte)((mask >> 4) | 0xF0);
     fQuality[1] = (byte)(mask | 0xF0);
 }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:6,代码来源:Key.cs

示例9: VariableLengthRead

 internal static int VariableLengthRead(hsStream s, int size)
 {
     if (size < 0x100)
         return (int)s.ReadByte();
     else if (size < 0x10000)
         return (int)s.ReadShort();
     else
         return s.ReadInt();
 }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:9,代码来源:SDLMgr.cs

示例10: 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

示例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

示例12: Read

        public void Read(hsStream s)
        {
            // Magically figure out what version we have...
            uint prpVer = s.ReadUInt();
            switch (prpVer) {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                    s.Version = new plVersion(2, 0, 0, 0);
                    break;
                case 6:
                    s.Version = plVersion.MystOnline;
                    break;
                default:
                    // Must be some sort of Myst 5 variant...
                    s.Rewind();
                    prpVer = (uint)s.ReadUShort();
                    switch (prpVer) {
                        case 6:
                            s.Version = plVersion.EndOfAges;
                            break;
                        case 9:
                            s.Version = plVersion.HexIsle;
                            break;
                        default:
                            throw new plVersionException(prpVer);
                    }
                    break;
            }

            if (s.Version.IsPlasma21)
                IReadClassVersions(s);

            fLocation.Read(s);
            fAge = s.ReadSafeString();
            if (s.Version.IsPreMystOnline) fChapter = s.ReadSafeString();
            else if (s.Version.IsMystOnline) fChapter = "District";
            fPage = s.ReadSafeString();

            // Some more versioning stuff for Uru...
            if (s.Version.IsMystOnline)
                s.Version = new plVersion(2, 0, s.ReadUShort(), 0);
            else if (s.Version.IsPreMystOnline)
                s.Version = new plVersion(2, 0, s.ReadUShort(), s.ReadUShort());

            if (prpVer < 6) {
                if (prpVer < 5) // IndexChecksum -- deprecated...
                    s.ReadUInt();
                if (prpVer >= 2)
                    fReleaseVersion = s.ReadInt();
                if (prpVer >= 3)
                    fFlags = (Flags)s.ReadInt();
            }

            if (prpVer >= 4)
                fChecksum = s.ReadUInt();
            if (prpVer >= 5) {
                fDataStart = s.ReadUInt();
                fIndexStart = s.ReadUInt();
            } else {
                //prm/prx???
                fDataStart = 0;
                fIndexStart = s.ReadByte();
            }

            // Garbage
            if (s.Version.IsMystOnline)
                IReadClassVersions(s);
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:71,代码来源:PageInfo.cs

示例13: Read

 public void Read(hsStream s)
 {
     fParent = s.ReadUInt();
     fChild = s.ReadUInt();
     fSaver = s.ReadUInt();
     s.ReadByte(); // "Seen" -- might as well be garbage
 }
开发者ID:Hoikas,项目名称:PlasmaDotNet,代码行数:7,代码来源:VaultNode.cs

示例14: Read

        public virtual void Read(hsStream s)
        {
            if (s.ReadByte() != kIoVersion)
                throw new NotSupportedException("Bad VarDescriptor IO Version");

            fName = s.ReadSafeString();
            string displayOptions = s.ReadStdString(); // TODO
            fCount = s.ReadInt();
            fType = (plAtomicType)s.ReadByte();
            Default = s.ReadSafeString();
            fFlags = (Flags)s.ReadInt();

            // Derived class in Cyan's code, but this is cleaner
            if (IsStateDesc) {
                fDescName = s.ReadSafeString();
                fVersion = (int)s.ReadShort();
            } else {
                fAtomicCount = (int)s.ReadShort();
                fAtomicType = (plAtomicType)s.ReadByte();
            }
        }
开发者ID:Hoikas,项目名称:PlasmaDotNet,代码行数:21,代码来源:StateDescriptor.cs

示例15: IReadKeyring

        private List<HoldingKey> IReadKeyring(hsStream s, plLocation loc)
        {
            List<HoldingKey> keyring = new List<HoldingKey>();

            int types = s.ReadInt();
            for (int i = 0; i < types; i++) {
                plCreatableID type = plManagedType.Read(s);
                if (s.Version >= plVersion.MystOnline) {
                    s.ReadInt();  // Size until the next type
                    s.ReadByte(); // Flags???
                }

                int count = s.ReadInt();

                // Some optimizations
                keyring.Capacity += count;
                fKeyCollector.Reserve(loc, type, count);

                for (int j = 0; j < count; j++) {
                    HoldingKey key = new HoldingKey();
                    key.fKey = ReadUoid(s);
                    key.fOffset = s.ReadInt();
                    key.fSize = s.ReadInt();
                    key.fStream = s;

                    keyring.Add(key);
                }
            }

            plDebugLog.GetLog("ResManager").Debug(String.Format("\t* Keyring: {0} Keys", keyring.Count));
            return keyring;
        }
开发者ID:branan,项目名称:PlasmaDotNet,代码行数:32,代码来源:ResManager.cs


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