Repository navigation
Add regional support #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CodingWonders
wants to merge
3
commits into
mw-21
Choose a base branch
from
mw-21-regional-settings
base: mw-21
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,45 @@ | ||
| using MicroWin.functions.Helpers.ProgramResources; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using System.Xml; | ||
| using System.Xml.Serialization; | ||
|
|
||
| namespace MicroWin.Classes.Regional | ||
| { | ||
| public class GeoId | ||
| { | ||
| [XmlAttribute("Id")] | ||
| public required string Id; | ||
|
|
||
| [XmlAttribute("DisplayName")] | ||
| public required string DisplayName; | ||
|
|
||
| public override string ToString() { | ||
| return $"GeoID {Id} -- {DisplayName}"; | ||
| } | ||
|
|
||
| public static List<GeoId> LoadItems() { | ||
| List<GeoId> geoList = []; | ||
|
|
||
| try { | ||
| XmlReaderSettings xs = new() { IgnoreWhitespace = true }; | ||
| #pragma warning disable CS8604 | ||
| using XmlReader reader = XmlReader.Create(ResourceHelper.GetProgramResourceStream("MicroWin.Resources.Regional.GeoId.xml"), xs); | ||
| #pragma warning restore CS8604 | ||
| while (reader.Read()) { | ||
| if (reader.NodeType == XmlNodeType.Element && reader.Name == "GeoId") { | ||
| geoList.Add(new() { Id = reader.GetAttribute("Id") ?? "", DisplayName = reader.GetAttribute("DisplayName") ?? "" }); | ||
| } | ||
| } | ||
| } catch (Exception ex) { | ||
| if (Debugger.IsAttached) | ||
| Debugger.Break(); | ||
| Debug.WriteLine(ex.Message); | ||
| } | ||
|
|
||
| return geoList; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,50 @@ | ||
| using MicroWin.functions.Helpers.ProgramResources; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using System.Xml; | ||
| using System.Xml.Serialization; | ||
|
|
||
| namespace MicroWin.Classes.Regional | ||
| { | ||
| public class ImageLanguage | ||
| { | ||
| [XmlAttribute("Id")] | ||
| public required string Id; | ||
|
|
||
| [XmlAttribute("DisplayName")] | ||
| public required string DisplayName; | ||
|
|
||
| public override string ToString() { | ||
| return $"Language {Id} -- {DisplayName}"; | ||
| } | ||
|
|
||
| public static List<ImageLanguage> LoadItems() { | ||
| List<ImageLanguage> langList = []; | ||
|
|
||
| try | ||
| { | ||
| XmlReaderSettings xs = new() { IgnoreWhitespace = true }; | ||
| #pragma warning disable CS8604 | ||
| using XmlReader reader = XmlReader.Create(ResourceHelper.GetProgramResourceStream("MicroWin.Resources.Regional.ImageLanguage.xml"), xs); | ||
| #pragma warning restore CS8604 | ||
| while (reader.Read()) | ||
| { | ||
| if (reader.NodeType == XmlNodeType.Element && reader.Name == "ImageLanguage") | ||
| { | ||
| langList.Add(new() { Id = reader.GetAttribute("Id") ?? "", DisplayName = reader.GetAttribute("DisplayName") ?? "" }); | ||
| } | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (Debugger.IsAttached) | ||
| Debugger.Break(); | ||
| Debug.WriteLine(ex.Message); | ||
| } | ||
|
|
||
| return langList; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,65 @@ | ||
| using MicroWin.functions.Helpers.ProgramResources; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using System.Xml; | ||
|
|
||
| namespace MicroWin.Classes.Regional | ||
| { | ||
| public class KeyboardIdentifier | ||
| { | ||
|
|
||
| public required string Id; | ||
|
|
||
| public required string DisplayName; | ||
|
|
||
| public required string TypeString; | ||
|
|
||
| public KeyboardType GetKeyboardType() | ||
| { | ||
| return TypeString switch | ||
| { | ||
| "Keyboard" => KeyboardType.Keyboard, | ||
| "IME" => KeyboardType.IME, | ||
| _ => KeyboardType.Unknown | ||
| }; | ||
| } | ||
|
|
||
| public override string ToString() { | ||
| return $"Keyboard {Id} -- {DisplayName} -- {GetKeyboardType()}"; | ||
| } | ||
|
|
||
| public static List<KeyboardIdentifier> LoadItems() { | ||
| List<KeyboardIdentifier> keyboardList = []; | ||
|
|
||
| try | ||
| { | ||
| XmlReaderSettings xs = new() { IgnoreWhitespace = true }; | ||
| #pragma warning disable CS8604 | ||
| using XmlReader reader = XmlReader.Create(ResourceHelper.GetProgramResourceStream("MicroWin.Resources.Regional.KeyboardIdentifier.xml"), xs); | ||
| #pragma warning restore CS8604 | ||
| while (reader.Read()) | ||
| { | ||
| if (reader.NodeType == XmlNodeType.Element && reader.Name == "KeyboardIdentifier") | ||
| { | ||
| keyboardList.Add(new() { Id = reader.GetAttribute("Id") ?? "", DisplayName = reader.GetAttribute("DisplayName") ?? "", TypeString = reader.GetAttribute("Type") ?? "" }); | ||
| } | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (Debugger.IsAttached) | ||
| Debugger.Break(); | ||
| Debug.WriteLine(ex.Message); | ||
| } | ||
| return keyboardList; | ||
| } | ||
| } | ||
|
|
||
| public enum KeyboardType : int { | ||
| Unknown = -1, | ||
| Keyboard = 0, | ||
| IME = 1 | ||
| } | ||
| } |
This file contains hidden or 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,55 @@ | ||
| using MicroWin.functions.Helpers.ProgramResources; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using System.Xml; | ||
| using System.Xml.Serialization; | ||
|
|
||
| namespace MicroWin.Classes.Regional | ||
| { | ||
| public class TimeOffset | ||
| { | ||
| [XmlAttribute("Id")] | ||
| public required string Id; | ||
|
|
||
| [XmlAttribute("DisplayName")] | ||
| public required string DisplayName; | ||
|
|
||
| public override string ToString() { | ||
| return $"Time Offset {Id} -- {DisplayName}"; | ||
| } | ||
|
|
||
| public static List<TimeOffset> LoadItems() { | ||
| List<TimeOffset> offsetList = []; | ||
|
|
||
| try | ||
| { | ||
| XmlReaderSettings xs = new() { IgnoreWhitespace = true }; | ||
| #pragma warning disable CS8604 | ||
| using XmlReader reader = XmlReader.Create(ResourceHelper.GetProgramResourceStream("MicroWin.Resources.Regional.TimeOffset.xml"), xs); | ||
| #pragma warning restore CS8604 | ||
| while (reader.Read()) | ||
| { | ||
| if (reader.NodeType == XmlNodeType.Element && reader.Name == "TimeOffset") | ||
| { | ||
| offsetList.Add(new() { Id = reader.GetAttribute("Id") ?? "", DisplayName = reader.GetAttribute("DisplayName") ?? "" }); | ||
| } | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (Debugger.IsAttached) | ||
| Debugger.Break(); | ||
| Debug.WriteLine(ex.Message); | ||
| } | ||
|
|
||
| return offsetList; | ||
| } | ||
|
|
||
| public TimeOffset Clone() | ||
| { | ||
| return (TimeOffset)MemberwiseClone(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,63 @@ | ||
| using MicroWin.functions.Helpers.ProgramResources; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Text; | ||
| using System.Xml; | ||
| using System.Xml.Serialization; | ||
|
|
||
| namespace MicroWin.Classes.Regional | ||
| { | ||
| public class UserLocale | ||
| { | ||
| [XmlAttribute("Id")] | ||
| public required string Id; | ||
| [XmlAttribute("DisplayName")] | ||
| public required string DisplayName; | ||
| [XmlAttribute("LCID")] | ||
| public required string LCID; | ||
| [XmlAttribute("KeyboardLayout")] | ||
| public string? KeyboardLayout; | ||
| [XmlAttribute("GeoLocation")] | ||
| public string? GeoLocation; | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return $"User Locale {Id} -- {DisplayName} -- {LCID} -- {KeyboardLayout} -- {GeoLocation}"; | ||
| } | ||
|
|
||
| public UserLocale Clone() { | ||
| return (UserLocale)MemberwiseClone(); | ||
| } | ||
|
|
||
| public static List<UserLocale> LoadItems() { | ||
| List<UserLocale> localeList = []; | ||
|
|
||
| try | ||
| { | ||
| XmlReaderSettings xs = new() { IgnoreWhitespace = true }; | ||
| #pragma warning disable CS8604 | ||
| using XmlReader reader = XmlReader.Create(ResourceHelper.GetProgramResourceStream("MicroWin.Resources.Regional.UserLocale.xml"), xs); | ||
| #pragma warning restore CS8604 | ||
| while (reader.Read()) | ||
| { | ||
| if (reader.NodeType == XmlNodeType.Element && reader.Name == "UserLocale") | ||
| { | ||
| localeList.Add(new() { Id = reader.GetAttribute("Id") ?? "", DisplayName = reader.GetAttribute("DisplayName") ?? "", | ||
| LCID = reader.GetAttribute("LCID") ?? "", KeyboardLayout = reader.GetAttribute("KeyboardLayout") ?? "", | ||
| GeoLocation = reader.GetAttribute("GeoLocation") ?? "" }); | ||
| } | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| if (Debugger.IsAttached) | ||
| Debugger.Break(); | ||
| Debug.WriteLine(ex.Message); | ||
| } | ||
|
|
||
| return localeList; | ||
| } | ||
|
|
||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.