/// <summary> /// Document constructor /// </summary> /// <param name="origName">Standard name in original file</param> /// <param name="doc">NormaCSAPI.Document object</param> public Document(string origName, NormaCSAPI.Document doc) { this.DWGName = origName; this.FoundName = doc.Designation; this.IsActual = doc.get_IsActual(); this.URL = doc.URL; HashSet<NormaCSAPI.Document> replaces = findReplacements(doc); if (replaces.Count > 0) this.Replaced = Document.convertNormaCSDocList(this.DWGName, replaces); }
/// <summary> /// Converter for NormaCSAPI.Document object into Document /// </summary> /// <param name="origName">Standard name in original file</param> /// <param name="doc">NormaCSAPI.Document object</param> /// <returns>Converted Document object</returns> public static Document convertNormaCSDocToInnerDoc(string origName, NormaCSAPI.Document doc) { Document innerDoc = new Document(origName, doc); return innerDoc; }
/// <summary> /// Replacements finder for the document /// </summary> /// <param name="doc">NormaCSAPI.Document object</param> /// <returns>Replacements list</returns> private HashSet<NormaCSAPI.Document> findReplacements(NormaCSAPI.Document doc) { HashSet<NormaCSAPI.Document> replacers = new HashSet<NormaCSAPI.Document>(); NormaCSAPI.Replacements replacedBy = doc.ReplacedBy; while (replacedBy.Count > 0) { foreach (NormaCSAPI.Replacement repl in replacedBy) replacers.Add(repl.get_Document()); replacedBy = replacers.Last().ReplacedBy; } return replacers; }