/// <summary>
        ///
        /// </summary>
        /// <param name="blog"></param>
        /// <param name="url"></param>
        /// <param name="apiMode"></param>
        /// <param name="offset"></param>
        /// <param name="limit"></param>
        public TumblrStatsManager(TumblrBlog blog = null, string url = null, TumblrApiVersion apiMode = TumblrApiVersion.V2Json, int offset = 0, int limit = 0)
        {
            DocumentManager            = new RemoteDocumentManager();
            ApiVersion                 = apiMode;
            DocumentManager.ApiVersion = apiMode;
            TotalPostsPerDocument      = (int)NumberOfPostsPerApiDocument.ApiV2;

            Blog = blog ?? ((url != null) ? new TumblrBlog(url) : null);

            if (Blog != null)
            {
                Blog.Posts = new HashSet <TumblrPost>();

                TumblrUrl    = WebHelper.RemoveTrailingBackslash(Blog.Url);
                TumblrDomain = WebHelper.GetDomainName(TumblrUrl);

                ApiQueryLimit  = limit;
                ApiQueryOffset = offset;

                TotalPostsPerDocument = (int)NumberOfPostsPerApiDocument.ApiV2; //20 for JSON, 50 for XML

                var values = Enum.GetValues(typeof(TumblrPostType)).Cast <TumblrPostType>();
                TypesCount = values.Count() - 3;

                // Get Blog Info
                DocumentManager.GetRemoteBlogInfo(TumblrApiHelper.GeneratePostTypeQueryUrl(TumblrDomain, TumblrPostType.All, 0, 1), Blog);
            }
        }
Beispiel #2
0
 public TagScanManager(TumblrBlog blog = null, bool photoPostOnly = false)
 {
     Blog            = blog;
     DocumentManager = new RemoteDocumentManager();
     TumblrUrl       = WebHelper.RemoveTrailingBackslash(blog.Url);
     TumblrDomain    = WebHelper.GetDomainName(blog.Url);
     TagList         = new HashSet <string>();
     PhotoPostOnly   = photoPostOnly;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="blog"></param>
        /// <param name="saveLocation"></param>
        /// <param name="generateLog"></param>
        /// <param name="parseSets"></param>
        /// <param name="parseJpeg"></param>
        /// <param name="parsePng"></param>
        /// <param name="parseGif"></param>
        /// <param name="imageSize"></param>
        /// <param name="offset"></param>
        /// <param name="limit"></param>
        /// <param name="apiVersion"></param>
        public PhotoPostParseManager(TumblrBlog blog = null, string saveLocation = null, bool generateLog = false, bool parseSets     = true,
                                     bool parseJpeg  = true, bool parsePng       = true, bool parseGif    = true, ImageSize imageSize = ImageSize.None, int offset = 0, int limit = 0, TumblrApiVersion apiVersion = TumblrApiVersion.V2Json)
        {
            if (blog != null)
            {
                TumblrUrl    = WebHelper.RemoveTrailingBackslash(blog.Url);
                TumblrDomain = WebHelper.GetDomainName(blog.Url);
            }

            GenerateLog = generateLog;

            ApiQueryOffset = offset;
            SaveLocation   = saveLocation;

            ApiQueryPostLimit = limit;

            ErrorList = new HashSet <string>();

            Blog = blog;
            ProcessingStatusCode = ProcessingCode.Ok;
            ParsePhotoSets       = parseSets;
            ParseJpeg            = parseJpeg;
            ParsePng             = parsePng;
            ParseGif             = parseGif;
            ImageSize            = imageSize;
            ApiVersion           = apiVersion;

            Blog?.Posts?.Clear();
            TotalNumberOfPosts  = 0;
            ImageList           = new HashSet <PhotoPostImage>();
            TotalNumberOfImages = 0;
            DocumentManager     = new RemoteDocumentManager()
            {
                ApiVersion = apiVersion
            };
            ImageCommentsList = new Dictionary <string, string>();
        }