public int CompareTo(object o) { DocLink dl1 = (DocLink)o; if (fromId > dl1.fromId) { return(1); } else if (fromId < dl1.fromId) { return(-1); } else { if (toId > dl1.toId) { return(1); } else if (toId < dl1.toId) { return(-1); } else { return(0); } } }
internal static EurocasesDocumentLink FromDocLink(DocLink docLink, String baseUrl) { return(new EurocasesDocumentLink(title: docLink.Title, baseUrl: baseUrl, docLangId: docLink.DocLangId, documentType: docLink.DocType, originalUrl: docLink.OriginalLink, publisher: docLink.Publisher)); }
public virtual DependencyObject Visit(DocLink docLink) { var result = new System.Windows.Documents.Hyperlink() { NavigateUri = new Uri($"#StartItem={docLink.Type}:{docLink.Id ?? docLink.Name}", UriKind.Relative) }; result.Inlines.Add(new Run(docLink.Name)); return(result); }
public Result UpsertDocLink([FromBody] DocLink docLink) { var result = new Result(); try { using (var dblocal = new LiteDatabase(dbPath)) { var docsTable = dblocal.GetCollection <DocLink>("DocLinks"); docsTable.Upsert(docLink); result.Success = true; } } catch (System.Exception ex) { result.Data = ex; } return(result); }
public bool Equals(Pile other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var res = Length == other.Length && Side == other.Side && BottomRostverk == other.BottomRostverk && PitHeight == other.PitHeight && Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase) && DocLink.Equals(other.DocLink, StringComparison.OrdinalIgnoreCase) && PilePike == other.PilePike && TopPileAfterBeat == other.TopPileAfterBeat && TopPileAfterCut == other.TopPileAfterCut; return(res); }
//converts hashedlinks into binary using my IDs public void convertLinksFile() { //step 1: load links into hashtable d.Index index = new d.Index(d.Helper.INDEX_DIRECTORY_NAME); FileStream fs = new FileStream(d.Helper.SOURCE_DIRECTORY_NAME + "hashedLinks.txt", FileMode.Open); StreamReader r = new StreamReader(fs, System.Text.Encoding.ASCII); Hashtable linksHash = new Hashtable(); string line; while ((line = r.ReadLine()) != null) { int endOfUrl = line.IndexOf("-->["); int startOfLinks = endOfUrl + 4; string url = line.Substring(7, endOfUrl - 7); int lengthOfLinks = line.Length - 7 - url.Length - 4 - 1; string links = line.Substring(startOfLinks, lengthOfLinks); char[] del = { ',' }; string[] linkUrls = links.Split(del); short docId = index.GetDocId(url); if (docId == -1) { continue; } for (int i = 0; i < linkUrls.Length; i++) { string link = linkUrls[i].Trim(); if (link.Length > 0) { short linkId = index.GetDocId(link); if (linkId == -1) { Console.WriteLine("linkId error: " + link); } DocLink dl = new DocLink(docId, linkId); linksHash.Add(dl, true); } } } r.Close(); fs.Close(); //step 2: load into array and sort them DocLink[] docLinkArray = new DocLink[linksHash.Count]; IDictionaryEnumerator en = linksHash.GetEnumerator(); int cursor = 0; while (en.MoveNext()) { docLinkArray[cursor++] = (DocLink)en.Key; } Array.Sort(docLinkArray); //step 3: write out to file string path = d.Helper.INDEX_DIRECTORY_NAME + d.Helper.INDEX_DOCLINKS_FILE; if (File.Exists(path)) { File.Delete(path); } string textpath = path + ".txt"; if (File.Exists(textpath)) { File.Delete(textpath); } FileStream fs1 = new FileStream(path, FileMode.CreateNew); FileStream fsText = new FileStream(textpath, FileMode.CreateNew); BinaryWriter w = new BinaryWriter(fs1); StreamWriter wText = new StreamWriter(fsText); int counter = 0; for (int i = 0; i < docLinkArray.Length; i++) { DocLink dl = docLinkArray[i]; if (dl == null) { Console.WriteLine("null"); } w.Write(dl.fromId); w.Write(dl.toId); wText.WriteLine(dl.fromId + " " + dl.toId); counter++; } w.Close(); wText.Close(); fs1.Close(); fsText.Close(); Console.WriteLine("total links=" + counter); }