aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShiftOS.WinForms/LanguageSelector.Designer.cs94
-rw-r--r--ShiftOS.WinForms/LanguageSelector.cs44
-rw-r--r--ShiftOS.WinForms/LanguageSelector.resx120
-rw-r--r--ShiftOS.WinForms/Program.cs9
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj9
-rw-r--r--ShiftOS.WinForms/WFLanguageProvider.cs17
-rw-r--r--ShiftOS_TheReturn.sln14
-rw-r--r--ShiftOS_TheReturn/Localization.cs14
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs2
9 files changed, 307 insertions, 16 deletions
diff --git a/ShiftOS.WinForms/LanguageSelector.Designer.cs b/ShiftOS.WinForms/LanguageSelector.Designer.cs
new file mode 100644
index 0000000..508b5df
--- /dev/null
+++ b/ShiftOS.WinForms/LanguageSelector.Designer.cs
@@ -0,0 +1,94 @@
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms
+{
+ partial class LanguageSelector
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // comboBox1
+ //
+ this.comboBox1.Cursor = System.Windows.Forms.Cursors.Default;
+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Items.AddRange(Localization.GetAllLanguages());
+ this.comboBox1.Location = new System.Drawing.Point(13, 13);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(167, 21);
+ this.comboBox1.TabIndex = 0;
+ this.comboBox1.SelectedItem = this.comboBox1.Items[0];
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(12, 40);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 1;
+ this.button1.Text = "Run";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(105, 40);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 2;
+ this.button2.Text = "Quit";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // LanguageSelector
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(192, 74);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.comboBox1);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "LanguageSelector";
+ this.ShowIcon = false;
+ this.Text = "Choose A Language";
+ this.ResumeLayout(false);
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.closing);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ComboBox comboBox1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Button button2;
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/LanguageSelector.cs b/ShiftOS.WinForms/LanguageSelector.cs
new file mode 100644
index 0000000..c9a5ac1
--- /dev/null
+++ b/ShiftOS.WinForms/LanguageSelector.cs
@@ -0,0 +1,44 @@
+using ShiftOS.Engine;
+using ShiftOS.WinForms.Applications;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ShiftOS.WinForms
+{
+ public partial class LanguageSelector : Form
+ {
+ public string languageID;
+ public bool rdy = false;
+
+ public LanguageSelector()
+ {
+ InitializeComponent();
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ Localization.SetLanguageID((string)comboBox1.SelectedItem);
+
+ rdy = true;
+
+ this.Close();
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ Environment.Exit(0);
+ }
+
+ private void closing(object sender, FormClosingEventArgs e)
+ {
+ if (!rdy) Environment.Exit(0);
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/LanguageSelector.resx b/ShiftOS.WinForms/LanguageSelector.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/LanguageSelector.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index 0578389..b5f371e 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -58,6 +58,14 @@ namespace ShiftOS.WinForms
Environment.Exit(0);
};
+ var langselect = new LanguageSelector();
+ langselect.ShowDialog();
+
+ while (!langselect.rdy)
+ {
+
+ };
+
TutorialManager.RegisterTutorial(new Oobe());
TerminalBackend.TerminalRequested += () =>
@@ -102,7 +110,6 @@ namespace ShiftOS.WinForms
}
}
-
public class WinformsFSFrontend : IFileSkimmer
{
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index d865c62..d7b3478 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -258,6 +258,12 @@
<Compile Include="GUIFunctions.cs" />
<Compile Include="HackerCommands.cs" />
<Compile Include="JobTasks.cs" />
+ <Compile Include="LanguageSelector.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="LanguageSelector.Designer.cs">
+ <DependentUpon>LanguageSelector.cs</DependentUpon>
+ </Compile>
<Compile Include="Oobe.cs">
<SubType>Form</SubType>
</Compile>
@@ -383,6 +389,9 @@
<EmbeddedResource Include="FakeSetupScreen.resx">
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="LanguageSelector.resx">
+ <DependentUpon>LanguageSelector.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Oobe.resx">
<DependentUpon>Oobe.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/WFLanguageProvider.cs b/ShiftOS.WinForms/WFLanguageProvider.cs
index e762e7e..b6b652b 100644
--- a/ShiftOS.WinForms/WFLanguageProvider.cs
+++ b/ShiftOS.WinForms/WFLanguageProvider.cs
@@ -52,6 +52,18 @@ namespace ShiftOS.WinForms
}
}
+ public string GetLanguagePath()
+ {
+ switch (SaveSystem.CurrentSave.Language)
+ {
+ case "deutsch - in beta":
+ return Paths.GetPath("deutsch.local");
+ default:
+ return Paths.GetPath("english.local");
+
+ }
+ }
+
public List<string> GetJSONTranscripts()
{
var strings = new List<string>();
@@ -65,6 +77,11 @@ namespace ShiftOS.WinForms
Utils.WriteAllText(Paths.GetPath("english.local"), getDefault());
}
+ public void WriteTranscript()
+ {
+ Utils.WriteAllText(GetLanguagePath(), GetCurrentTranscript());
+ }
+
private string getDefault()
{
return Properties.Resources.strings_en;
diff --git a/ShiftOS_TheReturn.sln b/ShiftOS_TheReturn.sln
index e56ebaa..8bb8ef4 100644
--- a/ShiftOS_TheReturn.sln
+++ b/ShiftOS_TheReturn.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftOS.Engine", "ShiftOS_TheReturn\ShiftOS.Engine.csproj", "{7C979B07-0585-4033-A110-E5555B9D6651}"
EndProject
@@ -19,10 +19,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ShiftOS.Modding.VB.LegacySk
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModLauncher", "ModLauncher\ModLauncher.csproj", "{AEACB7B5-E8FC-4569-BBD3-5053A694D6EC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gwen", "Gwen\Gwen.csproj", "{ADDA2F43-96C0-497F-8216-29C67ABC9806}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gwen.Renderer.OpenTK", "Gwen.Renderer.OpenTK\Gwen.Renderer.OpenTK.csproj", "{41650C82-D630-4E5C-845A-F1513C8FDC99}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -61,14 +57,6 @@ Global
{AEACB7B5-E8FC-4569-BBD3-5053A694D6EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEACB7B5-E8FC-4569-BBD3-5053A694D6EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEACB7B5-E8FC-4569-BBD3-5053A694D6EC}.Release|Any CPU.Build.0 = Release|Any CPU
- {ADDA2F43-96C0-497F-8216-29C67ABC9806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ADDA2F43-96C0-497F-8216-29C67ABC9806}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ADDA2F43-96C0-497F-8216-29C67ABC9806}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ADDA2F43-96C0-497F-8216-29C67ABC9806}.Release|Any CPU.Build.0 = Release|Any CPU
- {41650C82-D630-4E5C-845A-F1513C8FDC99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {41650C82-D630-4E5C-845A-F1513C8FDC99}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {41650C82-D630-4E5C-845A-F1513C8FDC99}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {41650C82-D630-4E5C-845A-F1513C8FDC99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs
index de5e158..a9d24b8 100644
--- a/ShiftOS_TheReturn/Localization.cs
+++ b/ShiftOS_TheReturn/Localization.cs
@@ -37,6 +37,7 @@ namespace ShiftOS.Engine
{
List<string> GetJSONTranscripts();
void WriteDefaultTranscript();
+ void WriteTranscript();
string GetCurrentTranscript();
string[] GetAllLanguages();
}
@@ -44,6 +45,7 @@ namespace ShiftOS.Engine
public static class Localization
{
private static ILanguageProvider _provider = null;
+ private static string _languageid = null;
public static string[] GetAllLanguages()
{
@@ -67,7 +69,7 @@ namespace ShiftOS.Engine
}
else
{
- _provider.WriteDefaultTranscript();
+ _provider.WriteTranscript();
}
}
@@ -197,5 +199,15 @@ namespace ShiftOS.Engine
{
_provider = p;
}
+
+ public static void SetLanguageID(string id)
+ {
+ _languageid = id;
+ }
+
+ public static string GetLanguageID()
+ {
+ return _languageid;
+ }
}
}
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index df4c6d6..5188bf1 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -70,7 +70,7 @@ namespace ShiftOS.Engine
root.permissions = Permissions.All;
System.IO.File.WriteAllText(Paths.SaveFile, JsonConvert.SerializeObject(root));
}
-
+ CurrentSave.Language = Localization.GetLanguageID();
if (Utils.Mounts.Count == 0)
Utils.Mount(System.IO.File.ReadAllText(Paths.SaveFile));