public bool TryPopulate([NotNull] VIsan vIsan) { if (!Cache.ContainsKey(vIsan.Number)) { return(false); } var json = Cache[vIsan.Number]; json.Populate(vIsan); return(true); }
private void PopulateParent(VIsan vIsan) { if (_token.IsCancelled || vIsan.Parent == null) { return; } var dom = GetDom(vIsan.Parent); Populate(vIsan.Parent, dom); }
public void Populate([CanBeNull] VIsan vIsan) { if (vIsan == null || !vIsan.IsSearchable) { return; } var dom = GetDom(vIsan); Populate(vIsan, dom); SetParent(vIsan, dom); PopulateParent(vIsan); _token.ReportProgress(100.0, "Finished querying isan.org"); }
private void SetParent(VIsan vIsan, CQ dom) { if (_token.IsCancelled || dom == null) { return; } var titles = dom["a[href*=\"javascript:publicDisplayWork\"]"]; titles.ForEach(delegate(IDomObject o) { var href = (o.GetAttribute("href") ?? "").Trim(); if (Isan.IsIsan(href)) { vIsan.Parent = Isan.TryParse(href); } }); }
public void TestPopulateEmptyTitle() { const string emptyTitleVIsan = "00000000E0AA000000000001"; var vIsan = VIsan.TryParse(emptyTitleVIsan); _provider.Populate(vIsan); var parent = vIsan.Parent; Assert.IsNull(vIsan.Title); Assert.IsNull(vIsan.Year); Assert.IsNull(vIsan.LengthMin); Assert.IsNotNull(parent); Assert.AreEqual("Lord Of War", parent.Title); Assert.AreEqual(2004, parent.Year); Assert.AreEqual(100, parent.LengthMin); }
private static VIsan GetVISAN(Disc disc) { var file = disc.FileSystem.Files.MCMF; if (file == null) { return(null); } var xml = string.Join(" ", File.ReadAllLines(file.FullName)); if (!ISANContentIdRegex.IsMatch(xml)) { return(null); } var match = ISANContentIdRegex.Match(xml); var contentId = match.Groups[1].Value; return(VIsan.TryParse(contentId)); }
public void Store([NotNull] VIsan vIsan) { Cache[vIsan.Number] = vIsan.ToJson(); }