コード例 #1
0
        /// <summary>
        /// The main method for startup and initialization.
        /// </summary>
        public void Execute()
        {
            string themePath = ClientConfiguration.Instance.GetThemePath(UserINISettings.Instance.ClientTheme);

            if (themePath == null)
            {
                themePath = ClientConfiguration.Instance.GetThemeInfoFromIndex(0)[1];
            }

            ProgramConstants.RESOURCES_DIR = "Resources\\" + themePath;

            if (!Directory.Exists(ProgramConstants.RESOURCES_DIR))
            {
                throw new DirectoryNotFoundException("Theme directory not found!" + Environment.NewLine + ProgramConstants.RESOURCES_DIR);
            }

            Logger.Log("Initializing updater.");

            File.Delete(ProgramConstants.GamePath + "version_u");

            CUpdater.Initialize(ClientConfiguration.Instance.LocalGame);

            Logger.Log("Operating system: " + Environment.OSVersion.VersionString);
            Logger.Log("Selected OS profile: " + MainClientConstants.OSId.ToString());

            // The query in CheckSystemSpecifications takes lots of time,
            // so we'll do it in a separate thread to make startup faster
            Thread thread = new Thread(CheckSystemSpecifications);

            thread.Start();

            Thread idThread = new Thread(GenerateOnlineId);

            idThread.Start();

            if (Directory.Exists(MainClientConstants.gamepath + "Updater"))
            {
                Logger.Log("Attempting to delete temporary updater directory.");
                try
                {
                    Directory.Delete(MainClientConstants.gamepath + "Updater", true);
                }
                catch
                {
                }
            }

            if (ClientConfiguration.Instance.CreateSavedGamesDirectory)
            {
                if (!Directory.Exists(MainClientConstants.gamepath + "Saved Games"))
                {
                    Logger.Log("Saved Games directory does not exist - attempting to create one.");
                    try
                    {
                        Directory.CreateDirectory(MainClientConstants.gamepath + "Saved Games");
                    }
                    catch
                    {
                    }
                }
            }

            if (CUpdater.CustomComponents != null)
            {
                Logger.Log("Removing partial custom component downloads.");
                foreach (CustomComponent component in CUpdater.CustomComponents)
                {
                    try
                    {
                        File.Delete(MainClientConstants.gamepath + component.LocalPath + "_u");
                    }
                    catch
                    {
                    }
                }
            }

            FinalSunSettings.WriteFinalSunIni();

            WriteInstallPathToRegistry();

            ClientConfiguration.Instance.RefreshSettings();

            GameClass gameClass = new GameClass();

            gameClass.Run();
        }
コード例 #2
0
        /// <summary>
        /// The main method for startup and initialization.
        /// </summary>
        public void Execute()
        {
            int themeId = UserINISettings.Instance.ClientTheme;

            if (themeId >= ClientConfiguration.Instance.ThemeCount || themeId < 0)
            {
                themeId = 0;
                UserINISettings.Instance.ClientTheme.Value = 0;
            }

            ProgramConstants.RESOURCES_DIR = "Resources\\" + ClientConfiguration.Instance.GetThemeInfoFromIndex(themeId)[1];

            Logger.Log("Initializing updater.");

            File.Delete(ProgramConstants.GamePath + "version_u");

            CUpdater.Initialize(ClientConfiguration.Instance.LocalGame);

            Logger.Log("Operating system: " + Environment.OSVersion.VersionString);
            Logger.Log("Selected OS profile: " + MainClientConstants.OSId.ToString());

            // The query in CheckSystemSpecifications takes lots of time,
            // so we'll do it in a separate thread to make startup faster
            Thread thread = new Thread(CheckSystemSpecifications);

            thread.Start();

            if (Directory.Exists(MainClientConstants.gamepath + "Updater"))
            {
                Logger.Log("Attempting to delete temporary updater directory.");
                try
                {
                    Directory.Delete(MainClientConstants.gamepath + "Updater", true);
                }
                catch
                {
                }
            }

            if (CUpdater.CustomComponents != null)
            {
                Logger.Log("Removing partial custom component downloads.");
                foreach (CustomComponent component in CUpdater.CustomComponents)
                {
                    try
                    {
                        File.Delete(MainClientConstants.gamepath + component.LocalPath + "_u");
                    }
                    catch
                    {
                    }
                }
            }

            FinalSunSettings.WriteFinalSunIni();

            WriteInstallPathToRegistry();

            ClientConfiguration.Instance.RefreshSettings();

            GameClass gameClass = new GameClass();

            gameClass.Run();
        }