コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListFileEntry"/> class.
 /// </summary>
 /// <param name="name">The name of the file.</param>
 /// <param name="attributes">The file's attributes.</param>
 internal ListFileEntry(string name, CloudFileAttributes attributes)
 {
     this.Name       = name;
     this.Attributes = attributes;
 }
コード例 #2
0
        /// <summary>
        /// Parses a file entry in a file listing response.
        /// </summary>
        /// <returns>File listing entry</returns>
        private static async Task <IListFileEntry> ParseFileEntryAsync(XmlReader reader, Uri baseUri, CancellationToken token)
        {
            token.ThrowIfCancellationRequested();

            CloudFileAttributes file = new CloudFileAttributes();
            string name = null;

            await reader.ReadStartElementAsync().ConfigureAwait(false);

            while (await reader.IsStartElementAsync().ConfigureAwait(false))
            {
                token.ThrowIfCancellationRequested();

                if (reader.IsEmptyElement)
                {
                    await reader.SkipAsync().ConfigureAwait(false);
                }
                else
                {
                    switch (reader.Name)
                    {
                    case Constants.NameElement:
                        name = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false);

                        break;

                    case Constants.PropertiesElement:
                        await reader.ReadStartElementAsync().ConfigureAwait(false);

                        while (await reader.IsStartElementAsync().ConfigureAwait(false))
                        {
                            token.ThrowIfCancellationRequested();

                            if (reader.IsEmptyElement)
                            {
                                await reader.SkipAsync().ConfigureAwait(false);
                            }
                            else
                            {
                                switch (reader.Name)
                                {
                                case Constants.ContentLengthElement:
                                    file.Properties.Length = await reader.ReadElementContentAsInt64Async().ConfigureAwait(false);

                                    break;

                                default:
                                    await reader.SkipAsync().ConfigureAwait(false);

                                    break;
                                }
                            }
                        }

                        await reader.ReadEndElementAsync().ConfigureAwait(false);

                        break;

                    default:
                        await reader.SkipAsync().ConfigureAwait(false);

                        break;
                    }
                }
            }

            await reader.ReadEndElementAsync().ConfigureAwait(false);

            Uri uri = NavigationHelper.AppendPathToSingleUri(baseUri, name);

            file.StorageUri = new StorageUri(uri);

            return(new ListFileEntry(name, file));
        }
コード例 #3
0
 internal ListFileEntry(string name, CloudFileAttributes attributes)
 {
     throw new System.NotImplementedException();
 }
コード例 #4
0
        /// <summary>
        /// Parses a file entry in a file listing response.
        /// </summary>
        /// <returns>File listing entry</returns>
        private IListFileEntry ParseFileEntry(Uri baseUri)
        {
            CloudFileAttributes file = new CloudFileAttributes();
            string name = null;

            this.reader.ReadStartElement();
            while (this.reader.IsStartElement())
            {
                if (this.reader.IsEmptyElement)
                {
                    this.reader.Skip();
                }
                else
                {
                    switch (this.reader.Name)
                    {
                    case Constants.NameElement:
                        name = reader.ReadElementContentAsString();
                        break;

                    case Constants.PropertiesElement:
                        this.reader.ReadStartElement();
                        while (this.reader.IsStartElement())
                        {
                            if (this.reader.IsEmptyElement)
                            {
                                this.reader.Skip();
                            }
                            else
                            {
                                switch (this.reader.Name)
                                {
                                case Constants.ContentLengthElement:
                                    file.Properties.Length = reader.ReadElementContentAsLong();
                                    break;

                                default:
                                    this.reader.Skip();
                                    break;
                                }
                            }
                        }

                        this.reader.ReadEndElement();
                        break;

                    default:
                        this.reader.Skip();
                        break;
                    }
                }
            }

            this.reader.ReadEndElement();

            Uri uri = NavigationHelper.AppendPathToSingleUri(baseUri, name);

            file.StorageUri = new StorageUri(uri);

            return(new ListFileEntry(name, file));
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListFileEntry"/> class.
 /// </summary>
 /// <param name="name">The name of the file.</param>
 /// <param name="attributes">The file's attributes.</param>
 internal ListFileEntry(string name, CloudFileAttributes attributes)
 {
     this.Name = name;
     this.Attributes = attributes;
 }