public static async Task <UMLClassDiagram?> TryCreateClassDiagram(UMLDocumentCollection documents, string fullPath) { if (!fullPath.Contains("class.puml", System.StringComparison.OrdinalIgnoreCase)) { return(null); } UMLClassDiagram?cd = documents.ClassDocuments.Find(p => p.FileName == fullPath); if (cd == null) { try { cd = await PlantUML.UMLClassDiagramParser.ReadFile(fullPath); } catch { } if (cd != null) { documents.ClassDocuments.RemoveAll(p => p.FileName == fullPath); documents.ClassDocuments.Add(cd); } } return(cd); }
public UnknownDocumentModel(Action <UMLDiagram, UMLDiagram> changedCallback, IConfiguration configuration, IIOService openDirectoryService, UMLUnknownDiagram model, UMLDocumentCollection diagrams, string fileName, string title, string content, AutoResetEvent messageCheckerTrigger ) : base(configuration, openDirectoryService, fileName, title, content, messageCheckerTrigger) { ChangedCallback = changedCallback; Diagram = model; Diagrams = diagrams; colorCodingProvider = new UMLColorCoding(); }
public async Task Save(UMLDocumentCollection data, string fileName) { string r = JsonConvert.SerializeObject(data, GetOptions()); await File.WriteAllTextAsync(fileName, r); }
public static async Task <(UMLClassDiagram?cd, UMLSequenceDiagram?sd, UMLUnknownDiagram?ud)> TryCreateDiagram(UMLDocumentCollection documents, string text) { UMLUnknownDiagram? ud = null; UMLClassDiagram? cd = null; UMLSequenceDiagram?sd = await PlantUML.UMLSequenceDiagramParser.ReadString(text, documents.ClassDocuments, false); if (sd == null) { cd = await PlantUML.UMLClassDiagramParser.ReadString(text); } if (cd == null) { ud = new UMLUnknownDiagram("", ""); } return(cd, sd, ud); }
public static async Task <(UMLClassDiagram?cd, UMLSequenceDiagram?sd, UMLComponentDiagram?comd, UMLUnknownDiagram?ud)> TryFindOrAddDocument(UMLDocumentCollection documents, string fullPath) { UMLUnknownDiagram? ud = null; UMLClassDiagram? cd = null; UMLComponentDiagram?comd = null; UMLSequenceDiagram? sd = await TryCreateSequenceDiagram(documents, fullPath); if (sd == null) { cd = await TryCreateClassDiagram(documents, fullPath); } if (cd == null) { comd = await TryCreateComponentDiagram(documents, fullPath); } if (cd == null) { ud = await PlantUML.UnknownDiagramParser.ReadFile(fullPath); } return(cd, sd, comd, ud); }