Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                var accountFile = File.ReadAllText(Directory.GetCurrentDirectory() + "/config/account.txt");
                var dofusPath   = File.ReadAllText(Directory.GetCurrentDirectory() + "/config/dofuspath.txt");

                var accountName     = accountFile.Split(':')[0];
                var accountPassword = accountFile.Split(':')[1];

                Task.Factory.StartNew(() =>
                {
                    CommandManager.Build();
                    MessageReceiver.Initialize();
                    ProtocolTypeManager.Initialize();

                    Settings.Default.DofusPath = dofusPath;
                    Settings.Default.Save();

                    MapsManager.Init(Settings.Default.DofusPath + @"\app\content\maps");
                    IconsManager.Instance.Initialize(Settings.Default.DofusPath + @"\app\content\gfx\items");
                    ObjectDataManager.Instance.AddReaders(Settings.Default.DofusPath + @"\app\data\common");

                    FastD2IReader.Instance.Init(Settings.Default.DofusPath + @"\app\data\i18n" +
                                                "\\i18n_fr.d2i");

                    ImageManager.Init(Settings.Default.DofusPath);
                }).ContinueWith(p =>
                {
                    _client = new DofusClient(accountName, accountPassword)
                    {
                        Debug = true
                    };

                    _client.Logger.OnLog += Logger_OnLog;
                });
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Environment.Exit(-1);
            }
        }