Beispiel #1
0
        private async void ExportAllSprites_Click(object sender, RoutedEventArgs e)
        {
            if (SPRT.Instance == null)
            {
                return;
            }

            string outDir = OpenFolder("Select where to save extracted files");

            if (outDir == null)
            {
                return;
            }

            List <Sprite> sprites = SPRT.Instance.Contents;

            int frameNumTotal = 0;

            for (int i = 0; i < sprites.Count; i++)
            {
                frameNumTotal += sprites[i].FrameNum;
            }

            ProgressWindow progressWindow = new ProgressWindow(frameNumTotal)
            {
                Title = "Exporting...",
                Owner = GetWindow(this)
            };

            progressWindow.Show();
            IProgress <double> progress = new Progress <double>(i => { progressWindow.IncrementProgress(i); });

            try
            {
                await ExportSprites(sprites, outDir, progressWindow.CancelToken, progress);
            }
            catch (OperationCanceledException)
            {
                // Cancelled
                Console.WriteLine("successfully cancelled exportall!");
            }

            progressWindow.Close();
        }
Beispiel #2
0
        private async void ExportBtn_Click(object sender, RoutedEventArgs e)
        {
            if (currentSelection == null)
            {
                return;
            }

            string outDir = OpenFolder("Select where to save extracted files");

            if (outDir == null)
            {
                return;
            }

            Sprite sprite = (Sprite)currentSelection.Asset;

            ProgressWindow progressWindow = new ProgressWindow(sprite.FrameNum)
            {
                Title = "Exporting...",
                Owner = GetWindow(this)
            };

            progressWindow.Show();
            IProgress <double> progress = new Progress <double>(i => { progressWindow.IncrementProgress(i); });

            try
            {
                await sprite.ExportFrames(outDir, progressWindow.CancelToken, progress);
            }
            catch (OperationCanceledException)
            {
                // Cancelled
                Console.WriteLine("successfully cancelled export!");
            }

            progressWindow.Close();
        }