Ejemplo n.º 1
0
        public static bool SaveConfig(string _DefaultProfile, ConfigWTF _ConfigWTF)
        {
            SaveConfigProfileForm saveConfigProfileForm = new SaveConfigProfileForm(_DefaultProfile, _ConfigWTF);

            saveConfigProfileForm.ShowDialog();
            return(saveConfigProfileForm.m_SavedProfile);
        }
Ejemplo n.º 2
0
        public static ConfigWTF LoadConfigFile(string _Filename)
        {
            ConfigWTF newConfigWTF = new ConfigWTF();

            newConfigWTF._LoadConfigFile(_Filename);
            return(newConfigWTF);
        }
Ejemplo n.º 3
0
 public ConfigSettingsForm(ConfigWTF _ConfigWTF, string _ProfileName)
 {
     m_ConfigWTF     = _ConfigWTF;
     m_ProfileName   = _ProfileName;
     this.Activated += ConfigSettingsForm_Activated;
     InitializeComponent();
 }
Ejemplo n.º 4
0
        public static ConfigWTF GetProfileConfigFile(string _ProfileName)
        {
            if (_ProfileName == "Active Wow Config")
            {
                return(ConfigWTF.LoadWTFConfigFile(WowVersionEnum.Vanilla));
            }

            string configWTFFile = "VF_WowLauncherSettings/Profiles/" + _ProfileName + "/Config.wtf";

            if (System.IO.File.Exists(configWTFFile) == true)
            {
                return(ConfigWTF.LoadConfigFile(configWTFFile));
            }

            return(null);
        }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
        private void ConfigSettingsForm_Load(object sender, EventArgs e)
        {
            Utility.SetPositionToMouse(this);
            //this.TopMost = true;
            c_ddlConfigProfile.Items.Clear();
            c_ddlConfigProfile.Items.Add("Active Wow Config");
            c_ddlConfigProfile.Items.AddRange(ConfigProfiles.GetProfileNames().ToArray());
            if (m_ConfigWTF == null)
            {
                m_ConfigWTF = ConfigWTF.LoadWTFConfigFile(WowVersionEnum.Vanilla);
            }
            if (c_ddlConfigProfile.Items.Contains(m_ProfileName) == false)
            {
                c_ddlConfigProfile.Items.Add(m_ProfileName);
            }

            c_ddlConfigProfile.SelectedItem = m_ProfileName;
            ConfigureConfigWTF();
        }
Ejemplo n.º 7
0
 public SaveConfigProfileForm(string _DefaultProfile, ConfigWTF _ConfigWTF)
 {
     m_DefaultProfile = _DefaultProfile;
     m_ConfigWTF      = _ConfigWTF;
     InitializeComponent();
 }
Ejemplo n.º 8
0
 public static void SaveConfigWTF(ConfigWTF _ConfigWTF, string _ProfileName)
 {
     Utility.AssertDirectory("VF_WowLauncherSettings/Profiles/" + _ProfileName);
     _ConfigWTF.SaveConfigFile("VF_WowLauncherSettings/Profiles/" + _ProfileName + "/Config.wtf");
 }
Ejemplo n.º 9
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");
        }
Ejemplo n.º 10
0
        internal static void EditWTFConfigSettings(WowVersionEnum _WowVersion)
        {
            ConfigSettingsForm configForm = new ConfigSettingsForm(ConfigWTF.LoadWTFConfigFile(_WowVersion), "Active Wow Config");

            configForm.ShowDialog();
        }