Esempio n. 1
0
        public static void UpdateNow()
        {
            if (System.IO.File.Exists(StaticValues.LauncherToolsDirectory + "RunwyUpdateAndLauncher.bat") == false ||
                System.IO.File.ReadAllText(StaticValues.LauncherToolsDirectory + "RunwyUpdateAndLauncher.bat") != StaticValues.RunwyUpdateAndLauncherFileData)
            {
                Utility.AssertDirectory(StaticValues.LauncherToolsDirectory);
                System.IO.File.WriteAllText(StaticValues.LauncherToolsDirectory + "RunwyUpdateAndLauncher.bat", StaticValues.RunwyUpdateAndLauncherFileData);
            }

            //startInfo.FileName = Settings.WowDirectory + "WoW.exe";
            //startInfo.WorkingDirectory = Settings.WowDirectory;
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName = StaticValues.LauncherToolsDirectory + "RunwyUpdateAndLauncher.bat";
            //startInfo.FileName = Settings.WowDirectory + "22VF_RealmPlayersUploader 1.5\\RunWoWAndUploaderNoCMDWindow.vbs";
            //startInfo.WorkingDirectory = Settings.WowDirectory + "22VF_RealmPlayersUploader 1.5\\";
            startInfo.Arguments              = "\"" + StaticValues.LauncherWorkDirectory + "\"";
            startInfo.UseShellExecute        = false;
            startInfo.RedirectStandardOutput = false;
            startInfo.CreateNoWindow         = true;

            //ProcessStartInfo startInfo = new ProcessStartInfo();
            //RunwyUpdateAndLauncher
            //startInfo.FileName = "wyUpdate.exe";
            //startInfo.Arguments = "/skipinfo";
            var wyUpdateProcess = Process.Start(startInfo);

            System.Windows.Forms.Application.Exit();
        }
Esempio n. 2
0
        public static List <string> GetProfileNames()
        {
            Utility.AssertDirectory("VF_WowLauncherSettings/Profiles/");
            string[]      directories  = System.IO.Directory.GetDirectories("VF_WowLauncherSettings/Profiles");
            List <string> profileNames = new List <string>();

            foreach (string directory in directories)
            {
                if (System.IO.File.Exists(directory + "\\Config.wtf"))
                {
                    profileNames.Add(directory.Split('\\', '/').Last());
                }
            }
            return(profileNames);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            g_LauncherApp = new WoWLauncherApp();
            g_LauncherApp.InitiateMessageIDs();
            try
            {
                try
                {
                    StaticValues.StartupArguments = new CMDArguments(args);
                    if (StaticValues.StartupArguments["RealmPlayersUploader"] != null) // /RealmPlayersUploader
                    {
                        Settings.Initialize();
                        ConsoleUtility.CreateConsole();
                        bool anyProblem = false;
                        if (RealmPlayersUploader.IsValidUserID(Settings.UserID) == true)
                        {
                            bool sentAll = true;

                            if (Settings.HaveClassic == true)
                            {
                                if (Settings.Instance.ContributeRealmPlayers == true)
                                {
                                    Logger.ConsoleWriteLine("Starting to send VF_RealmPlayers Files", ConsoleColor.White);
                                    var sentRealmPlayersFiles = ServerComm.SendAddonData(Settings.UserID, "VF_RealmPlayers", WowVersionEnum.Vanilla, "VF_RealmPlayersData", 50, out sentAll);
                                    foreach (var file in sentRealmPlayersFiles)
                                    {
                                        Logger.ConsoleWriteLine("Sent VF_RealmPlayers File \"" + file + "\"", ConsoleColor.Green);
                                    }
                                    if (sentAll == true)
                                    {
                                        InstalledAddons.ModifyInstalledAddon("VF_RealmPlayers", WowVersionEnum.Vanilla, "VF_RP_LastUploadedData", "\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"");
                                    }
                                    else
                                    {
                                        anyProblem = true;
                                    }
                                }


                                if (Settings.Instance.ContributeRaidStats == true)
                                {
                                    if (InstalledAddons.GetAddonInfo("VF_RaidStats", WowVersionEnum.Vanilla) != null)
                                    {
                                        Logger.ConsoleWriteLine("Starting to send VF_RaidStats Files", ConsoleColor.White);
                                        var sentRaidStatsFiles = ServerComm.SendAddonData(Settings.UserID, "VF_RaidStats", WowVersionEnum.Vanilla, "VF_RaidStatsData", 5000, out sentAll);
                                        foreach (var file in sentRaidStatsFiles)
                                        {
                                            Logger.ConsoleWriteLine("Sent VF_RaidStats File \"" + file + "\"", ConsoleColor.Cyan);
                                        }
                                        if (sentAll == true)
                                        {
                                            InstalledAddons.ModifyInstalledAddon("VF_RaidStats", WowVersionEnum.Vanilla, "VF_RS_LastUploadedData", "\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"");
                                        }
                                        else
                                        {
                                            anyProblem = true;
                                        }
                                    }
                                    else
                                    {
                                        Logger.ConsoleWriteLine("Starting to send VF_RaidDamage Files", ConsoleColor.White);
                                        var sentRaidDamageFiles = ServerComm.SendAddonData(Settings.UserID, "VF_RaidDamage", WowVersionEnum.Vanilla, "VF_RaidDamageData", 5000, out sentAll);
                                        foreach (var file in sentRaidDamageFiles)
                                        {
                                            Logger.ConsoleWriteLine("Sent VF_RaidDamage File \"" + file + "\"", ConsoleColor.Cyan);
                                        }
                                        if (sentAll == true)
                                        {
                                            InstalledAddons.ModifyInstalledAddon("VF_RaidDamage", WowVersionEnum.Vanilla, "VF_RD_LastUploadedData", "\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"");
                                        }
                                        else
                                        {
                                            anyProblem = true;
                                        }
                                    }
                                }
                            }
                            if (Settings.HaveTBC == true)
                            {
                                if (Settings.Instance.ContributeRealmPlayers == true)
                                {
                                    Logger.ConsoleWriteLine("Starting to send VF_RealmPlayersTBC Files", ConsoleColor.White);
                                    var sentRealmPlayersTBCFiles = ServerComm.SendAddonData(Settings.UserID, "VF_RealmPlayersTBC", WowVersionEnum.TBC, "VF_RealmPlayersData", 50, out sentAll);
                                    foreach (var file in sentRealmPlayersTBCFiles)
                                    {
                                        Logger.ConsoleWriteLine("Sent VF_RealmPlayersTBC File \"" + file + "\"", ConsoleColor.Cyan);
                                    }
                                    if (sentAll == true)
                                    {
                                        InstalledAddons.ModifyInstalledAddon("VF_RealmPlayersTBC", WowVersionEnum.TBC, "VF_RP_LastUploadedData", "\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"");
                                    }
                                    else
                                    {
                                        anyProblem = true;
                                    }
                                }

                                if (Settings.Instance.ContributeRaidStats == true)
                                {
                                    Logger.ConsoleWriteLine("Starting to send VF_RaidStatsTBC Files", ConsoleColor.White);
                                    var sentRaidStatsTBCFiles = ServerComm.SendAddonData(Settings.UserID, "VF_RaidStatsTBC", WowVersionEnum.TBC, "VF_RaidStatsData", 5000, out sentAll);
                                    foreach (var file in sentRaidStatsTBCFiles)
                                    {
                                        Logger.ConsoleWriteLine("Sent VF_RaidStatsTBC File \"" + file + "\"", ConsoleColor.Cyan);
                                    }
                                    if (sentAll == true)
                                    {
                                        InstalledAddons.ModifyInstalledAddon("VF_RaidStatsTBC", WowVersionEnum.TBC, "VF_RS_LastUploadedData", "\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"");
                                    }
                                    else
                                    {
                                        anyProblem = true;
                                    }
                                }
                            }
                            ServerComm.SendAddonData_Dispose();
                        }
                        else
                        {
                            anyProblem = true;
                            Logger.ConsoleWriteLine("UserID: " + Settings.UserID + " was not a valid UserID!");
                        }
                        if (anyProblem == true)
                        {
                            Logger.ConsoleWriteLine("Due to uploading problems, the window is closing in 10 seconds! Feel free to manually close it earlier. If this happens often and annoys you, please take a screenshot and make a thread on the realmplayers forum", ConsoleColor.White);
                            System.Threading.Thread.Sleep(10000);
                        }
                        else
                        {
                            if (Settings.Instance.Wait5SecondsAfterUpload == true)
                            {
                                Logger.ConsoleWriteLine("Closing in 5 seconds!", ConsoleColor.White);
                                System.Threading.Thread.Sleep(5000);
                            }
                        }
                        return;
                    }
                    else if (StaticValues.StartupArguments["LaunchWow"] != null)
                    {
                        Settings.Initialize();
                        ConsoleUtility.CreateConsole();
                        string useRealm         = StaticValues.StartupArguments["LaunchWow"];
                        string useConfigProfile = "Active Wow Config";
                        if (StaticValues.StartupArguments["ConfigProfile"] != null)
                        {
                            useConfigProfile = StaticValues.StartupArguments["ConfigProfile"];
                        }

                        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();

                        if (Settings.Instance.RealmLists.ContainsKey(useRealm) == false)
                        {
                            return;
                        }

                        var realmInfo = Settings.Instance.RealmLists[useRealm];
                        if (realmInfo.WowVersion == WowVersionEnum.TBC)
                        {
                            useConfigProfile = "Active Wow Config";
                            if (Settings.Instance.ClearWDB == true)
                            {
                                Utility.DeleteDirectory(Settings.GetWowDirectory(realmInfo.WowVersion) + "Cache");
                            }
                        }
                        else
                        {
                            if (Settings.Instance.ClearWDB == true)
                            {
                                Utility.DeleteDirectory(Settings.GetWowDirectory(realmInfo.WowVersion) + "WDB");
                            }
                        }

                        if (RealmPlayersUploader.IsValidUserID(Settings.UserID) == true)
                        {
                            if (System.IO.File.Exists(StaticValues.LauncherToolsDirectory + "RunWowAndUploader.bat") == false ||
                                System.IO.File.ReadAllText(StaticValues.LauncherToolsDirectory + "RunWowAndUploader.bat") != StaticValues.RunWowAndUploaderBatFileData)
                            {
                                Utility.AssertDirectory(StaticValues.LauncherToolsDirectory);
                                System.IO.File.WriteAllText(StaticValues.LauncherToolsDirectory + "RunWowAndUploader.bat", StaticValues.RunWowAndUploaderBatFileData);
                            }

                            if (Settings.Instance.RunWoWNotAdmin == false)
                            {
                                //startInfo.FileName = Settings.WowDirectory + "WoW.exe";
                                //startInfo.WorkingDirectory = Settings.WowDirectory;

                                startInfo.FileName = StaticValues.LauncherToolsDirectory + "RunWowAndUploader.bat";
                                //startInfo.FileName = Settings.WowDirectory + "22VF_RealmPlayersUploader 1.5\\RunWoWAndUploaderNoCMDWindow.vbs";
                                //startInfo.WorkingDirectory = Settings.WowDirectory + "22VF_RealmPlayersUploader 1.5\\";
                                startInfo.Arguments = "\"" + Settings.GetWowDirectory(realmInfo.WowVersion) + "\"";
                            }
                            else
                            {
                                string slash = "\\\\";
                                string snuff = "\\\"";

                                startInfo.FileName  = StaticValues.LauncherToolsDirectory + "NotAdmin.exe";
                                startInfo.Arguments = "\"cmd.exe\" \".\\\\\" "
                                                      + "\"/c "
                                                      + snuff
                                                      + snuff + StaticValues.LauncherWorkDirectory.Replace("\\", slash) + "/" + StaticValues.LauncherToolsDirectory.Replace("\\", slash) + "RunWowAndUploader.bat" + snuff
                                                      + " " + snuff + Settings.GetWowDirectory(realmInfo.WowVersion) + "\\" + snuff
                                                      + snuff
                                                      + "\" nowindow";
                            }
                            startInfo.UseShellExecute        = false;
                            startInfo.RedirectStandardOutput = false;
                            startInfo.CreateNoWindow         = true;
                        }
                        else
                        {
                            startInfo.FileName         = Settings.GetWowDirectory(realmInfo.WowVersion) + "WoW.exe";
                            startInfo.WorkingDirectory = Settings.GetWowDirectory(realmInfo.WowVersion);
                        }
                        Logger.ConsoleWriteLine("Starting to Launch WoW for realm: \"" + useRealm + "\", with ConfigProfile: \"" + useConfigProfile + "\"", ConsoleColor.Green);
                        LaunchFunctions.LaunchWow(useConfigProfile, useRealm, startInfo);
                        Logger.ConsoleWriteLine("Done with Launching WoW! Closing console window in 5 seconds!", ConsoleColor.White);
                        System.Threading.Thread.Sleep(5000);
                        return;
                    }

                    g_AppMutex = new Mutex(true, "Local\\VF_WoWLauncher");
                    if (g_AppMutex == null || g_AppMutex.WaitOne(TimeSpan.Zero, true))
                    {
                        Settings.Initialize();

                        if (Settings.DebugMode)
                        {
                            //ConsoleUtility.CreateConsole();
                        }

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        var launcherWindow = new LauncherWindow();
                        g_LauncherApp.HandleJumpListCommands(launcherWindow, StaticValues.StartupArguments);
                        Application.Run(launcherWindow);
                        if (g_AppMutex != null)
                        {
                            ForumReader.SaveForumSections();
                            Settings.Save();
                            ReleaseAppMutex();
                        }
                    }
                    else
                    {
                        g_AppMutex = null;
                        g_LauncherApp.HandleJumpListCommands(null, StaticValues.StartupArguments);
                    }
                }
                catch (Exception ex)
                {
                    ReleaseAppMutex();
                    Utility.MessageBoxShow("Exception occured! Please printscreen this message and send to Dilatazu @ realmplayers forums:\r\n" + ex.ToString());
                    ConsoleUtility.CreateConsole();
                    Logger.LogException(ex);
                    Logger.ConsoleWriteLine("Closing in 10 seconds!", ConsoleColor.White);
                    System.Threading.Thread.Sleep(10000);
                }
            }
            catch (Exception ex)
            {
                ReleaseAppMutex();
                Utility.MessageBoxShow("Very unexpected Exception occured! Please printscreen this message and send to Dilatazu @ realmplayers forums:\r\n" + ex.ToString());
            }
            ReleaseAppMutex();
        }
Esempio n. 4
0
 public static void Save()
 {
     Utility.AssertDirectory(StaticValues.LauncherSettingsDirectory);
     Utility.SaveSerialize(StaticValues.LauncherSettingsDirectory + "Settings.cfg", sm_Settings, false);
 }
Esempio n. 5
0
 public static void SaveConfigWTF(ConfigWTF _ConfigWTF, string _ProfileName)
 {
     Utility.AssertDirectory("VF_WowLauncherSettings/Profiles/" + _ProfileName);
     _ConfigWTF.SaveConfigFile("VF_WowLauncherSettings/Profiles/" + _ProfileName + "/Config.wtf");
 }