private void tsmiwg_Click(object sender, EventArgs e)
 {
     ToolStripMenuItemWithGenre tsmiwg = sender as ToolStripMenuItemWithGenre;
     this.lastSelectedGenre = tsmiwg.Genre;
     EventHandler handler = this.GenreSelected;
     if (null != handler) {
         handler(this, EventArgs.Empty);
     }
 }
Exemplo n.º 2
0
        public GPackageClass(GDataSet.GPackageRow row, GGenreClass parent)
            : this()
        {
            this.packageKey = row.PackageKey;
            this.genreKey = row.IsGenreKeyNull() ? (int?)null : row.GenreKey;
            this.packageTitle = row.IsPackageTitleNull() ? null : row.PackageTitle;
            this.packageCatch = row.IsPackageCatchNull() ? null : row.PackageCatch;
            this.packageText = row.IsPackageTextNull() ? null : row.PackageText;
            this.created = row.Created;
            this.lastModified = row.LastModified;

            this.parent = parent;
        }
Exemplo n.º 3
0
        public GContentClass(GDataSet.GContentRow row, GPackageClass parentPackage, GGenreClass grandparentGenre)
            : this()
        {
            this.contentKey = row.ContentKey;
            this.packageKey = row.IsPackageKeyNull() ? (int?)null : row.PackageKey;
            this.genreKey = row.IsGenreKeyNull() ? (int?)null : row.GenreKey;
            this.title = row.IsTitleNull() ? null : row.Title;
            this.seriesNumber = row.IsSeriesNumberNull() ? null : row.SeriesNumber;
            this.subtitle = row.IsSubtitleNull() ? null : row.Subtitle;
            this.summaryHtml = row.IsSummaryHtmlNull() ? null : row.SummaryHtml;
            this.durationValue = row.IsDurationValueNull() ? (TimeSpan?)null : row.DurationValue;
            this.deadlineText = row.IsDeadlineTextNull() ? null : row.DeadlineText;
            this.created = row.Created;
            this.lastModified = row.LastModified;

            this.parentPackage = parentPackage;
            this.grandparentGenre = grandparentGenre;
        }
Exemplo n.º 4
0
 private string GetResultFullFilenameOf(GGenreClass genre)
 {
     return Path.Combine(this.cacheDirectory, string.Format("CrawlResult_21_{0}_{1}.bin", genre.GenreId, genre.RootDirectory));
 }
Exemplo n.º 5
0
        private GPackageClass CreatePackageAndStoreOrUpdate(int packageKey, GGenreClass genre, string pacTitle, string pacCatch, string pacText)
        {
            int? genreKey = (null != genre) ? genre.GenreKey : (int?)null;
            GDataSet.GPackageRow row = this.dataSet.GPackage.FindByPackageKey(packageKey);
            if (null != row) {
                if (genre == null && !row.IsGenreKeyNull()) {
                    genre = this.GetCachedGenre(row.GenreKey);
                }

                bool updateFlag = false;
                if (genreKey.HasValue && (row.IsGenreKeyNull() || genreKey.Value != row.GenreKey)) {
                    row.GenreKey = genreKey.Value;
                    updateFlag = true;
                }
                if (row.IsPackageTitleNull() || !row.PackageTitle.Equals(pacTitle)) {
                    row.PackageTitle = pacTitle;
                    updateFlag = true;
                }
                if (row.IsPackageCatchNull() || !row.PackageCatch.Equals(pacCatch)) {
                    row.PackageCatch = pacCatch;
                    updateFlag = true;
                }
                if (row.IsPackageTextNull() || !row.PackageText.Equals(pacText)) {
                    row.PackageText = pacText;
                    updateFlag = true;
                }
                if (updateFlag) {
                    row.LastModified = DateTime.Now;
                }
                return new GPackageClass(row, genre);
            } else {
                row = this.dataSet.GPackage.NewGPackageRow();
                row.PackageKey = packageKey;
                if(genreKey.HasValue) row.GenreKey = genreKey.Value;
                row.PackageTitle = pacTitle;
                row.PackageCatch = pacCatch;
                row.PackageText = pacText;
                DateTime now = DateTime.Now;
                row.Created = now;
                row.LastModified = now;

                this.dataSet.GPackage.AddGPackageRow(row);
                return new GPackageClass(row, genre);
            }
        }
Exemplo n.º 6
0
 private void CreateGenreClasses()
 {
     this.allGenres.Clear();
     this.visibleGenres.Clear();
     this.dicGenreByKey.Clear();
     this.dicGenreByImgDir.Clear();
     foreach (GDataSet.GGenreRow grow in this.dataSet.GGenre) {
         GGenreClass genre = new GGenreClass(grow);
         this.allGenres.Add(genre);
         switch(genre.GenreKey){
             case 20: case 21: case 22:
                 break;
             default:
                 this.visibleGenres.Add(genre);
                 break;
         }
         this.dicGenreByKey.Add(genre.GenreKey, genre);
         this.dicGenreByImgDir.Add(genre.ImageDirectory, genre);
     }
 }
Exemplo n.º 7
0
        private GContentClass CreateContentAndStoreOrUpdate(int contKey, GPackageClass package, GGenreClass genre, string title, string seriesNumber, string subtitle, string summaryHtml, TimeSpan durationValue, string deadlineText)
        {
            int? pacKey = (null != package) ? package.PackageKey : (int?)null;
            int? genreKey = (null != genre) ? genre.GenreKey : (int?)null;
            GDataSet.GContentRow row = this.dataSet.GContent.FindByContentKey(contKey);
            if (null != row) {
                if (null == package && !row.IsPackageKeyNull()) {
                    this.TryFindPackage(row.PackageKey, out package);
                }
                if (null == genre && !row.IsGenreKeyNull()) {
                    genre = this.GetCachedGenre(row.GenreKey);
                }

                bool updateFlag = false;
                if (pacKey.HasValue && (row.IsPackageKeyNull() || pacKey.Value != row.PackageKey)) {
                    row.PackageKey = pacKey.Value;
                    updateFlag = true;
                }
                if (genreKey.HasValue && (row.IsGenreKeyNull() || genreKey.Value != row.GenreKey)) {
                    row.GenreKey = genreKey.Value;
                    updateFlag = true;
                }
                if (row.IsTitleNull() || !row.Title.Equals(title)) {
                    row.Title = title;
                    updateFlag = true;
                }
                if (row.IsSeriesNumberNull() || !row.SeriesNumber.Equals(seriesNumber)) {
                    row.SeriesNumber = seriesNumber;
                    updateFlag = true;
                }
                if (row.IsSubtitleNull() || !row.Subtitle.Equals(subtitle)) {
                    row.Subtitle = subtitle;
                    updateFlag = true;
                }
                if (row.IsSummaryHtmlNull() || !row.SummaryHtml.Equals(summaryHtml)) {
                    row.SummaryHtml = summaryHtml;
                    updateFlag = true;
                }
                if (row.IsDurationValueNull() || !row.DurationValue.Equals(durationValue)) {
                    row.DurationValue = durationValue;
                    updateFlag = true;
                }
                if (row.IsDeadlineTextNull() || !row.DeadlineText.Equals(deadlineText)) {
                    row.DeadlineText = deadlineText;
                    updateFlag = true;
                }

                if (updateFlag) {
                    row.LastModified = DateTime.Now;
                }
                return new GContentClass(row, package, genre);
            } else {
                row = this.dataSet.GContent.NewGContentRow();
                row.ContentKey = contKey;
                if(pacKey.HasValue) row.PackageKey = pacKey.Value;
                if(genreKey.HasValue) row.GenreKey = genreKey.Value;
                row.Title = title;
                row.SeriesNumber = seriesNumber;
                row.Subtitle = subtitle;
                row.SummaryHtml = summaryHtml;
                row.DurationValue = durationValue;
                row.DeadlineText = deadlineText;
                DateTime now = DateTime.Now;
                row.Created = now;
                row.LastModified = now;

                this.dataSet.GContent.AddGContentRow(row);
                return new GContentClass(row, package, genre);
            }
        }
Exemplo n.º 8
0
 public bool TryDeserializeCrawlResult(GGenreClass genre, out CrawlResult result)
 {
     try {
         using (FileStream fs = new FileStream(this.GetResultFullFilenameOf(genre), FileMode.Open)) {
             BinaryFormatter formatter = new BinaryFormatter();
             result = (CrawlResult)formatter.Deserialize(fs);
             return true;
         }
     } catch {
         result = null;
         return false;
     }
 }
Exemplo n.º 9
0
 public void SerializeCrawlResult(GGenreClass genre, CrawlResult result)
 {
     using (FileStream fs = new FileStream(this.GetResultFullFilenameOf(genre), FileMode.Create)) {
         BinaryFormatter formatter = new BinaryFormatter();
         formatter.Serialize(fs, result);
     }
 }
Exemplo n.º 10
0
 public ToolStripMenuItemWithGenre(GGenreClass genre)
     : base(genre.GenreName)
 {
     this.genre = genre;
 }
Exemplo n.º 11
0
 public GGenreTabPage(GGenreClass ggenre)
     : base(ggenre.GenreName, ggenre.GenreName + Environment.NewLine + ggenre.GenreTopPageUri.AbsoluteUri)
 {
     this.ggenre = ggenre;
 }
Exemplo n.º 12
0
 public CrawlRequestObject(GGenreClass genre, CrawlResult prevResult)
 {
     this.genre = genre;
     this.prevResult = prevResult;
 }
Exemplo n.º 13
0
 private bool AddTabIfNotExists(GGenreClass genre)
 {
     foreach (GenreTabPage gtp in this.tabcGsc.TabPages) {
         GGenreTabPage ggtp = gtp as GGenreTabPage;
         if (null != ggtp) {
             if (ggtp.Genre == genre) return false;
         }
     }
     this.AddGenreTabInternal(new GGenreTabPage(genre));
     return true;
 }