Example #1
0
        static public GfxFileReader DoLoad(string fileId, bool usePli, bool useJil)
        {
            //Console.WriteLine($"Using .jil={useJil}");

            var gfx = new BinaryReader(File.Open(fileId + ".gfx", FileMode.Open), Encoding.Default, true);
            var gil = new BinaryReader(File.Open(fileId + ".gil", FileMode.Open), Encoding.Default, true);

            BinaryReader paletteIndex, palette, directionIndex = null, jobIndex = null;

            if (usePli)
            {
                paletteIndex = new BinaryReader(File.Open(fileId + ".pil", FileMode.Open), Encoding.Default, true);
                palette      = new BinaryReader(File.Open(fileId + ".pa6", FileMode.Open), Encoding.Default, true);
            }
            else
            {
                paletteIndex = new BinaryReader(File.Open(fileId + ".pi4", FileMode.Open), Encoding.Default, true);
                palette      = new BinaryReader(File.Open(fileId + ".p46", FileMode.Open), Encoding.Default, true);
            }

            if (useJil)
            {
                directionIndex = new BinaryReader(File.Open(fileId + ".dil", FileMode.Open), Encoding.Default, true);
                jobIndex       = new BinaryReader(File.Open(fileId + ".jil", FileMode.Open), Encoding.Default, true);
            }



            var gfxIndexList      = new GilFileReader(gil);
            var paletteIndexList  = new PilFileReader(paletteIndex);
            var paletteCollection = new PaletteCollection(palette, paletteIndexList);

            DilFileReader directionIndexList = null;
            JilFileReader jobIndexList       = null;

            if (useJil)
            {
                directionIndexList = new DilFileReader(directionIndex);
                jobIndexList       = new JilFileReader(jobIndex);
            }

            gfxFile = new GfxFileReader(gfx, gfxIndexList, jobIndexList, directionIndexList, paletteCollection);

            gfx?.Close();
            gil?.Close();
            paletteIndex?.Close();
            palette?.Close();
            directionIndex?.Close();
            jobIndex?.Close();

            return(gfxFile);
        }
Example #2
0
        public ICollectionFileReader DoLoad(string fileId, bool usePli, bool useJil)
        {
            //Console.WriteLine($"Using .jil={useJil}");

            var gfx = new BinaryReader(File.Open(fileId + ".gfx", FileMode.Open), Encoding.Default, true);
            var gil = new BinaryReader(File.Open(fileId + ".gil", FileMode.Open), Encoding.Default, true);

            BinaryReader paletteIndex, palette, directionIndex = null, jobIndex = null;

            if (usePli)
            {
                paletteIndex = new BinaryReader(File.Open(fileId + ".pil", FileMode.Open), Encoding.Default, true);
                palette      = new BinaryReader(File.Open(fileId + ".pa6", FileMode.Open), Encoding.Default, true);
            }
            else
            {
                paletteIndex = new BinaryReader(File.Open(fileId + ".pi2", FileMode.Open), Encoding.Default, true);
                palette      = new BinaryReader(File.Open(fileId + ".p26", FileMode.Open), Encoding.Default, true);
            }

            if (useJil)
            {
                directionIndex = new BinaryReader(File.Open(fileId + ".dil", FileMode.Open), Encoding.Default, true);
                jobIndex       = new BinaryReader(File.Open(fileId + ".jil", FileMode.Open), Encoding.Default, true);
            }



            var gfxIndexList      = new GilFileReader(gil);
            var paletteIndexList  = new PilFileReader(paletteIndex);
            var paletteCollection = new PaletteCollection(palette, paletteIndexList);

            switch (fileId.Substring(fileId.Length - 2))
            {
            case ("20"):
            case ("21"):
            case ("22"):
            case ("24"):
                paletteCollection.GetPalette().replaceTeamColors = true;
                paletteCollection.GetPalette().team = TeamGFXSetting.SelectedIndex;
                break;
            }

            DilFileReader directionIndexList = null;
            JilFileReader jobIndexList       = null;

            if (useJil)
            {
                directionIndexList = new DilFileReader(directionIndex);
                jobIndexList       = new JilFileReader(jobIndex);
            }

            gfxFile = new GfxFileReader(gfx, gfxIndexList, jobIndexList, directionIndexList, paletteCollection);

            gfx?.Close();
            gil?.Close();
            paletteIndex?.Close();
            palette?.Close();
            directionIndex?.Close();
            jobIndex?.Close();
            gfxFile?.Close();

            return(gfxFile);
        }