public static CommentFileCreateResult CommentFileCreate(TaxonTreeNode _node) { if (_node == null) { return(CommentFileCreateResult.Failed); } if (TaxonComments.Manager.AvailableCollections.Count == 0) { return(CommentFileCreateResult.NoCollection); } CommentsCollection collection = TaxonComments.Manager.AvailableCollections[0]; string name = CommentFilename(_node.Desc); if (string.IsNullOrEmpty(name)) { return(CommentFileCreateResult.NoNameAndID); } string path = CommentFileDesc.BuildHtlmName(collection, name); if (File.Exists(path)) { return(CommentFileCreateResult.ExistsAlready); } Manager.CreateHtmlComment(path, name); Manager.CleanCommentInMemory(0); return(CommentFileCreateResult.Success); }
//--------------------------------------------------------------------------------------- public static List <CommentFileDesc> GetAllCommentFile(TaxonTreeNode _node) { if (_node == null) { return(null); } List <CommentFileDesc> result = null; foreach (CommentsCollection collection in TaxonComments.Manager.AvailableCollections) { if (!_node.Desc.IsUnnamed) { string path = CommentFileDesc.BuildHtlmName(collection, _node.Desc.RefMultiName.Main); if (File.Exists(path)) { if (result == null) { result = new List <CommentFileDesc>(); } result.Add(new CommentFileDesc(collection, _node.Desc.RefMultiName.Main)); } } if (_node.Desc.OTTID != 0) { string path = CommentFileDesc.BuildHtlmName(collection, _node.Desc.OTTID.ToString()); if (File.Exists(path)) { if (result == null) { result = new List <CommentFileDesc>(); } result.Add(new CommentFileDesc(collection, _node.Desc.OTTID.ToString())); } } } return(result); }