Skip to content

Commit 11148d2

Browse files
committed
add 'copy local' option to steam mods
1 parent fb5217d commit 11148d2

File tree

12 files changed

+295
-35
lines changed

12 files changed

+295
-35
lines changed

Assemblies/ModSwitch.dll

6.5 KB
Binary file not shown.

Languages/English/Keyed/Keyed.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ModSwitch.Import.Choice.Replace>Replace</ModSwitch.Import.Choice.Replace>
3333
<ModSwitch.Import.Choice.Append>Append</ModSwitch.Import.Choice.Append>
3434

35-
<ModSwitch.Color>Color</ModSwitch.Color>
35+
<ModSwitch.Color>Color...</ModSwitch.Color>
3636

3737
<ModSwitch.Color.white>white</ModSwitch.Color.white>
3838
<ModSwitch.Color.black>black</ModSwitch.Color.black>
@@ -44,6 +44,24 @@
4444
<ModSwitch.Color.cyan>cyan</ModSwitch.Color.cyan>
4545
<ModSwitch.Color.yellow>yellow</ModSwitch.Color.yellow>
4646

47+
<ModSwitch.CopyLocal>Create a local copy</ModSwitch.CopyLocal>
48+
49+
<ModSwitch.Error.SteamNotRunning>Steam currently not running/available</ModSwitch.Error.SteamNotRunning>
50+
51+
<ModSwitch.ExistingSettings>There are already stored settings for the mod under the new name {0}. You can confirm overwriting the existing settings or skip copying settings.</ModSwitch.ExistingSettings>
52+
<ModSwitch.ExistingSettings.Choice.Overwrite>Overwrite.</ModSwitch.ExistingSettings.Choice.Overwrite>
53+
<ModSwitch.ExistingSettings.Choice.Skip>Skip.</ModSwitch.ExistingSettings.Choice.Skip>
54+
55+
<ModSwitch.Error.InvalidChars>Contains invalid characters</ModSwitch.Error.InvalidChars>
56+
<ModSwitch.Error.TargetExists>Target already exists</ModSwitch.Error.TargetExists>
57+
58+
<ModSwitch.CopyLocal.Result.Copy>Copied mod {0} to {1}.</ModSwitch.CopyLocal.Result.Copy>>
59+
<ModSwitch.CopyLocal.Result.Settings>Copied {0} settings file(s).</ModSwitch.CopyLocal.Result.Settings>>
60+
<ModSwitch.CopyLocal.Result.Skipped>Skipped copying settings.</ModSwitch.CopyLocal.Result.Skipped>>
61+
62+
<ModSwitch.MoveTo>Move to...</ModSwitch.MoveTo>
63+
<ModSwitch.MoveTo.Top>Top</ModSwitch.MoveTo.Top>
64+
<ModSwitch.MoveTo.Bottom>Bottom</ModSwitch.MoveTo.Bottom>
4765

4866

4967
</LanguageData>

Source/ModSwitch/LanguageKeys.Generated.cs

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ public static class @keyed {
7777
/// </summary>
7878
public const string @ModSwitch_MissingMods_Choice_Ignore_Tip = "ModSwitch.MissingMods.Choice.Ignore.Tip";
7979
/// <summary>
80-
/// Get's the translation key for '<em>Open workshop</em>'
80+
/// Get's the translation key for '<em>Cancel & Open workshop</em>'
8181
/// </summary>
8282
public const string @ModSwitch_MissingMods_Choice_Workshop = "ModSwitch.MissingMods.Choice.Workshop";
8383
/// <summary>
84-
/// Get's the translation key for '<em>Try retrieving applicable mods from the Steam Workshop. Keep in mind those mods might no longer be available.</em>'
84+
/// Get's the translation key for '<em>Dont apply the Mod Set. Instead try retrieving applicable mods from the Steam Workshop. Keep in mind those mods might no longer be available.</em>'
8585
/// </summary>
8686
public const string @ModSwitch_MissingMods_Choice_Workshop_Tip = "ModSwitch.MissingMods.Choice.Workshop.Tip";
8787
/// <summary>
@@ -109,7 +109,7 @@ public static class @keyed {
109109
/// </summary>
110110
public const string @ModSwitch_Import_Choice_Append = "ModSwitch.Import.Choice.Append";
111111
/// <summary>
112-
/// Get's the translation key for '<em>Color</em>'
112+
/// Get's the translation key for '<em>Color...</em>'
113113
/// </summary>
114114
public const string @ModSwitch_Color = "ModSwitch.Color";
115115
/// <summary>
@@ -148,6 +148,58 @@ public static class @keyed {
148148
/// Get's the translation key for '<em>yellow</em>'
149149
/// </summary>
150150
public const string @ModSwitch_Color_yellow = "ModSwitch.Color.yellow";
151+
/// <summary>
152+
/// Get's the translation key for '<em>Create a local copy</em>'
153+
/// </summary>
154+
public const string @ModSwitch_CopyLocal = "ModSwitch.CopyLocal";
155+
/// <summary>
156+
/// Get's the translation key for '<em>Steam currently not running/available</em>'
157+
/// </summary>
158+
public const string @ModSwitch_Error_SteamNotRunning = "ModSwitch.Error.SteamNotRunning";
159+
/// <summary>
160+
/// Get's the translation key for '<em>There are already stored settings for the mod under the new name {0}. You can confirm overwriting the existing settings or skip copying settings.</em>'
161+
/// </summary>
162+
public const string @ModSwitch_ExistingSettings = "ModSwitch.ExistingSettings";
163+
/// <summary>
164+
/// Get's the translation key for '<em>Overwrite.</em>'
165+
/// </summary>
166+
public const string @ModSwitch_ExistingSettings_Choice_Overwrite = "ModSwitch.ExistingSettings.Choice.Overwrite";
167+
/// <summary>
168+
/// Get's the translation key for '<em>Skip.</em>'
169+
/// </summary>
170+
public const string @ModSwitch_ExistingSettings_Choice_Skip = "ModSwitch.ExistingSettings.Choice.Skip";
171+
/// <summary>
172+
/// Get's the translation key for '<em>Contains invalid characters</em>'
173+
/// </summary>
174+
public const string @ModSwitch_Error_InvalidChars = "ModSwitch.Error.InvalidChars";
175+
/// <summary>
176+
/// Get's the translation key for '<em>Target already exists</em>'
177+
/// </summary>
178+
public const string @ModSwitch_Error_TargetExists = "ModSwitch.Error.TargetExists";
179+
/// <summary>
180+
/// Get's the translation key for '<em>Copied mod {0} to {1}.</em>'
181+
/// </summary>
182+
public const string @ModSwitch_CopyLocal_Result_Copy = "ModSwitch.CopyLocal.Result.Copy";
183+
/// <summary>
184+
/// Get's the translation key for '<em>Copied {0} settings file(s).</em>'
185+
/// </summary>
186+
public const string @ModSwitch_CopyLocal_Result_Settings = "ModSwitch.CopyLocal.Result.Settings";
187+
/// <summary>
188+
/// Get's the translation key for '<em>Skipped copying settings.</em>'
189+
/// </summary>
190+
public const string @ModSwitch_CopyLocal_Result_Skipped = "ModSwitch.CopyLocal.Result.Skipped";
191+
/// <summary>
192+
/// Get's the translation key for '<em>Move to...</em>'
193+
/// </summary>
194+
public const string @ModSwitch_MoveTo = "ModSwitch.MoveTo";
195+
/// <summary>
196+
/// Get's the translation key for '<em>Top</em>'
197+
/// </summary>
198+
public const string @ModSwitch_MoveTo_Top = "ModSwitch.MoveTo.Top";
199+
/// <summary>
200+
/// Get's the translation key for '<em>Bottom</em>'
201+
/// </summary>
202+
public const string @ModSwitch_MoveTo_Bottom = "ModSwitch.MoveTo.Bottom";
151203
}
152204
}
153205
}

Source/ModSwitch/ModSwitch.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
24
using System.Linq;
5+
using System.Reflection;
36
using Harmony;
47
using UnityEngine;
58
using Verse;
@@ -9,6 +12,12 @@ namespace DoctorVanGogh.ModSwitch {
912
class ModSwitch : Mod {
1013
private Settings _settings;
1114

15+
private static readonly FieldInfo fiModLister_mods;
16+
17+
static ModSwitch() {
18+
fiModLister_mods = AccessTools.Field(typeof(ModLister), "mods");
19+
}
20+
1221
public ModSwitch(ModContentPack content) : base(content) {
1322
var harmony = HarmonyInstance.Create("DoctorVanGogh.ModSwitch");
1423
harmony.PatchAll(typeof(ModSwitch).Assembly);
@@ -37,5 +46,20 @@ public Color GetModColor(ModMetaData mod) {
3746
public void SetModColor(ModMetaData mod, Color value) {
3847
_settings.GetOrInsertAttributes(mod.Identifier).Color = value;
3948
}
49+
50+
public void MovePosition(ModMetaData mod, Position position) {
51+
List<ModMetaData> mods = (List<ModMetaData>) fiModLister_mods.GetValue(null);
52+
53+
if (mods.Remove(mod)) {
54+
switch (position) {
55+
case Position.Top:
56+
mods.Insert(0, mod);
57+
break;
58+
case Position.Bottom:
59+
mods.Add(mod);
60+
break;
61+
}
62+
}
63+
}
4064
}
4165
}

Source/ModSwitch/ModSwitch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<Compile Include="[UI]\Assets.cs" />
7171
<Compile Include="[UI]\Dialog_MissingMods.cs" />
7272
<Compile Include="[UI]\Dialog_SetText.cs" />
73+
<Compile Include="[Util]\Position.cs" />
7374
<Compile Include="[Util]\Util.cs" />
7475
<Compile Include="[Patches]\Patches.cs" />
7576
<Compile Include="[Util]\Linq.cs" />
@@ -109,5 +110,4 @@
109110
</Target>
110111
<Target Name="AfterBuild">
111112
</Target>
112-
113113
</Project>

Source/ModSwitch/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
[assembly: System.Reflection.AssemblyCopyright("Copyright © DoctorVanGogh 2017")]
1313
[assembly: System.Runtime.InteropServices.ComVisible(false)]
1414
[assembly: System.Runtime.InteropServices.Guid("ab2e8e89-3d1d-4e36-a0ae-489b6ebc84a6")]
15-
[assembly: System.Reflection.AssemblyVersion("1.0.0.10")]
15+
[assembly: System.Reflection.AssemblyVersion("1.1.0.27")]
1616

1717

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0.10
1+
1.1.0.27

0 commit comments

Comments
 (0)