private void button_SaveScheme_Click(object sender, EventArgs e) { using (FormSaveSchemeAs form = new FormSaveSchemeAs(ColorSchemeType.ClassicScript)) if (form.ShowDialog(this) == DialogResult.OK) { ClassicScriptColorScheme currentScheme = new ClassicScriptColorScheme { Sections = (HighlightingObject)colorButton_Sections.Tag, Values = (HighlightingObject)colorButton_Values.Tag, References = (HighlightingObject)colorButton_References.Tag, StandardCommands = (HighlightingObject)colorButton_StandardCommands.Tag, NewCommands = (HighlightingObject)colorButton_NewCommands.Tag, Comments = (HighlightingObject)colorButton_Comments.Tag, Background = ColorTranslator.ToHtml(colorButton_Background.BackColor), Foreground = ColorTranslator.ToHtml(colorButton_Foreground.BackColor) }; XmlHandling.SaveXmlFile(form.SchemeFilePath, currentScheme); comboBox_ColorSchemes.Items.Add(Path.GetFileNameWithoutExtension(form.SchemeFilePath)); comboBox_ColorSchemes.SelectedItem = Path.GetFileNameWithoutExtension(form.SchemeFilePath); comboBox_ColorSchemes.Items.Remove("~UNTITLED"); } }
public static bool IsProjectNameDuplicate(string projectName) { foreach (Project project in XmlHandling.GetProjectsFromXml()) { if (project.Name.ToLower() == projectName.ToLower()) { return(true); } } return(false); }
private void comboBox_ColorSchemes_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox_ColorSchemes.Items.Count == 1) { button_DeleteScheme.Enabled = false; // Disallow deleting the last available scheme } ToggleSaveSchemeButton(); string fullSchemePath = Path.Combine(DefaultPaths.GetClassicScriptColorConfigsPath(), comboBox_ColorSchemes.SelectedItem.ToString() + ".cssch"); ClassicScriptColorScheme selectedScheme = XmlHandling.ReadXmlFile <ClassicScriptColorScheme>(fullSchemePath); UpdateColorButtons(selectedScheme); UpdatePreviewColors(selectedScheme); }
private static void Main(string[] args) { UpdateNGCompilerPaths(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IDEConfiguration ideConfiguration = IDEConfiguration.Load(); List <Project> availableProjects = XmlHandling.GetProjectsFromXml(); List <Plugin> availablePlugins = XmlHandling.GetPluginsFromXml(); using (IDE ide = new IDE(ideConfiguration, availableProjects, availablePlugins)) { using (FormStart form = new FormStart(ide)) { if (args.Length > 0) { if (Path.GetExtension(args[0]).ToLower() != ".trproj") { MessageBox.Show("Invalid file type. TombIDE can only open .trproj files.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ide.IDEConfiguration.RememberedProject = string.Empty; form.OpenTrprojWithTombIDE(args[0]); // Changes ide.Configuration.RememberedProject to the opened project on success if (string.IsNullOrEmpty(ide.IDEConfiguration.RememberedProject)) { return; // Opening project failed } Application.Run(form); // Reset the RememberedProject setting after closing ide.IDEConfiguration.RememberedProject = string.Empty; ide.IDEConfiguration.Save(); } else { Application.Run(form); } } } #if (DEBUG) System.Diagnostics.Process.GetCurrentProcess().Kill(); // Faster app closing while debugging #endif }
private void RefreshAndReserializeProjects() { RepositionProjectNodeIcons(); _ide.AvailableProjects.Clear(); foreach (DarkTreeNode node in treeView.Nodes) { _ide.AvailableProjects.Add((Project)node.Tag); } XmlHandling.UpdateProjectsXml(_ide.AvailableProjects); panel_Main_Buttons.Visible = treeView.Nodes.Count == 0; }
private void UpdatePreview() { ClassicScriptColorScheme currentScheme = new ClassicScriptColorScheme { Sections = (HighlightingObject)colorButton_Sections.Tag, Values = (HighlightingObject)colorButton_Values.Tag, References = (HighlightingObject)colorButton_References.Tag, StandardCommands = (HighlightingObject)colorButton_StandardCommands.Tag, NewCommands = (HighlightingObject)colorButton_NewCommands.Tag, Comments = (HighlightingObject)colorButton_Comments.Tag, Background = ColorTranslator.ToHtml(colorButton_Background.BackColor), Foreground = ColorTranslator.ToHtml(colorButton_Foreground.BackColor) }; bool itemFound = false; foreach (string item in comboBox_ColorSchemes.Items) { if (item == "~UNTITLED") { continue; } ClassicScriptColorScheme itemScheme = XmlHandling.ReadXmlFile <ClassicScriptColorScheme>(Path.Combine(DefaultPaths.GetClassicScriptColorConfigsPath(), item + ".cssch")); if (currentScheme == itemScheme) { comboBox_ColorSchemes.SelectedItem = item; itemFound = true; break; } } if (!itemFound) { if (!comboBox_ColorSchemes.Items.Contains("~UNTITLED")) { comboBox_ColorSchemes.Items.Add("~UNTITLED"); } XmlHandling.SaveXmlFile(Path.Combine(DefaultPaths.GetClassicScriptColorConfigsPath(), "~UNTITLED.cssch"), currentScheme); comboBox_ColorSchemes.SelectedItem = "~UNTITLED"; } UpdatePreviewColors(currentScheme); }
/// <summary> /// Updates all plugin lists. /// </summary> private void CheckPlugins() { UpdateInternalPluginList(); LookForUndefinedPlugins(); _ide.AvailablePlugins.Sort(delegate(Plugin p1, Plugin p2) { return(p1.Name.CompareTo(p2.Name)); }); UpdateProjectPluginList(); _ide.Project.InstalledPlugins.Sort(delegate(Plugin p1, Plugin p2) { return(p1.Name.CompareTo(p2.Name)); }); HandleScriptReferenceFiles(); XmlHandling.UpdatePluginsXml(_ide.AvailablePlugins); _ide.Project.Save(); _ide.RaiseEvent(new IDE.PluginListsUpdatedEvent()); }
private void button_Apply_Click(object sender, EventArgs e) { try { string newName = PathHelper.RemoveIllegalPathSymbols(textBox_NewName.Text.Trim()); if (string.IsNullOrWhiteSpace(newName) || newName.ToLower() == "engine") { throw new ArgumentException("Invalid name."); } bool renameDirectory = checkBox_RenameDirectory.Checked; if (newName == _targetProject.Name) { // If the name hasn't changed, but the directory name is different and the user wants to rename it if (Path.GetFileName(_targetProject.ProjectPath) != newName && renameDirectory) { HandleDirectoryRenaming(); _targetProject.Rename(newName, true); _targetProject.Save(); } else { DialogResult = DialogResult.Cancel; } } else { // Check if a project with the same name already exists on the list foreach (Project project in XmlHandling.GetProjectsFromXml()) { if (project.Name.ToLower() == newName.ToLower()) { // Check if the project we found IS the current _ide.Project if (project.ProjectPath.ToLower() == _targetProject.ProjectPath.ToLower()) { if (renameDirectory) { HandleDirectoryRenaming(); } break; } else { throw new ArgumentException("A project with the same name already exists on the list."); } } } _targetProject.Rename(newName, renameDirectory); _targetProject.Save(); } } catch (Exception ex) { DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }