Beispiel #1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FileMetadata" /> class.</para>
        /// </summary>
        /// <param name="name">The last component of the path (including extension). This never
        /// contains a slash.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash.</param>
        /// <param name="clientModified">For files, this is the modification time set by the
        /// desktop client when the file was added to Dropbox. Since this time is not verified
        /// (the Dropbox server stores whatever the desktop client sends up), this should only
        /// be used for display purposes (such as sorting) and not, for example, to determine
        /// if a file has changed or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="parentSharedFolderId">Deprecated. Please use
        /// :field:'FileSharingInfo.parent_shared_folder_id' or
        /// :field:'FolderSharingInfo.parent_shared_folder_id' instead.</param>
        /// <param name="id">A unique identifier for the file.</param>
        /// <param name="mediaInfo">Additional information if the file is a photo or
        /// video.</param>
        /// <param name="sharingInfo">Set if this file is contained in a shared folder.</param>
        public FileMetadata(string name,
                            string pathLower,
                            sys.DateTime clientModified,
                            sys.DateTime serverModified,
                            string rev,
                            ulong size,
                            string parentSharedFolderId = null,
                            string id                   = null,
                            MediaInfo mediaInfo         = null,
                            FileSharingInfo sharingInfo = null)
            : base(name, pathLower, parentSharedFolderId)
        {
            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            else if (rev.Length < 9 || !re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev");
            }

            if (id != null && (id.Length < 1))
            {
                throw new sys.ArgumentOutOfRangeException("id");
            }

            this.ClientModified = clientModified;
            this.ServerModified = serverModified;
            this.Rev            = rev;
            this.Size           = size;
            this.Id             = id;
            this.MediaInfo      = mediaInfo;
            this.SharingInfo    = sharingInfo;
        }
Beispiel #2
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FileMetadata" /> class.</para>
        /// </summary>
        /// <param name="name">The last component of the path (including extension). This never
        /// contains a slash.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash.</param>
        /// <param name="pathDisplay">The cased path to be used for display purposes only. In
        /// rare instances the casing will not correctly match the user's filesystem, but this
        /// behavior will match the path provided in the Core API v1. Changes to the casing of
        /// paths won't be returned by <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.ListFolderContinueAsync" /></param>
        /// <param name="id">A unique identifier for the file.</param>
        /// <param name="clientModified">For files, this is the modification time set by the
        /// desktop client when the file was added to Dropbox. Since this time is not verified
        /// (the Dropbox server stores whatever the desktop client sends up), this should only
        /// be used for display purposes (such as sorting) and not, for example, to determine
        /// if a file has changed or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="parentSharedFolderId">Deprecated. Please use <see
        /// cref="Dropbox.Api.Files.FileSharingInfo.ParentSharedFolderId" /> or <see
        /// cref="Dropbox.Api.Files.FolderSharingInfo.ParentSharedFolderId" /> instead.</param>
        /// <param name="mediaInfo">Additional information if the file is a photo or
        /// video.</param>
        /// <param name="sharingInfo">Set if this file is contained in a shared folder.</param>
        /// <param name="propertyGroups">Additional information if the file has custom
        /// properties with the property template specified.</param>
        /// <param name="hasExplicitSharedMembers">This flag will only be present if
        /// include_has_explicit_shared_members  is true in <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.ListFolderAsync" /> or <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.GetMetadataAsync" />. If this  flag is
        /// present, it will be true if this file has any explicit shared  members. This is
        /// different from sharing_info in that this could be true  in the case where a file
        /// has explicit members but is not contained within  a shared folder.</param>
        public FileMetadata(string name,
                            string pathLower,
                            string pathDisplay,
                            string id,
                            sys.DateTime clientModified,
                            sys.DateTime serverModified,
                            string rev,
                            ulong size,
                            string parentSharedFolderId = null,
                            MediaInfo mediaInfo         = null,
                            FileSharingInfo sharingInfo = null,
                            col.IEnumerable <Dropbox.Api.Properties.PropertyGroup> propertyGroups = null,
                            bool?hasExplicitSharedMembers = null)
            : base(name, pathLower, pathDisplay, parentSharedFolderId)
        {
            if (id == null)
            {
                throw new sys.ArgumentNullException("id");
            }
            if (id.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1");
            }

            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            if (rev.Length < 9)
            {
                throw new sys.ArgumentOutOfRangeException("rev", "Length should be at least 9");
            }
            if (!re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev", @"Value should match pattern '\A(?:[0-9a-f]+)\z'");
            }

            var propertyGroupsList = enc.Util.ToList(propertyGroups);

            this.Id                       = id;
            this.ClientModified           = clientModified;
            this.ServerModified           = serverModified;
            this.Rev                      = rev;
            this.Size                     = size;
            this.MediaInfo                = mediaInfo;
            this.SharingInfo              = sharingInfo;
            this.PropertyGroups           = propertyGroupsList;
            this.HasExplicitSharedMembers = hasExplicitSharedMembers;
        }
Beispiel #3
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FileMetadata" /> class.</para>
        /// </summary>
        /// <param name="name">The last component of the path (including extension). This never
        /// contains a slash.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash.</param>
        /// <param name="pathDisplay">The cased path to be used for display purposes only. In
        /// rare instances the casing will not correctly match the user's filesystem, but this
        /// behavior will match the path provided in the Core API v1. Changes to the casing of
        /// paths won't be returned by <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.ListFolderContinueAsync" /></param>
        /// <param name="id">A unique identifier for the file.</param>
        /// <param name="clientModified">For files, this is the modification time set by the
        /// desktop client when the file was added to Dropbox. Since this time is not verified
        /// (the Dropbox server stores whatever the desktop client sends up), this should only
        /// be used for display purposes (such as sorting) and not, for example, to determine
        /// if a file has changed or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="parentSharedFolderId">Deprecated. Please use <see
        /// cref="Dropbox.Api.Files.FileSharingInfo.ParentSharedFolderId" /> or <see
        /// cref="Dropbox.Api.Files.FolderSharingInfo.ParentSharedFolderId" /> instead.</param>
        /// <param name="mediaInfo">Additional information if the file is a photo or
        /// video.</param>
        /// <param name="sharingInfo">Set if this file is contained in a shared folder.</param>
        public FileMetadata(string name,
                            string pathLower,
                            string pathDisplay,
                            string id,
                            sys.DateTime clientModified,
                            sys.DateTime serverModified,
                            string rev,
                            ulong size,
                            string parentSharedFolderId = null,
                            MediaInfo mediaInfo         = null,
                            FileSharingInfo sharingInfo = null)
            : base(name, pathLower, pathDisplay, parentSharedFolderId)
        {
            if (id == null)
            {
                throw new sys.ArgumentNullException("id");
            }
            if (id.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1");
            }

            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            if (rev.Length < 9)
            {
                throw new sys.ArgumentOutOfRangeException("rev", "Length should be at least 9");
            }
            if (!re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev", @"Value should match pattern '\A(?:[0-9a-f]+)\z'");
            }

            this.Id             = id;
            this.ClientModified = clientModified;
            this.ServerModified = serverModified;
            this.Rev            = rev;
            this.Size           = size;
            this.MediaInfo      = mediaInfo;
            this.SharingInfo    = sharingInfo;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FileMetadata" /> class.</para>
        /// </summary>
        /// <param name="name">The last component of the path (including extension). This never
        /// contains a slash.</param>
        /// <param name="id">A unique identifier for the file.</param>
        /// <param name="clientModified">For files, this is the modification time set by the
        /// desktop client when the file was added to Dropbox. Since this time is not verified
        /// (the Dropbox server stores whatever the desktop client sends up), this should only
        /// be used for display purposes (such as sorting) and not, for example, to determine
        /// if a file has changed or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash. This field will be null if the file or folder is not
        /// mounted.</param>
        /// <param name="pathDisplay">The cased path to be used for display purposes only. In
        /// rare instances the casing will not correctly match the user's filesystem, but this
        /// behavior will match the path provided in the Core API v1, and at least the last
        /// path component will have the correct casing. Changes to only the casing of paths
        /// won't be returned by <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.ListFolderContinueAsync" />. This
        /// field will be null if the file or folder is not mounted.</param>
        /// <param name="parentSharedFolderId">Please use <see
        /// cref="Dropbox.Api.Files.FileSharingInfo.ParentSharedFolderId" /> or <see
        /// cref="Dropbox.Api.Files.FolderSharingInfo.ParentSharedFolderId" /> instead.</param>
        /// <param name="mediaInfo">Additional information if the file is a photo or video.
        /// This field will not be set on entries returned by <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.ListFolderAsync" />, <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.ListFolderContinueAsync" />, or <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.GetThumbnailBatchAsync" />, starting
        /// December 2, 2019.</param>
        /// <param name="symlinkInfo">Set if this file is a symlink.</param>
        /// <param name="sharingInfo">Set if this file is contained in a shared folder.</param>
        /// <param name="isDownloadable">If true, file can be downloaded directly; else the
        /// file must be exported.</param>
        /// <param name="exportInfo">Information about format this file can be exported to.
        /// This filed must be set if <paramref name="isDownloadable" /> is set to
        /// false.</param>
        /// <param name="propertyGroups">Additional information if the file has custom
        /// properties with the property template specified.</param>
        /// <param name="hasExplicitSharedMembers">This flag will only be present if
        /// include_has_explicit_shared_members  is true in <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.ListFolderAsync" /> or <see
        /// cref="Dropbox.Api.Files.Routes.FilesUserRoutes.GetMetadataAsync" />. If this  flag
        /// is present, it will be true if this file has any explicit shared  members. This is
        /// different from sharing_info in that this could be true  in the case where a file
        /// has explicit members but is not contained within  a shared folder.</param>
        /// <param name="contentHash">A hash of the file content. This field can be used to
        /// verify data integrity. For more information see our <a
        /// href="https://www.dropbox.com/developers/reference/content-hash">Content hash</a>
        /// page.</param>
        /// <param name="fileLockInfo">If present, the metadata associated with the file's
        /// current lock.</param>
        public FileMetadata(string name,
                            string id,
                            sys.DateTime clientModified,
                            sys.DateTime serverModified,
                            string rev,
                            ulong size,
                            string pathLower            = null,
                            string pathDisplay          = null,
                            string parentSharedFolderId = null,
                            MediaInfo mediaInfo         = null,
                            SymlinkInfo symlinkInfo     = null,
                            FileSharingInfo sharingInfo = null,
                            bool isDownloadable         = true,
                            ExportInfo exportInfo       = null,
                            col.IEnumerable <global::Dropbox.Api.FileProperties.PropertyGroup> propertyGroups = null,
                            bool?hasExplicitSharedMembers = null,
                            string contentHash            = null,
                            FileLockMetadata fileLockInfo = null)
            : base(name, pathLower, pathDisplay, parentSharedFolderId)
        {
            if (id == null)
            {
                throw new sys.ArgumentNullException("id");
            }
            if (id.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1");
            }

            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            if (rev.Length < 9)
            {
                throw new sys.ArgumentOutOfRangeException("rev", "Length should be at least 9");
            }
            if (!re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev", @"Value should match pattern '\A(?:[0-9a-f]+)\z'");
            }

            var propertyGroupsList = enc.Util.ToList(propertyGroups);

            if (contentHash != null)
            {
                if (contentHash.Length < 64)
                {
                    throw new sys.ArgumentOutOfRangeException("contentHash", "Length should be at least 64");
                }
                if (contentHash.Length > 64)
                {
                    throw new sys.ArgumentOutOfRangeException("contentHash", "Length should be at most 64");
                }
            }

            this.Id                       = id;
            this.ClientModified           = clientModified;
            this.ServerModified           = serverModified;
            this.Rev                      = rev;
            this.Size                     = size;
            this.MediaInfo                = mediaInfo;
            this.SymlinkInfo              = symlinkInfo;
            this.SharingInfo              = sharingInfo;
            this.IsDownloadable           = isDownloadable;
            this.ExportInfo               = exportInfo;
            this.PropertyGroups           = propertyGroupsList;
            this.HasExplicitSharedMembers = hasExplicitSharedMembers;
            this.ContentHash              = contentHash;
            this.FileLockInfo             = fileLockInfo;
        }