Skip to content

Commit ede9abd

Browse files
committed
Add extra file path support
1 parent d2b20e2 commit ede9abd

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

Mod.Localizer/DefaultConfigurations.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public static class DefaultConfigurations
2121
[typeof(TranslationProcessor)] = "Customs"
2222
};
2323

24+
public static readonly IReadOnlyDictionary<Type, string> FileMapper = new Dictionary<Type, string>()
25+
{
26+
[typeof(BuildPropertyProcessor)] = "Info.json",
27+
};
28+
2429
public static string GetPath(TmodFileWrapper.ITmodFile mod, Type processorType, string file)
2530
{
2631
return Path.Combine(mod.Name, FolderMapper[processorType], file);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.IO;
3+
using Mod.Localizer.ContentFramework;
4+
using Mod.Localizer.ContentProcessor;
5+
6+
namespace Mod.Localizer.Extensions
7+
{
8+
internal static class ProcessorExtensions
9+
{
10+
public static string GetExtraDataPath<T>(this Processor<T> processor) where T : Content
11+
{
12+
if (!DefaultConfigurations.FileMapper.ContainsKey(processor.GetType()))
13+
{
14+
throw new InvalidOperationException($"{typeof(T).FullName} does not have an extra file.");
15+
}
16+
17+
return Path.Combine(Program.SourcePath, DefaultConfigurations.FileMapper[processor.GetType()]);
18+
}
19+
}
20+
}

Mod.Localizer/Mod.Localizer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<Compile Include="ContentProcessor\TileProcessor.cs" />
6969
<Compile Include="ContentProcessor\TranslationProcessor.cs" />
7070
<Compile Include="DefaultConfigurations.cs" />
71+
<Compile Include="Extensions\Processor.Extensions.cs" />
7172
<Compile Include="TargetInstruction.cs" />
7273
<Compile Include="ContentProcessor\DebugProcessor.cs" />
7374
<Compile Include="ContentProcessor\ItemProcessor.cs" />

Mod.Localizer/Resources/Strings.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Mod.Localizer/Resources/Strings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,7 @@
174174
<data name="Saving" xml:space="preserve">
175175
<value>Saving mod file {0}</value>
176176
</data>
177+
<data name="BuildPropWrittenToPath" xml:space="preserve">
178+
<value>Build properties has been written to {0}</value>
179+
</data>
177180
</root>

0 commit comments

Comments
 (0)