예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            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
            {
                if (masterPass == null)
                {
                    MasterPassword mp = new MasterPassword();
                    if (mp.ShowDialog() == true)
                    {
                        masterPass = mp.textBox.Text;
                        if (ReadAccountsFromFile())
                        {
                            listBoxAccounts.ItemsSource = accountList.Accounts;
                            listBoxAccounts.Items.Refresh();

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

                            steam = new Steam(accountList.InstallDir);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please define a master password!");
                        this.Close();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                //Maybe create file?
            }
        }
 private void GetAccounts()
 {
     try
     {
         string text = File.ReadAllText(Path);
         accountList = Serialize.FromXML <AccountList>(Hash.Decrypt(text, Properties.Settings.Default.EncryptionKey));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
예제 #3
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);
        }
        public MainWindow()
        {
            InitializeComponent();

            var screen = GetCurrentScreen(this);
            var height = screen.Bounds.Height;
            var width  = screen.Bounds.Width;

            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());

            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)\Steam");
                if (accountList.InstallDir == null)
                {
                    System.Windows.Forms.MessageBox.Show("You cannot use SteamAccountSwitcher without selecting your Steam.exe. Program will close now.", "Steam missing", System.MessageBoxButton.OK, MessageBoxImage.Error);
                    Close();
                }
            }

            steam = new Steam(accountList.InstallDir);
        }
예제 #5
0
 public bool ReadAccountsFromFile()
 {
     if (File.Exists(settingsSave + "\\accounts.ini"))
     {
         string text = System.IO.File.ReadAllText(settingsSave + "\\accounts.ini");
         try {
             string convert = Crypto.Decrypt(text, this.masterPass);
             accountList = FromXML <AccountList>(convert);
             wrongPass   = false;
             return(true);
         } catch (Exception e)
         {
             MessageBox.Show("Your password is invalid.");
             wrongPass = true;
             Application.Current.Shutdown();
         }
     }
     return(false);
 }
        public MainWindow()
        {
            InitializeComponent();
            accountList = new AccountList();


            //Properties.Settings.Default.Reset(); // Uncomment this to clear accounts

            try
            {
                Hash.CheckEncryptionKey();
                GetAccounts();
            }
            catch
            {
            }

            li_Accounts.ItemsSource = accountList.Accounts;
            li_Accounts.Items.Refresh();
        }
        public void ReadAccountsFromFile()
        {
            string text = System.IO.File.ReadAllText(settingsSave + "\\accounts.ini");

            accountList = FromXML <AccountList>(Crypto.Decrypt(text));
        }
예제 #8
0
        public void ReadAccountsFromFile()
        {
            string text = Crypto.Decrypt(System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\accounts.ini"));

            accountList = FromXML <AccountList>(text);
        }