public static IW1Top WProjectUnit(this IW1Top w1Top, IGProjectUnit gProjectUnit, StringBuilder sB, CancellationToken?ct = default) { var pathToDir = Path.Combine(w1Top.BasePath, gProjectUnit.GRelativePath); var pathToFile = Path.Combine(w1Top.BasePath, gProjectUnit.GRelativePath, gProjectUnit.GName + gProjectUnit.GFileSuffix); var transformDictionary = gProjectUnit.GPatternReplacement.GDictionary; IW1Top iW1Top; try { iW1Top = w1Top.WFile(pathToDir, pathToFile, transformDictionary, sB, ct); } catch (Exception e) { Console.WriteLine(e); // ToDo: better exception handling throw; } sB.Clear(); return(iW1Top); }
public GAssemblyUnit(string gName = default, string gRelativePath = default, IGProjectUnit gProjectUnit = default, IDictionary <IGCompilationUnitId <TValue>, IGCompilationUnit <TValue> > gCompilationUnits = default, IDictionary <IGPropertiesUnitId <TValue>, IGPropertiesUnit <TValue> > gPropertiesUnits = default, IDictionary <IGResourceUnitId <TValue>, IGResourceUnit <TValue> > gResourceUnits = default, IGPatternReplacement gPatternReplacement = default, IGComment gComment = default ) { GName = gName == default ? "" : gName; GRelativePath = gRelativePath == default ? "" : gRelativePath; GProjectUnit = gProjectUnit == default? new GProjectUnit(GName) : gProjectUnit; GCompilationUnits = gCompilationUnits == default ? new Dictionary <IGCompilationUnitId <TValue>, IGCompilationUnit <TValue> >() : gCompilationUnits; GPropertiesUnits = gPropertiesUnits == default ? new Dictionary <IGPropertiesUnitId <TValue>, IGPropertiesUnit <TValue> >() : gPropertiesUnits; GResourceUnits = gResourceUnits == default ? new Dictionary <IGResourceUnitId <TValue>, IGResourceUnit <TValue> >() : gResourceUnits; GComment = gComment == default? new GComment() : gComment; GPatternReplacement = gPatternReplacement == default? new GPatternReplacement() : gPatternReplacement; Id = new GAssemblyUnitId <TValue>(); }
public static IR1Top RProjectUnit(this IR1Top r1Top, IGProjectUnit gProjectUnit, IW1Top w1Top) { r1Top.Ct?.ThrowIfCancellationRequested(); r1Top.Sb.RenderProjectUnitPreambleStringBuilder(gProjectUnit, r1Top.Indent, r1Top.Eol, r1Top.Ct); r1Top.Indent.Append(r1Top.IndentDelta); r1Top.Sb.Append(r1Top.Eol); r1Top.Sb.Append($"{r1Top.IndentDelta}{GProjectUnit.Header}{r1Top.Eol}"); if (gProjectUnit.GPropertyGroupInProjectUnits.Any()) { foreach (var kvp in gProjectUnit.GPropertyGroupInProjectUnits) { r1Top.RPropertyGroupInProjectUnit(kvp.Value); } } r1Top.Sb.Append(r1Top.Eol); if (gProjectUnit.GItemGroupInProjectUnits.Any()) { foreach (var kvp in gProjectUnit.GItemGroupInProjectUnits) { r1Top.RItemGroupInProjectUnit(kvp.Value); } } r1Top.Sb.Append(r1Top.Eol); if (gProjectUnit.GResourceUnits.Any()) { r1Top.Sb.Append($"{r1Top.Indent}<ItemGroup>{r1Top.Eol}"); foreach (var kvp in gProjectUnit.GResourceUnits) { r1Top.RResourceUnitInProjectUnit(kvp.Value); r1Top.Sb.Append(r1Top.Eol); } r1Top.Sb.Append($"{r1Top.Indent}</ItemGroup>{r1Top.Eol}"); } r1Top.Indent.ReplaceFirst(r1Top.IndentDelta, ""); r1Top.Sb.RenderProjectUnitPostambleStringBuilder(gProjectUnit, r1Top.Indent, r1Top.Eol, r1Top.Ct); r1Top.Sb.Append(r1Top.Eol); w1Top.WProjectUnit(gProjectUnit, r1Top.Sb); return(r1Top); }
public static StringBuilder RenderProjectUnitPostambleStringBuilder(this StringBuilder sb, IGProjectUnit gProjectUnit, StringBuilder indent, string eol, CancellationToken?ct = default) { ct?.ThrowIfCancellationRequested(); return(sb.Append($"{StringConstants.ProjectUnitSDKProjectEndTagStringDefault}{eol}")); }