Example #1
0
 private void c_ddlConfigProfile_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((string)c_ddlConfigProfile.SelectedItem != m_ProfileName)
     {
         m_ProfileName = (string)c_ddlConfigProfile.SelectedItem;
         c_cbMaximized.CheckedChanged           -= m_ConfigWTF.EventMaximizedCB_Changed;
         c_cbWindowMode.CheckedChanged          -= m_ConfigWTF.EventWindowModeCB_Changed;
         c_ddlResolution.SelectedIndexChanged   -= m_ConfigWTF.EventResolutionDDL_Changed;
         c_ddlScriptMemory.SelectedIndexChanged -= m_ConfigWTF.EventScriptMemoryDDL_Changed;
         c_lbSettings.MouseDoubleClick          -= m_ConfigWTF.EventAllConfigsLB_MouseDoubleClick;
         m_ConfigWTF.Dispose();
         m_ConfigWTF = ConfigProfiles.GetProfileConfigFile(m_ProfileName);
         ConfigureConfigWTF();
     }
     c_lbSettings.Focus();
 }
Example #2
0
        private static void _LaunchWow(string _Config, string _RealmName, ProcessStartInfo _WowProcessStartInfo)
        {
            if (System.IO.File.Exists("VF_WowLauncherTools\\NotAdmin.exe") == false)
            {
                VF_Utility.AssertDirectory("VF_WowLauncherTools");
                System.IO.File.WriteAllBytes("VF_WowLauncherTools\\NotAdmin.exe", Properties.Resources.NotAdmin);
            }

            Logger.LogText("Started Launching");

            WowVersionEnum wowVersion    = WowVersionEnum.Vanilla;
            string         realmListFile = "";

            if (Settings.Instance.RealmLists.ContainsKey(_RealmName) == true)
            {
                var realmList = Settings.Instance.RealmLists[_RealmName];
                realmListFile = realmList.GetRealmListWTF();
                wowVersion    = realmList.WowVersion;
            }
            else
            {
                Logger.LogText("Unexpected Error: No such Realm exists!");
                return;
            }

            if (_Config != "Active Wow Config")
            {
                ConfigWTF config = ConfigProfiles.GetProfileConfigFile(_Config);
                config.SaveWTFConfigFile(wowVersion);
                Settings.Instance.AddLaunchShortcut(_Config, _RealmName);
            }

            DateTime startCheck = DateTime.UtcNow;

            if (System.IO.File.Exists(Settings.GetWowDirectory(wowVersion) + "realmlist.wtf") == false || System.IO.File.ReadAllText(Settings.GetWowDirectory(wowVersion) + "realmlist.wtf") != realmListFile)
            {
                System.IO.File.WriteAllText(Settings.GetWowDirectory(wowVersion) + "realmlist.wtf", realmListFile);
                if (System.IO.File.Exists(Settings.GetWowDirectory(wowVersion) + "realmlist.wtf") == false)
                {
                    Logger.LogText("Unexpected Error: There is no realmlist.wtf!");
                    return;
                }
                Logger.LogText("Waiting for realmlist.wtf to get saved correctly");
                startCheck = DateTime.UtcNow;
                while ((startCheck - System.IO.File.GetLastWriteTimeUtc(Settings.GetWowDirectory(wowVersion) + "realmlist.wtf")).Seconds > 10)
                {
                    Logger.LogText(".", false);
                    System.Threading.Thread.Sleep(20);
                    if ((DateTime.UtcNow - startCheck).Seconds > 10)
                    {
                        Logger.LogText("Unexpected Error: Took too long trying to create the new realmlist.wtf!");
                        return;
                    }
                }
            }
            Logger.LogText("realmlist.wtf is saved, Launching World of Warcraft!");
            Process[] processesBeforeStart = Process.GetProcessesByName("Wow");
            var       wowProcess           = Process.Start(_WowProcessStartInfo);

            if (_WowProcessStartInfo.FileName.ToLower().EndsWith("wow.exe") == false)
            {
                wowProcess = null;
                while (wowProcess == null && (DateTime.UtcNow - startCheck).TotalSeconds < 30)
                {
                    Utility.SoftThreadSleep(500);
                    Process[] currentProcesses = Process.GetProcessesByName("Wow");
                    foreach (var currProcess in currentProcesses)
                    {
                        if (processesBeforeStart.Length == 0 || processesBeforeStart.FirstOrDefault((_Value) => _Value.Id == currProcess.Id) == null)
                        {
                            //Logger.LogText("found new Wow.exe Process!");
                            wowProcess = currProcess;
                            break;
                        }
                    }
                }
            }
            if (wowProcess == null)
            {
                Utility.MessageBoxShow("There was an error, WoW could not be launched");
                return;
            }
            startCheck = DateTime.UtcNow;
            try
            {
                while (wowProcess.WaitForInputIdle(50) == false && (DateTime.UtcNow - startCheck).TotalSeconds < 20)
                {
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            //wait 1 extra second
            Utility.SoftThreadSleep(1000);

            Logger.LogText("Done Launching");
        }
Example #3
0
        public static void EditProfileConfig(string _Profile)
        {
            ConfigSettingsForm configForm = new ConfigSettingsForm(ConfigProfiles.GetProfileConfigFile(_Profile), _Profile);

            configForm.ShowDialog();
        }