示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 private bool Include(FileInfo file)
 {
     if (config.BackupType == BackupTypes.All)
     {
         return(IncludeFiletype(file));
     }
     if (!IncludeFiletype(file))
     {
         return(false);
     }
     CMD.ClearParameters();
     CMD.CommandText = "SELECT ModifiedDate FROM BackupFiles WHERE Filename = @Filename";
     CMD.AddWithValue("@Filename", file.FullName);
     CMD.ExecuteReader();
     if (CMD.Read())
     {
         DateTime md = CMD.GetDateTime(0);
         if (file.LastWriteTime > md)
         {
             CMD.CommandText = "UPDATE BackupFiles SET ModifiedDate = @ModifiedDate WHERE Filename = @Filename";
             CMD.AddWithValue("@ModifiedDate", file.LastWriteTime);
             CMD.ExecuteNonQuery();
             return(true);
         }
         return(false);
     }
     CMD.ClearParameters();
     CMD.CommandText = "INSERT INTO BackupFiles( Filename, ModifiedDate ) VALUES( @Filename, @ModifiedDate )";
     CMD.AddWithValue("@Filename", file.FullName);
     CMD.AddWithValue("@ModifiedDate", file.LastWriteTime);
     CMD.ExecuteNonQuery();
     return(true);
 }