Esempio n. 1
0
 /// <summary>
 /// Class constructor
 /// </summary>
 static ProcessManager()
 {
     config = new Config();
     wowProcess = new BlackMagic();
     CommandManager = new CommandManager();
     Injector = new InjectionManager();
     TLS = 0x0;
     Profile = new Profile();
     WowHWND = 0;
     BotManager = new BotManager();
     ScriptHost = new Host();
     WayPointManager.Instance.Init();
     Caronte = new Caronte.Caronte();
 }
Esempio n. 2
0
        /// <summary>
        /// Load Application config file
        /// </summary>
        public static void LoadConfig()
        {
            var serializer = new Serializer<Config>();

            try
            {
                config = serializer.Load(ConfigFileName);

                // Check version of config file
                if (ProcessManager.ConfigVersion != config.Version)
                    throw new ConfigFileChangedException();

                // Decrypt auto-login password
                if (!string.IsNullOrEmpty(config.Account.LoginPassword))
                {
                    try
                    {
                        config.Account.DecryptPassword(
                                config.Account.LoginPassword);
                    }
                    catch (Exception)
                    {
                        // We couldn't decrypt the password for some reason. We reset it to blank.
                        config.Account.LoginPassword = "";
                    }
                }

                OnConfigurationChanged();
            }
            catch (FileNotFoundException)
            {
                // Show App configuration window for the first time run
                if (FirstTimeRun != null)
                    FirstTimeRun();
                else
                    TerminateOnInternalBug(Bugs.CONFIG_NOT_FOUND,
                        "Config file config.xml not found");
            }
            catch (ConfigFileChangedException)
            {
                if (ConfigFileChanged != null)
                    ConfigFileChanged();
                else
                    TerminateOnInternalBug(Bugs.WRONG_CONFIG_VERSION,
                        "Config file config.xml has version " +
                        config.Version + " that different from application version " +
                        ProcessManager.ConfigVersion);
            }
            catch (WoWDataNotFoundException ex)
            {
                TerminateOnInternalBug(Bugs.WOWDATA_NOT_FOUND, ex.Message);
            }
            catch (Exception e)
            {
                TerminateOnInternalBug(Bugs.ERROR_LOAD_CONFIG,
                            "Unable load config.xml : " + e.Message);
            }
        }