private void butOK_Click(object sender, EventArgs e) { // Test if everything is 'ok' if (!NgParameterInfo.TriggerIsValid(_level.Settings, TestTrigger)) { if (DarkMessageBox.Show(this, "The currently selected trigger data is not valid for the engine.", "Trigger invalid", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return; } } // Store some values like we have not NG triggers _trigger.TriggerType = TriggerType; _trigger.TargetType = TargetType; _trigger.Target = paramTarget.Parameter; _trigger.Timer = paramTimer.Parameter; _trigger.Extra = paramExtra.Parameter; _trigger.CodeBits = CodeBits; _trigger.OneShot = cbOneShot.Checked; // Close DialogResult = DialogResult.OK; Close(); }
private void button_AddProgram_Click(object sender, EventArgs e) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Title = "Select the .exe file of the program you want to add"; dialog.Filter = "Executable Files|*.exe|Batch Files|*.bat"; if (dialog.ShowDialog(this) == DialogResult.OK) { try { // Check for duplicates foreach (DarkButton button in panel_Programs.Controls.OfType <DarkButton>()) { if (button.Tag.ToString().ToLower() == dialog.FileName.ToLower()) { throw new ArgumentException("Program shortcut already exists."); } } AddProgramButton(dialog.FileName, true); } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void UpdateDataGrid() { dataGrid.Columns.Clear(); try { string xmlPath = Path.Combine(DefaultPaths.GetReferencesPath(), comboBox_References.SelectedItem + ".xml"); using (XmlReader reader = XmlReader.Create(xmlPath)) using (DataSet dataSet = new DataSet()) { dataSet.ReadXml(reader); DataTable dataTable = dataSet.Tables[0]; if (comboBox_References.SelectedIndex == 0) { DataTable pluginMnemonicTable = GetPluginMnemonicTable(); foreach (DataRow row in pluginMnemonicTable.Rows) { dataTable.Rows.Add(row.ItemArray[0].ToString(), row.ItemArray[1].ToString(), row.ItemArray[2].ToString()); } } DataColumn dcRowString = dataTable.Columns.Add("_RowString", typeof(string)); foreach (DataRow dataRow in dataTable.Rows) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < dataTable.Columns.Count - 1; i++) { builder.Append(dataRow[i].ToString()); builder.Append("\t"); } dataRow[dcRowString] = builder.ToString(); } string filter = string.Empty; if (!string.IsNullOrWhiteSpace(textBox_Search.Text) && textBox_Search.Text != "Search references...") { filter = textBox_Search.Text.Trim(); } dataTable.DefaultView.RowFilter = "[_RowString] LIKE '%" + filter + "%'"; dataGrid.DataSource = dataTable; dataGrid.Columns["_RowString"].Visible = false; SetFriendlyColumnHeaders(); } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Execute() { Util.Tic(); var polygons = LoadPolygons(); //Console.WriteLine(" Polygons: {0} (took {1}ms to load)", polygons.Count, Util.Toc()); string loadingPolygons = $"Polygons: {polygons.Count} (took {Util.Toc()}ms to load)"; Util.Tic(); var sequentialInfo = RunSequential(polygons); //Console.WriteLine("Sequential: {0}ms", Util.Toc()); string sequential = $"Sequential: {Util.Toc()}ms"; Util.Tic(); var parallelInfo = RunParallel(polygons); //Console.WriteLine(" Parallel: {0}ms", Util.Toc()); string parallel = $"Parallel: {Util.Toc()}ms"; //var dummymesh = new Mesh(new Configuration()); var mesher = new GenericMesher(new Configuration()); DarkMessageBox.Show($"{Name} - {Description}", $"{loadingPolygons}\n{sequential} {sequentialInfo} \n{parallel} {parallelInfo}"); foreach (var poly in polygons) { InputGenerated(mesher.Triangulate(poly), EventArgs.Empty); DarkMessageBox.Show("Just showing all the read poly files", "Show next"); } }
private void UpdatePreview() { try { string splashImagePath = Path.Combine(_ide.Project.EnginePath, "splash.bmp"); if (File.Exists(splashImagePath)) { using (Image image = Image.FromFile(Path.Combine(_ide.Project.EnginePath, "splash.bmp"))) { if ((image.Width == 1024 && image.Height == 512) || (image.Width == 768 && image.Height == 384) || (image.Width == 512 && image.Height == 256)) { panel_Preview.BackgroundImage = ImageHandling.ResizeImage(image, 460, 230); label_Blank.Visible = false; } else { label_Blank.Visible = true; } } } else { label_Blank.Visible = true; } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button_Reset_Click(object sender, EventArgs e) { DialogResult result = DarkMessageBox.Show(this, "Are you sure you want to restore the default icon?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { string icoFilePath = string.Empty; if (_ide.Project.GameVersion == TRVersion.Game.TR4 || _ide.Project.GameVersion == TRVersion.Game.TRNG) { if (_ide.Project.GameVersion == TRVersion.Game.TRNG && File.Exists(Path.Combine(_ide.Project.EnginePath, "flep.exe"))) { icoFilePath = Path.Combine(DefaultPaths.GetDefaultTemplatesPath(_ide.Project.GameVersion), "FLEP.ico"); } else { icoFilePath = Path.Combine(DefaultPaths.GetDefaultTemplatesPath(_ide.Project.GameVersion), _ide.Project.GameVersion + ".ico"); } } else if (_ide.Project.GameVersion == TRVersion.Game.TR5Main) { icoFilePath = Path.Combine(DefaultPaths.GetDefaultTemplatesPath(_ide.Project.GameVersion), _ide.Project.GameVersion + ".ico"); } ApplyIconToExe(icoFilePath); } }
private bool IsValidGameLauncher() { // Check if the launcher file exists, if not, then try to find it if (!File.Exists(_selectedProject.LaunchFilePath)) { try { string launchFilePath = FileFinder.GetLauncherPathFromProject(_selectedProject); _selectedProject.LaunchFilePath = launchFilePath; _selectedProject.Save(); return(true); } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } else { return(true); } }
private void button_UseBlank_Click(object sender, EventArgs e) { DialogResult result = DarkMessageBox.Show(this, "Are you sure you want to apply a blank image?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { Bitmap bitmap = new Bitmap(512, 256); using (Graphics graphics = Graphics.FromImage(bitmap)) { Rectangle imageSize = new Rectangle(0, 0, 512, 256); graphics.FillRectangle(Brushes.Black, imageSize); } string pakFilePath = Path.Combine(_ide.Project.EnginePath, @"data\uklogo.pak"); byte[] rawImageData = ImageHandling.GetRawDataFromBitmap(bitmap); PakFile.SavePakFile(pakFilePath, rawImageData); UpdatePreview(); } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void butOK_Click(object sender, EventArgs e) { short ocb; if (!short.TryParse(tbOCB.Text, out ocb)) { DarkMessageBox.Show(this, "The value of OCB field is not valid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _editor.UndoManager.PushObjectPropertyChanged(_movable); byte CodeBits = 0; CodeBits |= (byte)(cbBit1.Checked ? 1 << 0 : 0); CodeBits |= (byte)(cbBit2.Checked ? 1 << 1 : 0); CodeBits |= (byte)(cbBit3.Checked ? 1 << 2 : 0); CodeBits |= (byte)(cbBit4.Checked ? 1 << 3 : 0); CodeBits |= (byte)(cbBit5.Checked ? 1 << 4 : 0); _movable.CodeBits = CodeBits; _movable.Invisible = cbInvisible.Checked; _movable.ClearBody = cbClearBody.Checked; _movable.Ocb = ocb; DialogResult = DialogResult.OK; Close(); }
private void ButtonAddApplication_Click(object sender, EventArgs e) { var appName = TextBoxFileName.Text; var fileLocation = TextBoxFileLocation.Text; if (string.IsNullOrWhiteSpace(appName)) { _ = DarkMessageBox.Show(this, "You must enter a name for this application.", "Empty Name", MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(fileLocation)) { _ = DarkMessageBox.Show(this, "You must enter the file path for this application.", "Empty File Location", MessageBoxIcon.Exclamation); return; } if (!File.Exists(fileLocation)) { _ = DarkMessageBox.Show(this, "The file for this application doesn't exist on your computer. Please choose another file.", "File Doesn't Exist", MessageBoxIcon.Exclamation); return; } MainWindow.Settings.UpdateApplication(appName, fileLocation); LoadExternalApplications(); }
public void DeleteConsoleItem() { try { if (DarkMessageBox.Show(this, "Do you really want to delete the selected item?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { var type = DgvConsoleFiles.CurrentRow.Cells[0].Value.ToString(); var name = DgvConsoleFiles.CurrentRow.Cells[2].Value.ToString(); var itemPath = TextBoxConsolePath.Text + name; if (type.Equals("folder")) { SetConsoleStatus($"Deleting folder: {itemPath}"); FtpExtensions.DeleteDirectory(FtpClient, itemPath); SetConsoleStatus("Successfully deleted folder."); } else if (type.Equals("file")) { SetConsoleStatus($"Deleting file: {itemPath}"); FtpExtensions.DeleteFile(FtpClient, itemPath); SetConsoleStatus("Successfully deleted file."); } DgvConsoleFiles.Rows.RemoveAt(DgvConsoleFiles.CurrentRow.Index); } } catch (Exception ex) { SetConsoleStatus($"Unable to delete item. Error: {ex.Message}", ex); } }
public void ErrorNewMessageBox(string title, string message) { DarkMessageBox msgResized = new DarkMessageBox(title, message); msgResized.StartPosition = FormStartPosition.CenterScreen; msgResized.Show(); }
private void FormKeyboardLayout_KeyUp(object sender, KeyEventArgs e) { if (!listenKeys.Visible) { return; } if ((_listeningKeys & Keys.KeyCode) == Keys.None) { return; } if (Hotkey.ReservedCameraKeys.Contains(_listeningKeys)) { DarkMessageBox.Show(this, "This key is reserved for camera movement. Please define another key.", "Reserved key", MessageBoxButtons.OK, MessageBoxIcon.Error); StopListening(); return; } if (_listeningClearAfterwards) { _currConfig[_listeningDestination.Name]?.Clear(); } _currConfig[_listeningDestination.Name].Add(_listeningKeys); RedrawList(); StopListening(); }
private void button_Apply_Click(object sender, EventArgs e) { try { string newName = PathHelper.RemoveIllegalPathSymbols(textBox_NewName.Text).Trim(); if (string.IsNullOrWhiteSpace(newName)) { throw new ArgumentException("Invalid name."); } if (newName.Equals(Path.GetFileName(_targetItemPath), StringComparison.OrdinalIgnoreCase)) { DialogResult = DialogResult.Cancel; } else { string newPath = Path.Combine(Path.GetDirectoryName(_targetItemPath), newName + Path.GetExtension(_targetItemPath)); if (File.Exists(_targetItemPath)) { File.Move(_targetItemPath, newPath); } else { Directory.Move(_targetItemPath, newPath); } } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }
private void ButtonAddGame_Click(object sender, EventArgs e) { if (ComboBoxGameTitle.SelectedIndex == -1) { _ = DarkMessageBox.Show(this, "You must first specify a game title.", "No Game Title", MessageBoxIcon.Exclamation); return; } if (ComboBoxGameRegion.SelectedIndex == -1) { _ = DarkMessageBox.Show(this, "You must specify a game region.", "No Game Region", MessageBoxIcon.Exclamation); return; } var gameTitle = ComboBoxGameTitle.GetItemText(ComboBoxGameTitle.SelectedItem); var gameRegion = ComboBoxGameRegion.GetItemText(ComboBoxGameRegion.SelectedItem); var gameId = MainWindow.Database.Categories.GetCategoryByTitle(gameTitle).Id; DgvGameRegions.Rows.Add(gameTitle, gameRegion); MainWindow.Settings.UpdateGameRegion(gameId, gameRegion); LoadSavedRegions(); }
private void button_Reset_Click(object sender, EventArgs e) { DialogResult result = DarkMessageBox.Show(this, "Are you sure you want to restore the default image?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { string sourcePakPath = string.Empty; if (_ide.Project.GameVersion == TRVersion.Game.TR4 || _ide.Project.GameVersion == TRVersion.Game.TRNG) { sourcePakPath = Path.Combine(DefaultPaths.GetDefaultTemplatesPath(_ide.Project.GameVersion), "uklogo.pak"); } else if (_ide.Project.GameVersion == TRVersion.Game.TR5Main) { sourcePakPath = Path.Combine(DefaultPaths.GetDefaultTemplatesPath(_ide.Project.GameVersion), "uklogo.pak"); } string destPakPath = Path.Combine(_ide.Project.EnginePath, @"data\uklogo.pak"); File.Copy(sourcePakPath, destPakPath, true); UpdatePreview(); } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void ButtonSaveAll_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in DgvGameRegions.Rows) { var gameTitle = row.Cells[0].Value.ToString(); var gameRegion = row.Cells[1].Value.ToString(); var gameId = MainWindow.Database.Categories.GetCategoryByTitle(gameTitle).Id; if (MainWindow.Database.Categories.GetGameRegions(gameId).Contains(gameRegion)) { MainWindow.Settings.UpdateGameRegion(gameId, gameRegion); } else { _ = DarkMessageBox.Show(this, $"Region: {gameRegion} is not supported for Game: {gameTitle}\nPlease change the region to one that is supported for this game.", "Invalid Region", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } _ = DarkMessageBox.Show(this, "All game regions have now been saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); }
private void ButtonBackupSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(TextBoxLocalPath.Text) || TextBoxLocalPath.Text.IndexOfAny(Path.GetInvalidPathChars()) != -1) { _ = DarkMessageBox.Show(this, "You must include a local file path for the game file backup.", "Empty Local Path", MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(TextBoxConsolePath.Text)) { _ = DarkMessageBox.Show(this, "You must include a console path for for the game file backup. This is where the file will be restored at on the console.", "Empty Console Path", MessageBoxIcon.Exclamation); return; } BackupFile.CategoryId = TextBoxGameId.Text; BackupFile.FileName = Path.GetFileName(TextBoxConsolePath.Text); BackupFile.LocalPath = TextBoxLocalPath.Text; BackupFile.InstallPath = TextBoxConsolePath.Text; Close(); }
private void butPlay_Click(object sender, EventArgs e) { if (_soundId == -1) { return; } var soundInfo = _soundInfos.FirstOrDefault(soundInfo_ => soundInfo_.Id == _soundId); if (soundInfo == null) { DarkMessageBox.Show(this, "This sound is missing.", "Unable to play sound.", MessageBoxIcon.Information); return; } try { WadSoundPlayer.PlaySoundInfo(_editor.Level, soundInfo); } catch (Exception exc) { logger.Warn(exc, "Unable to play sample"); DarkMessageBox.Show(this, "Playing sound failed. " + exc, "Unable to play sound.", MessageBoxIcon.Information); } }
private string GetFlagDescription(string flag, ReferenceType type) { string result = string.Empty; try { result = GetDescriptionFromRDDA(flag, type); if (string.IsNullOrEmpty(result) && type == ReferenceType.Mnemonics) { result = GetDescriptionFromPlugin(flag); } if (!string.IsNullOrEmpty(result)) { result = Regex.Replace(result, @"\r\n?|\n", "\n"); } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
/// <summary> /// Return the user's game region, either automatically by searching existing console directories or prompt /// the user to select one. /// </summary> /// <param name="owner">Parent form</param> /// <param name="gameId">Game Id</param> /// <returns></returns> public string GetGameRegion(Form owner, string gameId) { if (MainWindow.Settings.RememberGameRegions) { var gameRegion = MainWindow.Settings.GetGameRegion(gameId); if (!string.IsNullOrEmpty(gameRegion)) { return(gameRegion); } } if (MainWindow.Settings.AutoDetectGameRegion) { var foundRegions = Regions.Where(region => MainWindow.FtpConnection.DirectoryExists($"/dev_hdd0/game/{region}")).ToList(); foreach (var region in foundRegions.Where(region => DarkMessageBox.Show(MainWindow.Window, $"Game Region: {region} has been found for: {Title}\nIs this correct?", "Found Game Region", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)) { return(region); } _ = DarkMessageBox.Show(MainWindow.Window, "Could not find any regions on your console for this game title. You must install the game update for this title first.", "No Game Update", MessageBoxIcon.Error); return(null); } return(DialogExtensions.ShowListInputDialog(owner, "Game Regions", Regions.ToList())); }
private void button_Apply_Click(object sender, EventArgs e) { try { string newName = PathHelper.RemoveIllegalPathSymbols(textBox_NewName.Text.Trim()); if (string.IsNullOrWhiteSpace(newName)) { throw new ArgumentException("Invalid file name."); } if (newName == Path.GetFileName(_ide.Project.LaunchFilePath)) { DialogResult = DialogResult.Cancel; } else { string newPath = Path.Combine(Path.GetDirectoryName(_ide.Project.LaunchFilePath), newName + ".exe"); File.Move(_ide.Project.LaunchFilePath, newPath); _ide.Project.LaunchFilePath = newPath; _ide.Project.Save(); } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { MainWindow.Window.SetStatus($"An unknown error occurred: {((Exception) e.ExceptionObject).Message}", (Exception)e.ExceptionObject); _ = DarkMessageBox.Show(MainWindow.Window, $"An unknown error occurred: {((Exception) e.ExceptionObject).Message}. If you keep receiving this issue when then report it on GitHub so we can investigate."); }
/// <summary> /// /// </summary> /// <param name="backupFile"></param> public void RestoreGameFile(BackupFile backupFile) { try { if (!File.Exists(backupFile.LocalPath)) { _ = DarkMessageBox.Show(this, "This file backup doesn't exist on your computer. If your game doesn't have mods installed, then I would suggest you backup the original files.", "No File Found", MessageBoxIcon.Information); return; } FtpExtensions.UploadFile(MainWindow.FtpConnection, backupFile.LocalPath, backupFile.InstallPath); _ = DarkMessageBox.Show(this, $"Successfully restored file: {backupFile.FileName} to path: {backupFile.InstallPath}", "Success", MessageBoxIcon.Information); } catch (Exception ex) { Program.Log.Error("There was an issue attempting to restore file.", ex); _ = DarkMessageBox.Show(this, "There was an issue restoring file. Make sure the local file exists on your computer.", "Error", MessageBoxIcon.Error); } }
private void OpenSelectedResource() { if (treeView_Resources.SelectedNodes.Count == 0) { return; } // Check if the clicked node is not a default node if (treeView_Resources.Nodes.Contains(treeView_Resources.SelectedNodes[0])) { return; } try { ProcessStartInfo startInfo = new ProcessStartInfo(); if (treeView_Resources.SelectedNodes[0].ParentNode == treeView_Resources.Nodes[1]) // Wad handling { startInfo.FileName = Path.Combine(DefaultPaths.GetProgramDirectory(), "WadTool.exe"); startInfo.Arguments = "\"" + treeView_Resources.SelectedNodes[0].Text + "\""; } else { startInfo.FileName = treeView_Resources.SelectedNodes[0].Text; } Process.Start(startInfo); } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { string errorMessage = string.Format("An unhandled exception occurred: {0}", e.Exception.Message); DarkMessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); e.Handled = true; }
private void button_Create_Click(object sender, EventArgs e) { try { string newFileName = PathHelper.RemoveIllegalPathSymbols(textBox_NewFileName.Text).Trim(); if (string.IsNullOrWhiteSpace(newFileName)) { throw new ArgumentException("Invalid file name."); } newFileName += GetSelectedExtension(); string targetDirectory = ((DirectoryInfo)treeView.SelectedNodes[0].Tag).FullName; foreach (string file in Directory.GetFiles(targetDirectory, "*.*", SearchOption.TopDirectoryOnly)) { if (newFileName.Equals(Path.GetFileName(file), StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("A file with the same name already exists in that directory."); } } // // // // NewFilePath = Path.Combine(targetDirectory, newFileName); // // // // } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }
private void DeleteItem() { DarkTreeNode selectedNode = treeView.SelectedNodes[0]; string message; if (IsDirectoryNode(selectedNode)) { message = "Are you sure you want to move the \"" + treeView.SelectedNodes[0].Text + "\" folder into the recycle bin?"; } else if (IsFileNode(selectedNode)) { message = "Are you sure you want to move the \"" + treeView.SelectedNodes[0].Text + "\" file into the recycle bin?"; } else { return; } DialogResult result = DarkMessageBox.Show(this, message, "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (IsDirectoryNode(selectedNode)) { FileSystem.DeleteDirectory(GetItemPathFromNode(selectedNode), UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } else { FileSystem.DeleteFile(GetItemPathFromNode(selectedNode), UIOption.AllDialogs, RecycleOption.SendToRecycleBin); } } }
private void button_Save_Click(object sender, EventArgs e) { try { string newName = RemoveIllegalPathSymbols(textBox_Name.Text).Trim(); if (string.IsNullOrWhiteSpace(newName)) { throw new ArgumentException("Invalid name."); } string schemeFilePath = null; switch (_schemeType) { case ColorSchemeType.ClassicScript: { string schemeFolderPath = DefaultPaths.GetClassicScriptColorConfigsPath(); foreach (string file in Directory.GetFiles(schemeFolderPath, "*.cssch", SearchOption.TopDirectoryOnly)) { if (Path.GetFileNameWithoutExtension(file).Equals(newName, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("A scheme with the same name already exists."); } } schemeFilePath = Path.Combine(schemeFolderPath, newName + ".cssch"); break; } case ColorSchemeType.Lua: { string schemeFolderPath = DefaultPaths.GetLuaColorConfigsPath(); foreach (string file in Directory.GetFiles(schemeFolderPath, "*.luasch", SearchOption.TopDirectoryOnly)) { if (Path.GetFileNameWithoutExtension(file).Equals(newName, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("A scheme with the same name already exists."); } } schemeFilePath = Path.Combine(schemeFolderPath, newName + ".luasch"); break; } } // // // // SchemeFilePath = schemeFilePath; // // // // } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }
private void ToolItemDeleteBackup_Click(object sender, EventArgs e) { if (DarkMessageBox.Show(this, "Do you really want to delete the selected item?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { MainWindow.Settings.BackupFiles.RemoveAt(DgvBackups.CurrentRow.Index); LoadBackupFiles(); } }