Beispiel #1
0
        private void btnDecrypt_Click(object sender, EventArgs e)
        {
            string gdbPath = txtGDBPath.Text;
            string errMsg;

            if (rbAccessGDB.Checked)
            {
                EncryptGDB.GDB_Crypt_Status status = EncryptGDB.CheckAccessGDBStatus(gdbPath);
                switch (status)
                {
                case EncryptGDB.GDB_Crypt_Status.GCS_NOT_AVAILABLE:
                    DisplayMessage("Access地理数据库无效");
                    break;

                case EncryptGDB.GDB_Crypt_Status.GCS_ENCRYTED:
                    if (EncryptGDB.DecryptAccessGDB(gdbPath, out errMsg))
                    {
                        DisplayMessage("Access地理数据库解密成功");
                    }
                    else
                    {
                        DisplayMessage(errMsg);
                    }
                    break;

                case EncryptGDB.GDB_Crypt_Status.GCS_NOT_CRYTED:
                    DisplayMessage("Access地理数据库未加密,无需再次解密");
                    break;
                }

                DoCheckAccessGDBStatus(gdbPath);
            }
            else if (rbFileGDB.Checked)
            {
                EncryptGDB.GDB_Crypt_Status status = EncryptGDB.CheckFileGDBStatus(gdbPath);
                switch (status)
                {
                case EncryptGDB.GDB_Crypt_Status.GCS_NOT_AVAILABLE:
                    DisplayMessage("文件地理数据库无效");
                    break;

                case EncryptGDB.GDB_Crypt_Status.GCS_ENCRYTED:
                    if (EncryptGDB.DecryptFileGDB(gdbPath, out errMsg))
                    {
                        DisplayMessage("文件地理数据库解密成功");
                    }
                    else
                    {
                        DisplayMessage(errMsg);
                    }
                    break;

                case EncryptGDB.GDB_Crypt_Status.GCS_NOT_CRYTED:
                    DisplayMessage("文件地理数据库未加密,无需再次解密");
                    break;
                }

                DoCheckFileGDBStatus(gdbPath);
            }
        }
Beispiel #2
0
        private void DoCheckAccessGDBStatus(string gdbPath)
        {
            EncryptGDB.GDB_Crypt_Status status = EncryptGDB.CheckAccessGDBStatus(gdbPath);
            switch (status)
            {
            case EncryptGDB.GDB_Crypt_Status.GCS_NOT_AVAILABLE:
                DisplayMessage("Access地理数据库无效");
                break;

            case EncryptGDB.GDB_Crypt_Status.GCS_ENCRYTED:
                btnEncrypt.Enabled     = false;
                dtpEncryptDate.Enabled = false;
                btnDecrypt.Enabled     = true;
                break;

            case EncryptGDB.GDB_Crypt_Status.GCS_NOT_CRYTED:
                btnEncrypt.Enabled     = true;
                dtpEncryptDate.Enabled = true;
                btnDecrypt.Enabled     = false;
                break;
            }
        }