Ejemplo n.º 1
0
        public override void Open()
        {
            Close();

            Header   = TexHeader.Read(IOStream);
            Palettes = Header.TryReadPalette(IOStream);
        }
Ejemplo n.º 2
0
        public void Convert()
        {
            using (Stream input = new FileStream(_inputFile, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                TexHeader       header   = TexHeader.Read(input);
                BitmapPalette[] palettes = header.TryReadPalette(input);

                if (palettes.Length == 0)
                {
                    using (Stream output = new FileStream(_outputFile, FileMode.Create, FileAccess.Write, FileShare.None))
                        Convert(input, output, header);
                }
                else
                {
                    using (Stream output = new FileStream(_outputFile, FileMode.Create, FileAccess.Write, FileShare.None))
                        Convert(input, output, header, palettes[0]);

                    for (int i = 0; i < palettes.Length; i++)
                    {
                        string fileName = Path.ChangeExtension(_outputFile, string.Empty) + "_" + i.ToString("D" + palettes.Length / 10 + 1) + ".act";
                        using (Stream output = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None))
                            SavePalette(palettes[i], output);
                    }
                }
            }
        }