Skip to content

Commit fd6cc3b

Browse files
committed
Add codes to save the mod file
* oh why I forgot this * ahhhhhhhhhhhhhhhhhhh * noooooooooooooooooo * whhhhhhhhhhhy
1 parent 26bc451 commit fd6cc3b

File tree

6 files changed

+41
-12
lines changed

6 files changed

+41
-12
lines changed

Mod.Localizer/ContentProcessor/DebugProcessor.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public override IReadOnlyList<Content> DumpContents()
1616

1717
public override void PatchContents(IReadOnlyList<Content> contents)
1818
{
19-
PatchMainAssembly();
2019
}
2120

2221
private void DumpMainAssembly()
@@ -36,11 +35,6 @@ private void DumpMainAssembly()
3635
Logger.Debug("Write assembly files: {0}, {1}", dllPath, pdbPath);
3736
}
3837

39-
private void PatchMainAssembly()
40-
{
41-
Logger.Debug("Not implemented yet");
42-
}
43-
4438
public DebugProcessor(TmodFileWrapper.ITmodFile modFile, ModuleDef modModule, GameCultures culture) : base(modFile, modModule, culture)
4539
{
4640
}

Mod.Localizer/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ private static void Patch(TmodFileWrapper.ITmodFile modFile, IEnumerable<Type> p
108108
}
109109

110110
InnerPatch(modFile, procs);
111+
112+
// save mod file
113+
var file = string.Format(DefaultConfigurations.OutputFileNameFormat, modFile.Name);
114+
Logger.Warn(Strings.Saving, file);
115+
116+
modFile.Write(file);
111117
}
112118

113119
private static void InnerPatch(TmodFileWrapper.ITmodFile modFile, IEnumerable<Type> processors, string dll = null)
@@ -117,6 +123,8 @@ private static void InnerPatch(TmodFileWrapper.ITmodFile modFile, IEnumerable<Ty
117123
dll = modFile.HasFile("All.dll") ? "All.dll" : "Windows.dll";
118124
}
119125

126+
Logger.Info(Strings.Patching, dll);
127+
120128
var module = AssemblyDef.Load(modFile.GetFile(dll)).Modules.Single();
121129

122130
foreach (var processor in processors)
@@ -230,7 +238,7 @@ public static void Main(string[] args)
230238

231239
ConfigureLogger();
232240
#if DEBUG
233-
System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN");
241+
//Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("zh-CN");
234242
#endif
235243

236244
if (args.Length == 0)

Mod.Localizer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("0.1.1.0")]
35-
[assembly: AssemblyFileVersion("0.1.1.0")]
34+
[assembly: AssemblyVersion("0.1.2.0")]
35+
[assembly: AssemblyFileVersion("0.1.2.0")]

Mod.Localizer/Resources/Strings.Designer.cs

Lines changed: 18 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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,10 @@
168168
<data name="ProgramVersion" xml:space="preserve">
169169
<value>{0} started. (v{1})</value>
170170
</data>
171+
<data name="Patching" xml:space="preserve">
172+
<value>Patching platform {0}</value>
173+
</data>
174+
<data name="Saving" xml:space="preserve">
175+
<value>Saving mod file {0}</value>
176+
</data>
171177
</root>

Mod.Localizer/Resources/Strings.zh-CN.resx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@
156156
<data name="ProcessComplete" xml:space="preserve">
157157
<value>处理完毕。</value>
158158
</data>
159-
<data name="ProcessTargetNullCheck" xml:space="preserve">
160-
<value>Value cannot be null or whitespace.</value>
161-
</data>
162159
<data name="ProcExceptionOccur" xml:space="preserve">
163160
<value>应用{0}时出现错误</value>
164161
</data>
@@ -168,4 +165,10 @@
168165
<data name="ProgramVersion" xml:space="preserve">
169166
<value>{0} 正在运行。(v{1})</value>
170167
</data>
168+
<data name="Patching" xml:space="preserve">
169+
<value>导入文本:{0}</value>
170+
</data>
171+
<data name="Saving" xml:space="preserve">
172+
<value>保存模组文件:{0}</value>
173+
</data>
171174
</root>

0 commit comments

Comments
 (0)