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


C# BitReader.Read方法代码示例

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


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

示例1: PlayerJoinEvent

        public PlayerJoinEvent(BitReader bitReader, Replay replay, int playerIndex)
        {
            this.EventType = GameEventType.Inactive;

            // This should probably be a series of {shl; or} on .Read(1)
            // to make it version-independent
            if (replay.ReplayBuild < 22612)
            {
                this.JoinFlags = (int)bitReader.Read(4);
            }
            else
            {
                this.JoinFlags = (int)bitReader.Read(12); // unknown
            }

            // Initialize player if not exists (true for observers)
            Player player = replay.GetPlayerById(playerIndex);
            if (player == null)
            {
                var p = new Player { PlayerType = PlayerType.Spectator };
                replay.ClientList[playerIndex] = player = p;
            }

            // Initialize wireframe
            player.Wireframe = new List<Unit>();
            player.WireframeSubgroup = 0;

            // Initialize control groups
            player.Hotkeys = new List<Unit>[10];
        }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:30,代码来源:PlayerJoinEvent.cs

示例2: CameraEvent

        public CameraEvent(BitReader bitReader, Replay replay)
        {
            TargetX = CFixedToDouble(bitReader.Read(16));
            TargetY = CFixedToDouble(bitReader.Read(16));

            HasDistance = bitReader.Read(1) != 0;
            if (HasDistance)
            {
                Distance = CFixedToDouble(bitReader.Read(16));
            }

            HasPitch = bitReader.Read(1) != 0;
            if (HasPitch)
            {
                Pitch = RotationAmountToDegrees(bitReader.Read(16));
            }

            HasYaw = bitReader.Read(1) != 0;
            if (HasYaw)
            {
                Yaw = RotationAmountToDegrees(bitReader.Read(16));
            }

            HasHeightOffset = bitReader.Read(1) != 0;
            if (HasHeightOffset)
            {
                // Debug since we're unsure
                HeightOffset = CFixedToDouble(bitReader.Read(16));
            }

            this.EventType = GameEventType.Other;
        }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:32,代码来源:CameraEvent.cs

示例3: GetGraphicInfo

        public static void GetGraphicInfo(BitReader reader, ref Item item)
        {
            item.has_graphic = reader.ReadBit(); ;
            if (item.has_graphic)
                item.graphic = (byte)reader.Read(3);

            item.has_colour = reader.ReadBit();
            if (item.has_colour)
                item.colour = (UInt16)reader.Read(11);
        }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:10,代码来源:Parser.cs

示例4: EarInfo

        public static bool EarInfo(BitReader reader, ref Item item)
        {
            if (item.ear)
            {
                reader.Read(3);
                item.ear_level = (byte)reader.Read(7);
                //item.ear_name = "Fix Me"; //fix me later
                List<Byte> ear_name = new List<byte>();
                reader.Read(8);
                while (ear_name.Last() != 0x00)
                {
                    reader.Read(8); // 16 characters of 7 bits each for the name of the ear to process later
                }

                item.ear_name = Convert.ToBase64String(ear_name.ToArray());
                return true;
            }
            else
                return false;
        }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:20,代码来源:Parser.cs

示例5: SendResourcesEvent

        public SendResourcesEvent(BitReader bitReader, Replay replay)
        {
            this.EventType = GameEventType.Other;

            var playerId = (int)bitReader.Read(4);
            Target = replay.GetPlayerById(playerId);

            var someFlags = (int)bitReader.Read(3);

            if (someFlags-- > 0) // 4
            {
                MineralsSent = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 3
            {
                VespeneSent = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 2
            {
                TerrazineSent = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 1
            {
                CustomSent = ReadSignedAmount(bitReader.Read(32));
            }
        }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:26,代码来源:SendResourcesEvent.cs

示例6: RequestResourcesEvent

        public RequestResourcesEvent(BitReader bitReader, Replay replay)
        {
            this.EventType = GameEventType.Other;

            var someFlags = (int)bitReader.Read(3);

            if (someFlags-- > 0) // 4
            {
                MineralsRequested = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 3
            {
                VespeneRequested = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 2
            {
                TerrazineRequested = ReadSignedAmount(bitReader.Read(32));
            }
            if (someFlags-- > 0) // 1
            {
                CustomRequested = ReadSignedAmount(bitReader.Read(32));
            }
        }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:23,代码来源:RequestResourcesEvent.cs

示例7: GetItemType

        // gets the 3 letter item code
        public static bool GetItemType(BitReader reader, ref Item item)
        {
            byte[] code_bytes = new byte[4];
            for (int i = 0; i < code_bytes.Length; i++)
                code_bytes[i] = (byte)(reader.Read(8));
            code_bytes[3] = 0;

            item.type = System.Text.Encoding.ASCII.GetString(code_bytes).Substring(0, 3);

            ItemEntry entry;
            if (!DataManager.Instance.m_itemData.Get(item.type, out entry))
            {
                Console.WriteLine("Failed to look up item in item data table");
                return true;
            }

            item.name = entry.Name;
            item.width = entry.Width;
            item.height = entry.Height;

            item.is_armor = entry.IsArmor();
            item.is_weapon = entry.IsWeapon();

            if (item.type == "gld")
            {
                item.is_gold = true;
                bool big_pile = reader.ReadBit();
                if (big_pile) item.amount = (uint)reader.Read(32);
                else item.amount = (uint)reader.Read(12);
                return true;
            }
            else return false;
        }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:34,代码来源:Parser.cs

示例8: SelectionEvent

        public SelectionEvent(BitReader bitReader, Replay replay, Player player, UnitData data)
        {
            int wireframeLength = 8;
            if (replay.ReplayBuild >= 22612)
            {
                wireframeLength = 9; // Maximum selection size has been increased to 500, up from 255.
            }

            // Parse select event and update player wireframe accordingly
            WireframeIndex = (int)bitReader.Read(4);
            player.WireframeSubgroup = SubgroupIndex = (int)bitReader.Read(wireframeLength);

            if (WireframeIndex == 10)
            {
                this.EventType = GameEventType.Selection;
            }
            else // This is a control group update, likely from a CAbilMorph
            {
                this.EventType = GameEventType.Inactive;
            }

            List<Unit> affectedWireframe;
            if (WireframeIndex == 10)
            {
                affectedWireframe = player.Wireframe;
            }
            else
            {
                affectedWireframe = player.Hotkeys[WireframeIndex];
            }

            RemovedUnits = new List<Unit>();

            var updateFlags = (int)bitReader.Read(2);

            ClearSelection = false;

            if (updateFlags == 1)
            {
                var numBits = (int)bitReader.Read(wireframeLength);
                var unitsRemoved = new bool[numBits];

                var wireframeIndex = 0;
                while (numBits >= 8)
                {
                    numBits -= 8;
                    var flags = bitReader.Read(8);
                    for (int i = 0; i < 8; i++)
                    {
                        unitsRemoved[wireframeIndex + i] = (flags & (1 << i)) != 0;
                    }
                    wireframeIndex += 8;
                }
                if (numBits != 0)
                {
                    var flags = bitReader.Read(numBits);
                    for (int i = 0; i < numBits; i++)
                    {
                        unitsRemoved[wireframeIndex + i] = (flags & (1 << i)) != 0;
                    }
                    wireframeIndex += numBits;
                }

                for (int i = 0; i < wireframeIndex; i++)
                {
                    if (unitsRemoved[i])
                    {
                        RemovedUnits.Add(affectedWireframe[i]);
                    }
                }
            }
            else if (updateFlags == 2)
            {
                var indexArrayLength = (int)bitReader.Read(wireframeLength);
                if (indexArrayLength > 0)
                {
                    for (int i = 0; i < indexArrayLength; i++)
                    {
                        RemovedUnits.Add(affectedWireframe[(int)bitReader.Read(wireframeLength)]);
                    }
                }
            }
            else if (updateFlags == 3)
            {
                var indexArrayLength = (int)bitReader.Read(wireframeLength);
                if (indexArrayLength > 0)
                {
                    AddedUnits = new List<Unit>(indexArrayLength);
                    for (int i = 0; i < indexArrayLength; i++)
                    {
                        AddedUnits.Add(affectedWireframe[(int)bitReader.Read(wireframeLength)]);
                    }
                }

                ClearSelection = true;
            }

            // Build removed unit types
            RemovedUnitTypes = new Dictionary<UnitType, int>();
            foreach (var unit in RemovedUnits)
//.........这里部分代码省略.........
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:101,代码来源:SelectionEvent.cs

示例9: AbilityEvent

        public AbilityEvent(BitReader bitReader, Replay replay, Player player, AbilityData abilityData, UnitData unitData)
        {
            uint flags;
            //   1.3.3 patch notes:
            //   - Fixed an issue where the APM statistic could be artificially increased.
            // This adds the "failed" flag, which is triggered usually by holding down a
            // hotkey, leading to key repeat spamming the event throughout a single tick.
            if (replay.ReplayBuild < 18574) // < 1.3.3
            {
                flags = bitReader.Read(17);
            }
            else if (replay.ReplayBuild < 22612) // < 1.5.0
            {
                flags = bitReader.Read(18);
            }
            else
            {
                flags = bitReader.Read(20);
            }
            Queued = (flags & 2) != 0;
            RightClick = (flags & 8) != 0;
            WireframeClick = (flags & 0x20) != 0;
            ToggleAbility = (flags & 0x40) != 0;
            EnableAutoCast = (flags & 0x80) != 0;
            AbilityUsed = (flags & 0x100) != 0;
            WireframeUnload = (flags & 0x200) != 0;
            WireframeCancel = (flags & 0x400) != 0;
            MinimapClick = (flags & 0x10000) != 0;
            AbilityFailed = (flags & 0x20000) != 0;

            // flags & 0xf815 -> Debug for unknown flags
            // Never found any across all test data.

            DefaultAbility = (bitReader.Read(1) == 0);
            DefaultActor = true;
            if (!DefaultAbility)
            {
                AbilityType = abilityData.GetAbilityType(
                    (int)bitReader.Read(16),
                    (int)bitReader.Read(5));
                DefaultActor = (bitReader.Read(1) == 0);
                if (!DefaultActor)
                {   // I'm thinking this would be an array type... but I can't
                    // find anything that causes this bit to be set.
                    throw new InvalidOperationException("Unsupported: non-default actor");
                }
            }
            if (DefaultActor)
            {
                // Deep copy the current wireframe as the actor list
                // -----
                // If a user wants to deal with subgroups to get a more
                // concise actor list, the data is all here.  We're not
                // going to bother, though, because there are several
                // exceptions to account for in determining event actors.
                Actors = new List<Unit>(player.Wireframe.Count);
                foreach (var unit in player.Wireframe)
                {
                    Actors.Add(new Unit(unit));
                }
            }

            var targetType = bitReader.Read(2);
            if (targetType == 1) // Location target
            {
                var targetX = bitReader.Read(20);
                var targetY = bitReader.Read(20);
                var targetZ = bitReader.Read(32);
                TargetLocation = Location.FromEventFormat(targetX, targetY, targetZ);
            }
            else if (targetType == 2) // Unit + Location target
            {
                TargetFlags = (int)bitReader.Read(8);
                WireframeIndex = (int)bitReader.Read(8);

                var unitId = (int)bitReader.Read(32);
                var unit = replay.GetUnitById(unitId);
                var unitTypeId = (int)bitReader.Read(16);
                if (unit == null)
                {
                    var unitType = unitData.GetUnitType(unitTypeId);
                    unit = new Unit(unitId, unitType);
                    unit.typeId = unitTypeId;
                    replay.GameUnits.Add(unitId, unit);
                }

                TargetUnit = unit;

                var targetHasPlayer = bitReader.Read(1) == 1;
                if (targetHasPlayer)
                {
                    TargetPlayer = (int)bitReader.Read(4);
                }

                // 1.4.0 -- Don't really know what this was meant to fix
                if (replay.ReplayBuild >= 19595)
                {
                    var targetHasTeam = bitReader.Read(1) == 1;
                    if (targetHasTeam)
                    {
//.........这里部分代码省略.........
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:101,代码来源:AbilityEvent.cs

示例10: HotkeyEvent

        public HotkeyEvent(BitReader bitReader, Replay replay, Player player)
        {
            int wireframeLength = 8;
            if (replay.ReplayBuild >= 22612)
            {
                wireframeLength = 9; // Maximum selection size has been increased to 500, up from 255.
            }
            this.EventType = GameEventType.Selection;

            ControlGroup = (int)bitReader.Read(4);

            // throws
            ActionType = (HotkeyActionType)(int)bitReader.Read(2);

            var updateType = (int)bitReader.Read(2);

            // This is an internal update that is somewhat asynchronous to
            // the main wireframe.
            var unitsRemovedList = new List<Unit>();
            if (updateType == 1) // Remove by flags
            {
                var numBits = (int)bitReader.Read(wireframeLength);
                var unitsRemoved = new bool[numBits];
                var wireframeIndex = 0;

                while (numBits >= 8)
                {
                    numBits -= 8;
                    var flags = bitReader.Read(8);
                    for (int i = 0; i < 8; i++)
                    {
                        unitsRemoved[wireframeIndex + i] = (flags & (1 << i)) != 0;
                    }
                    wireframeIndex += 8;
                }
                if (numBits != 0)
                {
                    var flags = bitReader.Read(numBits);
                    for (int i = 0; i < numBits; i++)
                    {
                        unitsRemoved[wireframeIndex + i] = (flags & (1 << i)) != 0;
                    }
                    wireframeIndex += numBits;
                }

                for (int i = 0; i < wireframeIndex; i++)
                {
                    if (unitsRemoved[i])
                    {
                        unitsRemovedList.Add(player.Hotkeys[ControlGroup][i]);
                    }
                }
            }
            else if (updateType == 2)
            {
                var numIndices = (int)bitReader.Read(wireframeLength);
                for (int i = 0; i < numIndices; i++)
                {
                    unitsRemovedList.Add(player.Hotkeys[ControlGroup][(int)bitReader.Read(wireframeLength)]);
                }
            }
            else if (updateType == 3) // Replace control group with portion of control group
            {
                // This happens fairly rarely, so I'll just invert the output
                unitsRemovedList = new List<Unit>(player.Hotkeys[ControlGroup]);

                var numIndices = (int)bitReader.Read(wireframeLength);
                for (int i = 0; i < numIndices; i++)
                {
                    unitsRemovedList.Remove(player.Hotkeys[ControlGroup][(int)bitReader.Read(wireframeLength)]);
                }
            }

            if (ActionType == HotkeyActionType.AddToControlGroup)
            {
                var oldControlgroup = player.Hotkeys[ControlGroup];
                List<Unit> newControlgroup;
                if (oldControlgroup != null)
                {
                    newControlgroup = new List<Unit>(player.Wireframe.Count + oldControlgroup.Count);

                    foreach (Unit unit in oldControlgroup)
                    {
                        newControlgroup.Add(unit);
                    }
                }
                else
                {
                    newControlgroup = new List<Unit>(player.Wireframe.Count);
                }

                foreach (Unit unit in player.Wireframe)
                {
                    if (oldControlgroup == null || !oldControlgroup.Contains(unit))
                    {
                        newControlgroup.Add(unit);
                    }
                }
                newControlgroup.Sort((m, n) => m.Id - n.Id);

//.........这里部分代码省略.........
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:101,代码来源:HotkeyEvent.cs

示例11: HandleUnitArrays

        /// <summary>
        /// Reads the 8 {16, 8, 8}, 8 {32} struct; the result is in AddedUnits / AddedUnitTypes.
        /// </summary>
        void HandleUnitArrays(BitReader bitReader, Replay replay, UnitData data)
        {
            int wireframeLength = 8;
            if (replay.ReplayBuild >= 22612)
            {
                wireframeLength = 9; // Maximum selection size has been increased to 500, up from 255.
            }

            var typesLength = (int)bitReader.Read(wireframeLength);
            AddedUnitTypes = new Dictionary<UnitType, int>(typesLength);

            // Guarantee order is maintained
            var subgroups = new List<KeyValuePair<UnitType, int>>(typesLength);

            for (int i = 0; i < typesLength; i++)
            {
                var unitTypeId = (int)bitReader.Read(16);
                var unitType = data.GetUnitType(unitTypeId);

                var unitSubtype = bitReader.Read(8);
                if (unitSubtype == 2) // hallucination -- cheers, Graylin
                {
                    unitType = data.GetHallucination(unitType);
                }

                var unitCountType = (int)bitReader.Read(wireframeLength);
                if (unitType == UnitType.Unknown && AddedUnitTypes.ContainsKey(UnitType.Unknown))
                {
                    AddedUnitTypes[UnitType.Unknown] += unitCountType;
                }
                else
                {
                    AddedUnitTypes.Add(unitType, unitCountType);
                }
                subgroups.Add(new KeyValuePair<UnitType, int>(unitType, unitCountType));
            }

            var idsLength = (int)bitReader.Read(wireframeLength);
            AddedUnits = AddedUnits ?? new List<Unit>(idsLength);
            if (idsLength == 0) return;

            var subgroupsEnumerator = subgroups.GetEnumerator();

            int currentSubgroupIndex;
            if (subgroupsEnumerator.MoveNext())
            {
                currentSubgroupIndex = subgroupsEnumerator.Current.Value;
            }
            else return;

            for (int i = 0; i < idsLength; i++)
            {
                var unitId = (int)bitReader.Read(32);
                var unit = replay.GetUnitById(unitId);
                var unitType = subgroupsEnumerator.Current.Key;
                if (unit == null)
                {
                    unit = new Unit(unitId, unitType);
                    replay.GameUnits.Add(unitId, unit);
                }
                else
                {
                    unit.UpdateType(unitType);
                }
                AddedUnits.Add(unit);

                if (--currentSubgroupIndex <= 0)
                {
                    if (subgroupsEnumerator.MoveNext())
                    {
                        currentSubgroupIndex = subgroupsEnumerator.Current.Value;
                    }
                }
            }
        }
开发者ID:kensniper,项目名称:sc2replay-csharp,代码行数:78,代码来源:SelectionEvent.cs

示例12: NpcAssignment

        protected void NpcAssignment(byte type, List<byte> data)
        {
            byte[] packet = data.ToArray();
            NpcEntity output;
            //try
            //{
            BitReader br = new BitReader(data.ToArray());
            br.ReadBitsLittleEndian(8);
            UInt32 id = (uint)br.Read(32);
            UInt16 npctype = (ushort)br.Read(16);
            UInt16 x = (ushort)br.Read(16);
            UInt16 y = (ushort)br.Read(16);
            byte life = (byte)br.Read(8);
            byte size = (byte)br.Read(8);

            output = new NpcEntity(id, npctype, life, x, y);

            int informationLength = 16;

            String[] entries;

            if (!DataManager.Instance.m_monsterFields.Get(npctype, out entries))
                Logger.Write("Failed to read monstats data for NPC of type {0}", type);
            if (entries.Length != informationLength)
                Logger.Write("Invalid monstats entry for NPC of type {0}", type);

            bool lookupName = false;

            if (data.Count > 0x10)
            {
                br.Read(4);
                if (br.ReadBit())
                {
                    for (int i = 0; i < informationLength; i++)
                    {
                        int temp;

                        int value = Int32.Parse(entries[i]);

                        if (!BitScanReverse(out temp, (uint)value - 1))
                            temp = 0;
                        if (temp == 31)
                            temp = 0;

                        //Console.WriteLine("BSR: {0} Bitcount: {1}", temp+1, bitCount);
                        int bits = br.Read(temp + 1);
                    }
                }

                output.SuperUnique = false;

                output.HasFlags = br.ReadBit();
                if (output.HasFlags)
                {
                    output.Champion = br.ReadBit();
                    output.Unique = br.ReadBit();
                    output.SuperUnique = br.ReadBit();
                    output.IsMinion = br.ReadBit();
                    output.Ghostly = br.ReadBit();
                    //Console.WriteLine("{0} {1} {2} {3} {4}", output.Champion, output.Unique, output.SuperUnique, output.IsMinion, output.Ghostly);
                }

                if (output.SuperUnique)
                {
                    output.SuperUniqueId = br.ReadBitsLittleEndian(16);
                    String name;
                    if (!DataManager.Instance.m_superUniques.Get(output.SuperUniqueId, out name))
                    {
                        Logger.Write("Failed to lookup super unique monster name for {0}", output.SuperUniqueId);
                        output.Name = "invalid";
                    }
                    else
                    {
                        output.Name = name;
                        //Console.WriteLine("NPC: {0}", name);
                    }
                }
                else
                    lookupName = true;

                if (data.Count > 17 && lookupName != true && output.Name != "invalid")
                {
                    output.IsLightning = false;
                    while (true)
                    {
                        byte mod = (byte)br.ReadBitsLittleEndian(8);
                        if (mod == 0)
                            break;
                        if (mod == 0x11)
                            output.IsLightning = true;
                    }
                }
            }
            else
                lookupName = true;

            if (lookupName)
            {
                String name;
                if (!DataManager.Instance.m_monsterNames.Get((int)output.Type, out name))
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:OmegaBot,代码行数:101,代码来源:D2gsHandler.cs

示例13: GetSocketInfo

 public static void GetSocketInfo(BitReader reader, ref Item item)
 {
     item.used_sockets = (byte)reader.Read(3);
 }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:4,代码来源:Parser.cs

示例14: GetLevelQuality

 public static bool GetLevelQuality(BitReader reader, ref Item item)
 {
     item.quality = Item.QualityType.normal;
     if (item.simple_item || item.gambling)
         return false;
     item.level = (byte)reader.Read(7);
     item.quality = (Item.QualityType)(reader.Read(4));
     return true;
 }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:9,代码来源:Parser.cs

示例15: GetIdentifiedInfo

        public static void GetIdentifiedInfo(BitReader reader, ref Item item)
        {
            if (item.identified)
            {
                switch (item.quality)
                {
                    case Item.QualityType.inferior:
                        item.prefix = (byte)reader.Read(3);
                        break;
                    case Item.QualityType.superior:
                        item.superiority = (Item.SuperiorItemClassType)(reader.Read(3));
                        break;
                    case Item.QualityType.magical:
                        item.prefix = (uint)reader.Read(11);
                        item.suffix = (uint)reader.Read(11);
                        break;

                    case Item.QualityType.crafted:
                    case Item.QualityType.rare:
                        item.prefix = (uint)reader.Read(8) - 156;
                        item.suffix = (uint)reader.Read(8) - 1;
                        break;

                    case Item.QualityType.set:
                        item.set_code = (uint)reader.Read(12);
                        break;
                    case Item.QualityType.unique:
                        if (item.type != "std") //standard of heroes exception?
                            item.unique_code = (uint)reader.Read(12);
                        break;
                }
            }

            if (item.quality == Item.QualityType.rare || item.quality == Item.QualityType.crafted)
            {
                for (ulong i = 0; i < 3; i++)
                {
                    if (reader.ReadBit())
                        item.prefixes.Add((uint)reader.Read(11));
                    if (reader.ReadBit())
                        item.suffixes.Add((uint)reader.Read(11));
                }
            }

            if (item.rune_word)
            {
                item.runeword_id = (uint)reader.Read(12);
                item.runeword_parameter = (byte)reader.Read(4);
                //std::cout << "runeword_id: " << item.runeword_id << ", parameter: " << item.runeword_parameter << std::endl;
            }

            if (item.personalised)
            {
                List<Byte> personalised_name = new List<byte>();
                reader.Read(8);
                while (personalised_name.Last() != 0x00)
                {
                    reader.Read(8); // 16 characters of 7 bits each for the name of the ear to process later
                }
                item.personalised_name = Convert.ToBase64String(personalised_name.ToArray()); //this is also a problem part i'm not sure about

            }

            if (item.is_armor)
                item.defense = (uint)reader.Read(11) - 10;

            if (item.type == "7cr")
                reader.Read(8);
            else if (item.is_armor || item.is_weapon)
            {
                item.maximum_durability = (byte)reader.Read(8);
                item.indestructible = (uint)((item.maximum_durability == 0) ? 1 : 0);

                item.durability = (byte)reader.Read(8);
                reader.ReadBit();
            }
            if (item.has_sockets)
                item.sockets = (byte)reader.Read(4);
        }
开发者ID:uvbs,项目名称:OmegaBot,代码行数:79,代码来源:Parser.cs


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