示例#1
0
 public void ReportItemError(ItemId itemId, ExportRecord rootExportRecord, ExportErrorType errorType, string diagnosticMessage)
 {
     this.ItemErrorRecords.Add(new ErrorRecord
     {
         Item = new ExportRecord
         {
             Id                = itemId.Id,
             DocumentId        = itemId.DocumentId,
             InternetMessageId = itemId.InternetMessageId,
             Parent            = rootExportRecord,
             Size              = itemId.Size,
             SourceId          = itemId.SourceId,
             ExportFile        = null,
             OriginalPath      = itemId.ReportingPath,
             Title             = (string.IsNullOrEmpty(itemId.Subject) ? string.Empty : itemId.Subject),
             IsUnsearchable    = this.DataContext.IsUnsearchable
         },
         ErrorType         = errorType,
         DiagnosticMessage = diagnosticMessage,
         SourceId          = itemId.SourceId,
         Time = DateTime.UtcNow
     });
     if (!itemId.IsDuplicate)
     {
         this.Size += (long)((ulong)itemId.Size);
     }
 }
示例#2
0
        private void CreatePstFile(string filePath)
        {
            PstWriter.CreatePstSession(filePath).Close();
            ProgressRecord progressRecord = new ProgressRecord();
            ExportRecord   exportRecord   = new ExportRecord
            {
                ExportFile = new ExportFile
                {
                    Name = Path.GetFileName(filePath),
                    Path = filePath
                },
                SourceId         = null,
                Id               = Path.GetFileNameWithoutExtension(filePath),
                OriginalPath     = null,
                Parent           = null,
                Title            = null,
                DocumentType     = "File",
                RelationshipType = "None",
                IsUnsearchable   = this.dataContext.IsUnsearchable
            };

            if (this.dataContext.IsPublicFolder)
            {
                this.currentPFRecord = exportRecord;
                if (this.dataContext.IsUnsearchable)
                {
                    this.pfUnsearchableExportResult = this.currentPFRecord;
                }
                else
                {
                    this.pfExportResult = this.currentPFRecord;
                }
                progressRecord.ReportRootRecord(this.currentPFRecord);
            }
            else
            {
                this.currentRootRecord = exportRecord;
                if (this.dataContext.IsUnsearchable)
                {
                    this.rootUnsearchableExportResult = this.currentRootRecord;
                }
                else
                {
                    this.rootExportResult = this.currentRootRecord;
                }
                progressRecord.ReportRootRecord(this.currentRootRecord);
            }
            this.progressController.ReportProgress(progressRecord);
        }
示例#3
0
 public void ReportItemExported(ItemId itemId, string targetMessageId, ExportRecord rootExportRecord)
 {
     this.ItemExportedRecords.Add(new ExportRecord
     {
         Id                          = itemId.Id,
         Parent                      = rootExportRecord,
         SourceId                    = itemId.SourceId,
         ExportFile                  = null,
         OriginalPath                = itemId.ReportingPath,
         TargetPath                  = targetMessageId,
         PrimaryIdOfDuplicates       = itemId.PrimaryItemId,
         Title                       = itemId.Subject,
         Size                        = itemId.Size,
         Sender                      = itemId.Sender,
         SenderSmtpAddress           = itemId.SenderSmtpAddress,
         SentTime                    = itemId.SentTime,
         ReceivedTime                = itemId.ReceivedTime,
         BodyPreview                 = itemId.BodyPreview,
         Importance                  = itemId.Importance,
         IsRead                      = itemId.IsRead,
         HasAttachment               = itemId.HasAttachment,
         ToRecipients                = itemId.ToRecipients,
         CcRecipients                = itemId.CcRecipients,
         BccRecipients               = itemId.BccRecipients,
         DocumentId                  = itemId.DocumentId,
         InternetMessageId           = itemId.InternetMessageId,
         ToGroupExpansionRecipients  = itemId.ToGroupExpansionRecipients,
         CcGroupExpansionRecipients  = itemId.CcGroupExpansionRecipients,
         BccGroupExpansionRecipients = itemId.BccGroupExpansionRecipients,
         DGGroupExpansionError       = itemId.DGGroupExpansionError.ToString(),
         DocumentType                = "Message",
         RelationshipType            = "Container",
         IsUnsearchable              = this.DataContext.IsUnsearchable
     });
     if (!itemId.IsDuplicate)
     {
         this.Size += (long)((ulong)itemId.Size);
     }
 }
示例#4
0
 private void ReportFileInformation(ExportRecord rootExportRecord)
 {
     if (rootExportRecord != null)
     {
         byte[] array;
         using (SHA256CryptoServiceProvider sha256CryptoServiceProvider = new SHA256CryptoServiceProvider())
         {
             using (FileStream fileStream = new FileStream(rootExportRecord.ExportFile.Path, FileMode.Open, FileAccess.Read, FileShare.Read, 16777216))
             {
                 array = sha256CryptoServiceProvider.ComputeHash(fileStream);
                 rootExportRecord.ExportFile.Size = (ulong)fileStream.Length;
             }
         }
         StringBuilder stringBuilder = new StringBuilder();
         for (int i = 0; i < array.Length; i++)
         {
             stringBuilder.Append(array[i].ToString("x2", CultureInfo.InvariantCulture));
         }
         rootExportRecord.ExportFile.Hash = "SHA256:" + stringBuilder.ToString();
         ProgressRecord progressRecord = new ProgressRecord();
         progressRecord.ReportRootRecord(rootExportRecord);
         this.progressController.ReportProgress(progressRecord);
     }
 }
示例#5
0
 public void ReportRootRecord(ExportRecord rootExportRecord)
 {
     this.RootExportedRecord = rootExportRecord;
 }