Exemplo n.º 1
0
        public static (HipFile, Game, Platform) FromINI(string fileName)
        {
            HipFile hipFile = new HipFile();

            hipFile.SetupFromINI(fileName, out Game game, out Platform platform);
            return(hipFile, game, platform);
        }
Exemplo n.º 2
0
        public static (HipFile, Game, Platform) FromPath(string fileName)
        {
            HipFile  hipFile  = new HipFile();
            Game     game     = Game.Unknown;
            Platform platform = Platform.Unknown;

            using (var binaryReader = new BinaryReader(new FileStream(fileName, FileMode.Open)))
                while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
                {
                    string currentSection = new string(binaryReader.ReadChars(4));
                    if (currentSection == Section.HIPA.ToString())
                    {
                        hipFile.HIPA = new Section_HIPA(binaryReader);
                    }
                    else if (currentSection == Section.PACK.ToString())
                    {
                        hipFile.PACK = new Section_PACK(binaryReader, out game, out platform);
                    }
                    else if (currentSection == Section.DICT.ToString())
                    {
                        hipFile.DICT = new Section_DICT(binaryReader);
                    }
                    else if (currentSection == Section.STRM.ToString())
                    {
                        hipFile.STRM = new Section_STRM(binaryReader);
                    }
                    else
                    {
                        throw new Exception(currentSection);
                    }
                }

            return(hipFile, game, platform);
        }