Example #1
0
        // load values from settings file into static strings
        public static void LoadSettings()
        {
            // Load content of settings file
            string[] filecontent = File.ReadAllLines("settings.txt");

            // check if settings content is valid, if not reload settings content
            if (filecontent.Length != 2)
            {
                // throw some error message and create settings file new
                ErrorReports.SettingsError("Settings file must contain exactly two entries, one for language and one for mhw exe path");
                // load content again
                filecontent = File.ReadAllLines("settings.txt");
            }

            // load setting into static variables		==> NEEDS FURTHER ERROR CHECKS
            language = filecontent[0].Split('=')[1];
            mhw_path = filecontent[1].Split('=')[1];
        }
Example #2
0
        public static void LoadMods()
        {
            // read modlist.txt
            string[] fileContent = File.ReadAllLines("modlist.txt");


            // split every line in file ';'
            foreach (string s in fileContent)
            {
                if (s != "")                // check if line contains data
                {
                    // split line and store data in array
                    string[] splitDummy = s.Split(';');

                    // check if entries available
                    if (splitDummy.Length == 0)
                    {
                        ErrorReports.ModlistError("Split lenght is zero.");
                    }
                    else
                    {
                        // check if entries have the correct amaount
                        if (splitDummy.Length != 3)
                        {
                            ErrorReports.ModlistError("Split lenght is not three.");
                        }
                        else
                        {
                            // add entry to modlist listview List
                            lvi_ModList.Add(new ListViewItem(new String[] { splitDummy[0], splitDummy[1], splitDummy[2] }));
                        }
                    }
                }
                else                 // report error for empty line
                {
                    ErrorReports.ModlistError("Empty line.");
                }
            }
        }
Example #3
0
        void Btn_RunMHWClick(object sender, EventArgs e)
        {
            // just to be sure ... check all paths again
            // if one ore more files cannot found do nothing and throw some error

            bool errorDetected = false;

            if (!File.Exists(Settings.MHW_Path))
            {
                ErrorReports.FileNotFoundError(Settings.MHW_Path);
                errorDetected = true;
            }

            foreach (ListViewItem lvi in ModList.Lvi_Modlist)
            {
                if (!File.Exists(lvi.SubItems[2].Text))
                {
                    ErrorReports.FileNotFoundError(lvi.SubItems[2].Text);
                    errorDetected = true;
                }
            }

            // if no error occured, start mhw first, wait ten seconds and start the mods
            if (!errorDetected)
            {
                Process.Start(Settings.MHW_Path);

                System.Threading.Thread.Sleep(10000);

                foreach (ListViewItem lvi in ModList.Lvi_Modlist)
                {
                    Process.Start(lvi.SubItems[2].Text);
                }

                // once all the work is done bow yourselfe and shut down
                Application.Exit();
            }
        }