Beispiel #1
0
 private static void SaveCheck(string path, string fileName)
 {
     if (File.Exists(path))
     {
         Log.Information("{FileName} successfully saved", fileName);
         FLogger.AppendInformation();
         FLogger.AppendText($"Successfully saved '{fileName}'", Constants.WHITE, true);
     }
     else
     {
         Log.Error("{FileName} could not be saved", fileName);
         FLogger.AppendError();
         FLogger.AppendText($"Could not save '{fileName}'", Constants.WHITE, true);
     }
 }
Beispiel #2
0
        private void OnClick(object sender, RoutedEventArgs e)
        {
            if (_applicationView.MapViewer.MapImage == null)
            {
                return;
            }
            var path = Path.Combine(UserSettings.Default.OutputDirectory, "Textures", "MiniMap.png");

            var saveFileDialog = new SaveFileDialog
            {
                Title            = "Save MiniMap",
                FileName         = "MiniMap.png",
                InitialDirectory = path.SubstringBeforeLast('\\'),
                Filter           = "PNG Files (*.png)|*.png|All Files (*.*)|*.*"
            };

            if (!(bool)saveFileDialog.ShowDialog())
            {
                return;
            }
            path = saveFileDialog.FileName;

            using var fileStream = new FileStream(path, FileMode.Create);
            var encoder = new PngBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(_applicationView.MapViewer.GetImageToSave()));
            encoder.Save(fileStream);

            if (File.Exists(path))
            {
                Log.Information("MiniMap.png successfully saved");
                FLogger.AppendInformation();
                FLogger.AppendText("Successfully saved 'MiniMap.png'", Constants.WHITE, true);
            }
            else
            {
                Log.Error("MiniMap.png could not be saved");
                FLogger.AppendError();
                FLogger.AppendText("Could not save 'MiniMap.png'", Constants.WHITE, true);
            }
        }
Beispiel #3
0
        public override async void Execute(LoadingModesViewModel contextViewModel, object parameter)
        {
            if (_applicationView.CUE4Parse.GameDirectory.HasNoFile)
            {
                return;
            }
            if (_applicationView.CUE4Parse.Game == FGame.FortniteGame &&
                _applicationView.CUE4Parse.Provider.MappingsContainer == null)
            {
                FLogger.AppendError();
                FLogger.AppendText("Mappings could not get pulled, extracting assets might not work properly. If so, press F12 or please restart.", Constants.WHITE, true);
            }
#if DEBUG
            var loadingTime = Stopwatch.StartNew();
#endif
            _applicationView.CUE4Parse.AssetsFolder.Folders.Clear();
            _applicationView.CUE4Parse.SearchVm.SearchResults.Clear();
            MainWindow.YesWeCats.LeftTabControl.SelectedIndex = 1;     // folders tab

            await _applicationView.CUE4Parse.LoadLocalizedResources(); // load locres if not already loaded

            Helper.CloseWindow <AdonisWindow>("Search View");          // close search window if opened

            await _threadWorkerView.Begin(async cancellationToken =>
            {
                // filter what to show
                switch (UserSettings.Default.LoadingMode)
                {
                case ELoadingMode.Single:
                case ELoadingMode.Multiple:
                    {
                        var l = (IList)parameter;
                        if (l.Count < 1)
                        {
                            return;
                        }

                        var directoryFilesToShow = l.Cast <FileItem>();
                        FilterDirectoryFilesToDisplay(cancellationToken, directoryFilesToShow);
                        break;
                    }

                case ELoadingMode.All:
                    {
                        FilterDirectoryFilesToDisplay(cancellationToken, null);
                        break;
                    }

                case ELoadingMode.AllButNew:
                case ELoadingMode.AllButModified:
                    {
                        await FilterNewOrModifiedFilesToDisplay(cancellationToken).ConfigureAwait(false);
                        break;
                    }

                default: throw new ArgumentOutOfRangeException();
                }

                _discordHandler.UpdatePresence(_applicationView.CUE4Parse);
            });

#if DEBUG
            loadingTime.Stop();
            FLogger.AppendDebug();
            FLogger.AppendText($"{_applicationView.CUE4Parse.SearchVm.SearchResults.Count} packages and a lot of localized resources loaded in {loadingTime.Elapsed.TotalSeconds.ToString("F3", CultureInfo.InvariantCulture)} seconds", Constants.WHITE, true);
#endif
        }