示例#1
0
 public void Rollback(SourceInformationCollection allSourceInformation)
 {
     Tracer.TraceInformation("PstTarget.Rollback - Start", new object[0]);
     Tracer.TraceInformation("PstTarget.Rollback IncludeDuplicates {0}, IncludeSearchableItems {1}, IncludeUnsearchableItems {2}", new object[]
     {
         this.ExportContext.ExportMetadata.IncludeDuplicates ? "true" : "false",
         this.ExportContext.ExportMetadata.IncludeSearchableItems ? "true" : "false",
         this.ExportContext.ExportMetadata.IncludeUnsearchableItems ? "true" : "false"
     });
     foreach (SourceInformation sourceInformation in allSourceInformation.Values)
     {
         Tracer.TraceInformation("PstTarget.Rollback source Id {0}, source Name {1}", new object[]
         {
             sourceInformation.Configuration.Id,
             sourceInformation.Configuration.Name
         });
         bool isPublicFolder = sourceInformation.Configuration.Id.StartsWith("\\");
         if (this.ExportContext.ExportMetadata.IncludeDuplicates)
         {
             if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
             {
                 this.RemoveFileForSource(sourceInformation.Configuration.Name, false, isPublicFolder);
             }
             if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
             {
                 this.RemoveFileForSource(sourceInformation.Configuration.Name, true, isPublicFolder);
             }
         }
         if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
         {
             string itemIdListFilePath = this.GetItemIdListFilePath(sourceInformation.Configuration.Id, false);
             LocalFileHelper.RemoveFile(itemIdListFilePath, ExportErrorType.FailedToRollbackResultsInTargetLocation);
         }
         if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
         {
             string itemIdListFilePath2 = this.GetItemIdListFilePath(sourceInformation.Configuration.Id, true);
             LocalFileHelper.RemoveFile(itemIdListFilePath2, ExportErrorType.FailedToRollbackResultsInTargetLocation);
         }
     }
     if (!this.ExportContext.ExportMetadata.IncludeDuplicates)
     {
         if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
         {
             this.RemoveFileForSource(null, false, false);
             this.RemoveFileForSource(null, false, true);
         }
         if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
         {
             this.RemoveFileForSource(null, true, false);
             this.RemoveFileForSource(null, true, true);
         }
     }
     Tracer.TraceInformation("PstTarget.Rollback - End", new object[0]);
 }
示例#2
0
        private void RemoveFileForSource(string source, bool isUnsearchable, bool isPublicFolder)
        {
            Tracer.TraceInformation("PstTarget.RemoveFileForSource ", new object[0]);
            int    num  = 1000;
            string text = string.Empty;
            bool   flag = true;
            int    num2 = 1;

            while (flag)
            {
                if (isPublicFolder)
                {
                    text = this.GetPFPstFilePath(isUnsearchable, num2++);
                }
                else
                {
                    text = this.GetPstFilePath(source, isUnsearchable, num2++);
                }
                if (File.Exists(text))
                {
                    try
                    {
                        LocalFileHelper.RemoveFile(text, ExportErrorType.FailedToRollbackResultsInTargetLocation);
                        goto IL_81;
                    }
                    catch (ExportException ex)
                    {
                        Tracer.TraceError("PstTarget.RemoveFileForSource: Failed FileName: {0}, Exception: {1}", new object[]
                        {
                            text,
                            ex.ToString()
                        });
                        goto IL_81;
                    }
                    goto IL_7F;
                }
                goto IL_7F;
IL_81:
                if (num2 > num)
                {
                    Tracer.TraceError("PstTarget.RemoveFileForSource: Exceeded fileCount limit of {0} files for source {1}.", new object[]
                    {
                        num2,
                        source
                    });
                    return;
                }
                continue;
IL_7F:
                flag = false;
                goto IL_81;
            }
        }
示例#3
0
 public void CheckInitialStatus(SourceInformationCollection allSourceInformation, OperationStatus status)
 {
     foreach (SourceInformation sourceInformation in allSourceInformation.Values)
     {
         bool isPublicFolder = sourceInformation.Configuration.Id.StartsWith("\\");
         if (this.ExportContext.ExportMetadata.IncludeDuplicates)
         {
             if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
             {
                 this.ValidateDataFile(sourceInformation.Configuration.Name, false, isPublicFolder);
             }
             if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
             {
                 this.ValidateDataFile(sourceInformation.Configuration.Name, true, isPublicFolder);
             }
         }
         if (!this.ExportContext.IsResume || !sourceInformation.Status.IsSearchCompleted(this.ExportContext.ExportMetadata.IncludeSearchableItems, this.ExportContext.ExportMetadata.IncludeUnsearchableItems))
         {
             if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
             {
                 string itemIdListFilePath = this.GetItemIdListFilePath(sourceInformation.Configuration.Id, false);
                 LocalFileHelper.RemoveFile(itemIdListFilePath, ExportErrorType.FailedToCleanupCorruptedStatusLog);
             }
             if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
             {
                 string itemIdListFilePath2 = this.GetItemIdListFilePath(sourceInformation.Configuration.Id, true);
                 LocalFileHelper.RemoveFile(itemIdListFilePath2, ExportErrorType.FailedToCleanupCorruptedStatusLog);
             }
         }
     }
     if (!this.ExportContext.ExportMetadata.IncludeDuplicates)
     {
         if (this.ExportContext.ExportMetadata.IncludeSearchableItems)
         {
             this.ValidateDataFile(null, false, false);
         }
         if (this.ExportContext.ExportMetadata.IncludeUnsearchableItems)
         {
             this.ValidateDataFile(null, true, false);
         }
     }
 }
示例#4
0
 public void RemoveItemIdList(string mailboxId, bool isUnsearchable)
 {
     LocalFileHelper.RemoveFile(this.GetItemIdListFilePath(mailboxId, isUnsearchable), ExportErrorType.FailedToRemoveItemIdList);
 }