Skip to content

Commit

Permalink
Rename folder Model to Elements
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjustino committed Dec 25, 2022
1 parent 68ba433 commit 58d0c45
Show file tree
Hide file tree
Showing 44 changed files with 71 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using C4Sharp.Extensions;
using C4Sharp.Commons.Extensions;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// The word "component" is a hugely overloaded term in the software development industry, but in this context a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// Component types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel;
using C4Sharp.Extensions;
using C4Sharp.Commons.Extensions;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// Not Docker! In the C4 model, a container represents an application or a data store. A container is something
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using C4Sharp.Extensions;
using C4Sharp.Models.Relationships;
using C4Sharp.Commons.Extensions;
using C4Sharp.Elements.Relationships;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// Container Boundary
Expand Down Expand Up @@ -29,12 +29,9 @@ public sealed record ContainerBoundary<T> : ContainerBoundary
{
public ContainerBoundary():base(StructureIdentity.New<T>(), typeof(T).ToNamingConvention())
{

}

public ContainerBoundary(string label):base(StructureIdentity.New<T>(), label)
{

}

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// Container Type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record Api(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Api, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record BlobStore(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Blob, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ClientDesktop(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.ClientDesktop, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ClientSideWebApp(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Spa, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record Database(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Database, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record EventStreaming(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Topic, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record FileSystem(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.FileSystem, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record MessageBroker(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Queue, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record Mobile(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Mobile, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record Queue(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.Queue, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ServerConsole(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.ServerConsole, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ServerSideWebApp(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.WebApplication, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ServerlessFunction(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.ServerlessFunction, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Containers;
namespace C4Sharp.Elements.Containers;

public record ShellScript(string Alias, string Label, string Technology, string? Description = null)
: Container(Alias, Label, ContainerType.ShellScript, Technology, Description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// A deployment node is something like physical infrastructure (e.g. a physical server or device),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models;
namespace C4Sharp.Elements;

public record EnterpriseBoundary(string Alias, string Label, params Structure[] Structures) : Structure(Alias, Label), IBoundary
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models;
namespace C4Sharp.Elements;

public interface IBoundary
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using C4Sharp.Models.Relationships;
using C4Sharp.Elements.Relationships;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// A person represents one of the human users of your software system (e.g. actors, roles, personas, etc)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Plantuml.Constants;
namespace C4Sharp.Elements.Plantuml.Constants;

public record ElementName
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Plantuml.Constants;
namespace C4Sharp.Elements.Plantuml.Constants;

public record LineStyle
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Plantuml.Constants;
namespace C4Sharp.Elements.Plantuml.Constants;

public record Shape
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using C4Sharp.Diagrams;
using C4Sharp.Models.Plantuml.Constants;
using C4Sharp.Elements.Plantuml.Constants;

namespace C4Sharp.Models.Plantuml;
namespace C4Sharp.Elements.Plantuml;

public class ElementStyle : IElementStyle
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using C4Sharp.Diagrams;
using C4Sharp.Models.Plantuml.Constants;
using C4Sharp.Elements.Plantuml.Constants;

namespace C4Sharp.Models.Plantuml;
namespace C4Sharp.Elements.Plantuml;

public class ElementTag : IElementTag
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Text;
using C4Sharp.Diagrams;
using C4Sharp.FileSystem;
using C4Sharp.Models.Plantuml.Constants;
using System.Text;

namespace C4Sharp.Models.Plantuml.Extensions;
namespace C4Sharp.Elements.Plantuml.Extensions;

/// <summary>
/// Parser Diagram to PlantUML
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using C4Sharp.Models.Relationships;
using C4Sharp.Elements.Relationships;

namespace C4Sharp.Models.Plantuml.Extensions;
namespace C4Sharp.Elements.Plantuml.Extensions;

/// <summary>
/// Parser Relationship to PlantUML
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using C4Sharp.Extensions;
using C4Sharp.Models.Relationships;
using System.Text;
using C4Sharp.Commons;
using C4Sharp.Elements.Relationships;

namespace C4Sharp.Models.Plantuml.Extensions;
namespace C4Sharp.Elements.Plantuml.Extensions;

/// <summary>
/// PlantUML Parser
Expand Down Expand Up @@ -54,7 +54,7 @@ private static string ToPumlString(this SoftwareSystemBoundary boundary)

foreach (var container in boundary.Containers)
{
stream.AppendLine($"{SpaceMethods.Indent()}{container.ToPumlString()}");
stream.AppendLine($"{TabIndentation.Indent()}{container.ToPumlString()}");
}

stream.AppendLine("}");
Expand All @@ -72,7 +72,7 @@ private static string ToPumlString(this EnterpriseBoundary boundary)
{
if (structure is Person or SoftwareSystem or EnterpriseBoundary)
{
stream.AppendLine($"{SpaceMethods.Indent()}{structure.ToPumlString()}");
stream.AppendLine($"{TabIndentation.Indent()}{structure.ToPumlString()}");
}
}

Expand Down Expand Up @@ -122,15 +122,15 @@ private static string ToPumlString(this ContainerBoundary boundary)
stream.AppendLine($"Container_Boundary({boundary.Alias}, \"{boundary.Label}\") {{");
foreach (var component in boundary.Components)
{
stream.AppendLine($"{SpaceMethods.Indent()}{component.ToPumlString()}");
stream.AppendLine($"{TabIndentation.Indent()}{component.ToPumlString()}");
}

if (boundary.Relationships.Any())
{
stream.AppendLine();
foreach (var relationship in boundary.Relationships)
{
stream.AppendLine($"{SpaceMethods.Indent()}{relationship.ToPumlString()}");
stream.AppendLine($"{TabIndentation.Indent()}{relationship.ToPumlString()}");
}
}

Expand All @@ -142,7 +142,7 @@ private static string ToPumlString(this ContainerBoundary boundary)
private static string ToPumlString(this DeploymentNode deployment, int concat = 0)
{
var stream = new StringBuilder();
var spaces = SpaceMethods.Indent(concat);
var spaces = TabIndentation.Indent(concat);

if (concat == 0)
{
Expand All @@ -158,12 +158,12 @@ private static string ToPumlString(this DeploymentNode deployment, int concat =

foreach (var node in deployment.Nodes)
{
stream.AppendLine($"{node.ToPumlString(concat + SpaceMethods.TabSize)}");
stream.AppendLine($"{node.ToPumlString(concat + TabIndentation.TabSize)}");
}

if (deployment.Container != null)
{
stream.AppendLine(SpaceMethods.Indent(concat) + deployment.Container.ToPumlString());
stream.AppendLine(TabIndentation.Indent(concat) + deployment.Container.ToPumlString());
}

stream.Append(spaces + "}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Diagnostics;
using System.Text;
using C4Sharp.Diagrams;
using C4Sharp.Extensions;
using C4Sharp.Elements.Plantuml.Extensions;
using C4Sharp.FileSystem;
using C4Sharp.Models.Plantuml.Extensions;

namespace C4Sharp.Models.Plantuml.IO;
namespace C4Sharp.Elements.Plantuml.IO;

public partial class PlantumlContext : IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Plantuml.IO;
namespace C4Sharp.Elements.Plantuml.IO;

/// <summary>
/// PlantumlException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using C4Sharp.Extensions;
using C4Sharp.Commons;
using C4Sharp.FileSystem;

namespace C4Sharp.Models.Plantuml.IO;
namespace C4Sharp.Elements.Plantuml.IO;

internal static class PlantumlResources
{
Expand Down Expand Up @@ -47,7 +47,7 @@ private static void LoadResource(string resourcesPath, string resourceName)
return;
}

var stream = ResourceMethods.GetResourceContent(resourceName);
var stream = ResourceFile.ReadString(resourceName);
Directory.CreateDirectory(resourcesPath);
File.WriteAllText(path, stream);
}
Expand Down Expand Up @@ -106,7 +106,7 @@ private static void LoadIconPngResource(string resourcesPath)

private static void LoadStream(string path, string resourceName)
{
var stream = ResourceMethods.GetResourceStream(resourceName) ?? throw new InvalidOperationException();
var stream = ResourceFile.ReadStream(resourceName) ?? throw new InvalidOperationException();
using var file = new FileStream(path, FileMode.Create, FileAccess.Write);
stream.CopyTo(file);
stream.Flush();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using C4Sharp.Diagrams;
using C4Sharp.Models.Plantuml.Constants;
using C4Sharp.Elements.Plantuml.Constants;

namespace C4Sharp.Models.Plantuml;
namespace C4Sharp.Elements.Plantuml;

public class RelationshipTag : IRelationshipTag
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Relationships;
namespace C4Sharp.Elements.Relationships;

/// <summary>
/// Boundary scope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Relationships;
namespace C4Sharp.Elements.Relationships;

/// <summary>
/// Direction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Relationships;
namespace C4Sharp.Elements.Relationships;

/// <summary>
/// Positions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace C4Sharp.Models.Relationships;
namespace C4Sharp.Elements.Relationships;

/// <summary>
/// Relationship
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using C4Sharp.Models.Relationships;
using C4Sharp.Elements.Relationships;

namespace C4Sharp.Models;
namespace C4Sharp.Elements;

/// <summary>
/// A software system is the highest level of abstraction and describes something that delivers value to its users,
Expand Down
Loading

0 comments on commit 58d0c45

Please sign in to comment.