Class XmlDocumentsCache
- Namespace
- SunamoDevCode
- Assembly
- SunamoDevCode.dll
Cache for XML documents (typically csproj files) to avoid repeated parsing.
public class XmlDocumentsCache
- Inheritance
-
XmlDocumentsCache
- Inherited Members
- Extension Methods
Fields
BuildProjectsDependencyTreeList
Delegate for building the project dependency tree from a csproj path and cache.
public static Func<string, Dictionary<string, XmlDocument>?, Task<List<string>>> BuildProjectsDependencyTreeList
Field Value
- Func<string, Dictionary<string, XmlDocument>, Task<List<string>>>
Cache
Dictionary caching parsed XmlDocuments keyed by file path.
public static Dictionary<string, XmlDocument> Cache
Field Value
CantBeLoadWithDictToAvoidCollectionWasChangedButCanWithNull
List of paths that cannot be loaded with a dictionary to avoid collection-was-changed exceptions.
public static List<string> CantBeLoadWithDictToAvoidCollectionWasChangedButCanWithNull
Field Value
Clpb
Optional progress bar for displaying cache loading progress.
public static IProgressBarDC? Clpb
Field Value
Nulled
Count of csproj files that were null (ignored or failed to load).
public static int Nulled
Field Value
ProjectDeps
In key is csproj path In value is absolute path of references (recursive)
public static Dictionary<string, List<string>> ProjectDeps
Field Value
Type
Type reference for this class.
public static Type Type
Field Value
Methods
BadXml()
Returns paths of projects with invalid XML.
public static List<string> BadXml()
Returns
BuildProjectDeps()
Builds a filtered dictionary containing only successfully loaded XML documents from the cache.
public static Dictionary<string, XmlDocument> BuildProjectDeps()
Returns
- Dictionary<string, XmlDocument>
Dictionary of valid XML documents keyed by csproj path.
Get(string)
Nemůže se volat společně s .Result! viz. https://stackoverflow.com/a/65820543/9327173 Způsobí to deadlock! Musím to dělat přes ThisApp.async_ Can return null during many situations For example when ignored => must always checking for null
public static Task<ResultWithExceptionDC<XmlDocument>> Get(string path)
Parameters
pathstringPath to the csproj file to load or retrieve from cache.
Returns
- Task<ResultWithExceptionDC<XmlDocument>>
Result containing the parsed XmlDocument or an exception message.
Set(string, string, bool)
Sets or updates a cached XML document from raw XML content, optionally saving to disk.
public static Task Set(string path, string xmlContent, bool saveToFile = false)
Parameters
pathstringPath to the csproj file.
xmlContentstringRaw XML content to parse.
saveToFileboolWhether to also write the document to disk.
Returns
Set(string, XmlDocument, bool)
Sets or updates a cached XML document, optionally saving to disk.
public static Task Set(string path, XmlDocument document, bool saveToFile = false)
Parameters
pathstringPath to the csproj file.
documentXmlDocumentXmlDocument to cache.
saveToFileboolWhether to also write the document to disk.