public HTMLExtractor(string passedURL)
        {
            URL = passedURL;

            SiteName = SiteDetector(URL);

            using (WebClient client = new WebClient()) // WebClient class inherits IDisposable
            {
                HTML = client.DownloadString(URL);
            }

            if (SiteName.ToLower() == "imdb")
            {
                IMDB imdb = new IMDB(HTML);
                MetaCollector = new MetaCollector(imdb);
            }
            else
            {
                TV tv = new TV(HTML);
                MetaCollector = new MetaCollector(tv);
            }
        }
Exemplo n.º 2
0
    protected void SetupControl()
    {
        if (this.StopProcessing)
        {
            listElem.Visible = false;
            return;
        }

        listElem.Visible = true;

        // Show warning if activities logging is disabled for current site
        lblDis.Visible = !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(CMSContext.CurrentSiteName);

        listElem.ShowContactNameColumn = true;
        listElem.OrderBy = "ActivityCreated DESC";

        string where = null;
        if (!String.IsNullOrEmpty(ActivityType))
        {
            where = SqlHelperClass.AddWhereCondition(where, "ActivityType='" + SqlHelperClass.GetSafeQueryString(this.ActivityType, true) + "'");
        }

        // Get site ID from site name
        string siteName = (SiteName != null ? SiteName.ToLower() : "");
        int    siteId   = -1;

        switch (siteName)
        {
        case "##all##":
            break;

        case "##currentsite##":
            siteId = CMSContext.CurrentSiteID;
            break;

        default:
            siteId = SiteInfoProvider.GetSiteID(siteName);
            break;
        }
        if (siteId != -1)
        {
            where = SqlHelperClass.AddWhereCondition(where, "ActivitySiteID=" + siteId);
        }

        // Get correct time interval
        int      days = ValidationHelper.GetInteger(DateInterval, 0);
        DateTime dt   = DateTimeHelper.GetDayStart(DateTime.Now);

        switch (days)
        {
        case -1:
            dt = DateTimeHelper.GetWeekStart(dt, CultureHelper.DefaultUICulture);
            break;

        case -2:
            dt = DateTimeHelper.GetMonthStart(dt);
            break;

        default:
            dt = dt.AddDays(-days);
            break;
        }
        where = SqlHelperClass.AddWhereCondition(where, "ActivityCreated >= '" + dt.ToString("s") + "'"); // "s" - ISO format (supported by DB regardless of culture)
        listElem.ShowSiteNameColumn = (siteId == -1);                                                     // Show site name column if activities from all sites are listed
        listElem.WhereCondition     = where;

        if (!RequestHelper.IsPostBack())
        {
            // Init page size for the first time only
            listElem.PageSize = PageSize;
        }
    }