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 : CelesteNetBinaryReader.cs
with MIT License
from 0x0ade

public T? ReadRef<T>() where T : DataType<T>
            => Data.GetRef<T>(ReadUInt32());

19 Source : CelesteNetBinaryReader.cs
with MIT License
from 0x0ade

public T? ReadOptRef<T>() where T : DataType<T>
            => Data.TryGetRef(ReadUInt32(), out T? value) ? value : null;

19 Source : DataContext.cs
with MIT License
from 0x0ade

[Obsolete("Use CelesteNetBinaryReader instead.")]
        public T? ReadRef<T>(BinaryReader reader) where T : DataType<T>
            => GetRef<T>(reader.ReadUInt32());

19 Source : DataContext.cs
with MIT License
from 0x0ade

[Obsolete("Use CelesteNetBinaryReader instead.")]
        public T? ReadOptRef<T>(BinaryReader reader) where T : DataType<T>
            => TryGetRef(reader.ReadUInt32(), out T? value) ? value : null;

19 Source : XnaToFnaUtil.cs
with zlib License
from 0x0ade

public void ScanPath(string path) {
            if (Directory.Exists(path)) {
                // Use the directory as "dependency directory" and scan in it.
                if (Directories.Contains(path))
                    // No need to scan the dir if the dir is scanned...
                    return;

                RestoreBackup(path);

                Log($"[ScanPath] Scanning directory {path}");
                Directories.Add(path);
                replacedemblyResolver.AddSearchDirectory(path); // Needs to be added manually as DependencyDirs was already added

                // Most probably the actual game directory - let's just copy XnaToFna.exe to there to be referenced properly.
                string xtfPath = Path.Combine(path, Path.GetFileName(Thisreplacedembly.Location));
                if (Path.GetDirectoryName(Thisreplacedembly.Location) != path) {
                    Log($"[ScanPath] Found separate game directory - copying XnaToFna.exe and FNA.dll");
                    File.Copy(Thisreplacedembly.Location, xtfPath, true);

                    string dbExt = null;
                    if (File.Exists(Path.ChangeExtension(Thisreplacedembly.Location, "pdb")))
                        dbExt = "pdb";
                    if (File.Exists(Path.ChangeExtension(Thisreplacedembly.Location, "mdb")))
                        dbExt = "mdb";
                    if (dbExt != null)
                        File.Copy(Path.ChangeExtension(Thisreplacedembly.Location, dbExt), Path.ChangeExtension(xtfPath, dbExt), true);

                    if (File.Exists(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll")))
                        File.Copy(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll"), Path.Combine(path, "FNA.dll"), true);
                    else if (File.Exists(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll.tmp")))
                        File.Copy(Path.Combine(Path.GetDirectoryName(Thisreplacedembly.Location), "FNA.dll.tmp"), Path.Combine(path, "FNA.dll"), true);

                }

                ScanPaths(Directory.GetFiles(path));
                return;
            }

            if (File.Exists(path + ".xex")) {
                if (!ExtractedXEX.Contains(path)) {
                    // Remove the original file - let XnaToFna unpack and handle it later.
                    File.Delete(path);
                } else {
                    // XnaToFna will handle the .xex instead.
                }
                return;
            }

            if (path.EndsWith(".xex")) {
                string pathTarget = path.Substring(0, path.Length - 4);
                if (string.IsNullOrEmpty(Path.GetExtension(pathTarget)))
                    return;

                using (Stream streamXEX = File.OpenRead(path))
                using (BinaryReader reader = new BinaryReader(streamXEX))
                using (Stream streamRAW = File.OpenWrite(pathTarget)) {
                    XEXImageData data = new XEXImageData(reader);

                    int offset = 0;
                    int size = data.m_memorySize;

                    // Check if this file is a PE containing an embedded PE.
                    if (data.m_memorySize > 0x10000) { // One default segment alignment.
                        using (MemoryStream streamMEM = new MemoryStream(data.m_memoryData))
                        using (BinaryReader mem = new BinaryReader(streamMEM)) {
                            if (mem.ReadUInt32() != 0x00905A4D) // MZ
                                goto WriteRaw;
                            // This is horrible.
                            streamMEM.Seek(0x00000280, SeekOrigin.Begin);
                            if (mem.ReadUInt64() != 0x000061746164692E) // ".idata\0\0"
                                goto WriteRaw;
                            streamMEM.Seek(0x00000288, SeekOrigin.Begin);
                            mem.ReadInt32(); // Virtual size; It's somewhat incorrect?
                            offset = mem.ReadInt32(); // Virtual offset.
                            // mem.ReadInt32(); // Raw size; Still incorrect.
                            // Let's just write everything...
                            size = data.m_memorySize - offset;
                        }
                    }

                    WriteRaw:
                    streamRAW.Write(data.m_memoryData, offset, size);
                }

                path = pathTarget;
                ExtractedXEX.Add(pathTarget);
            } else if (!path.EndsWith(".dll") && !path.EndsWith(".exe"))
                return;

            // Check if .dll is CLR replacedembly
            replacedemblyName name;
            try {
                name = replacedemblyName.GetreplacedemblyName(path);
            } catch {
                return;
            }

            ReaderParameters modReaderParams = Modder.GenReaderParameters(false);
            // Don't ReadWrite if the module being read is XnaToFna or a relink target.
            bool isReadWrite =
#if !CECIL0_9
            modReaderParams.ReadWrite =
#endif
                path != Thisreplacedembly.Location &&
                !Mappings.Exists(mappings => name.Name == mappings.Target);
            // Only read debug info if it exists
            if (!File.Exists(path + ".mdb") && !File.Exists(Path.ChangeExtension(path, "pdb")))
                modReaderParams.ReadSymbols = false;
            Log($"[ScanPath] Checking replacedembly {name.Name} ({(isReadWrite ? "rw" : "r-")})");
            ModuleDefinition mod;
            try {
                mod = MonoModExt.ReadModule(path, modReaderParams);
            } catch (Exception e) {
                Log($"[ScanPath] WARNING: Cannot load replacedembly: {e}");
                return;
            }
            bool add = !isReadWrite || name.Name == ThisreplacedemblyName;

            if ((mod.Attributes & ModuleAttributes.ILOnly) != ModuleAttributes.ILOnly) {
                // Mono.Cecil can't handle mixed mode replacedemblies.
                Log($"[ScanPath] WARNING: Cannot handle mixed mode replacedembly {name.Name}");
                if (MixedDeps == MixedDepAction.Stub) {
                    ModulesToStub.Add(mod);
                    add = true;
                } else {
                    if (MixedDeps == MixedDepAction.Remove) {
                        RemoveDeps.Add(name.Name);
                    }
#if !CECIL0_9
                    mod.Dispose();
#endif
                    return;
                }
            }

            if (add && !isReadWrite) { // XNA replacement
                foreach (XnaToFnaMapping mapping in Mappings)
                    if (name.Name == mapping.Target) {
                        mapping.IsActive = true;
                        mapping.Module = mod;
                        foreach (string from in mapping.Sources) {
                            Log($"[ScanPath] Mapping {from} -> {name.Name}");
                            Modder.RelinkModuleMap[from] = mod;
                        }
                    }
            } else if (!add) {
                foreach (XnaToFnaMapping mapping in Mappings)
                    if (mod.replacedemblyReferences.Any(dep => mapping.Sources.Contains(dep.Name))) {
                        add = true;
                        Log($"[ScanPath] XnaToFna-ing {name.Name}");
                        goto BreakMappings;
                    }
            }
            BreakMappings:

            if (add) {
                Modules.Add(mod);
                ModulePaths[mod] = path;
            } else {
#if !CECIL0_9
                mod.Dispose();
#endif
            }

        }

19 Source : IrdParser.cs
with MIT License
from 13xforever

public static Ird Parse(byte[] content)
        {
            if (content == null)
                throw new ArgumentNullException(nameof(content));

            if (content.Length < 200)
                throw new ArgumentException("Data is too small to be a valid IRD structure", nameof(content));

            if (BitConverter.ToInt32(content, 0) != Ird.Magic)
                using (var compressedStream = new MemoryStream(content, false))
                using (var gzip = new GZipStream(compressedStream, CompressionMode.Decompress))
                using (var decompressedStream = new MemoryStream())
                {
                    gzip.CopyTo(decompressedStream);
                    content = decompressedStream.ToArray();
                }
            if (BitConverter.ToInt32(content, 0) != Ird.Magic)
                throw new FormatException("Not a valid IRD file");

            var result = new Ird();
            using (var stream = new MemoryStream(content, false))
            using (var reader = new BinaryReader(stream, Encoding.UTF8))
            {
                reader.ReadInt32(); // magic
                result.Version = reader.ReadByte();
                result.ProductCode = Encoding.ASCII.GetString(reader.ReadBytes(9));
                result.replacedleLength = reader.ReadByte();
                result.replacedle = Encoding.UTF8.GetString(reader.ReadBytes(result.replacedleLength));
                result.UpdateVersion = Encoding.ASCII.GetString(reader.ReadBytes(4)).Trim();
                result.GameVersion = Encoding.ASCII.GetString(reader.ReadBytes(5)).Trim();
                result.AppVersion = Encoding.ASCII.GetString(reader.ReadBytes(5)).Trim();
                if (result.Version == 7)
                    result.Id = reader.ReadInt32();
                result.HeaderLength = reader.ReadInt32();
                result.Header = reader.ReadBytes(result.HeaderLength);
                result.FooterLength = reader.ReadInt32();
                result.Footer = reader.ReadBytes(result.FooterLength);
                result.RegionCount = reader.ReadByte();
                result.RegionMd5Checksums = new List<byte[]>(result.RegionCount);
                for (var i = 0; i < result.RegionCount; i++)
                    result.RegionMd5Checksums.Add(reader.ReadBytes(16));
                result.FileCount = reader.ReadInt32();
                result.Files = new List<IrdFile>(result.FileCount);
                for (var i = 0; i < result.FileCount; i++)
                {
                    var file = new IrdFile();
                    file.Offset = reader.ReadInt64();
                    file.Md5Checksum = reader.ReadBytes(16);
                    result.Files.Add(file);
                }
                result.Unknown = reader.ReadInt32();
                if (result.Version == 9)
                    result.Pic = reader.ReadBytes(115);
                result.Data1 = reader.ReadBytes(16);
                result.Data2 = reader.ReadBytes(16);
                if (result.Version < 9)
                    result.Pic = reader.ReadBytes(115);
                result.Uid = reader.ReadInt32();
                var dataLength = reader.BaseStream.Position;
                result.Crc32 = reader.ReadUInt32();

                var crc32 = Crc32Algorithm.Compute(content, 0, (int)dataLength);
                if (result.Crc32 != crc32)
                    throw new InvalidDataException($"Corrupted IRD data, expected {result.Crc32:x8}, but was {crc32:x8}");
            }
            return result;
        }

19 Source : WaveFileReader.cs
with MIT License
from 3wz

public static void ReadWaveHeader(Stream stream, out WaveFormat format, out long dataChunkPosition, out int dataChunkLength, List<RiffChunk> chunks)
        {
            dataChunkPosition = -1;
            format = null;
            BinaryReader br = new BinaryReader(stream);
            if (Encoding.ASCII.GetString(br.ReadBytes(4)) != "RIFF")//WaveInterop.mmioStringToFOURCC("RIFF", 0)
            {
                throw new FormatException("Not a WAVE file - no RIFF header");
            }
            uint fileSize = br.ReadUInt32(); // read the file size (minus 8 bytes)
            if (Encoding.ASCII.GetString(br.ReadBytes(4)) != "WAVE")//WaveInterop.mmioStringToFOURCC("WAVE", 0)
            {
                throw new FormatException("Not a WAVE file - no WAVE header");
            }
            int dataChunkID = BitConverter.ToInt32(Encoding.UTF8.GetBytes("data"), 0); ;//WaveInterop.mmioStringToFOURCC("data", 0)
            int formatChunkId = BitConverter.ToInt32(Encoding.UTF8.GetBytes("fmt "), 0); ;//WaveInterop.mmioStringToFOURCC("fmt ", 0)
            dataChunkLength = 0;

            // sometimes a file has more data than is specified after the RIFF header
            long stopPosition = Math.Min(fileSize + 8, stream.Length);

            // this -8 is so we can be sure that there are at least 8 bytes for a chunk id and length
            while (stream.Position <= stopPosition - 8)
            {
                Int32 chunkIdentifier = br.ReadInt32();
                Int32 chunkLength = br.ReadInt32();
                if (chunkIdentifier == dataChunkID)
                {
                    dataChunkPosition = stream.Position;
                    dataChunkLength = chunkLength;
                    stream.Position += chunkLength;
                }
                else if (chunkIdentifier == formatChunkId)
                {
                    format = WaveFormat.FromFormatChunk(br, chunkLength);
                }
                else
                {
                    // check for invalid chunk length
                    if (chunkLength < 0 || chunkLength > stream.Length - stream.Position)
                    {
                        Debug.replacedert(false, String.Format("Invalid chunk length {0}, pos: {1}. length: {2}",
                            chunkLength, stream.Position, stream.Length));
                        // an exception will be thrown further down if we haven't got a format and data chunk yet,
                        // otherwise we will tolerate this file despite it having corrupt data at the end
                        break;
                    }
                    if (chunks != null)
                    {
                        chunks.Add(new RiffChunk(chunkIdentifier, chunkLength, stream.Position));
                    }
                    stream.Position += chunkLength;
                }
            }

            if (format == null)
            {
                throw new FormatException("Invalid WAV file - No fmt chunk found");
            }
            if (dataChunkPosition == -1)
            {
                throw new FormatException("Invalid WAV file - No data chunk found");
            }
        }

19 Source : EndianBinaryReader.cs
with MIT License
from 91Act

public override uint ReadUInt32()
        {
            if (endian == EndianType.BigEndian)
            {
                a32 = ReadBytes(4);
                Array.Reverse(a32);
                return BitConverter.ToUInt32(a32, 0);
            }
            return base.ReadUInt32();
        }

19 Source : OvrAvatarPacket.cs
with MIT License
from absurd-joy

public static OvrAvatarDriver.ControllerPose ReadControllerPose(this BinaryReader reader)
    {
        return new OvrAvatarDriver.ControllerPose
        {
            buttons = (ovrAvatarButton)reader.ReadUInt32(),
            touches = (ovrAvatarTouch)reader.ReadUInt32(),
            joystickPosition = reader.ReadVector2(),
            indexTrigger = reader.ReadSingle(),
            handTrigger = reader.ReadSingle(),
            isActive = reader.ReadBoolean(),
        };
    }

19 Source : App.PortableExecutableHelper.cs
with MIT License
from ABTSoftware

internal static bool IsDotNetreplacedembly(string peFile)
            {
                uint peHeader;
                uint peHeaderSignature;
                ushort machine;
                ushort sections;
                uint timestamp;
                uint pSymbolTable;
                uint noOfSymbol;
                ushort optionalHeaderSize;
                ushort characteristics;
                ushort dataDictionaryStart;
                uint[] dataDictionaryRVA = new uint[16];
                uint[] dataDictionarySize = new uint[16];


                Stream fs = new FileStream(peFile, FileMode.Open, FileAccess.Read);
                BinaryReader reader = new BinaryReader(fs);

                //PE Header starts @ 0x3C (60). Its a 4 byte header.
                fs.Position = 0x3C;

                peHeader = reader.ReadUInt32();

                //Moving to PE Header start location...
                fs.Position = peHeader;
                peHeaderSignature = reader.ReadUInt32();

                //We can also show all these value, but we will be       
                //limiting to the CLI header test.

                machine = reader.ReadUInt16();
                sections = reader.ReadUInt16();
                timestamp = reader.ReadUInt32();
                pSymbolTable = reader.ReadUInt32();
                noOfSymbol = reader.ReadUInt32();
                optionalHeaderSize = reader.ReadUInt16();
                characteristics = reader.ReadUInt16();

                /*
                    Now we are at the end of the PE Header and from here, the
                                PE Optional Headers starts...
                        To go directly to the datadictionary, we'll increase the      
                        stream’s current position to with 96 (0x60). 96 because,
                                28 for Standard fields
                                68 for NT-specific fields
                    From here DataDictionary starts...and its of total 128 bytes. DataDictionay has 16 directories in total,
                    doing simple maths 128/16 = 8.
                    So each directory is of 8 bytes.
                                In this 8 bytes, 4 bytes is of RVA and 4 bytes of Size.

                    btw, the 15th directory consist of CLR header! if its 0, its not a CLR file :)
             */
                dataDictionaryStart = Convert.ToUInt16(Convert.ToUInt16(fs.Position) + 0x60);
                fs.Position = dataDictionaryStart;
                for (int i = 0; i < 15; i++)
                {
                    dataDictionaryRVA[i] = reader.ReadUInt32();
                    dataDictionarySize[i] = reader.ReadUInt32();
                }
                if (dataDictionaryRVA[14] == 0)
                {
                    Console.WriteLine("This is NOT a valid CLR File!!");
                    return false;
                }
                else
                {
                    Console.WriteLine("This is a valid CLR File..");
                    return true;
                }
                fs.Close();
            }

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

public static string ReadString32L(this BinaryReader reader)
        {
            uint length = reader.ReadUInt32();

            // 32L strings are crazy.  the only place this is known as of time of writing this is in the
            // Login header packet.  it's a DWORD of the data length, followed by a packed word of the 
            // string length.  for most cases, this means the string comes out with a 1 or 2 character
            // prefix that just needs to get tossed.

            if (length == 0)
                return "";

            reader.Skip(1);
            length--;

            if (length > 255)
            {
                reader.Skip(1);
                length--;
            }

            string rdrStr = (length != 0 ? new string(reader.ReadChars((int)length)) : string.Empty);

            // in the login header, this is completely unnecessary as it's the end of the packet.  if
            // we find this is ever used somewhere else, we would need to validate it.
            reader.Skip(CalculatePadMultiple(sizeof(uint) + length, 4u));
            return rdrStr;
        }

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

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

            Part    = reader.ReadUInt32();
            Start   = reader.ReadSingle();
            End     = reader.ReadSingle();
            Time    = reader.ReadSingle();
        }

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

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

            NoDraw = reader.ReadUInt32();
        }

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

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

            Id = reader.ReadUInt32();
        }

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

public override void Unpack(BinaryReader reader, BSPType treeType)
        {
            Type = Encoding.ASCII.GetString(reader.ReadBytes(4)).Reverse();

            LeafIndex = reader.ReadInt32();

            if (treeType == BSPType.Physics)
            {
                Solid = reader.ReadInt32();

                // Note that if Solid is equal to 0, these values will basically be null. Still read them, but they don't mean anything.
                Sphere = new Sphere();
                Sphere.Unpack(reader);

                InPolys = new List<ushort>();
                uint numPolys = reader.ReadUInt32();
                for (uint i = 0; i < numPolys; i++)
                    InPolys.Add(reader.ReadUInt16());
            }
        }

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

public virtual void Unpack(BinaryReader reader, BSPType treeType)
        {
            Type = Encoding.ASCII.GetString(reader.ReadBytes(4)).Reverse();
            
            switch (Type)
            {
                // These types will unpack the data completely, in their own clreplacedes
                case "PORT":
                case "LEAF":
                    throw new Exception();
            }

            SplittingPlane = new Plane();
            SplittingPlane.Unpack(reader);

            switch (Type)
            {
                case "BPnn":
                case "BPIn":
                    PosNode = BSPNode.ReadNode(reader, treeType);
                    break;
                case "BpIN":
                case "BpnN":
                    NegNode = BSPNode.ReadNode(reader, treeType);
                    break;
                case "BPIN":
                case "BPnN":
                    PosNode = BSPNode.ReadNode(reader, treeType);
                    NegNode = BSPNode.ReadNode(reader, treeType);
                    break;
            }

            if (treeType == BSPType.Cell)
                return;

            Sphere = new Sphere();
            Sphere.Unpack(reader);

            if (treeType == BSPType.Physics)
                return;

            InPolys = new List<ushort>();
            uint numPolys = reader.ReadUInt32();
            for (uint i = 0; i < numPolys; i++)
                InPolys.Add(reader.ReadUInt16());
        }

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

public override void Unpack(BinaryReader reader, BSPType treeType)
        {
            Type = Encoding.ASCII.GetString(reader.ReadBytes(4)).Reverse();

            SplittingPlane = new Plane();
            SplittingPlane.Unpack(reader);

            PosNode = BSPNode.ReadNode(reader, treeType);
            NegNode = BSPNode.ReadNode(reader, treeType);

            if (treeType == BSPType.Drawing)
            {
                Sphere = new Sphere();
                Sphere.Unpack(reader);

                var numPolys = reader.ReadUInt32();
                var numPortals = reader.ReadUInt32();

                InPolys = new List<ushort>();
                for (uint i = 0; i < numPolys; i++)
                    InPolys.Add(reader.ReadUInt16());

                InPortals.Unpack(reader, numPortals);
            }
        }

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

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

            Frame.Unpack(reader);

            NumLeaves = reader.ReadUInt32();

            Portals.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            var numPolygons        = reader.ReadUInt32();
            var numPhysicsPolygons = reader.ReadUInt32();
            var numPortals         = reader.ReadUInt32();

            VertexArray.Unpack(reader);

            Polygons.Unpack(reader, numPolygons);

            for (uint i = 0; i < numPortals; i++)
                Portals.Add(reader.ReadUInt16());

            reader.AlignBoundary();

            CellBSP.Unpack(reader, BSPType.Cell);

            PhysicsPolygons.Unpack(reader, numPhysicsPolygons);

            PhysicsBSP.Unpack(reader, BSPType.Physics);

            uint hasDrawingBSP = reader.ReadUInt32();
            if (hasDrawingBSP != 0)
            {
                DrawingBSP = new BSPTree();
                DrawingBSP.Unpack(reader, BSPType.Drawing);
            }

            reader.AlignBoundary();
        }

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

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

            CloTextureEffects.Unpack(reader);
        }

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

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

            CloSubPalettes.Unpack(reader);
        }

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

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

            PaletteSet = reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            Offset      = reader.ReadUInt32();
            NumColors   = reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            Style           = (MotionStance)reader.ReadUInt32();
            AttackHeight    = (AttackHeight)reader.ReadUInt32();
            AttackType      = (AttackType)reader.ReadUInt32();
            MinSkillLevel   = reader.ReadUInt32();
            Motion          = (MotionCommand)reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            Version = reader.ReadUInt32();
            ContractId = reader.ReadUInt32();
            ContractName = reader.ReadPString();
            reader.AlignBoundary();

            Description = reader.ReadPString();
            reader.AlignBoundary();
            DescriptionProgress = reader.ReadPString();
            reader.AlignBoundary();

            NameNPCStart = reader.ReadPString();
            reader.AlignBoundary();
            NameNPCEnd = reader.ReadPString();
            reader.AlignBoundary();

            QuestflagStamped = reader.ReadPString();
            reader.AlignBoundary();
            QuestflagStarted = reader.ReadPString();
            reader.AlignBoundary();
            QuestflagFinished = reader.ReadPString();
            reader.AlignBoundary();
            QuestflagProgress = reader.ReadPString();
            reader.AlignBoundary();
            QuestflagTimer = reader.ReadPString();
            reader.AlignBoundary();
            QuestflagRepeatTime = reader.ReadPString();
            reader.AlignBoundary();

            LocationNPCStart.Unpack(reader);
            LocationNPCEnd.Unpack(reader);
            LocationQuestArea.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            VertexType = reader.ReadInt32();

            var numVertices = reader.ReadUInt32();

            if (VertexType == 1)
                Vertices.Unpack(reader, numVertices);
            else
                throw new NotImplementedException();
        }

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

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

            ObjDesc.Unpack(reader);
            ObjDescBald.Unpack(reader);
        }

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

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

            ObjDesc.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            ZeroTimeOfYear  = reader.ReadDouble();
            ZeroYear        = reader.ReadUInt32();
            DayLength       = reader.ReadSingle();
            DaysPerYear     = reader.ReadUInt32();
            YearSpec        = reader.ReadPString();
            reader.AlignBoundary();

            TimesOfDay.Unpack(reader);

            uint numDaysOfTheWeek = reader.ReadUInt32();
            for (uint i = 0; i < numDaysOfTheWeek; i++)
            {
                var weekDay = reader.ReadPString();
                reader.AlignBoundary();
                DaysOfTheWeek.Add(weekDay);
            }

            Seasons.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            IconImage       = reader.ReadUInt32();
            Bald            = (reader.ReadByte() == 1);
            AlternateSetup  = reader.ReadUInt32();

            ObjDesc.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            MaximumVowelsInARow = reader.ReadUInt32();
            FirstNCharactersMustHaveAVowel = reader.ReadUInt32();
            VowelContainingSubstringLength = reader.ReadUInt32();
            ExtraAllowedCharacters = reader.ReadUInt32();

            Unknown = reader.ReadByte(); // Not sure what this is...

            uint numLetterGroup = reader.ReadUInt32();
            for (uint i = 0; i < numLetterGroup; i++)
                CompoundLetterGroups.Add(reader.ReadUnicodeString());
        }

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

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

            BaseLoc.Unpack(reader);

            Freq        = reader.ReadSingle();

            DisplaceX   = reader.ReadSingle();
            DisplaceY   = reader.ReadSingle();

            MinScale    = reader.ReadSingle();
            MaxScale    = reader.ReadSingle();

            MaxRotation = reader.ReadSingle();

            MinSlope    = reader.ReadSingle();
            MaxSlope    = reader.ReadSingle();

            Align       = reader.ReadUInt32();
            Orient      = reader.ReadUInt32();

            WeenieObj   = reader.ReadUInt32();
        }

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

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

            Frame.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            Version         = reader.ReadUInt32();
            GameMapID       = reader.ReadUInt32();
            AutotestMapId   = reader.ReadUInt32();
            AutotestMapSize = reader.ReadUInt32();
            ClearCellId     = reader.ReadUInt32();
            ClearMonsterId  = reader.ReadUInt32();
        }

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

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

            Scenes.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            Mod         = reader.ReadSingle();
            ScriptId    = reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            StartDate = reader.ReadUInt32();
            Name = reader.ReadPString();
            reader.AlignBoundary();
        }

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

public void Unpack(BinaryReader reader)
        {
            Name            = reader.ReadString();
            Scale           = reader.ReadUInt32();
            SetupID         = reader.ReadUInt32();
            SoundTable      = reader.ReadUInt32();
            IconImage       = reader.ReadUInt32();
            BasePalette     = reader.ReadUInt32();
            SkinPalSet      = reader.ReadUInt32();
            PhysicsTable    = reader.ReadUInt32();
            MotionTable     = reader.ReadUInt32();
            CombatTable     = reader.ReadUInt32();

            BaseObjDesc.Unpack(reader);

            HairColorList.UnpackSmartArray(reader);
            HairStyleList.UnpackSmartArray(reader);
            EyeColorList.UnpackSmartArray(reader);
            EyeStripList.UnpackSmartArray(reader);
            NoseStripList.UnpackSmartArray(reader);
            MouthStripList.UnpackSmartArray(reader);

            HeadgearList.UnpackSmartArray(reader);
            ShirtList.UnpackSmartArray(reader);
            PantsList.UnpackSmartArray(reader);
            FootwearList.UnpackSmartArray(reader);
            ClothingColorsList.UnpackSmartArray(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            BeginTime           = reader.ReadSingle();
            EndTime             = reader.ReadSingle();
            BeginAngle          = reader.ReadSingle();
            EndAngle            = reader.ReadSingle();
            TexVelocityX        = reader.ReadSingle();
            TexVelocityY        = reader.ReadSingle();
            DefaultGFXObjectId  = reader.ReadUInt32();
            DefaultPESObjectId  = reader.ReadUInt32();
            Properties          = reader.ReadUInt32();

            reader.AlignBoundary();
        }

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

public void Unpack(BinaryReader reader)
        {
            ObjectIndex = reader.ReadUInt32();
            GFXObjId    = reader.ReadUInt32();
            Rotate      = reader.ReadSingle();
            Transparent = reader.ReadSingle();
            Luminosity  = reader.ReadSingle();
            MaxBright   = reader.ReadSingle();

            reader.AlignBoundary();
        }

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

public void Unpack(BinaryReader reader)
        {
            Begin       = reader.ReadSingle();

            DirBright   = reader.ReadSingle();
            DirHeading  = reader.ReadSingle();
            DirPitch    = reader.ReadSingle();
            DirColor    = reader.ReadUInt32();

            AmbBright   = reader.ReadSingle();
            AmbColor    = reader.ReadUInt32();

            MinWorldFog     = reader.ReadSingle();
            MaxWorldFog     = reader.ReadSingle();
            WorldFogColor   = reader.ReadUInt32();
            WorldFog        = reader.ReadUInt32();

            reader.AlignBoundary();

            SkyObjReplace.Unpack(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            SoundId = reader.ReadUInt32();
            Priority = reader.ReadSingle();
            Probability = reader.ReadSingle();
            Volume = reader.ReadSingle();
        }

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

public void Unpack(BinaryReader reader)
        {
            Name = reader.ReadObfuscatedString();
            reader.AlignBoundary();
            Desc = reader.ReadObfuscatedString();
            reader.AlignBoundary();
            School = (MagicSchool)reader.ReadUInt32();
            Icon = reader.ReadUInt32();
            Category = (SpellCategory)reader.ReadUInt32();
            Bitfield = reader.ReadUInt32();
            BaseMana = reader.ReadUInt32();
            BaseRangeConstant = reader.ReadSingle();
            BaseRangeMod = reader.ReadSingle();
            Power = reader.ReadUInt32();
            SpellEconomyMod = reader.ReadSingle();
            FormulaVersion = reader.ReadUInt32();
            ComponentLoss = reader.ReadSingle();
            MetaSpellType = (SpellType)reader.ReadUInt32();
            MetaSpellId = reader.ReadUInt32();

            switch (MetaSpellType)
            {
                case SpellType.Enchantment:
                case SpellType.FellowEnchantment:
                    Duration = reader.ReadDouble();
                    DegradeModifier = reader.ReadSingle();
                    DegradeLimit = reader.ReadSingle();
                    break;
                case SpellType.PortalSummon:
                    PortalLifetime = reader.ReadDouble();
                    break;
            }

            // Components : Load them first, then decrypt them. More efficient to hash all at once.
            List<uint> rawComps = new List<uint>();

            for (uint j = 0; j < 8; j++)
            {
                uint comp = reader.ReadUInt32();

                // We will only add the comp if it is valid
                if (comp > 0)
                    rawComps.Add(comp);
            }

            // Get the decryped component values
            Formula = DecryptFormula(rawComps, Name, Desc);

            CasterEffect = reader.ReadUInt32();
            TargetEffect = reader.ReadUInt32();
            FizzleEffect = reader.ReadUInt32();
            RecoveryInterval = reader.ReadDouble();
            RecoveryAmount = reader.ReadSingle();
            DisplayOrder = reader.ReadUInt32();
            NonComponentTargetType = reader.ReadUInt32();
            ManaMod = reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            Name        = reader.ReadObfuscatedString();
            reader.AlignBoundary();
            Category    = reader.ReadUInt32();
            Icon        = reader.ReadUInt32();
            Type        = reader.ReadUInt32();
            Gesture     = reader.ReadUInt32();
            Time        = reader.ReadSingle();
            Text        = reader.ReadObfuscatedString();
            reader.AlignBoundary();
            CDM         = reader.ReadSingle();
        }

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

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

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

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

            var num_varnames = reader.ReadUInt16();
            for (uint i = 0; i < num_varnames; i++)
                VarNames.Add(reader.ReadUnicodeString());

            var num_vars = reader.ReadUInt16();
            for (uint i = 0; i < num_vars; i++)
                Vars.Add(reader.ReadUnicodeString());

            var num_strings = reader.ReadUInt32();
            for (uint i = 0; i < num_strings; i++)
                Strings.Add(reader.ReadUnicodeString());

            var num_comments = reader.ReadUInt32();
            for (uint i = 0; i < num_comments; i++)
                Comments.Add(reader.ReadUInt32());

            Unknown = reader.ReadByte();
        }

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

public void Unpack(BinaryReader reader)
        {
            Name            = reader.ReadString();
            IconImage       = reader.ReadUInt32();
            replacedle           = reader.ReadUInt32();
            // Attributes
            Strength        = reader.ReadUInt32();
            Endurance       = reader.ReadUInt32();
            Coordination    = reader.ReadUInt32();
            Quickness       = reader.ReadUInt32();
            Focus           = reader.ReadUInt32();
            Self            = reader.ReadUInt32();

            NormalSkillsList.UnpackSmartArray(reader);
            PrimarySkillsList.UnpackSmartArray(reader);
        }

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

public void Unpack(BinaryReader reader)
        {
            TCode   = reader.ReadUInt32();
            TexGID  = reader.ReadUInt32();
        }

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

public void Unpack(BinaryReader reader)
        {
            TexGID          = reader.ReadUInt32();
            TexTiling       = reader.ReadUInt32();
            MaxVertBright   = reader.ReadUInt32();
            MinVertBright   = reader.ReadUInt32();
            MaxVertSaturate = reader.ReadUInt32();
            MinVertSaturate = reader.ReadUInt32();
            MaxVertHue      = reader.ReadUInt32();
            MinVertHue      = reader.ReadUInt32();
            DetailTexTiling = reader.ReadUInt32();
            DetailTexGID    = reader.ReadUInt32();
        }

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

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

            uint hasObjects = reader.ReadUInt32();
            if (hasObjects == 1)
                HasObjects = true;

            // Read in the terrain. 9x9 so 81 records.
            for (int i = 0; i < 81; i++)
            {
                var terrain = reader.ReadUInt16();
                Terrain.Add(terrain);
            }

            // Read in the height. 9x9 so 81 records
            for (int i = 0; i < 81; i++)
            {
                var height = reader.ReadByte();
                Height.Add(height);
            }

            reader.AlignBoundary();
        }

See More Examples