/// <summary>
        /// Runs a form
        /// </summary>
        private void ThreadProcPasswordMain()
        {
            // Show loading screen
            ThreadManage.ShowLoadingScreen();
            // Instantiate PasswordMain Form
            frmPasswordMain frm = new frmPasswordMain(_userID);

            // Close loading screen
            ThreadManage.CloseLoadingForm();
            // Run the form
            Application.Run(frm);
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Show loading screen
            ThreadManage.ShowLoadingScreen();

            // Instantiate loading form
            frmLogin frm = new frmLogin();

            // Initialize the Database
            Initializer.InitalizeDatabase();
            // Manage the sessions
            SessionManage.Erase6months();

            // Close the loading screen
            ThreadManage.CloseLoadingForm();

            // Start the form
            Application.Run(frm);
        }
Example #3
0
        /// <summary>
        /// Import with Google Passwords CSV Export
        /// </summary>
        private void GooglePasswordsImport()
        {
            // Import and read the CSV File
            GooglePasswordsFileReader();
            // Check if the import came back with rows
            if (_importTable.Rows.Count < 1)
            {
                return;
            }

            // If the user has passwords. Ask if they want to remove them
            if (_passwordsTable.Rows.Count > 0)
            {
                // Ask the user if they want to remove the previous passwords
                DialogResult box = MessageBox.Show("Click Yes if you want the previous passwords deleted",
                                                   Properties.Settings.Default.ProjectName,
                                                   MessageBoxButtons.YesNo);

                // If the user clicked yes
                // Delete their passwords
                if (box == DialogResult.Yes)
                {
                    DeletePasswords();
                }
            }

            ThreadManage.ShowLoadingScreen();

            // Initialize the Passwords DataTable with the correct passwords
            InitializeAllPasswords();
            // For each row in the File Passwords
            foreach (DataRow row in _importTable.Rows)
            {
                if (!titles.Contains(row["Title"].ToString()) ||
                    !usernames.Contains(row["Email"].ToString()))
                {
                    // Setting the PasswordID
                    int passwordID = 0;
                    if (_allPasswordsTable.Rows.Count > 0)
                    {
                        passwordID = int.Parse(_allPasswordsTable.Rows[_allPasswordsTable.Rows.Count - 1]["PasswordID"].ToString());
                    }

                    // Create a new row
                    DataRow newRow = _allPasswordsTable.NewRow();
                    // Assign PasswordID, UserID, PasswordTitle and PasswordUsername
                    newRow["PasswordID"]       = passwordID + 1;
                    newRow["UserID"]           = _userID;
                    newRow["PasswordTitle"]    = row["Title"];
                    newRow["PasswordUsername"] = row["Email"];
                    // Encrypt the password
                    newRow["PasswordEncrypted"] = Encryption.Encrypt(row["Password"].ToString(), getUsername());
                    // Assign PasswordTag
                    newRow["TagID"] = DBNull.Value;
                    // Save the row
                    newRow.EndEdit();
                    _allPasswordsTable.Rows.Add(newRow);

                    // Save the Table
                    // Populate Grid
                    Context.SaveDataBaseTable(_allPasswordsTable);
                }
            }

            ThreadManage.CloseLoadingForm();
        }