// Token: 0x0600016A RID: 362 RVA: 0x00005A84 File Offset: 0x00003C84 public bool OnCreateAttachment(string cancellationId, CancellationTokenSource tokenSource) { bool result = false; lock (this.lockObject) { if (this.CancellationItems.ContainsKey(cancellationId) && this.CancellationItems[cancellationId].IsCancellationRequested) { OwaServerTraceLogger.AppendToLog(new TraceLogEvent("CancelAttachmentManager.OnCreateAttachment", this.userContext, "OnCreateAttachment", string.Format("Attachment was cancelled before CreateAttachment, CancellationId: {0}.", cancellationId))); result = true; } else { CancelAttachmentManager.CancellationItem cancellationItem = new CancelAttachmentManager.CancellationItem(); cancellationItem.CancellationId = cancellationId; cancellationItem.CancellationTokenSource = tokenSource; cancellationItem.AttachmentCompletedEvent = new ManualResetEvent(false); this.CancellationItems[cancellationId] = cancellationItem; } } return(result); }
// Token: 0x0600016D RID: 365 RVA: 0x00005C08 File Offset: 0x00003E08 public bool CancelAttachment(string cancellationId, int timeout) { CancelAttachmentManager.CancellationItem cancellationItem; lock (this.lockObject) { if (!this.CancellationItems.ContainsKey(cancellationId)) { OwaServerTraceLogger.AppendToLog(new TraceLogEvent("CancelAttachmentManager.CancelAttachment", this.userContext, "CancelAttachment", string.Format("CreateAttachment has not started, marking item as cancelled for CancellationId: {0}", cancellationId))); cancellationItem = new CancelAttachmentManager.CancellationItem(); cancellationItem.CancellationId = cancellationId; cancellationItem.IsCancellationRequested = true; this.cancellationItems.Add(cancellationId, cancellationItem); return(true); } cancellationItem = this.CancellationItems[cancellationId]; cancellationItem.IsCancellationRequested = true; if (cancellationItem.CancellationTokenSource != null) { cancellationItem.CancellationTokenSource.Cancel(); } } if (cancellationItem.AttachmentId == null && cancellationItem.AttachmentCompletedEvent != null && !cancellationItem.AttachmentCompletedEvent.WaitOne(timeout)) { OwaServerTraceLogger.AppendToLog(new TraceLogEvent("CancelAttachmentManager.CancelAttachment", this.userContext, "CancelAttachment", string.Format("Cancel attachment timed out for CancellationId: {0}", cancellationId))); return(false); } if (cancellationItem.AttachmentId == null) { OwaServerTraceLogger.AppendToLog(new TraceLogEvent("CancelAttachmentManager.CancelAttachment", this.userContext, "CancelAttachment", string.Format("AttachmentId not found. Returning success for cancellationId: {0}", cancellationId))); return(true); } bool flag2 = AttachmentUtilities.DeleteAttachment(cancellationItem.AttachmentId); OwaServerTraceLogger.AppendToLog(new TraceLogEvent("CancelAttachmentManager.CancelAttachment", this.userContext, "CancelAttachment", string.Format("DeleteAttachmentSucceeded = {0} for CancellationId: {1}, AttachmentId: {2}", flag2, cancellationId, cancellationItem.AttachmentId.Id))); return(flag2); }