public MainForm() { // bring up the UI InitializeComponent(); // localize ModKit strings. Localizer localizer = new Localizer(this); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN"); Console.WriteLine(strings.Hello); // setup MainForm hooks. setupHooks(); // check for updates updater = new Updater(this); // init mainform controls stuff initControls(); // get the dota dir retrieveDotaDir(); // get the master 'game' and 'content' paths. gamePath = Path.Combine(dotaDir, "game", "dota_addons"); contentPath = Path.Combine(dotaDir, "content", "dota_addons"); // create these dirs if they don't exist. if (!Directory.Exists(gamePath)) { Directory.CreateDirectory(gamePath); } if (!Directory.Exists(contentPath)) { Directory.CreateDirectory(contentPath); } // get all the addons in the 'game' dir. addons = getAddons(); // setup custom tiles setupCustomTiles(); // deserialize settings deserializeSettings(); // auto-retrieve the workshop IDs for published addons if there are any. getWorkshopIDs(); // set currAddon to the addon that was last opened in last run of modkit. if (Settings.Default.LastAddon != "") { Addon a = getAddonFromName(Settings.Default.LastAddon); if (a != null) { changeCurrAddon(a); } } // basically, if this is first run of modkit, set the currAddon to w/e the default addon is in the workshop tools. if (currAddon == null) { changeCurrAddon(addons[getDefaultAddonName()]); } // init our features of Modkit initFeatures(); }
public MainForm() { // bring up the UI InitializeComponent(); // Check for settings updates. if (Settings.Default.UpdateRequired) { Settings.Default.Upgrade(); Settings.Default.UpdateRequired = false; Settings.Default.Save(); // open up changelog if (Settings.Default.OpenChangelog && !DEBUG) { Process.Start("https://github.com/Myll/Dota-2-ModKit/releases"); } } // setup hooks FormClosing += MainForm_FormClosing; tabControl.Selected += TabControl_Selected; githubTextBox.KeyDown += GithubTextBox_KeyDown; tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; // check for updates updater = new Updater(this); updater.checkForUpdates(); // allow public accessibility to these AddonTile = addonTile; ProgressSpinner1 = progressSpinner1; SpellLibBtn = spellLibraryBtn; MetroToolTip1 = metroToolTip1; GameTile = gameTile; ContentTile = contentTile; FindSoundNameBtn = findSoundNameBtn; // init mainform controls stuff Size size = new Size(steamTile.Width, steamTile.Height); steamTile.TileImage = (Image)new Bitmap(Resources.steam_icon, size); luaRadioBtn.Checked = true; tabControl.SelectedIndex = 0; notificationLabel.Text = ""; versionLabel.Text = "v" + version; retrieveDotaDir(); // at this point assume valid dota dir. Debug.WriteLine("Directory: " + dotaDir); // save the dota dir Settings.Default.DotaDir = dotaDir; gamePath = Path.Combine(dotaDir, "game", "dota_addons"); contentPath = Path.Combine(dotaDir, "content", "dota_addons"); // create these dirs if they don't exist. if (!Directory.Exists(gamePath)) { Directory.CreateDirectory(gamePath); } if (!Directory.Exists(contentPath)) { Directory.CreateDirectory(contentPath); } // get all the addons in the 'game' dir. addons = getAddons(); // does this computer have any dota addons? if (addons.Count == 0) { MetroMessageBox.Show(this, "No Dota 2 addons detected. There must be one addon for D2ModKit to function properly. Exiting.", "No Dota 2 addons detected.", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } // some functions in the Tick try and use mainform's controls on another thread. so we need to allot a very small amount of time for // mainform to init its controls. this is mainly for the very first run of modkit. Timer initTimer = new Timer(); initTimer.Interval = 100; initTimer.Tick += InitTimer_Tick; initTimer.Start(); }
public MainForm() { Instance = this; // bring up the UI InitializeComponent(); // localize ModKit strings. Localizer localizer = new Localizer(this); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN"); Console.WriteLine(strings.Hello); // setup MainForm hooks. setupHooks(); // check for updates updater = new Updater(this); // init mainform controls stuff initControls(); // get the dota dir retrieveDotaDir(); // get the master 'game' and 'content' paths. gamePath = Path.Combine(dotaDir, "game", "dota_addons"); contentPath = Path.Combine(dotaDir, "content", "dota_addons"); // create these dirs if they don't exist. if (!Directory.Exists(gamePath)) { Directory.CreateDirectory(gamePath); } if (!Directory.Exists(contentPath)) { Directory.CreateDirectory(contentPath); } // get all the addons in the 'game' dir. addons = getAddons(); // setup custom tiles setupCustomTiles(); // deserialize settings deserializeSettings(); // auto-retrieve the workshop IDs for published addons if there are any. getWorkshopIDs(); // set currAddon to the addon that was last opened in last run of modkit. if (Settings.Default.LastAddon != "") { Addon a = getAddonFromName(Settings.Default.LastAddon); if (a != null) { changeCurrAddon(a); } } // basically, if this is first run of modkit, set the currAddon to w/e the default addon is in the workshop tools. if (currAddon == null) { changeCurrAddon(addons[getDefaultAddonName()]); } // init our features of Modkit initFeatures(); }