Esempio n. 1
0
        private void SaveModDetails_Click(object sender, RoutedEventArgs e)
        {
            var modDetails = string.Empty;
            var delimiter  = string.Empty;

            foreach (var modDetail in ModDetails)
            {
                modDetails += $"{delimiter}{modDetail.Title} ({modDetail.ModId}){Environment.NewLine}{modDetail.ModUrl}";
                delimiter   = Environment.NewLine;
            }

            var window = new CommandLineWindow(modDetails);

            window.OutputTextWrapping = TextWrapping.NoWrap;
            window.Height             = 500;
            window.Title = _globalizer.GetResourceString("ModDetails_Clipboard_SaveTitle");
            window.Owner = Window.GetWindow(this);
            window.ShowDialog();
        }
        private void ValidateAllGameDataFiles(string folder)
        {
            if (string.IsNullOrWhiteSpace(folder) || !Directory.Exists(folder))
            {
                MessageBox.Show(_globalizer.GetResourceString("GameDataWindow_ValidateSuccessLabel"), _globalizer.GetResourceString("GameDataWindow_ValidateSuccessTitle"), MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            var fileList  = Directory.GetFiles(folder, $"*.{GlobalizedApplication.Instance.GetResourceString("GameDataWindow_GameDataDefaultExtension")}");
            var errorList = new List <string>();

            foreach (var file in fileList)
            {
                try
                {
                    ValidateGameDataFile(file);
                }
                catch (Exception ex)
                {
                    errorList.Add($"{Path.GetFileNameWithoutExtension(file)} - {ex.Message}");
                }
            }

            if (errorList.Count > 0)
            {
                var message = $"{_globalizer.GetResourceString("GameDataWindow_ValidateErrorLabel")}{Environment.NewLine}{string.Join(Environment.NewLine, errorList)}";
                var window  = new CommandLineWindow(message);
                window.OutputTextWrapping = TextWrapping.NoWrap;
                window.Height             = 300;
                window.Width = 600;
                window.Title = _globalizer.GetResourceString("GameDataWindow_ValidateErrorTitle");
                window.Owner = this;
                window.ShowDialog();
            }
            else
            {
                MessageBox.Show(_globalizer.GetResourceString("GameDataWindow_ValidateSuccessLabel"), _globalizer.GetResourceString("GameDataWindow_ValidateSuccessTitle"), MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }