Beispiel #1
0
        private void LoadFile()
        {
            byte[]       bytes  = System.IO.File.ReadAllBytes(Path);
            BinaryReader buffer = new BinaryReader(bytes);

            string header = buffer.ReadStringWithLength("header", ExpectedHeader.Length);

            buffer.AdvanceIndex(ExpectedHeader.Length);
            if (!ExpectedHeader.Equals(header))
            {
                throw new InvalidOperationException($"Expected header to be {ExpectedHeader} but found {header}!");
            }

            Build build = LoadBuild(buffer);
            Dictionary <int, string> hashToName = LoadDictionary(buffer);

            file = new File(build, hashToName);
        }
Beispiel #2
0
        public static BuildData LoadFile(string filePath)
        {
            var buffer = new BinaryReader(System.IO.File.ReadAllBytes(filePath));

            var header = buffer.ReadStringWithLength("header", ExpectedHeader.Length);

            buffer.AdvanceIndex(ExpectedHeader.Length);

            if (!ExpectedHeader.Equals(header))
            {
                throw new InvalidOperationException($"Expected header to be {ExpectedHeader} but found {header}!");
            }

            return(new BuildData
            {
                Build = LoadBuild(buffer),
                HashToName = LoadDictionary(buffer)
            });
        }