-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from 8T4/freature/plantumlstream
Freature/plantumlstream
- Loading branch information
Showing
23 changed files
with
241 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace C4Sharp.Models | ||
{ | ||
public record EnterpriseBoundary(string Alias, string Label) : Structure(Alias, Label) | ||
{ | ||
public IEnumerable<Structure> Structures { get; init; } = Array.Empty<Structure>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using C4Sharp.Diagrams; | ||
|
||
namespace C4Sharp.Models.Plantuml | ||
{ | ||
public static class PlantumlStream | ||
{ | ||
private static readonly object Lock = new object(); | ||
|
||
public static (string, Stream) GetStream(this PlantumlSession session, Diagram diagram) | ||
{ | ||
lock (Lock) | ||
{ | ||
var puml = diagram.ToPumlString(session.StandardLibraryBaseUrl); | ||
return session.GetStream(puml); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/samples/C4Sharp.Sample/Diagrams/EnterpriseDiagramBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using C4Sharp.Diagrams.Core; | ||
using C4Sharp.Models; | ||
using C4Sharp.Models.Relationships; | ||
using C4Sharp.Sample.Structures; | ||
|
||
namespace C4Sharp.Sample.Diagrams | ||
{ | ||
using static Position; | ||
using static People; | ||
using static Systems; | ||
|
||
public class EnterpriseDiagramBuilder | ||
{ | ||
public static ContextDiagram Build() | ||
{ | ||
return new () | ||
{ | ||
Title = "System Enterprise diagram for Internet Banking System", | ||
Structures = new Structure[] | ||
{ | ||
Customer, | ||
new EnterpriseBoundary("eboundary", "Domain A") | ||
{ | ||
Structures = new Structure [] | ||
{ | ||
BankingSystem, | ||
new EnterpriseBoundary("eboundary1", "Domain Internal Users") | ||
{ | ||
Structures = new Structure [] | ||
{ | ||
InternalCustomer, | ||
} | ||
}, | ||
new EnterpriseBoundary("eboundary2", "Domain Managers") | ||
{ | ||
Structures = new Structure [] | ||
{ | ||
Manager, | ||
} | ||
}, | ||
} | ||
}, | ||
Mainframe, | ||
MailSystem | ||
}, | ||
Relationships = new[] | ||
{ | ||
Customer > BankingSystem, | ||
InternalCustomer > BankingSystem, | ||
Manager > BankingSystem, | ||
(Customer < MailSystem)["Sends e-mails to"], | ||
(BankingSystem > MailSystem)["Sends e-mails", "SMTP"][Neighbor], | ||
BankingSystem > Mainframe, | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.