Esempio n. 1
0
 public void ReadGtfTest(string fileName, string outPath)
 {
     using FileStream inStream  = new FileStream(fileName, FileMode.Open, FileAccess.Read);
     using GTF gtf              = GTF.CreateFromGtfStream(inStream);
     using FileStream outStream = new FileStream(outPath, FileMode.Create);
     gtf.SavePngTo(outStream);
 }
Esempio n. 2
0
        public async Task ReplaceGTF(int index, Bitmap bitmap)
        {
            if (index < 0 || index > Count)
            {
                throw new ArgumentOutOfRangeException();
            }
            int encodingType = gtfs[index].Type;

            gtfs[index].Dispose();
            using MemoryStream ms = new MemoryStream();
            await GTF.WriteGTF(ms, bitmap, encodingType);

            ms.Seek(0, SeekOrigin.Begin);
            gtfs[index] = GTF.CreateFromGtfStream(ms);
            ms.Seek(0, SeekOrigin.Begin);
            await gtfSource.Entries[index].SetData(ms);
        }
Esempio n. 3
0
        public static async Task <SpriteSheetSource> CreateImageSource(ParFile parFile)
        {
            SpriteSheetSource imageSource = new SpriteSheetSource(parFile);

            foreach (ParEntry entry in parFile.Entries)
            {
                try
                {
                    imageSource.filenames.Add(entry.FileName);
                    GTF gtf = GTF.CreateFromGtfStream(await entry.GetData());
                    imageSource.gtfs.Add(gtf);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(imageSource);
        }