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


C# ByteBuffer.ReadUInt16方法代码示例

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


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

示例1: Load_Pet


//.........这里部分代码省略.........
            Title = buff.ReadString(); //OwnerName
            buff.ReadUInt32();//1

            PvPFlag = buff.ReadUInt32();
            Karma = buff.ReadInt32();

            Cur_Fed = buff.ReadUInt32();
            Max_Fed = buff.ReadUInt32();

            Cur_HP = buff.ReadUInt32();
            Max_HP = buff.ReadUInt32();

            Cur_MP = buff.ReadUInt32();
            Max_MP = buff.ReadUInt32();

            SP = buff.ReadUInt32();
            Level = buff.ReadUInt32();
            XP = buff.ReadUInt64();

            XP_ThisLevel = buff.ReadUInt64();
            XP_NextLevel = buff.ReadUInt64();

            Cur_Load = buff.ReadUInt32();
            Max_Load = buff.ReadUInt32();

            Patk = buff.ReadUInt32();
            PDef = buff.ReadUInt32();
            Accuracy = buff.ReadUInt32();// p
            Evasion = buff.ReadUInt32();//p
            Focus = buff.ReadUInt32();//p
            Matk = buff.ReadUInt32();
            MDef = buff.ReadUInt32();

            buff.ReadUInt32();//m acu
            buff.ReadUInt32();//m eva
            buff.ReadUInt32();//m crit

            buff.ReadUInt32();// speed
            buff.ReadUInt32();//patak sped
            buff.ReadUInt32();// cast

            /*if (Globals.gamedata.Chron < Chronicle.CT3_0)
            {
                AbnormalEffects = buff.ReadUInt32(); //AbnormalEffect bleed=1; poison=2; poison & bleed=3; flame=4;
            }
            else
            {
                buff.ReadUInt32(); //??
            }*/
            Mountable = buff.ReadUInt16();

            buff.ReadByte();
            buff.ReadUInt16();

            if (Globals.gamedata.Chron >= Chronicle.CT1)
            {
                TeamCircle = buff.ReadByte();
                /*if (Globals.gamedata.Chron >= Chronicle.CT3_0)
                {
                    //buff.ReadUInt32(); //00 00 00 00
                    buff.ReadUInt16();
                    AbnormalEffects = buff.ReadUInt32();
                    buff.ReadUInt32(); //00 00 00 00
                    buff.ReadUInt16(); //00 00 00 00
                }*/
                SSUsage = buff.ReadUInt32();
                SPSUSage = buff.ReadUInt32();
                Form = buff.ReadUInt32();
                buff.ReadUInt32();//0x00
                if (Globals.gamedata.Chron >= Chronicle.CT3_0)
                {
                    //buff.ReadUInt16(); //00 00
                    try
                    {
                        buff.ReadUInt32(); //00 00
                        buff.ReadUInt32(); //02 00 00 00 current pet points
                        buff.ReadUInt32(); //06 00 00 00 max pet points

                        uint abn_count = buff.ReadUInt32();
                        if (abn_count < 30) // well ... its oddi wayso :P
                        {
                            _AbnEffects.Add(buff.ReadUInt32());
                        }


                    }
                    catch
                    {

                    }
                }
            }
            else
            {
                HasOwner = buff.ReadByte();
                SSUsage = buff.ReadUInt32();
                Form = buff.ReadUInt32();
                buff.ReadUInt32();//0x00
            }
        }
开发者ID:stephenZh,项目名称:l2net,代码行数:101,代码来源:Pet_Info.cs

示例2: Read

        /// <summary>
        /// Reads a single archiveFile from a Zip Archive.  Should only be used by ZipArchive.  
        /// </summary>
        /// <returns>A ZipArchiveFile representing the archiveFile read from the archive.</returns>
        internal static ZipArchiveFile Read(ZipArchive archive)
        {
            Stream reader = archive.fromStream;
            ByteBuffer header = new ByteBuffer(30);
            int count = header.ReadContentsFrom(reader);
            if (count == 0)
                return null;

            //Local file header:
            //
            //local file header signature     4 bytes  (0x04034b50)
            //version needed to extract       2 bytes
            //general purpose bit flag        2 bytes
            //compression method              2 bytes
            //last mod file time              2 bytes
            //last mod file date              2 bytes
            //crc-32                          4 bytes
            //compressed size                 4 bytes
            //uncompressed size               4 bytes
            //file name length                2 bytes
            //extra field length              2 bytes
            //
            //file name (variable size)
            //extra field (variable size)

            uint fileSignature = header.ReadUInt32();
            if (fileSignature != SignatureFileEntry) {
                if (fileSignature != SignatureArchiveDirectory)
                    throw new ApplicationException("Bad ZipFile Header");
                return null;
            }

            ushort versionNeededToExtract = header.ReadUInt16();
            if (versionNeededToExtract > MaximumVersionExtractable)
                throw new ApplicationException("Zip file requires unsupported features");

            header.SkipBytes(2); // general purpose bit flag

            ZipArchiveFile newEntry = new ZipArchiveFile(archive, null);

            newEntry.compressionMethod = (CompressionMethod)header.ReadUInt16();
            newEntry.lastWriteTime = DosTimeToDateTime(header.ReadUInt32());
            newEntry.crc32 = header.ReadUInt32();
            newEntry.compressedLength = checked((int)header.ReadUInt32());
            newEntry.length = header.ReadUInt32();
            int fileNameLength = checked((int)header.ReadUInt16());

            byte[] fileNameBuffer = new byte[fileNameLength];
            int fileNameCount = reader.Read(fileNameBuffer, 0, fileNameLength);
            newEntry.name = Encoding.UTF8.GetString(fileNameBuffer).Replace('/', Path.DirectorySeparatorChar);
            archive.entries[newEntry.name] = newEntry;

            if (count != header.Length || fileNameCount != fileNameLength || fileNameLength == 0 || newEntry.LastWriteTime.Ticks == 0)
                throw new ApplicationException("Bad Zip File Header");
            if (newEntry.Name.IndexOfAny(invalidPathChars) >= 0)
                throw new ApplicationException("Invalid File Name");
            if (newEntry.compressionMethod != CompressionMethod.None && newEntry.compressionMethod != CompressionMethod.Deflate)
                throw new ApplicationException("Unsupported compression mode " + newEntry.compressionMethod);

            if (archive.IsReadOnly && reader.CanSeek) {
                // Optimization: we can defer reading in the data in the common case of a read-only archive.
                // by simply remembering where the data is and fetching it on demand.  This is nice because
                // we only hold on to memory of data we are actually operating on.  (instead of the whole archive)
                //
                // Because uncompresseData is null, we know that we fetch it from the archive 'fromStream'.
                newEntry.positionOfCompressedDataInArchive = archive.fromStream.Position;
                reader.Seek(newEntry.compressedLength, SeekOrigin.Current);
            } else {
                // We may be updating the archive in place, so we need to copy the data out.
                newEntry.compressedData = new byte[newEntry.compressedLength];
                reader.Read(newEntry.compressedData, 0, (int)newEntry.compressedLength);
            }

            #if DEBUG
            newEntry.Validate();
            #endif

            return newEntry;
        }
开发者ID:strager,项目名称:NoCap,代码行数:83,代码来源:Zip.cs


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