/// <summary> /// GetAttachmentInfo /// </summary> /// Get AttachmentInfo structure describing the attachment views /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <AttachmentInfo> GetAttachmentInfoAsync(this IAttachments operations, string attachmentId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentInfoWithHttpMessagesAsync(attachmentId, null, cancellationToken).ConfigureAwait(false)) { return(await _result.HandleErrorAsync <AttachmentInfo>().ConfigureAwait(false)); } }
/// <summary> /// GetAttachmentStreamAsync /// </summary> /// Get the named view as binary content as a stream /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <System.IO.Stream> GetAttachmentStreamAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
protected Dictionary <string, string> ApplyAttachmentChanges(EntitySyncItem item) { Event @event = item.Item as Event; Dictionary <string, string> dictionary = null; if (@event.Attachments != null && @event.Attachments.Count > 0) { dictionary = new Dictionary <string, string>(@event.Attachments.Count); @event.IsDraft = true; List <IAttachment> attachments = @event.Attachments; @event.Attachments = null; IAttachments attachments2 = this.Events[@event.Id].Attachments; foreach (IAttachment attachment in attachments) { if (attachment is EntityDeleteAttachment) { attachments2.Delete(attachment.Id, null); } else { string id = attachment.Id; attachment.Id = null; string id2 = attachments2.Create(attachment, null).Id; dictionary[id] = HttpUtility.UrlEncode(item.Item.Id + ":" + id2); } } @event.IsDraft = false; @event.ChangeKey = null; } return(dictionary); }
public TicketDetailsAgentController( IDisplayTickets displayTickets, IPriority priority, IStatus status, ITicketsReply ticketsReply, IAttachments attachments, ITicketHistory ticketHistory, ITickets tickets, IProfile profile, ICategory category, ITicketEscalationHistory iticketEscalationHistory, IUserMaster userMaster ) { _displayTickets = displayTickets; _priority = priority; _status = status; _ticketsReply = ticketsReply; _attachments = attachments; _ticketHistory = ticketHistory; _tickets = tickets; _profile = profile; _category = category; _iticketEscalationHistory = iticketEscalationHistory; _userMaster = userMaster; }
/// <summary> /// GetAttachment /// </summary> /// <remarks> /// Get the named view as binary content /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Stream> GetAttachmentAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false); _result.Request.Dispose(); return(_result.Body); }
/// <summary> /// GetAttachmentStreamAsync /// </summary> /// Get the named view as binary content as a stream /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <System.IO.Stream> GetAttachmentStreamAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false)) { var bytes = await _result.HandleErrorAsync <byte[]>().ConfigureAwait(false); return(new System.IO.MemoryStream(bytes)); } }
public TicketDetailsController(IDisplayTickets displayTickets, IPriority priority, IStatus status, ITicketsReply ticketsReply, IAttachments attachments, ITickets tickets, ITicketHistory ticketHistory) { _displayTickets = displayTickets; _priority = priority; _status = status; _ticketsReply = ticketsReply; _attachments = attachments; _tickets = tickets; _ticketHistory = ticketHistory; }
/// <summary> /// GetAttachment /// </summary> /// Get the named view as binary content /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <byte[]> GetAttachmentAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false)) { MemoryStream memoryStream = new MemoryStream(); await _result.Body.CopyToAsync(memoryStream).ConfigureAwait(false); return(memoryStream.ToArray()); } }
public TicketAdminController(ICategory category, IPriority priority, ITickets tickets, IAttachments attachments, ITicketHistory ticketHistory, IProfile profile, IUserMaster userMaster) { _category = category; _priority = priority; _tickets = tickets; _attachments = attachments; _ticketHistory = ticketHistory; _profile = profile; _userMaster = userMaster; }
public TicketController(ICategory category, IPriority priority, ITickets tickets, IAttachments attachments, ITicketHistory ticketHistory, IProfile profile) { _category = category; _priority = priority; _tickets = tickets; _attachments = attachments; _ticketHistory = ticketHistory; _profile = profile; }
/// <summary> /// GetAttachment /// </summary> /// Get the named view as binary content /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <byte[]> GetAttachmentAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false)) { MemoryStream memoryStream = new MemoryStream(); byte[] buffer = new byte[_result.Body.Length]; await _result.Body.ReadAsync(buffer, 0, (int)_result.Body.Length).ConfigureAwait(false); return(buffer); } }
public void Setup() { client = new Mock <IProxy>(); request = new Mock <BaseRequest>(new Mock <IProxy>().Object); request.CallBase = true; // Create proxy instance (test constructors) attachmentsProxy = new AxosoftAPI.NET.Attachments(client.Object); attachmentsProxy = new AxosoftAPI.NET.Attachments(request.Object); }
/// <summary> /// GetAttachment /// </summary> /// Get the named view as binary content /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <byte[]> GetAttachmentAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false)) { var stream = await _result.HandleErrorAsync <System.IO.Stream>().ConfigureAwait(false); System.IO.MemoryStream memStream = new System.IO.MemoryStream(); await stream.CopyToAsync(memStream).ConfigureAwait(false); return(memStream.GetBuffer()); } }
internal MessageHandler( [NotNull] ITeamCityWriter rootWriter, [NotNull] ITestCaseFilter testCaseFilter, [NotNull] ISuiteNameProvider suiteNameProvider, [NotNull] IOptions options, [NotNull] IAttachments attachments) { _rootWriter = rootWriter ?? throw new ArgumentNullException(nameof(rootWriter)); _testCaseFilter = testCaseFilter ?? throw new ArgumentNullException(nameof(testCaseFilter)); _suiteNameProvider = suiteNameProvider ?? throw new ArgumentNullException(nameof(suiteNameProvider)); _options = options; _attachments = attachments ?? throw new ArgumentNullException(nameof(attachments)); }
public DeleteAttachmentController(IAttachments attachments) { _attachments = attachments; }
public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddAttachmentsDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition, IAttachments model, Guid?referenceId) where TIn : IAttachments { var order = 1; model.UrlAttachments?.ForEach(i => { i.OrderNumber = order++; i.OwnerReferenceId = referenceId; }); return(definition.AddCollection(input => input.UrlAttachments, output => output.Attachments)); }
public AttachmentsPresenter(IAttachments view) : base(view) { }
// Token: 0x06000767 RID: 1895 RVA: 0x00029340 File Offset: 0x00027540 protected override int InternalExecute(int count) { string[] array = HttpUtility.UrlDecode(base.FileReference).Split(new char[] { ':' }); if (array.Length != 2) { throw new AirSyncPermanentException(StatusCode.Sync_TooManyFolders, false) { ErrorStringForProtocolLogger = "InvalidEntityAttachemtnId" }; } StoreObjectId itemId = StoreId.EwsIdToStoreObjectId(array[0]); IEvents events = EntitySyncItem.GetEvents(this.CalendaringContainer, base.Session, itemId); if (events == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "EventsNotFound" }; } IAttachments attachments = events[array[0]].Attachments; if (attachments == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "EntityNotFound" }; } IAttachment attachment = attachments.Read(array[1], null); if (attachment == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "EntityAttachementNotFound" }; } base.ContentType = attachment.ContentType; FileAttachment fileAttachment = attachment as FileAttachment; ItemAttachment itemAttachment = attachment as ItemAttachment; if (fileAttachment != null) { if (!base.MaxAttachmentSize.IsUnlimited && fileAttachment.Content.Length > (int)base.MaxAttachmentSize.Value.ToBytes()) { throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge); } count = ((count == -1) ? fileAttachment.Content.Length : Math.Min(count, fileAttachment.Content.Length - base.MinRange)); base.OutStream.Write(fileAttachment.Content, base.MinRange, count); return(count); } else { if (itemAttachment != null) { int result; AttachmentHelper.GetAttachment(base.Session, itemId, attachment.Id, base.OutStream, base.MinRange, count, base.MaxAttachmentSize, base.RightsManagementSupport, out result); return(result); } throw new AirSyncPermanentException(StatusCode.Sync_InvalidWaitTime, new LocalizedString(string.Format("Attachment type \"{0}\" is not supported.", attachment.GetType().FullName)), false) { ErrorStringForProtocolLogger = "UnsupportedEntityAttachementType" }; } }
/// <summary> /// GetAttachment /// </summary> /// Get the named view as binary content /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <byte[]> GetAttachmentAsync(this IAttachments operations, string attachmentId, string viewId, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.GetAttachmentWithHttpMessagesAsync(attachmentId, viewId, null, cancellationToken).ConfigureAwait(false); return(_result.HandleError <byte[]>()); }
/// <summary> /// GetAttachment /// </summary> /// Get the named view as binary content /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> public static byte[] GetAttachment(this IAttachments operations, string attachmentId, string viewId) { return(Task.Factory.StartNew(s => ((IAttachments)s).GetAttachmentAsync(attachmentId, viewId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// GetAttachmentInfo /// </summary> /// <remarks> /// Get AttachmentInfo structure describing the attachment views /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> public static AttachmentInfo GetAttachmentInfo(this IAttachments operations, string attachmentId) { return(operations.GetAttachmentInfoAsync(attachmentId).GetAwaiter().GetResult()); }
/// <summary> /// GetAttachment /// </summary> /// <remarks> /// Get the named view as binary content /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='viewId'> /// View id from attachmentInfo /// </param> public static Stream GetAttachment(this IAttachments operations, string attachmentId, string viewId) { return(operations.GetAttachmentAsync(attachmentId, viewId).GetAwaiter().GetResult()); }