Ejemplo n.º 1
0
        public async Task SetNewContentAsync(Stream content, CancellationToken token)
        {
            if (Item.ContentMetadata == null)
            {
                throw new InvalidOperationException(string.Format("ItemChange for {0} of type {1} must have metadata",
                    Item.Path, ChangeType.ToString()));
            }

            if (Item.ContentMetadata.IsBinary)
            {
                NewContent = await CreateItemContentFromBinaryStreamAsync(content, token);
            }
            else
            {
                NewContent = await CreateItemContentFromTextStreamAsync(content, Item.ContentMetadata.Encoding);
            }
        }
Ejemplo n.º 2
0
        public async Task SetNewContentAsync(Stream content, CancellationToken token)
        {
            if (Item.ContentMetadata == null)
            {
                throw new InvalidOperationException(string.Format("ItemChange for {0} of type {1} must have metadata",
                                                                  Item.Path, ChangeType.ToString()));
            }

            if (Item.ContentMetadata.IsBinary)
            {
                NewContent = await CreateItemContentFromBinaryStreamAsync(content, token);
            }
            else
            {
                NewContent = await CreateItemContentFromTextStreamAsync(content, Item.ContentMetadata.Encoding);
            }
        }