Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
v2.16.7
Browse files Browse the repository at this point in the history
Fix patch duplication on invalid dll
  • Loading branch information
misandrie committed May 9, 2024
1 parent 95b2daf commit fa9aa1f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Marsey/Config/MarseyVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class MarseyVars
/// Due to the nature of how Marseyloader is compiled (its not) we cannot check its version
/// Almost as if this variable is a consequence of having the project included rather than referenced
/// </summary>
public static readonly Version MarseyVersion = new Version("2.12.6");
public static readonly Version MarseyVersion = new Version("2.12.7");

/// <summary>
/// Default MarseyAPI endpoint url
Expand Down
8 changes: 4 additions & 4 deletions Marsey/PatchAssembly/AssemblyInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void Initialize(Assembly assembly)
return patchTypes.Single();
}
}

private static void ProcessDataType(Assembly assembly, Type dataType)
{
string typeName = dataType.Name;
Expand Down Expand Up @@ -97,10 +97,10 @@ private static void TryCreateAddPatch(Assembly assembly, MemberInfo? dataType, s

// Check if its even valid
if (!PatchFactory.TryGetValue(dataType.Name, out Func<Assembly, string, string, bool, IPatch>? createPatch)) return;

Hidesey.HidePatch(assembly); // Conceal assembly from the game

IPatch patch = createPatch(assembly, name, description, preloadField);
PatchListManager.AddPatchToList(patch);
}
}
}
9 changes: 9 additions & 0 deletions Marsey/Patches/MarseyPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ public MarseyPatch(string asmpath, Assembly asm, string name, string desc, bool
this.Asm = asm;
this.Preload = preload;
}

public override bool Equals(object obj)
{
if (obj is MarseyPatch other)
{
return this.Name == other.Name && this.Desc == other.Desc;
}
return false;
}
}
17 changes: 13 additions & 4 deletions Marsey/Subversion/Subverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,33 @@ public static void Hide(Assembly asm)
{
Hidesey.HidePatch(asm);
}

public static List<SubverterPatch> GetSubverterPatches() => PatchListManager.GetPatchList<SubverterPatch>();
}

public class SubverterPatch : IPatch
{
public string Asmpath { get; set; }
public Assembly Asm { get; set; }
public string Name { get; set; }
public string Name { get; set; }
public string Desc { get; set; }
public MethodInfo? Entry { get; set; }
public bool Enabled { get; set; }

public SubverterPatch(string asmpath, Assembly asm, string name, string desc)
{
Asmpath = asmpath;
Name = name;
Desc = desc;
Asm = asm;
}
}

public override bool Equals(object obj)
{
if (obj is SubverterPatch other)
{
return this.Name == other.Name && this.Desc == other.Desc;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class PatchesTabViewModel : MainWindowTabViewModel
public ObservableCollection<SubverterPatch> SubverterPatches { get; } = new ObservableCollection<SubverterPatch>();
public ObservableCollection<ResourcePack> ResourcePacks { get; } = new ObservableCollection<ResourcePack>();
public ICommand OpenPatchDirectoryCommand { get; }

#if DEBUG
public bool ShowRPacks => true;
#else
Expand All @@ -47,8 +47,8 @@ private void ReloadMods()

List<SubverterPatch> subverters = Subverter.GetSubverterPatches();
LoadPatchList(subverters, SubverterPatches, "subverterpatches");
List<ResourcePack> resourcePacks = ResMan.GetRPacks();

List<ResourcePack> resourcePacks = ResMan.GetRPacks();
LoadResPacks(resourcePacks, ResourcePacks);
}

Expand Down

0 comments on commit fa9aa1f

Please sign in to comment.