示例#1
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (!this.Pwd1.Text.Equals(this.Pwd2.Text))
     {
         MessageBox.Show(this, "Passwords do not match.", "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         DBProfileData dBProfileDatum = new DBProfileData()
         {
             IsLocalDB           = this.chk_LocalDB.Checked,
             Catalog             = this.Catalog.Text,
             DataSource          = this.DataSource.Text,
             Password            = this.Pwd1.Text,
             PersistSecurityInfo = this.chk_Security.Checked,
             UserId = this.UserID.Text
         };
         string str = Path.Combine(VMGlobal.ProfilePath, VMGlobal.ProfileFile);
         if (!Directory.Exists(VMGlobal.ProfilePath))
         {
             Directory.CreateDirectory(VMGlobal.ProfilePath);
             Network.SetAcl(VMGlobal.ProfilePath);
         }
         if (Directory.Exists(VMGlobal.ProfilePath))
         {
             FileCrypto.Save(dBProfileDatum, str);
             if (File.Exists(str))
             {
                 MessageBox.Show(this, "C3 Sentinel connection profile saved.", "Profile", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 base.DialogResult = DialogResult.OK;
                 base.Close();
                 return;
             }
         }
     }
 }
示例#2
0
 public bool SaveAssetProfile(string DriveID, CamProfile rec)
 {
     FileCrypto.Save((object)rec, Path.Combine(DriveID, "C3Sentinel.Dat"));
     new FileInfo(Path.Combine(DriveID, "C3Sentinel.Dat")).Attributes = FileAttributes.Hidden;
     return(IsProfile(DriveID));
 }