System.IO.BinaryReader.ReadUInt32()

Here are the examples of the csharp api System.IO.BinaryReader.ReadUInt32() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2093 Examples 7

19 Source : ChatPoseTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            var totalObjects = reader.ReadUInt16();
            reader.ReadUInt16(); // var bucketSize
            for (int i = 0; i < totalObjects; i++)
            {
                string key = reader.ReadPString(); reader.AlignBoundary();
                string value = reader.ReadPString(); reader.AlignBoundary();
                ChatPoseHash.Add(key, value);
            }

            var totalEmoteObjects = reader.ReadUInt16();
            reader.ReadUInt16();// var bucketSize
            for (int i = 0; i < totalEmoteObjects; i++)
            {
                string key = reader.ReadPString(); reader.AlignBoundary();
                ChatEmoteData value = new ChatEmoteData();
                value.Unpack(reader);
                ChatEmoteHash.Add(key, value);
            }
        }

19 Source : ContractTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            ushort num_contracts = reader.ReadUInt16();
            /*ushort table_size = */reader.ReadUInt16(); // We don't need this since C# handles it's own memory

            for (ushort i = 0; i < num_contracts; i++)
            {
                uint key = reader.ReadUInt32();

                Contract value = new Contract();
                value.Unpack(reader);

                Contracts.Add(key, value);
            }
        }

19 Source : DidMapper.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            ClientIDNumberingType = (NumberingType)reader.ReadByte();
            uint numClientEnumToIDs = reader.ReadCompressedUInt32();
            for (var i = 0; i < numClientEnumToIDs; i++)
                ClientEnumToID.Add(reader.ReadUInt32(), reader.ReadUInt32());

            ClientNameNumberingType = (NumberingType)reader.ReadByte();
            uint numClientEnumToNames = reader.ReadCompressedUInt32();
            for (var i = 0; i < numClientEnumToNames; i++)
                ClientEnumToName.Add(reader.ReadUInt32(), reader.ReadPString(1));

            ServerIDNumberingType = (NumberingType)reader.ReadByte();
            uint numServerEnumToIDs = reader.ReadCompressedUInt32();
            for (var i = 0; i < numServerEnumToIDs; i++)
                ServerEnumToID.Add(reader.ReadUInt32(), reader.ReadUInt32());

            ServerNameNumberingType = (NumberingType)reader.ReadByte();
            uint numServerEnumToNames = reader.ReadCompressedUInt32();
            for (var i = 0; i < numServerEnumToNames; i++)
                ServerEnumToName.Add(reader.ReadUInt32(), reader.ReadPString(1));
        }

19 Source : EnumMapper.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();
            BaseEnumMap = reader.ReadUInt32();

            NumberingType = (NumberingType)reader.ReadByte();

            uint num_enums = reader.ReadCompressedUInt32();
            for (var i = 0; i < num_enums; i++)
                IdToStringMap.Add(reader.ReadUInt32(), reader.ReadPString(1));
        }

19 Source : EnvCell.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            Flags = (EnvCellFlags)reader.ReadUInt32();

            reader.BaseStream.Position += 4; // Skip ahead 4 bytes, because this is the CellId. Again. Twice.

            byte numSurfaces    = reader.ReadByte();
            byte numPortals     = reader.ReadByte();    // Note that "portal" in this context does not refer to the swirly pink/purple thing, its basically connecting cells
            ushort numStabs     = reader.ReadUInt16();  // I believe this is what cells can be seen from this one. So the engine knows what else it needs to load/draw.

            // Read what surfaces are used in this cell
            for (uint i = 0; i < numSurfaces; i++)
                Surfaces.Add(0x08000000u | reader.ReadUInt16()); // these are stored in the dat as short values, so we'll make them a full dword

            EnvironmentId = (0x0D000000u | reader.ReadUInt16());

            CellStructure = reader.ReadUInt16();

            Position.Unpack(reader);

            CellPortals.Unpack(reader, numPortals);

            for (uint i = 0; i < numStabs; i++)
                VisibleCells.Add(reader.ReadUInt16());

            if ((Flags & EnvCellFlags.HreplacedtaticObjs) != 0)
                StaticObjects.Unpack(reader);

            if ((Flags & EnvCellFlags.HasRestrictionObj) != 0)
                RestrictionObj = reader.ReadUInt32();
        }

19 Source : Font.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();
            MaxCharHeight = reader.ReadUInt32();
            MaxCharWidth = reader.ReadUInt32();
            NumCharacters = reader.ReadUInt32();

            for(uint i = 0; i < NumCharacters; i++)
            {
                var fontCharDesc = new FontCharDesc();
                fontCharDesc.Unpack(reader);
                CharDescs.Add(fontCharDesc);
            }

            NumHorizontalBorderPixels = reader.ReadUInt32();
            NumVerticalBorderPixels = reader.ReadUInt32();
            BaselineOffset = reader.ReadUInt32();
            ForegroundSurfaceDataID = reader.ReadUInt32();
            BackgroundSurfaceDataID = reader.ReadUInt32();
        }

19 Source : LanguageInfo.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Version = reader.ReadInt32();
            Base = reader.ReadInt16();
            NumDecimalDigits = reader.ReadInt16();
            LeadingZero = reader.ReadBoolean();

            GroupingSize = reader.ReadInt16();
            Numerals = UnpackList(reader);
            DecimalSeperator = UnpackList(reader);
            GroupingSeperator = UnpackList(reader);
            NegativeNumberFormat = UnpackList(reader);
            IsZeroSingular = reader.ReadBoolean();
            IsOneSingular = reader.ReadBoolean();
            IsNegativeOneSingular = reader.ReadBoolean();
            IsTwoOrMoreSingular = reader.ReadBoolean();
            IsNegativeTwoOrLessSingular = reader.ReadBoolean();
            reader.AlignBoundary();

            TreasurePrefixLetters = UnpackList(reader);
            TreasureMiddleLetters = UnpackList(reader);
            TreasureSuffixLetters = UnpackList(reader);
            MalePlayerLetters = UnpackList(reader);
            FemalePlayerLetters = UnpackList(reader);
            ImeEnabledSetting = reader.ReadUInt32();

            SymbolColor = reader.ReadUInt32();
            SymbolColorText = reader.ReadUInt32();
            SymbolHeight = reader.ReadUInt32();
            SymbolTranslucence = reader.ReadUInt32();
            SymbolPlacement = reader.ReadUInt32();
            CandColorBase = reader.ReadUInt32();
            CandColorBorder = reader.ReadUInt32();
            CandColorText = reader.ReadUInt32();
            CompColorInput = reader.ReadUInt32();
            CompColorTargetConv = reader.ReadUInt32();
            CompColorConverted = reader.ReadUInt32();
            CompColorTargetNotConv = reader.ReadUInt32();
            CompColorInputErr = reader.ReadUInt32();
            CompTranslucence = reader.ReadUInt32();
            CompColorText = reader.ReadUInt32();
            OtherIME = reader.ReadUInt32();

            WordWrapOnSpace = reader.ReadInt32();
            AdditionalSettings = UnpackList(reader);
            AdditionalFlags = reader.ReadUInt32();
        }

19 Source : StringTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            Language = reader.ReadUInt32();

            Unknown = reader.ReadByte();

            StringTableData.UnpackSmartArray(reader);
        }

19 Source : Surface.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Type = (SurfaceType)reader.ReadUInt32();

            if (Type.HasFlag(SurfaceType.Base1Image) || Type.HasFlag(SurfaceType.Base1ClipMap))
            {
                // image or clipmap
                OrigTextureId = reader.ReadUInt32();
                OrigPaletteId = reader.ReadUInt32();
            }
            else
            {
                // solid color
                ColorValue = reader.ReadUInt32();
            }

            Translucency    = reader.ReadSingle();
            Luminosity      = reader.ReadSingle();
            Diffuse         = reader.ReadSingle();
        }

19 Source : SurfaceTexture.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();
            Unknown = reader.ReadInt32();
            UnknownByte = reader.ReadByte();
            Textures.Unpack(reader);
        }

19 Source : TabooTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            // I don't actually know the structure of TabooTableEntries. It could be a Dictionary as I have it defined, or it could be a List where the key is just a variable in TabooTableEntry
            // I was unable to find the unpack code in the client. If someone can point me to it, I can make sure we match what the client is doing. - Mag

            /*var x01 = */reader.ReadByte();
            var length = reader.ReadByte();

            TabooTableEntries.Unpack(reader, length);
        }

19 Source : Texture.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();
            Unknown = reader.ReadInt32();
            Width = reader.ReadInt32();
            Height = reader.ReadInt32();
            Format = (SurfacePixelFormat)reader.ReadUInt32();
            Length = reader.ReadInt32();

            SourceData = reader.ReadBytes(Length);

            switch (Format)
            {
                case SurfacePixelFormat.PFID_INDEX16:
                case SurfacePixelFormat.PFID_P8:
                    DefaultPaletteId = reader.ReadUInt32();
                    break;
                default:
                    DefaultPaletteId = null;
                    break;
            }
        }

19 Source : XpTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            // The counts for each "Table" are at the top of the file.
            int attributeCount          = reader.ReadInt32();
            int vitalCount              = reader.ReadInt32();
            int trainedSkillCount       = reader.ReadInt32();
            int specializedSkillCount   = reader.ReadInt32();

            uint levelCount             = reader.ReadUInt32();

            for (int i = 0; i <= attributeCount; i++)
                AttributeXpList.Add(reader.ReadUInt32());

            for (int i = 0; i <= vitalCount; i++)
                VitalXpList.Add(reader.ReadUInt32());

            for (int i = 0; i <= trainedSkillCount; i++)
                TrainedSkillXpList.Add(reader.ReadUInt32());

            for (int i = 0; i <= specializedSkillCount; i++)
                SpecializedSkillXpList.Add(reader.ReadUInt32());

            for (int i = 0; i <= levelCount; i++)
                CharacterLevelXPList.Add(reader.ReadUInt64());

            for (int i = 0; i <= levelCount; i++)
                CharacterLevelSkillCreditList.Add(reader.ReadUInt32());
        }

19 Source : DatDatabaseHeader.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            FileType    = reader.ReadUInt32();
            BlockSize   = reader.ReadUInt32();
            FileSize    = reader.ReadUInt32();
            DataSet     = (DatDatabaseType)reader.ReadUInt32();
            DataSubset  = reader.ReadUInt32();

            FreeHead    = reader.ReadUInt32();
            FreeTail    = reader.ReadUInt32();
            FreeCount   = reader.ReadUInt32();
            BTree       = reader.ReadUInt32();

            NewLRU      = reader.ReadUInt32();
            OldLRU      = reader.ReadUInt32();
            UseLRU      = (reader.ReadUInt32() == 1);

            MasterMapID = reader.ReadUInt32();

            EnginePackVersion   = reader.ReadUInt32();
            GamePackVersion     = reader.ReadUInt32();
            VersionMajor        = reader.ReadBytes(16);
            VersionMinor        = reader.ReadUInt32();
        }

19 Source : DatDirectoryHeader.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            for (int i = 0; i < Branches.Length; i++)
                Branches[i] = reader.ReadUInt32();

            EntryCount = reader.ReadUInt32();

            Entries = new DatFile[EntryCount];

            for (int i = 0; i < EntryCount; i++)
            {
                Entries[i] = new DatFile();
                Entries[i].Unpack(reader);
            }
        }

19 Source : DatFile.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            /*BitFlags    =*/ reader.ReadUInt32();
            ObjectId    = reader.ReadUInt32();
            FileOffset  = reader.ReadUInt32();
            FileSize    = reader.ReadUInt32();
            /*Date        =*/ reader.ReadUInt32();
            /*Iteration   =*/ reader.ReadUInt32();
        }

19 Source : DxtUtil.cs
with GNU Affero General Public License v3.0
from ACEmulator

private static void DecompressDxt1Block(BinaryReader imageReader, int x, int y, int blockCountX, int width, int height, byte[] imageData)
        {
            ushort c0 = imageReader.ReadUInt16();
            ushort c1 = imageReader.ReadUInt16();

            byte r0, g0, b0;
            byte r1, g1, b1;
            ConvertRgb565ToRgb888(c0, out r0, out g0, out b0);
            ConvertRgb565ToRgb888(c1, out r1, out g1, out b1);

            uint lookupTable = imageReader.ReadUInt32();

            for (int blockY = 0; blockY < 4; blockY++)
            {
                for (int blockX = 0; blockX < 4; blockX++)
                {
                    byte r = 0, g = 0, b = 0, a = 255;
                    uint index = (lookupTable >> 2 * (4 * blockY + blockX)) & 0x03;

                    if (c0 > c1)
                    {
                        switch (index)
                        {
                            case 0:
                                r = r0;
                                g = g0;
                                b = b0;
                                break;
                            case 1:
                                r = r1;
                                g = g1;
                                b = b1;
                                break;
                            case 2:
                                r = (byte)((2 * r0 + r1) / 3);
                                g = (byte)((2 * g0 + g1) / 3);
                                b = (byte)((2 * b0 + b1) / 3);
                                break;
                            case 3:
                                r = (byte)((r0 + 2 * r1) / 3);
                                g = (byte)((g0 + 2 * g1) / 3);
                                b = (byte)((b0 + 2 * b1) / 3);
                                break;
                        }
                    }
                    else
                    {
                        switch (index)
                        {
                            case 0:
                                r = r0;
                                g = g0;
                                b = b0;
                                break;
                            case 1:
                                r = r1;
                                g = g1;
                                b = b1;
                                break;
                            case 2:
                                r = (byte)((r0 + r1) / 2);
                                g = (byte)((g0 + g1) / 2);
                                b = (byte)((b0 + b1) / 2);
                                break;
                            case 3:
                                r = 0;
                                g = 0;
                                b = 0;
                                a = 0;
                                break;
                        }
                    }

                    int px = (x << 2) + blockX;
                    int py = (y << 2) + blockY;
                    if ((px < width) && (py < height))
                    {
                        int offset = ((py * width) + px) << 2;
                        imageData[offset] = r;
                        imageData[offset + 1] = g;
                        imageData[offset + 2] = b;
                        imageData[offset + 3] = a;
                    }
                }
            }
        }

19 Source : DxtUtil.cs
with GNU Affero General Public License v3.0
from ACEmulator

private static void DecompressDxt3Block(BinaryReader imageReader, int x, int y, int blockCountX, int width, int height, byte[] imageData)
        {
            byte a0 = imageReader.ReadByte();
            byte a1 = imageReader.ReadByte();
            byte a2 = imageReader.ReadByte();
            byte a3 = imageReader.ReadByte();
            byte a4 = imageReader.ReadByte();
            byte a5 = imageReader.ReadByte();
            byte a6 = imageReader.ReadByte();
            byte a7 = imageReader.ReadByte();

            ushort c0 = imageReader.ReadUInt16();
            ushort c1 = imageReader.ReadUInt16();

            byte r0, g0, b0;
            byte r1, g1, b1;
            ConvertRgb565ToRgb888(c0, out r0, out g0, out b0);
            ConvertRgb565ToRgb888(c1, out r1, out g1, out b1);

            uint lookupTable = imageReader.ReadUInt32();

            int alphaIndex = 0;
            for (int blockY = 0; blockY < 4; blockY++)
            {
                for (int blockX = 0; blockX < 4; blockX++)
                {
                    byte r = 0, g = 0, b = 0, a = 0;

                    uint index = (lookupTable >> 2 * (4 * blockY + blockX)) & 0x03;

                    switch (alphaIndex)
                    {
                        case 0:
                            a = (byte)((a0 & 0x0F) | ((a0 & 0x0F) << 4));
                            break;
                        case 1:
                            a = (byte)((a0 & 0xF0) | ((a0 & 0xF0) >> 4));
                            break;
                        case 2:
                            a = (byte)((a1 & 0x0F) | ((a1 & 0x0F) << 4));
                            break;
                        case 3:
                            a = (byte)((a1 & 0xF0) | ((a1 & 0xF0) >> 4));
                            break;
                        case 4:
                            a = (byte)((a2 & 0x0F) | ((a2 & 0x0F) << 4));
                            break;
                        case 5:
                            a = (byte)((a2 & 0xF0) | ((a2 & 0xF0) >> 4));
                            break;
                        case 6:
                            a = (byte)((a3 & 0x0F) | ((a3 & 0x0F) << 4));
                            break;
                        case 7:
                            a = (byte)((a3 & 0xF0) | ((a3 & 0xF0) >> 4));
                            break;
                        case 8:
                            a = (byte)((a4 & 0x0F) | ((a4 & 0x0F) << 4));
                            break;
                        case 9:
                            a = (byte)((a4 & 0xF0) | ((a4 & 0xF0) >> 4));
                            break;
                        case 10:
                            a = (byte)((a5 & 0x0F) | ((a5 & 0x0F) << 4));
                            break;
                        case 11:
                            a = (byte)((a5 & 0xF0) | ((a5 & 0xF0) >> 4));
                            break;
                        case 12:
                            a = (byte)((a6 & 0x0F) | ((a6 & 0x0F) << 4));
                            break;
                        case 13:
                            a = (byte)((a6 & 0xF0) | ((a6 & 0xF0) >> 4));
                            break;
                        case 14:
                            a = (byte)((a7 & 0x0F) | ((a7 & 0x0F) << 4));
                            break;
                        case 15:
                            a = (byte)((a7 & 0xF0) | ((a7 & 0xF0) >> 4));
                            break;
                    }
                    ++alphaIndex;

                    switch (index)
                    {
                        case 0:
                            r = r0;
                            g = g0;
                            b = b0;
                            break;
                        case 1:
                            r = r1;
                            g = g1;
                            b = b1;
                            break;
                        case 2:
                            r = (byte)((2 * r0 + r1) / 3);
                            g = (byte)((2 * g0 + g1) / 3);
                            b = (byte)((2 * b0 + b1) / 3);
                            break;
                        case 3:
                            r = (byte)((r0 + 2 * r1) / 3);
                            g = (byte)((g0 + 2 * g1) / 3);
                            b = (byte)((b0 + 2 * b1) / 3);
                            break;
                    }

                    int px = (x << 2) + blockX;
                    int py = (y << 2) + blockY;
                    if ((px < width) && (py < height))
                    {
                        int offset = ((py * width) + px) << 2;
                        imageData[offset] = r;
                        imageData[offset + 1] = g;
                        imageData[offset + 2] = b;
                        imageData[offset + 3] = a;
                    }
                }
            }
        }

19 Source : UnpackableExtensions.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void UnpackSmartArray<T>(this Dictionary<uint, T> value, BinaryReader reader) where T : IUnpackable, new()
        {
            var totalObjects = reader.ReadCompressedUInt32();

            for (int i = 0; i < totalObjects; i++)
            {
                var key = reader.ReadUInt32();

                var item = new T();
                item.Unpack(reader);
                value.Add(key, item);
            }
        }

19 Source : UnpackableExtensions.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void UnpackPackedHashTable(this Dictionary<uint, uint> value, BinaryReader reader)
        {
            var totalObjects = reader.ReadUInt16();
            /*var bucketSize = */
            reader.ReadUInt16();

            for (int i = 0; i < totalObjects; i++)
                value.Add(reader.ReadUInt32(), reader.ReadUInt32());
        }

19 Source : UnpackableExtensions.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void UnpackPackedHashTable<T>(this Dictionary<uint, T> value, BinaryReader reader) where T : IUnpackable, new()
        {
            var totalObjects = reader.ReadUInt16();
            /*var bucketSize = */reader.ReadUInt16();

            for (int i = 0; i < totalObjects; i++)
            {
                var key = reader.ReadUInt32();

                var item = new T();
                item.Unpack(reader);
                value.Add(key, item);
            }
        }

19 Source : UnpackableExtensions.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static void UnpackPackedHashTable<T>(this SortedDictionary<uint, T> value, BinaryReader reader) where T : IUnpackable, new()
        {
            var totalObjects = reader.ReadUInt16();
            /*var bucketSize = */
            reader.ReadUInt16();

            for (int i = 0; i < totalObjects; i++)
            {
                var key = reader.ReadUInt32();

                var item = new T();
                item.Unpack(reader);
                value.Add(key, item);
            }
        }

19 Source : SoundTweakedHook.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            base.Unpack(reader);

            SoundID = reader.ReadUInt32();
            Priority = reader.ReadSingle();
            Probability = reader.ReadSingle();
            Volume = reader.ReadSingle();
        }

19 Source : StopParticleHook.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            base.Unpack(reader);

            EmitterId = reader.ReadUInt32();
        }

19 Source : TextureVelocityPartHook.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            base.Unpack(reader);

            PartIndex   = reader.ReadUInt32();
            USpeed      = reader.ReadSingle();
            VSpeed      = reader.ReadSingle();
        }

19 Source : AmbientSoundDesc.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            SType       = reader.ReadUInt32();
            Volume      = reader.ReadSingle();
            BaseChance  = reader.ReadSingle();
            MinRate     = reader.ReadSingle();
            MaxRate     = reader.ReadSingle();
        }

19 Source : AmbientSTBDesc.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            STBId = reader.ReadUInt32();

            AmbientSounds.Unpack(reader);
        }

19 Source : AnimationFrame.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader, uint numParts)
        {
            Frames.Unpack(reader, numParts);

            uint numHooks = reader.ReadUInt32();
            for (uint i = 0; i < numHooks; i++)
            {
                var hook = AnimationHook.ReadHook(reader);
                Hooks.Add(hook);
            }
        }

19 Source : AnimationHook.cs
with GNU Affero General Public License v3.0
from ACEmulator

public virtual void Unpack(BinaryReader reader)
        {
            HookType = (AnimationHookType)reader.ReadUInt32();
            Direction = (AnimationHookDir)reader.ReadInt32();
        }

19 Source : AnimationHook.cs
with GNU Affero General Public License v3.0
from ACEmulator

public static AnimationHook ReadHook(BinaryReader reader)
        {
            // We peek forward to get the hook type, then revert our position.
            var hookType = (AnimationHookType)reader.ReadUInt32();
            reader.BaseStream.Position -= 4;

            AnimationHook hook;

            switch (hookType)
            {
                case AnimationHookType.Sound:
                    hook = new SoundHook();
                    break;

                case AnimationHookType.SoundTable:
                    hook = new SoundTableHook();
                    break;

                case AnimationHookType.Attack:
                    hook = new AttackHook();
                    break;

                case AnimationHookType.ReplaceObject:
                    hook = new ReplaceObjectHook();
                    break;

                case AnimationHookType.Ethereal:
                    hook = new EtherealHook();
                    break;

                case AnimationHookType.TransparentPart:
                    hook = new TransparentPartHook();
                    break;

                case AnimationHookType.Luminous:
                    hook = new LuminousHook();
                    break;

                case AnimationHookType.LuminousPart:
                    hook = new LuminousPartHook();
                    break;

                case AnimationHookType.Diffuse:
                    hook = new DiffuseHook();
                    break;

                case AnimationHookType.DiffusePart:
                    hook = new DiffusePartHook();
                    break;

                case AnimationHookType.Scale:
                    hook = new ScaleHook();
                    break;

                case AnimationHookType.CreateParticle:
                    hook = new CreateParticleHook();
                    break;

                case AnimationHookType.DestroyParticle:
                    hook = new DestroyParticleHook();
                    break;

                case AnimationHookType.StopParticle:
                    hook = new StopParticleHook();
                    break;

                case AnimationHookType.NoDraw:
                    hook = new NoDrawHook();
                    break;

                case AnimationHookType.DefaultScriptPart:
                    hook = new DefaultScriptPartHook();
                    break;

                case AnimationHookType.CallPES:
                    hook = new CallPESHook();
                    break;

                case AnimationHookType.Transparent:
                    hook = new TransparentHook();
                    break;

                case AnimationHookType.SoundTweaked:
                    hook = new SoundTweakedHook();
                    break;

                case AnimationHookType.SetOmega:
                    hook = new SetOmegaHook();
                    break;

                case AnimationHookType.TextureVelocity:
                    hook = new TextureVelocityHook();
                    break;

                case AnimationHookType.TextureVelocityPart:
                    hook = new TextureVelocityPartHook();
                    break;

                case AnimationHookType.SetLight:
                    hook = new SetLightHook();
                    break;

                case AnimationHookType.CreateBlockingParticle:
                    hook = new CreateBlockingParticle();
                    break;

                // The following HookTypes have no additional properties:
                // AnimationHookType.AnimationDone
                // AnimationHookType.DefaultScript
                case AnimationHookType.AnimationDone:
                case AnimationHookType.DefaultScript:
                    hook = new AnimationHook();
                    break;

                default:
                    log.Warn($"Not Implemented Hook type encountered: {hookType}");
                    hook = null;
                    break;
            }

            if (hook != null)
                hook.Unpack(reader);

            return hook;
        }

19 Source : AnimData.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            AnimId      = reader.ReadUInt32();
            LowFrame    = reader.ReadInt32();
            HighFrame   = reader.ReadInt32();
            Framerate   = reader.ReadSingle();
        }

19 Source : AttackCone.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            PartIndex   = reader.ReadUInt32();

            LeftX       = reader.ReadSingle();
            LeftY       = reader.ReadSingle();

            RightX      = reader.ReadSingle();
            RightY      = reader.ReadSingle();
            
            Radius      = reader.ReadSingle();
            Height      = reader.ReadSingle();
        }

19 Source : CloTextureEffect.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            OldTexture = reader.ReadUInt32();
            NewTexture = reader.ReadUInt32();
        }

19 Source : GearCG.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Name            = reader.ReadString();
            ClothingTable   = reader.ReadUInt32();
            WeenieDefault   = reader.ReadUInt32();
        }

19 Source : Generator.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Name = reader.ReadObfuscatedString();
            reader.AlignBoundary();

            Id = reader.ReadUInt32();

            Items.Unpack(reader);
        }

19 Source : GfxObjInfo.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Id          = reader.ReadUInt32();
            DegradeMode = reader.ReadUInt32();
            MinDist     = reader.ReadSingle();
            IdealDist   = reader.ReadSingle();
            MaxDist     = reader.ReadSingle();
        }

19 Source : HeritageGroupCG.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Name                = reader.ReadString();
            IconImage           = reader.ReadUInt32();
            SetupID             = reader.ReadUInt32();
            EnvironmentSetupID  = reader.ReadUInt32();
            AttributeCredits    = reader.ReadUInt32();
            SkillCredits        = reader.ReadUInt32();

            PrimaryStartAreas.UnpackSmartArray(reader);
            SecondaryStartAreas.UnpackSmartArray(reader);
            Skills.UnpackSmartArray(reader);
            Templates.UnpackSmartArray(reader);
            reader.BaseStream.Position++; // 0x01 byte here. Not sure what/why, so skip it!
            Genders.UnpackSmartArray(reader);
        }

19 Source : LandSurf.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Type = reader.ReadUInt32(); // This is always 0

            if (Type == 1)
                throw new NotImplementedException();
            TexMerge.Unpack(reader);
        }

19 Source : LightInfo.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            ViewerSpaceLocation.Unpack(reader);

            Color       = reader.ReadUInt32();
            Intensity   = reader.ReadSingle();
            Falloff     = reader.ReadSingle();
            ConeAngle   = reader.ReadSingle();
        }

19 Source : RoadAlphaMap.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            RCode       = reader.ReadUInt32();
            RoadTexGID  = reader.ReadUInt32();
        }

19 Source : SkillBase.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Description = reader.ReadPString(); reader.AlignBoundary();
            Name = reader.ReadPString(); reader.AlignBoundary();
            IconId = reader.ReadUInt32();
            TrainedCost = reader.ReadInt32();
            SpecializedCost = reader.ReadInt32();
            Category = reader.ReadUInt32();
            ChargenUse = reader.ReadUInt32();
            MinLevel = reader.ReadUInt32();
            Formula.Unpack(reader);
            UpperBound = reader.ReadDouble();
            LowerBound = reader.ReadDouble();
            LearnMod = reader.ReadDouble();
        }

19 Source : TabooTableEntry.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Unknown1 = reader.ReadUInt32();
            Unknown2 = reader.ReadUInt16();

            uint count = reader.ReadUInt32();

            for (int i = 0; i < count; i++)
                BannedPatterns.Add(reader.ReadString());
        }

19 Source : TerrainType.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            TerrainName = reader.ReadPString();
            reader.AlignBoundary();

            TerrainColor = reader.ReadUInt32();

            SceneTypes.Unpack(reader);
        }

19 Source : TexMerge.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            BaseTexSize = reader.ReadUInt32();

            CornerTerrainMaps.Unpack(reader);
            SideTerrainMaps.Unpack(reader);
            RoadMaps.Unpack(reader);
            TerrainDesc.Unpack(reader);
        }

19 Source : TimeOfDay.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            Start   = reader.ReadSingle();
            IsNight = (reader.ReadUInt32() == 1);
            Name    = reader.ReadPString();
            reader.AlignBoundary();
        }

19 Source : TMTerrainDesc.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void Unpack(BinaryReader reader)
        {
            TerrainType = reader.ReadUInt32();
            TerrainTex.Unpack(reader);
        }

19 Source : Animation.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id          = reader.ReadUInt32();
            Flags       = (AnimationFlags)reader.ReadUInt32();
            NumParts    = reader.ReadUInt32();
            NumFrames   = reader.ReadUInt32();

            if ((Flags & AnimationFlags.PosFrames) != 0)
                PosFrames.Unpack(reader, NumFrames);

            for (uint i = 0; i < NumFrames; i++)
            {
                var animationFrame = new AnimationFrame();
                animationFrame.Unpack(reader, NumParts);
                PartFrames.Add(animationFrame);
            }
        }

19 Source : CharGen.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();
            reader.BaseStream.Position += 4;

            StarterAreas.UnpackSmartArray(reader);

            // HERITAGE GROUPS -- 11 standard player races and 2 Olthoi.
            reader.BaseStream.Position++; // Not sure what this byte 0x01 is indicating, but we'll skip it because we can.

            HeritageGroups.UnpackSmartArray(reader);
        }

19 Source : ClothingTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32();

            ClothingBaseEffects.UnpackPackedHashTable(reader);

            ClothingSubPalEffects.UnpackPackedHashTable(reader);
        }

19 Source : CombatManeuverTable.cs
with GNU Affero General Public License v3.0
from ACEmulator

public override void Unpack(BinaryReader reader)
        {
            Id = reader.ReadUInt32(); // This should always equal the fileId

            CMT.Unpack(reader);

            Stances = new Dictionary<MotionStance, AttackHeights>();

            foreach (var maneuver in CMT)
            {
                if (!Stances.TryGetValue(maneuver.Style, out var attackHeights))
                {
                    attackHeights = new AttackHeights();
                    Stances.Add(maneuver.Style, attackHeights);
                }

                if (!attackHeights.Table.TryGetValue(maneuver.AttackHeight, out var attackTypes))
                {
                    attackTypes = new AttackTypes();
                    attackHeights.Table.Add(maneuver.AttackHeight, attackTypes);
                }

                if (!attackTypes.Table.TryGetValue(maneuver.AttackType, out var motionCommands))
                {
                    motionCommands = new List<MotionCommand>();
                    attackTypes.Table.Add(maneuver.AttackType, motionCommands);
                }

                motionCommands.Add(maneuver.Motion);
            }
        }

See More Examples