Пример #1
0
        // Token: 0x06001999 RID: 6553 RVA: 0x0005A2D8 File Offset: 0x000584D8
        internal static CreateAttachmentResponse CreateAttachment(CallContext callContext, CreateAttachmentRequest translatedRequest)
        {
            CreateAttachmentHelper.UpdateContentType(callContext);
            CreateAttachmentResponse result;

            using (CreateAttachment createAttachment = new CreateAttachment(callContext, translatedRequest))
            {
                if (!createAttachment.PreExecute())
                {
                    result = null;
                }
                else
                {
                    ServiceResult <AttachmentType> currentStepResult;
                    try
                    {
                        currentStepResult = createAttachment.Execute();
                    }
                    catch (LocalizedException exception)
                    {
                        currentStepResult = ExceptionHandler <AttachmentType> .GetServiceResult <AttachmentType>(exception, null);
                    }
                    createAttachment.SetCurrentStepResult(currentStepResult);
                    result = (CreateAttachmentResponse)createAttachment.PostExecute();
                }
            }
            return(result);
        }
Пример #2
0
        protected override string InternalExecute()
        {
            if (!this.isHtml5)
            {
                CreateAttachmentHelper.UpdateContentType(base.CallContext);
            }
            UserContext             userContext             = UserContextManager.GetUserContext(base.CallContext.HttpContext, base.CallContext.EffectiveCaller, true);
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
            CancellationToken       token = cancellationTokenSource.Token;

            if (this.cancellationId != null)
            {
                bool flag = userContext.CancelAttachmentManager.OnCreateAttachment(this.cancellationId, cancellationTokenSource);
                if (flag)
                {
                    CreateAttachmentHelper.SendFailureNotification(userContext, this.subscriptionId, null, AttachmentResultCode.Cancelled, this.channelId, null);
                    return(null);
                }
            }
            Guid operationId = Guid.NewGuid();

            CreateReferenceAttachmentFromLocalFile.UploadAndAttachReferenceAttachment(operationId, userContext, base.CallContext, this.itemId, this.fileName, this.fileContent, base.IdConverter, this.subscriptionId, this.channelId, token, this.cancellationId);
            return(operationId.ToString());
        }