Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var DofusPath       = @"C:\Users\NOM D'UTILISATEUR\AppData\Local\Ankama\Dofus";
            var AccountName     = "NomDeCompte";
            var AccountPassword = "******";

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

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

                MapsManager.Init(Properties.Settings.Default.DofusPath + @"\app\content\maps");
                IconsManager.Instance.Initialize(Properties.Settings.Default.DofusPath + @"\app\content\gfx\items");
                ObjectDataManager.Instance.AddReaders(Properties.Settings.Default.DofusPath + @"\app\data\common");
                I18nDataManager.Instance.AddReaders(Properties.Settings.Default.DofusPath + @"\app\data\i18n");
                I18nDataManager.Instance.DefaultLanguage = Languages.French;
                ImageManager.Init(Properties.Settings.Default.DofusPath);
            }).ContinueWith(p =>
            {
                Client = new DofusClient(AccountName, AccountPassword)
                {
                    Debug = false
                };

                Client.Logger.OnLog += Logger_OnLog;
            });
        }
Пример #2
0
        public void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            CleanUpOldTemps();
            CheckOrPromptForSetup();
            MapsManager.Init(osuSongsFolder);

            string bg = SettingManager.Get("customBgPath");

            if (!string.IsNullOrEmpty(bg))
            {
                SetFormCustomBackground(bg);
            }

            if (SettingManager.Get("overlayMode"))
            {
                // register hotkey, 2|4: CONTROL|SHIFT, 36: HOME
                HotkeyManager.Register(HotkeyManager.GetRuntimeHandle(this), 2 | 4, 36);
                // sub to hotkey press event
                HotkeyManager.HotkeyPressed += HotkeyPressed;
            }


            if (startupHide == true) // can only do this stuff when LOADED.
            {
                HideWindow();        // the uri handler is handling, lets just lay low in the background
            }
            CheckForUpdates();
        }
Пример #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                GlobalConfiguration.Instance.Initialize();

                AccountConfiguration accountToConnect;

                using (var af = new AccountsForm())
                {
                    if (af.ShowDialog() != DialogResult.OK)
                    {
                        Environment.Exit(-1);
                    }

                    accountToConnect = af.AccountToConnect;
                }

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

                    Logger.Default.OnLog += Logger_OnLog;

                    Settings.Default.DofusPath = GlobalConfiguration.Instance.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 =>
                {
                    var fullSocketConfiguration = new FullSocketConfiguration
                    {
                        RealAuthHost = "213.248.126.40",
                        RealAuthPort = 443
                    };

                    var messageReceiver = new MessageReceiver();
                    messageReceiver.Initialize();
                    _fullSocket        = new FullSocket.FullSocket(fullSocketConfiguration, messageReceiver);
                    var dispatcherTask = new DispatcherTask(new MessageDispatcher(), _fullSocket);
                    _account           = _fullSocket.Connect(accountToConnect.Username, accountToConnect.Password, this);
                    LogWelcomeMessage();
                });
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Environment.Exit(-1);
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
        private static void CheckBlueSheepDatas()
        {
            // Create the BlueSheep needed folders
            string applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string blueSheepPath       = Path.Combine(applicationDataPath, "BlueSheep");

            if (!Directory.Exists(blueSheepPath))
            {
                Directory.CreateDirectory(blueSheepPath);
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Accounts")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Accounts")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Groups")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Groups")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Temp")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Temp")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Paths")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Paths")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "IAs")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "IAs")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Logs")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Logs")).Attributes = FileAttributes.Normal;
            }

            string bsConfPath = Path.Combine(blueSheepPath, "bs.conf");

            if (File.Exists(bsConfPath))
            {
                StreamReader sr   = new StreamReader(bsConfPath);
                string       path = sr.ReadLine();
                if (Directory.Exists(Path.Combine(path, "app", "content", "maps")))
                {
                    ActualMainForm.DofusPath = path;
                }
                else
                {
                    sr.Close();
                    DofusPathForm frm = new DofusPathForm(ActualMainForm);
                    frm.ShowDialog();
                }
            }
            else
            {
                DofusPathForm frm = new DofusPathForm(ActualMainForm);
                frm.ShowDialog();
            }


            FileInfo fileInfo = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Logs.txt");

            fileInfo.Delete();
            using (fileInfo.Create())
            {
            }

            //fileInfo = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Packets.txt");
            //fileInfo.Delete();
            //using (fileInfo.Create())
            //{
            //}


            I18NFileAccessor i18NFileAccessor = new I18NFileAccessor();

            if (File.Exists(@"C:\Program Files (x86)\Dofus2\app\data\i18n\i18n_fr.d2i"))
            {
                string path = @"C:\Program Files (x86)\Dofus2\app\data\i18n\i18n_fr.d2i";
                i18NFileAccessor.Init(path);
                I18N i18N = new I18N(i18NFileAccessor);
                GameData.Init(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                              + @"\Dofus2\app\data\common");
                MapsManager.Init(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                                 + @"\Dofus2\app\content\maps");
            }
            else if (File.Exists(bsConfPath))
            {
                List <string> PaysList = new List <string>();
                PaysList.AddRange(new List <string>()
                {
                    "fr", "en", "ja", "es", "de", "pt"
                });
                foreach (string pays in PaysList)
                {
                    string combinedPath = Path.Combine(ActualMainForm.DofusPath, "app", "data", "i18n", "i18n_" + pays + ".d2i");
                    if (File.Exists(combinedPath))
                    {
                        i18NFileAccessor.Init(combinedPath);
                        break;
                    }
                }
                I18N i18N = new I18N(i18NFileAccessor);
                GameData.Init(Path.Combine(ActualMainForm.DofusPath, "app", "data", "common"));
                MapsManager.Init(Path.Combine(ActualMainForm.DofusPath, "app", "content", "maps"));
            }
            //else
            //{
            //    i18NFileAccessor.Init(Path.Combine(ActualMainForm.DofusPath, "app", "data", "i18n", "i18n_fr.d2i"));
            //    I18N i18N = new I18N(i18NFileAccessor);
            //    GameData.Init(@"D:\Dofus2\app\data\common");
            //    MapsManager.Init(@"D:\Dofus2\app\content\maps");
            //}
            IntelliSense.InitMonsters();
            IntelliSense.InitItems();
            IntelliSense.InitServers();
        }