private void Save_DestinationMod_btn_Click(object sender, EventArgs e) { ProgramConsole.SaveNewDestinationMod(destinationMod_cbb.SelectedItem.ToString()); CodeWriter.CheckPaths(); MessageBox.Show("Changed Destination Module to " + ProgramConsole.DestinationMod + " successfully!"); }
private void Create_btn_Click(object sender, EventArgs e) { bool newDir = false; bool isOK = false; if (!useOriginalMod_cb.Checked) { // !!! HAS TO BE HERE FOR NOW !!! // string destModPath = ImportantMethods.GetDirectoryPathOnly(ProgramConsole.GetModuleInfoPath()) + '\\' + destinationModul_txt.Text; newDir = !Directory.Exists(destModPath); if (newDir) { Directory.CreateDirectory(destModPath); } // !!! HAS TO BE HERE FOR NOW !!! // } isOK = CreateProjectFolder(); if (!useOriginalMod_cb.Checked && isOK) { isOK = CreateModuleFolder(newDir); } if (isOK) { ProgramConsole.LoadProject(CodeReader.ProjectPath, true); ProjectCreated = true; } Close(); }
private void ProjectObject_Click(object sender, EventArgs e) { ProjectObject pObject = (ProjectObject)sender; //Button b = (Button)sender; string path = pObject.ProjectPath; //b.Tag.ToString(); bool loadSuccess = false; if (Directory.Exists(path)) { loadSuccess = LoadProject(path); } if (!loadSuccess) { DialogResult result = MessageBox.Show( "The selected project couldn't be found or is corrupted!" + Environment.NewLine + "Do you want to remove this entry?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { ProgramConsole.RemoveProjectPathFromLastOpened(path); Label x = zuletztVerwendet_lbl; zuletztVerwendet_panel.Controls.Clear(); zuletztVerwendet_panel.Controls.Add(x); Properties.Settings.Default.Reload(); LoadLastOpenedProjects(); } } }
private void Save_Mod_btn_Click(object sender, EventArgs e) { ProgramConsole.SaveNewOriginalMod(originalMod_cbb.SelectedItem.ToString()); CodeWriter.CheckPaths(); string backupFolder = CodeWriter.ModuleSystem + "BACKUP"; foreach (string file in Directory.GetFiles(backupFolder)) { File.Copy(file, CodeWriter.ModuleSystem + Path.GetFileName(file), true); } string variablesProcess = CodeWriter.ModuleSystem + "variables.txt"; string variablesModule = CodeReader.ModPath + "variables.txt"; string[] info = ProgramConsole.ReadProjectFileInfoFromFile(CodeReader.ProjectPath); bool useVariables = bool.Parse(info[6]); if (File.Exists(variablesModule) && useVariables) { File.Copy(variablesModule, variablesProcess, true); } else if (File.Exists(variablesProcess) && !useVariables) { File.Delete(variablesProcess); } //else // MessageBox.Show("ERROR?!"); MessageBox.Show("Changed Original Module to " + ProgramConsole.OriginalMod + " successfully!"); }
private void LoadLastOpenedProjects() { string[] lastOpenedProjectPaths = ProgramConsole.GetLastOpenedProjectPaths(); string[] lastOpenedProjectNames = ProgramConsole.GetLastOpenedProjectNames(); for (int i = 0; i < lastOpenedProjectPaths.Length; i++) { zuletztVerwendet_panel.Controls.Add(GetLastProjectControl(lastOpenedProjectNames[i], lastOpenedProjectPaths[i])); } }
private void ChangeProjectPathsToNewOne(string currentPath, string newPath) { foreach (string dir in Directory.GetDirectories(currentPath)) { string[] info = ProgramConsole.ReadProjectFileInfoInFolder(dir); if (info != null) { info[1] = newPath + ImportantMethods.GetDirectoryNameOnly(info[1]); ProgramConsole.SaveProjectFileInfo(dir, info); } } }
/// <summary> /// The program entry point. /// </summary> /// <param name="args">Command line arguments</param> public static void Main(string[] args) { Debug.Print(string.Join(Environment.NewLine, args)); IProgramConsole console = new ProgramConsole(); var program = Parse(new Program(console), args); if (program.EnsureShowHelp()) { return; } Console.WriteLine("Hello world!"); }
private bool LoadProject(string projectPath) { bool success = false; try { ProgramConsole.LoadProject(projectPath, true); RemoveAllTabPagesExeptConsole(); LoadProjectExplorer(); success = true; } catch (Exception) { } return(success); }
public static void Main() { var teamRepository = new XmlRepository <string, Team <string> >("teams.xml"); var playerRepository = new XmlRepository <string, Player <string> >("players.xml"); var gameRepository = new XmlRepository <string, Game <string> >("games.xml"); var playerActivityRepository = new XmlRepository <CompositeId <string>, PlayerActivity <string> >("activities.xml"); PopulateTeams(teamRepository, playerRepository); PopulateGames(gameRepository, playerRepository, playerActivityRepository); var service = new CommonService(teamRepository, playerRepository, gameRepository, playerActivityRepository); var console = new ProgramConsole(service); console.Run(); }
private void OpenFile_ofd_FileOk(object sender, System.ComponentModel.CancelEventArgs e) { string fileName = Path.GetFileName(openFile_ofd.FileName); string endPoint = fileName.Substring(fileName.LastIndexOf('.') + 1); //RemoveAllTabPagesExeptConsole(); if (endPoint.Equals("mbsp")) { LoadProject(ProgramConsole.ReadProjectFileInfoFromFile(openFile_ofd.FileName)[1]); } else { MessageBox.Show( "Invalid Projectformat: " + endPoint + Environment.NewLine + "Selected file: " + openFile_ofd.FileName, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning ); } }
private void InitializeProject() { string s = ProgramConsole.GetModuleInfoPath(); if (s.Equals(ProgramConsole.DEFAULT_STEAMPATH)) { ProgramConsole.SetModPath(false); } projectVorlagenSearch_txt.Click += ProjectVorlagenSearch_txt_Click; projectVorlagenSearch_txt.LostFocus += ProjectVorlagenSearch_txt_LostFocus; string projectsPath = Properties.Settings.Default.projectsFolderPath.TrimEnd('\\'); //Application.StartupPath + "\\Projects"; if (Directory.Exists(projectsPath)) { foreach (string dir in Directory.GetDirectories(projectsPath)) { string[] files = Directory.GetFiles(dir); foreach (string file in files) { if (file.Contains(".")) { if (file.Substring(file.LastIndexOf('.')).Equals(".mbsp")) { projects_cbb.Items.Add(ImportantMethods.GetDirectoryNameOnly(dir)); } } } } if (projects_cbb.Items.Count > 0) { projects_cbb.SelectedIndex = 0; } } else { Directory.CreateDirectory(projectsPath); } }
private void ExtraOptions_tree_AfterSelect(object sender, TreeViewEventArgs e) { itemsets_panel.Visible = false; projects_panel.Visible = false; if (e.Node.Name.StartsWith("set_")) { itemsets_panel.Visible = true; itemsets_panel.BringToFront(); currentSetIndex = int.Parse(e.Node.Name.Split('_')[1]) - 1; SetupCurrentSet(); } else if (e.Node.Name.StartsWith("proj")) { projects_panel.Visible = true; projects_panel.BringToFront(); string[] info = ProgramConsole.ReadProjectFileInfoCurrent(); string modFolder = info[3]; //CodeReader.ModPath.TrimEnd('\\'); string modules = modFolder.Remove(modFolder.LastIndexOf('\\')); foreach (string folder in Directory.GetDirectories(modules)) { string tmp = folder.Substring(folder.LastIndexOf('\\') + 1); originalMod_cbb.Items.Add(tmp); destinationMod_cbb.Items.Add(tmp); } projectFolder_txt.Text = info[1]; originalMod_cbb.SelectedItem = info[2]; destinationMod_cbb.SelectedItem = info[4]; copyDefaultVariables_cb.Checked = bool.Parse(info[6]); } else if (e.Node.Name.StartsWith("gener")) { new HeaderValueTool().ShowDialog(); } else if (e.Node.Name.StartsWith("Settings")) { moduleIniPanel.BringToFront(); } }
private void CreateProject_Load(object sender, EventArgs e) { string modulesDir = ImportantMethods.GetDirectoryPathOnly(ProgramConsole.GetModuleInfoPath()); bool invalidModule = true; bool noNativeModuleIni = true; DialogResult dialogResult = DialogResult.OK; PathSelector pathSelector = new PathSelector("Modules"); if (!Directory.Exists(modulesDir)) { do { dialogResult = pathSelector.ShowDialog(); modulesDir = pathSelector.SelectedPath; noNativeModuleIni = !File.Exists(modulesDir + "\\Native\\module.ini"); invalidModule = (!Directory.Exists(modulesDir) || noNativeModuleIni); pathSelector.SetError(invalidModule); } while (invalidModule && dialogResult == DialogResult.OK); } if (dialogResult != DialogResult.OK) { Close(); } else { modulesDir += '\\'; string[] modules = Directory.GetDirectories(modulesDir.TrimEnd('\\')); foreach (string module in modules) { modules_cbb.Items.Add(ImportantMethods.GetDirectoryNameOnly(module)); } string s = "Native"; if (!Directory.Exists(modulesDir + s)) { if (modules.Length > 0) { s = modules[0]; if (Directory.Exists(modulesDir + s)) { int i = 0; do { i++; } while (Directory.Exists(modulesDir + s + i)); s += i; } } else { s = string.Empty; } } modules_cbb.SelectedIndex = modules_cbb.Items.IndexOf(s); } }
private bool CreateProjectFolder() { if (!copyTextFiles_cb.Checked) { return(true); } string destPath = path_txt.Text; bool directoryNew = !Directory.Exists(destPath); DialogResult forceOverride = DialogResult.Yes; if (!directoryNew) { forceOverride = ShowErrorPathAlreadyExists(destPath); } if (!directoryNew && forceOverride != DialogResult.Yes) { return(false); } string headerFiles = "headerFiles"; string moduleFiles = "moduleFiles"; string moduleSystem = "moduleSystem"; //if (!directoryNew) Directory.CreateDirectory(destPath); destPath += '\\'; //if (!Directory.Exists(destPath + headerFiles)) Directory.CreateDirectory(destPath + headerFiles); //if (!Directory.Exists(destPath + moduleFiles)) Directory.CreateDirectory(destPath + moduleFiles); //if (!Directory.Exists(destPath + moduleSystem)) Directory.CreateDirectory(destPath + moduleSystem); //ProgramConsole.SaveNewSelectedMod(modules_cbb.SelectedItem.ToString(), destPath); //CodeReader.ProjectPath = destPath; // Initialize??? because this needs to have a own mod and destinion for each project!!! so why not change the extraoption SetMod to this location //File.WriteAllText(destPath + "module_info.py", "export_dir = \"" + CodeReader.ModPath.Replace('\\', '/') + '\"'); string module_info__path = File.ReadAllText(CodeReader.FILES_PATH + "module_info.path"); string[] info = new string[] { name_txt.Text, destPath, modules_cbb.SelectedItem.ToString(), module_info__path.Replace("%MOD_NAME%", modules_cbb.SelectedItem.ToString()), destinationModul_txt.Text, module_info__path.Replace("%MOD_NAME%", destinationModul_txt.Text), // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - useDefaultVariables_cb.Checked.ToString(), }; CodeReader.ProjectPath = destPath.Trim('\\'); ProgramConsole.SaveProjectFileInfo(CodeReader.ProjectPath, info); //File.WriteAllLines(destPath + Path.GetFileName(destPath.TrimEnd('\\') + ".mbsp"), info); ProgramConsole.SetMods(CodeReader.ProjectPath); moduleSystem += '\\'; CodeWriter.CheckPaths(); foreach (string file in Directory.GetFiles(CodeWriter.DefaultModuleSystemPath)) { File.Copy(file, destPath + moduleSystem + Path.GetFileName(file), !directoryNew); } if (useDefaultVariables_cb.Checked) { CopyVariables(destPath, moduleSystem); } return(true); }
private static void InitializeConsole(string[] args) { if (args.Length != 0 && args.Length <= MAX_ARGUMENTS) { DebugMode = args[0].Equals("-deep"); if (args[0].Equals("-debug")) { DebugMode = true; } else if (DebugMode) { DeepValidationActive = true; } if (args.Length > 1) { modulePath = args[1].TrimStart('-'); } } else { //modulePath = @"F:\Program Files\Steam\steamapps\common\MountBlade Warband\Modules"; modulePath = ProgramConsole.GetModuleInfoPath(); if (modulePath.IndexOf('%') >= 0) { modulePath = modulePath.Remove(modulePath.IndexOf('%') - 1); } } Console.WriteLine("ModulePath set to: \"" + modulePath + "\"" + Environment.NewLine); Console.Title = "CheckIfEqualFiles"; Console.SetWindowSize(Console.WindowWidth + 32, Console.WindowHeight + 16); backupPath = modulePath + "\\BACKUP-TXT"; if (!Directory.Exists(backupPath)) { Directory.CreateDirectory(backupPath); } if (File.Exists(LANGUAGE_INI)) { string[] lines = File.ReadAllLines(LANGUAGE_INI); string[] codes; for (int i = 0; i < lines.Length; i++) { codes = lines[i].Split('='); languageAcceptLetter.Add(codes[1][0]); languageDeniedLetter.Add(codes[1][2]); Console.WriteLine("Language [" + codes[0].ToUpper() + "] loaded!"); } Console.WriteLine(Environment.NewLine + lines.Length + " languages loaded!" + Environment.NewLine); } else { Console.WriteLine(Environment.NewLine + "No language file found!"); Console.WriteLine("Loading default language: [EN]" + Environment.NewLine); languageAcceptLetter.Add('Y'); languageDeniedLetter.Add('N'); } if (!DebugMode) { Console.Clear(); } }