コード例 #1
0
 /// <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));
     }
 }
コード例 #2
0
 /// <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);
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 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;
 }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        /// <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));
            }
        }
コード例 #7
0
 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;
 }
コード例 #8
0
        /// <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());
            }
        }
コード例 #9
0
 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;
 }
コード例 #10
0
 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;
 }
コード例 #11
0
        /// <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);
            }
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        /// <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());
            }
        }
コード例 #14
0
 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));
 }
コード例 #15
0
 public DeleteAttachmentController(IAttachments attachments)
 {
     _attachments = attachments;
 }
コード例 #16
0
        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));
        }
コード例 #17
0
 public AttachmentsPresenter(IAttachments view) : base(view)
 {
 }
コード例 #18
0
        // 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"
                      };
            }
        }
コード例 #19
0
        /// <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[]>());
        }
コード例 #20
0
 /// <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());
 }
コード例 #21
0
 /// <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());
 }
コード例 #22
0
 /// <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());
 }