// if error occures while doing stuff with settings file, throw some message to the user, delete the corrupted file and restart the application (triggering CreateDataFiles.SettingsFile) public static void SettingsError(string info) { MessageBox.Show("Settings file contains some errors.\nFile will be deleted and created new with default values.\n" + info, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); File.Delete("settings.txt"); CreateDataFiles.SettingsFile(); }
// DEBUG //ListViewItem lviModData = new ListViewItem(new String[]{"0","ModName","ModPath"}); public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // // Check if some files need to be created if (!File.Exists("settings.txt")) { CreateDataFiles.SettingsFile(); } if (!File.Exists("modlist.txt")) { CreateDataFiles.ModsFile(); } // Load language and MHW-Exe path Settings.LoadSettings(); // Load UI text and informations LoadUI(); // Load Mods and add them to the listView control ModList.LoadMods(); LoadItemsToListView(); // DEBUG COMMANDS //lv_ModList.Items.Add(lviModData); //Settings.UpdateSettings("en","NewPath"); //MessageBox.Show("Lang: "+Settings.Language+"\nPath: "+Settings.MHW_Path); //if(File.Exists(Settings.MHW_Path)) // MessageBox.Show("FertilizerMOD found"); //Process.Start(Settings.MHW_Path); }