Skip to content

Commit

Permalink
Listing now supports multiple patchers per repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Sep 30, 2020
1 parent 6b8d0fe commit 69a6a07
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<PropertyGroup>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<Version>0.8.3</Version>
<Version>0.8.5</Version>
</PropertyGroup>
</Project>
12 changes: 0 additions & 12 deletions Mutagen.Bethesda.Synthesis/DTO/PatcherMeta.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Mutagen.Bethesda.Synthesis/DTO/PatchersListing.cs

This file was deleted.

16 changes: 5 additions & 11 deletions Synthesis.Bethesda.GUI/ViewModels/Config/SolutionPatcherVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.IO;
using System.Reactive.Linq;
using System.Text;
using Synthesis.Bethesda.Execution.Patchers;
using Buildalyzer;
using System.Linq;
using DynamicData.Binding;
Expand All @@ -20,14 +19,9 @@
using System.Diagnostics;
using Buildalyzer.Environment;
using System.Reactive;
using Microsoft.Build.Evaluation;
using System.Threading;
using Serilog.Context;
using Serilog;
using Serilog.Events;
using Newtonsoft.Json;
using Mutagen.Bethesda.Synthesis;
using Mutagen.Bethesda.Synthesis.DTO;
using Synthesis.Bethesda.DTO;

namespace Synthesis.Bethesda.GUI
{
Expand Down Expand Up @@ -183,7 +177,7 @@ public SolutionPatcherVM(ProfileVM parent, SolutionPatcherSettings? settings = n
{
try
{
return Path.Combine(Path.GetDirectoryName(projPath)!, "SynthesisMeta.json");
return Path.Combine(Path.GetDirectoryName(projPath)!, Constants.MetaFileName);
}
catch (Exception)
{
Expand All @@ -203,13 +197,13 @@ public SolutionPatcherVM(ProfileVM parent, SolutionPatcherSettings? settings = n
{
try
{
return JsonConvert.DeserializeObject<PatcherInfo>(File.ReadAllText(path));
return JsonConvert.DeserializeObject<PatcherCustomization>(File.ReadAllText(path));
}
catch (Exception ex)
{
Logger.Error(ex, "Error reading in meta");
}
return default(PatcherInfo?);
return default(PatcherCustomization?);
});
})
.Switch()
Expand Down Expand Up @@ -242,7 +236,7 @@ public SolutionPatcherVM(ProfileVM parent, SolutionPatcherSettings? settings = n
if (string.IsNullOrWhiteSpace(x.meta)) return;
File.WriteAllText(x.meta,
JsonConvert.SerializeObject(
new PatcherInfo()
new PatcherCustomization()
{
Description = x.desc,
HideByDefault = x.hidden,
Expand Down
1 change: 0 additions & 1 deletion Synthesis.Bethesda.UnitTests/CodeSnippetTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Synthesis.Bethesda.Execution.Patchers;
using Synthesis.Bethesda.Execution.Settings;
using Noggog;
using Noggog.Utility;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
1 change: 0 additions & 1 deletion Synthesis.Bethesda.UnitTests/RunnerTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Synthesis.Bethesda.Execution.Patchers;
using Synthesis.Bethesda.Execution.Runner;
using Noggog;
using Noggog.Utility;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
3 changes: 2 additions & 1 deletion Synthesis.Bethesda/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Mutagen.Bethesda;
using Mutagen.Bethesda;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -9,5 +9,6 @@ public static class Constants
{
public static readonly string SynthesisName = "Synthesis";
public static readonly ModKey SynthesisModKey = new ModKey(SynthesisName, ModType.Plugin);
public static readonly string MetaFileName = "SynthesisMeta.json";
}
}
11 changes: 11 additions & 0 deletions Synthesis.Bethesda/DTO/MutagenPatchersListing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Synthesis.Bethesda.DTO
{
public class MutagenPatchersListing
{
public RepositoryListing[] Repositories { get; set; } = Array.Empty<RepositoryListing>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
using System.Collections.Generic;
using System.Text;

namespace Mutagen.Bethesda.Synthesis.DTO
namespace Synthesis.Bethesda.DTO
{
public class PatcherInfo : IEquatable<PatcherInfo>
public class PatcherCustomization : IEquatable<PatcherCustomization>
{
public string? Nickname { get; set; }
public bool HideByDefault { get; set; } = false;
public string? Description { get; set; }

public override bool Equals(object obj)
{
return obj is PatcherInfo info && this.Equals(info);
return obj is PatcherCustomization info && this.Equals(info);
}

public bool Equals(PatcherInfo other)
public bool Equals(PatcherCustomization other)
{
if (HideByDefault != other.HideByDefault) return false;
if (!string.Equals(this.Description, other.Description)) return false;
Expand Down
12 changes: 12 additions & 0 deletions Synthesis.Bethesda/DTO/PatcherListing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Synthesis.Bethesda.DTO
{
public class PatcherListing
{
public PatcherCustomization? Customization { get; set; }
public string ProjectPath { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
using System.Collections.Generic;
using System.Text;

namespace Mutagen.Bethesda.Synthesis.DTO
namespace Synthesis.Bethesda.DTO
{
public class PatcherRepoInfo
public class RepositoryListing
{
public PatcherListing[] Patchers { get; set; } = Array.Empty<PatcherListing>();
public string? AvatarURL { get; set; }
public string? User { get; set; }
public string? Repository { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions Synthesis.Bethesda/RunSynthesisPatcher.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using CommandLine;
using CommandLine;
using Mutagen.Bethesda;
using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Text;

namespace Synthesis.Bethesda
Expand Down

0 comments on commit 69a6a07

Please sign in to comment.