Пример #1
0
        void diabloProcess_Exited(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                try
                {
                    this.Invoke(new ProcessExitedDelegate(diabloProcess_Exited), sender, e);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                diabloPanel.ReleaseDiabloWindow();

                if (diabloWindow != null)
                {
                    diabloWindow.Close();
                    diabloWindow = null;
                }

                ConsoleTab.WriteLine("Closed " + ((Process)sender).StartInfo.FileName);
            }
        }
Пример #2
0
        public void LoadDiablo2(int loginDelay)
        {
            if (diabloWindow == null)
            {
                if (!string.IsNullOrEmpty(exePath) && System.IO.File.Exists(exePath))
                {
                    Process          diabloProcess = new Process();
                    ProcessStartInfo info          = new ProcessStartInfo();
                    info.FileName  = exePath;
                    info.Arguments = "-w -ns";

                    // Crap Fett007 added to bring master variable
                    string username = string.Empty;
                    string password = string.Empty;
                    string charslot = string.Empty;
                    string master   = string.Empty;

                    foreach (string accountString in BlueVex2.Properties.Settings.Default.Accounts)
                    {
                        if (accountString.StartsWith(defaultAccount + ","))
                        {
                            string[] parts = accountString.Split(',');
                            username = parts[0];
                            password = parts[1];
                            charslot = parts[2];
                            master   = parts[3];
                        }
                    }


                    switch (master)
                    {
                    case "True":
                        info.Arguments = "-w -sndbkg";
                        break;

                    case "False":
                        info.Arguments = "-w -ns";
                        break;
                    }

                    ConsoleTab.WriteLine("Loading " + exePath);

                    diabloProcess = Process.Start(info);
                    diabloProcess.EnableRaisingEvents = true;
                    diabloProcess.Exited += new EventHandler(diabloProcess_Exited);

                    // Wait for the app to load
                    diabloProcess.WaitForInputIdle();

                    diabloHandle = diabloProcess.MainWindowHandle;

                    // If greater than Windows XP
                    if (System.Environment.OSVersion.Version.Major > 5)
                    {
                        diabloWindow = new DiabloWindow(Application.OpenForms[0], diabloPanel, diabloHandle, this.Text);
                        diabloPanel.BindDiabloWindow(diabloWindow);

                        if (((TabControl)this.Parent).SelectedTab == this)
                        {
                            diabloWindow.Activate();
                        }
                        else
                        {
                            diabloWindow.Deactivate();
                        }
                    }
                    if (BlueVex2.Properties.Settings.Default.UseBV2AutoLogin)
                    {
                        ((IDiabloWindow)diabloWindow).LoginToBattleNet(this.defaultAccount);
                    }
                }
                else
                {
                    ConsoleTab.WriteLine("Could not find diablo 2 game.exe " + exePath);
                }
            }
        }
Пример #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ConsoleTab console = new ConsoleTab();
            this.tabControl1.TabPages.Add(console);

            ConsoleTab.WriteLine("BlueVex 2 Diablo 2 Proxy By Pleh");

            OverviewTab overview = new OverviewTab();
            this.tabControl1.TabPages.Add(overview);

            try
            {
                LoadDiabloTabs();
            }
            catch (Exception err)
            {
                MessageBox.Show("Make sure your settings are set." + "\r\n\n" + "Advanced:" + "\r\n\n" + err.ToString(), "BlueVex2", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (BlueVex2.Properties.Settings.Default.UseBV2Proxy)
            {
                StartProxies();
                PlugInManager.FindAvailablePlugIns();
                List<Plugin> plugs = PlugInManager.AvailablePlugins;

                foreach (Plugin plug in plugs)
                {
                    ConsoleTab.WriteLine("Loading plugin: " + plug.TypeName);
                }
            }
        }