コード例 #1
0
        /// <summary>
        /// Build a new PSTRegistryEntry with values under the provided subKey.
        /// </summary>
        /// <param name="subKey">SubKey that contains registry values to build the new PSTRegistryEntry.</param>
        /// <returns>Return a new PSTRegistryEntry initialized with values contains under the subKey.</returns>
        private static PSTRegistryEntry GetPstRegistryEntry(RegistryKey subKey)
        {
            PSTRegistryEntry regEntry = new PSTRegistryEntry("");

            try
            {
                regEntry.RegistryPath         = subKey.Name;
                regEntry.SourcePath           = subKey.GetValue("SourcePath").ToString();
                regEntry.ToBackup             = ((int)subKey.GetValue("Backup") == 1) ? true : false;
                regEntry.LastSuccessfulBackup = Convert.ToDateTime(subKey.GetValue("LastSuccessfulBackup").ToString());
            }
            catch (Exception) { }

            return(regEntry);
        }
コード例 #2
0
ファイル: FrmSettings.cs プロジェクト: DCourtel/Pst_Backup
 /// <summary>
 /// Save informations about PST files mounted in Outlook, into registry
 /// </summary>
 private void SavePSTFilesToRegistry()
 {
     try
     {
         for (int i = 0; i < chkLstBxPstFiles.Items.Count; i++)
         {
             PSTRegistryEntry pstFile = (PSTRegistryEntry)chkLstBxPstFiles.Items[i];
             pstFile.ToBackup = chkLstBxPstFiles.CheckedItems.Contains(chkLstBxPstFiles.Items[i]);
             pstFile.Save();
         }
     }
     catch (Exception ex)
     {
         PstBackupLogger.Logger.Write(30000, "Error when saving PstFiles Settings : " + ex.Message, 0, System.Diagnostics.EventLogEntryType.Error);
     }
 }