예제 #1
0
        private void UnpackImagesClicked(object sender, RoutedEventArgs e)
        {
            try
            {
                var            inFile     = string.Empty;
                var            outDir     = string.Empty;
                OpenFileDialog inFileDiag = new OpenFileDialog
                {
                    Title       = "Select Luna Nights data.win file",
                    DefaultExt  = "win",
                    Filter      = "Data.win (*.win)|*.win",
                    Multiselect = false
                };
                if (inFileDiag.ShowDialog() == true)
                {
                    inFile = inFileDiag.FileName;
                }

                if (string.IsNullOrWhiteSpace(inFile))
                {
                    return;
                }

                VistaFolderBrowserDialog outDirDiag = new VistaFolderBrowserDialog()
                {
                    UseDescriptionForTitle = true,
                    Description            = "Select output folder for images"
                };
                if (outDirDiag.ShowDialog() == true)
                {
                    outDir = outDirDiag.SelectedPath;
                }

                if (string.IsNullOrWhiteSpace(inFile) || string.IsNullOrWhiteSpace(outDir))
                {
                    return;
                }

                Task.Run(() => _imagePacker.UnpackImagesFromData(inFile, outDir));
            }
            catch (Exception ex)
            {
                _syncContext.Post((s) => ErrorTracker.CurrentError = ex.Message, null);
            }
        }