48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.Globalization;
|
|
|
|
namespace WordpressEboobScraper2.Scraper;
|
|
|
|
public class EpubParameter
|
|
{
|
|
public readonly string Series;
|
|
public readonly int SeriesIndex;
|
|
public readonly Guid ID_OPF;
|
|
public readonly Guid ID_CAL;
|
|
public readonly string Title;
|
|
public readonly string Author;
|
|
public readonly DateTime Release;
|
|
public readonly string Language;
|
|
public readonly string StartURL;
|
|
public readonly string Foldername;
|
|
public readonly Site SiteType;
|
|
|
|
public string AuthorSort { get { return Author.Split(' ').Aggregate((a, b) => b + ", " + a); } }
|
|
|
|
public EpubParameter(Site st, string t, string a, string r, string l, string s) : this(st, null, -1, t, a, r, l, s) { }
|
|
|
|
public EpubParameter(Site st, string z, int i, string t, string a, string r, string l, string s)
|
|
{
|
|
SiteType = st;
|
|
Series = z;
|
|
SeriesIndex = i;
|
|
Title = t;
|
|
Author = a;
|
|
Release = DateTime.ParseExact(r, "yyyy-MM-dd", CultureInfo.InvariantCulture);
|
|
Language = l;
|
|
StartURL = s;
|
|
if (z == null)
|
|
Foldername = Helper.Filenamify(t);
|
|
else
|
|
Foldername = string.Format("{0} {1} - {2}", Helper.Filenamify(z), i, Helper.Filenamify(t));
|
|
|
|
var u = new Random(Title.GetHashCode() ^ Author.GetHashCode());
|
|
var g = new byte[16];
|
|
u.NextBytes(g);
|
|
ID_OPF = new Guid(g);
|
|
u.NextBytes(g);
|
|
ID_CAL = new Guid(g);
|
|
}
|
|
|
|
public String DisplayStr => (Series == null) ? $"{Title}" : $"{Series} {SeriesIndex} - {Title}";
|
|
}
|