forked from SUDALV92/OctopathTraveler-TreasureChests-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove "Debug_ReadonlyMode" debug config, add -readonlyMode app arg;
Add -language=xx add arg; Add item inventory feature, add item count display (achievement); Add place color;
- Loading branch information
1 parent
d75f387
commit b5692ad
Showing
23 changed files
with
737 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,101 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Windows; | ||
|
||
namespace OctopathTraveler | ||
{ | ||
/// <summary> | ||
/// App.xaml の相互作用ロジック | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
/// <summary> | ||
/// App.xaml の相互作用ロジック | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
private void App_Startup(object sender, StartupEventArgs e) | ||
{ | ||
#if !DEBUG | ||
Application.Current.DispatcherUnhandledException += OnDispatcherUnhandledException; | ||
#endif | ||
|
||
for (int i = 0; i < e.Args.Length; i++) | ||
{ | ||
string arg = e.Args[i]; | ||
Trace.WriteLine($"Startup arg[{i}]: {arg}"); | ||
if (arg.StartsWith("-language=")) | ||
{ | ||
SetLanguage(arg["-language=".Length..]); | ||
continue; | ||
} | ||
|
||
if (arg == "-readonlyMode") | ||
{ | ||
SaveData.IsReadonlyMode = true; | ||
} | ||
} | ||
} | ||
|
||
private static void SetLanguage(string language) | ||
{ | ||
try | ||
{ | ||
CultureInfo cultureInfo; | ||
language = language.ToLower(); | ||
switch (language) | ||
{ | ||
case "zh-cn": | ||
case "zh_cn": | ||
cultureInfo = CultureInfo.GetCultureInfo("zh-CN"); | ||
break; | ||
case "ja-jp": | ||
case "ja_jp": | ||
cultureInfo = CultureInfo.GetCultureInfo("ja-JP"); | ||
break; | ||
case "en-us": | ||
case "en_us": | ||
cultureInfo = CultureInfo.GetCultureInfo("en-US"); | ||
break; | ||
default: | ||
if (language.StartsWith("en")) | ||
{ | ||
cultureInfo = CultureInfo.GetCultureInfo("en-US"); | ||
break; | ||
} | ||
return; | ||
} | ||
CultureInfo.CurrentUICulture = cultureInfo; | ||
OctopathTraveler.Properties.Resources.Culture = cultureInfo; | ||
} | ||
catch | ||
{ | ||
} | ||
} | ||
|
||
private static void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) | ||
{ | ||
try | ||
{ | ||
if (e.Handled) | ||
return; | ||
|
||
HandleException(e.Exception); | ||
} | ||
finally | ||
{ | ||
e.Handled = true; | ||
} | ||
} | ||
|
||
private static void HandleException(Exception exception) | ||
{ | ||
string ex = exception.ToString(); | ||
try | ||
{ | ||
File.AppendAllText("exception.log", DateTime.Now.ToString() + "\n" + ex + "\n"); | ||
} | ||
catch (Exception) | ||
{ | ||
} | ||
MessageBox.Show(ex, "Program Exception"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.