/// <summary>
        /// <para>Initializes a new instance of the <see cref="ThumbnailArg" /> class.</para>
        /// </summary>
        /// <param name="path">The path to the image file you want to thumbnail.</param>
        /// <param name="format">The format for the thumbnail image, jpeg (default) or png. For
        /// images that are photos, jpeg should be preferred, while png is  better for
        /// screenshots and digital arts.</param>
        /// <param name="size">The size for the thumbnail image.</param>
        public ThumbnailArg(string path,
                            ThumbnailFormat format = null,
                            ThumbnailSize size     = null)
        {
            if (path == null)
            {
                throw new sys.ArgumentNullException("path");
            }
            if (!re.Regex.IsMatch(path, @"\A(?:(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?))\z"))
            {
                throw new sys.ArgumentOutOfRangeException("path", @"Value should match pattern '\A(?:(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?))\z'");
            }

            if (format == null)
            {
                format = Dropbox.Api.Files.ThumbnailFormat.Jpeg.Instance;
            }
            if (size == null)
            {
                size = Dropbox.Api.Files.ThumbnailSize.W64h64.Instance;
            }
            this.Path   = path;
            this.Format = format;
            this.Size   = size;
        }
Example #2
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ThumbnailArg" /> class.</para>
        /// </summary>
        /// <param name="path">The path to the image file you want to thumbnail.</param>
        /// <param name="format">The format for the thumbnail image, jpeg (default) or png. For
        /// images that are photos, jpeg should be preferred, while png is  better for
        /// screenshots and digital arts.</param>
        /// <param name="size">The size for the thumbnail image.</param>
        public ThumbnailArg(string path,
                            ThumbnailFormat format = null,
                            ThumbnailSize size     = null)
        {
            if (path == null)
            {
                throw new sys.ArgumentNullException("path");
            }
            else if (!re.Regex.IsMatch(path, @"((/|id:).*)|(rev:[0-9a-f]{9,})"))
            {
                throw new sys.ArgumentOutOfRangeException("path");
            }

            if (format == null)
            {
                format = ThumbnailFormat.Jpeg.Instance;
            }

            if (size == null)
            {
                size = ThumbnailSize.W64h64.Instance;
            }

            this.Path   = path;
            this.Format = format;
            this.Size   = size;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ThumbnailV2Arg" /> class.</para>
        /// </summary>
        /// <param name="resource">Information specifying which file to preview. This could be
        /// a path to a file, a shared link pointing to a file, or a shared link pointing to a
        /// folder, with a relative path.</param>
        /// <param name="format">The format for the thumbnail image, jpeg (default) or png. For
        /// images that are photos, jpeg should be preferred, while png is  better for
        /// screenshots and digital arts.</param>
        /// <param name="size">The size for the thumbnail image.</param>
        /// <param name="mode">How to resize and crop the image to achieve the desired
        /// size.</param>
        public ThumbnailV2Arg(PathOrLink resource,
                              ThumbnailFormat format = null,
                              ThumbnailSize size     = null,
                              ThumbnailMode mode     = null)
        {
            if (resource == null)
            {
                throw new sys.ArgumentNullException("resource");
            }

            if (format == null)
            {
                format = global::Dropbox.Api.Files.ThumbnailFormat.Jpeg.Instance;
            }
            if (size == null)
            {
                size = global::Dropbox.Api.Files.ThumbnailSize.W64h64.Instance;
            }
            if (mode == null)
            {
                mode = global::Dropbox.Api.Files.ThumbnailMode.Strict.Instance;
            }
            this.Resource = resource;
            this.Format   = format;
            this.Size     = size;
            this.Mode     = mode;
        }