-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba32cf7
commit c5113f1
Showing
9 changed files
with
235 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="ZeldaTOTK.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<userSettings> | ||
<ZeldaTOTK.Properties.Settings> | ||
<setting name="lang" serializeAs="String"> | ||
<value>0</value> | ||
</setting> | ||
</ZeldaTOTK.Properties.Settings> | ||
</userSettings> | ||
</configuration> |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
using System.Xml.Linq; | ||
|
||
namespace ZeldaTOTK | ||
{ | ||
internal class CapsuleIDNameConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
var id = (String)value; | ||
if (!Info.Instance().Capsule.ContainsKey(id)) return id; | ||
return Info.Instance().Capsule[id].Name; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ZeldaTOTK | ||
{ | ||
internal class Info | ||
{ | ||
private static Info? mThis; | ||
public Dictionary<String, NameIDInfo> Capsule { get; private set; } = new Dictionary<String, NameIDInfo>(); | ||
|
||
private Info() { } | ||
public static Info Instance() | ||
{ | ||
if (mThis == null) | ||
{ | ||
mThis = new Info(); | ||
mThis.Init(); | ||
} | ||
return mThis; | ||
} | ||
|
||
private void Init() | ||
{ | ||
AppendList(@"info\capsule.txt", Capsule); | ||
} | ||
|
||
private void AppendList<Type>(String filename, Dictionary<String, Type> items) | ||
where Type : NameIDInfo, new() | ||
{ | ||
if (!System.IO.File.Exists(filename)) return; | ||
String[] lines = System.IO.File.ReadAllLines(filename); | ||
foreach (String line in lines) | ||
{ | ||
if (line.Length < 3) continue; | ||
if (line[0] == '#') continue; | ||
String[] values = line.Split('\t'); | ||
if (values.Length < 2) continue; | ||
if (String.IsNullOrEmpty(values[0])) continue; | ||
if (String.IsNullOrEmpty(values[1])) continue; | ||
|
||
Type type = new Type(); | ||
if (type.Line(values)) | ||
{ | ||
items.Add(type.ID, type); | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ZeldaTOTK | ||
{ | ||
internal class NameIDInfo | ||
{ | ||
public String ID { get; set; } = ""; | ||
public String Name | ||
{ | ||
get | ||
{ | ||
if (Names.Count == 0) return ""; | ||
|
||
var index = Properties.Settings.Default.lang; | ||
if (index >= Names.Count) return ""; | ||
|
||
var value = Names[index]; | ||
if (String.IsNullOrEmpty(value)) value = Names[0]; | ||
return value; | ||
} | ||
} | ||
private List<String> Names { get; set; } = new List<String>(); | ||
|
||
public bool Line(String[] oneLine) | ||
{ | ||
ID = oneLine[0]; | ||
for (int i = 1; i < oneLine.Length; i++) | ||
{ | ||
Names.Add(oneLine[i]); | ||
} | ||
return true; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ZeldaTOTK.Properties" GeneratedClassName="Settings"> | ||
<Profiles /> | ||
<Settings> | ||
<Setting Name="lang" Type="System.Int32" Scope="User"> | ||
<Value Profile="(Default)">0</Value> | ||
</Setting> | ||
</Settings> | ||
</SettingsFile> |
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