public bool LoginBnet(SteamAccount b)
        {
            if (!IsSteamRunning())
            {
                LogoutSteam();
            }
            if (DownloadMissing.CheckIfMissing())
            {
                var messBox = MessageBox.Show("Autohotkey file not found. Would you like to download it? \n Clicking yes will download from github over HTTPS \n Clicking no will prevent login. ", "Battle.net Switcher", MessageBoxButton.YesNo);
                if (messBox == MessageBoxResult.Yes)
                {
                    DownloadMissing.Download();
                }
                else
                {
                    return(false);
                }
            }
            Process ahk = new Process {
                StartInfo = new ProcessStartInfo(AppDomain.CurrentDomain.BaseDirectory + @"\main.ahk", b.Username + " " + b.Password)
            };

            ahk.Start();
            return(true);
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();
            if (DownloadMissing.CheckIfMissing())
            {
                DownloadMissing.Download();
            }
            this.Top    = Properties.Settings.Default.Top;
            this.Left   = Properties.Settings.Default.Left;
            this.Height = Properties.Settings.Default.Height;
            this.Width  = Properties.Settings.Default.Width;

            if (Properties.Settings.Default.Maximized)
            {
                WindowState = WindowState.Maximized;
            }

            accountList = new AccountList();

            //Get directory of Executable
            settingsSave = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).TrimStart(@"file:\\".ToCharArray());

            this.buttonInfo.ToolTip = "Build Version: " + Assembly.GetEntryAssembly().GetName().Version.ToString();

            try
            {
                ReadAccountsFromFile();
            }
            catch
            {
                //Maybe create file?
            }



            listBoxAccounts.ItemsSource = accountList.Accounts;
            listBoxAccounts.Items.Refresh();

            if (accountList.InstallDir == "" || (accountList.InstallDir == null))
            {
                accountList.InstallDir = SelectSteamFile(@"C:\Program Files (x86)\Battle.net");
                if (accountList.InstallDir == null)
                {
                    MessageBox.Show("You cannot use Battle.net switcher without selecting your Battle.net.exe. Program will close now.", "BNET missing", MessageBoxButton.OK, MessageBoxImage.Error);
                    Close();
                }
            }

            steam = new Steam(accountList.InstallDir);
        }