Beispiel #1
0
        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();
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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 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();
            }
        }