mirror of
https://github.com/Ellpeck/Contentless.git
synced 2024-11-27 17:28:35 +01:00
Fix braces.
This commit is contained in:
parent
783fc8683e
commit
a8ed920103
1 changed files with 8 additions and 16 deletions
|
@ -44,10 +44,8 @@ public static class Program {
|
||||||
var overrides = Program.GetOverrides(config.Overrides).ToArray();
|
var overrides = Program.GetOverrides(config.Overrides).ToArray();
|
||||||
|
|
||||||
var referencesVersions = config.References.ToDictionary(x => x, x => (string)null, StringComparer.OrdinalIgnoreCase);
|
var referencesVersions = config.References.ToDictionary(x => x, x => (string)null, StringComparer.OrdinalIgnoreCase);
|
||||||
if (config.References.Length > 0)
|
if (config.References.Length > 0) {
|
||||||
{
|
if (args.Length > 1) {
|
||||||
if (args.Length > 1)
|
|
||||||
{
|
|
||||||
ExtractVersions(args[1], referencesVersions);
|
ExtractVersions(args[1], referencesVersions);
|
||||||
_nuGetHelper = new NuGetHelper(Path.GetDirectoryName(args[1]));
|
_nuGetHelper = new NuGetHelper(Path.GetDirectoryName(args[1]));
|
||||||
}
|
}
|
||||||
|
@ -59,19 +57,16 @@ public static class Program {
|
||||||
var changed = false;
|
var changed = false;
|
||||||
var referencesSyncs = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
var referencesSyncs = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
// load any references to be able to include custom content types as well
|
// load any references to be able to include custom content types as well
|
||||||
for (int i = 0; i < content.Count; i++)
|
for (int i = 0; i < content.Count; i++) {
|
||||||
{
|
|
||||||
var line = content[i];
|
var line = content[i];
|
||||||
if (!line.StartsWith(ReferenceHeader))
|
if (!line.StartsWith(ReferenceHeader))
|
||||||
continue;
|
continue;
|
||||||
var reference = line.Substring(ReferenceHeader.Length);
|
var reference = line.Substring(ReferenceHeader.Length);
|
||||||
var libraryName = Path.GetFileName(reference)[..^4];
|
var libraryName = Path.GetFileName(reference)[..^4];
|
||||||
|
|
||||||
if (referencesVersions.TryGetValue(libraryName, out var version) && version is not null)
|
if (referencesVersions.TryGetValue(libraryName, out var version) && version is not null) {
|
||||||
{
|
|
||||||
var fullLibraryPath = CalculateFullPathToLibrary(libraryName, version);
|
var fullLibraryPath = CalculateFullPathToLibrary(libraryName, version);
|
||||||
if (reference != fullLibraryPath)
|
if (reference != fullLibraryPath) {
|
||||||
{
|
|
||||||
Console.WriteLine($"Changing library reference from {reference} to {fullLibraryPath}");
|
Console.WriteLine($"Changing library reference from {reference} to {fullLibraryPath}");
|
||||||
reference = fullLibraryPath;
|
reference = fullLibraryPath;
|
||||||
content[i] = ReferenceHeader + fullLibraryPath;
|
content[i] = ReferenceHeader + fullLibraryPath;
|
||||||
|
@ -96,18 +91,15 @@ public static class Program {
|
||||||
if (line.StartsWith(ReferenceHeader))
|
if (line.StartsWith(ReferenceHeader))
|
||||||
referencesLastIndex = i + 1;
|
referencesLastIndex = i + 1;
|
||||||
else if (line.StartsWith("/importer:") || line.StartsWith("/processor:") || line.StartsWith("/build:") ||
|
else if (line.StartsWith("/importer:") || line.StartsWith("/processor:") || line.StartsWith("/build:") ||
|
||||||
line.Contains("-- Content --"))
|
line.Contains("-- Content --")) {
|
||||||
{
|
|
||||||
if (referencesLastIndex == 0)
|
if (referencesLastIndex == 0)
|
||||||
referencesLastIndex = i;
|
referencesLastIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var reference in referencesVersions)
|
foreach (var reference in referencesVersions)
|
||||||
if (!referencesSyncs.Contains(reference.Key) && reference.Value is not null)
|
if (!referencesSyncs.Contains(reference.Key) && reference.Value is not null) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
var path = CalculateFullPathToLibrary(reference.Key, reference.Value);
|
var path = CalculateFullPathToLibrary(reference.Key, reference.Value);
|
||||||
content.Insert(referencesLastIndex++, ReferenceHeader + path);
|
content.Insert(referencesLastIndex++, ReferenceHeader + path);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
Loading…
Reference in a new issue