aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShiftOS.Objects/UniteClient.cs2
-rw-r--r--ShiftOS.Objects/UserConfig.cs4
-rw-r--r--ShiftOS.Server/SaveManager.cs11
-rw-r--r--ShiftOS.WinForms/Applications/MindBlow.Designer.cs153
-rw-r--r--ShiftOS.WinForms/Applications/MindBlow.cs121
-rw-r--r--ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs27
-rw-r--r--ShiftOS.WinForms/MainMenu/MainMenu.cs20
-rw-r--r--ShiftOS.WinForms/Properties/Resources.Designer.cs17
-rw-r--r--ShiftOS.WinForms/Properties/Resources.resx3
-rw-r--r--ShiftOS.WinForms/Resources/strings_en.txt6
-rw-r--r--ShiftOS.WinForms/Resources/strings_fr.txt259
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj10
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MindBlow.cs1
-rw-r--r--ShiftOS.WinForms/UniteLoginDialog.Designer.cs123
-rw-r--r--ShiftOS.WinForms/UniteLoginDialog.cs91
-rw-r--r--ShiftOS.WinForms/UniteLoginDialog.resx120
-rw-r--r--ShiftOS.WinForms/WFLanguageProvider.cs68
-rw-r--r--ShiftOS_TheReturn/BFInterpreter.cs67
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs2
19 files changed, 620 insertions, 485 deletions
diff --git a/ShiftOS.Objects/UniteClient.cs b/ShiftOS.Objects/UniteClient.cs
index ccd721b..8843930 100644
--- a/ShiftOS.Objects/UniteClient.cs
+++ b/ShiftOS.Objects/UniteClient.cs
@@ -23,7 +23,7 @@ namespace ShiftOS.Unite
{
get
{
- return UserConfig.Get().UniteUrl;
+ return "";
}
}
diff --git a/ShiftOS.Objects/UserConfig.cs b/ShiftOS.Objects/UserConfig.cs
index 61d11b8..579ce00 100644
--- a/ShiftOS.Objects/UserConfig.cs
+++ b/ShiftOS.Objects/UserConfig.cs
@@ -10,7 +10,7 @@ namespace ShiftOS.Objects
{
public class UserConfig
{
- public string UniteUrl { get; set; }
+ public string Language { get; set; }
public string DigitalSocietyAddress { get; set; }
public int DigitalSocietyPort { get; set; }
@@ -18,7 +18,7 @@ namespace ShiftOS.Objects
{
var conf = new UserConfig
{
- UniteUrl = "http://getshiftos.ml",
+ Language = "english",
DigitalSocietyAddress = "michaeltheshifter.me",
DigitalSocietyPort = 13370
};
diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs
index baf5b64..3ea8a28 100644
--- a/ShiftOS.Server/SaveManager.cs
+++ b/ShiftOS.Server/SaveManager.cs
@@ -184,17 +184,6 @@ namespace ShiftOS.Server
}
catch { }
- try
- {
- //Update the shiftos website with the user's codepoints.
- if (!string.IsNullOrWhiteSpace(sav.UniteAuthToken))
- {
- var wreq = WebRequest.Create(UserConfig.Get().UniteUrl + "/API/SetCodepoints/" + sav.Codepoints.ToString());
- wreq.Headers.Add("Authentication: Token " + sav.UniteAuthToken);
- wreq.GetResponse();
- }
- }
- catch { }
}
diff --git a/ShiftOS.WinForms/Applications/MindBlow.Designer.cs b/ShiftOS.WinForms/Applications/MindBlow.Designer.cs
index da269f6..6a8474d 100644
--- a/ShiftOS.WinForms/Applications/MindBlow.Designer.cs
+++ b/ShiftOS.WinForms/Applications/MindBlow.Designer.cs
@@ -30,16 +30,18 @@
{
this.tabs = new System.Windows.Forms.TabControl();
this.console = new System.Windows.Forms.TabPage();
- this.program = new System.Windows.Forms.TabPage();
- this.monitor = new System.Windows.Forms.TabPage();
this.consoleout = new System.Windows.Forms.TextBox();
- this.programinput = new System.Windows.Forms.TextBox();
- this.load = new System.Windows.Forms.Button();
+ this.program = new System.Windows.Forms.TabPage();
+ this.stop = new System.Windows.Forms.Button();
+ this.run = new System.Windows.Forms.Button();
this.save = new System.Windows.Forms.Button();
- this.memptr = new System.Windows.Forms.Label();
- this.instptr = new System.Windows.Forms.Label();
+ this.load = new System.Windows.Forms.Button();
+ this.programinput = new System.Windows.Forms.TextBox();
+ this.monitor = new System.Windows.Forms.TabPage();
+ this.reset = new System.Windows.Forms.Button();
this.memlist = new System.Windows.Forms.ListBox();
- this.run = new System.Windows.Forms.Button();
+ this.instptr = new System.Windows.Forms.Label();
+ this.memptr = new System.Windows.Forms.Label();
this.tabs.SuspendLayout();
this.console.SuspendLayout();
this.program.SuspendLayout();
@@ -70,8 +72,20 @@
this.console.Text = "Console";
this.console.UseVisualStyleBackColor = true;
//
+ // consoleout
+ //
+ this.consoleout.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.consoleout.Location = new System.Drawing.Point(3, 3);
+ this.consoleout.Multiline = true;
+ this.consoleout.Name = "consoleout";
+ this.consoleout.ReadOnly = true;
+ this.consoleout.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.consoleout.Size = new System.Drawing.Size(378, 237);
+ this.consoleout.TabIndex = 0;
+ //
// program
//
+ this.program.Controls.Add(this.stop);
this.program.Controls.Add(this.run);
this.program.Controls.Add(this.save);
this.program.Controls.Add(this.load);
@@ -84,73 +98,78 @@
this.program.Text = "Program";
this.program.UseVisualStyleBackColor = true;
//
- // monitor
+ // stop
//
- this.monitor.Controls.Add(this.memlist);
- this.monitor.Controls.Add(this.instptr);
- this.monitor.Controls.Add(this.memptr);
- this.monitor.Location = new System.Drawing.Point(4, 22);
- this.monitor.Name = "monitor";
- this.monitor.Size = new System.Drawing.Size(384, 243);
- this.monitor.TabIndex = 2;
- this.monitor.Text = "Monitor";
- this.monitor.UseVisualStyleBackColor = true;
+ this.stop.Location = new System.Drawing.Point(303, 217);
+ this.stop.Name = "stop";
+ this.stop.Size = new System.Drawing.Size(75, 23);
+ this.stop.TabIndex = 4;
+ this.stop.Text = "Stop";
+ this.stop.UseVisualStyleBackColor = true;
+ this.stop.Click += new System.EventHandler(this.stop_Click);
//
- // consoleout
+ // run
//
- this.consoleout.Dock = System.Windows.Forms.DockStyle.Fill;
- this.consoleout.Location = new System.Drawing.Point(3, 3);
- this.consoleout.Multiline = true;
- this.consoleout.Name = "consoleout";
- this.consoleout.ReadOnly = true;
- this.consoleout.Size = new System.Drawing.Size(378, 237);
- this.consoleout.TabIndex = 0;
+ this.run.Location = new System.Drawing.Point(196, 217);
+ this.run.Name = "run";
+ this.run.Size = new System.Drawing.Size(101, 23);
+ this.run.TabIndex = 3;
+ this.run.Text = "Run";
+ this.run.UseVisualStyleBackColor = true;
+ this.run.Click += new System.EventHandler(this.run_Click);
//
- // programinput
+ // save
//
- this.programinput.Location = new System.Drawing.Point(3, 0);
- this.programinput.Multiline = true;
- this.programinput.Name = "programinput";
- this.programinput.Size = new System.Drawing.Size(378, 218);
- this.programinput.TabIndex = 0;
+ this.save.Location = new System.Drawing.Point(102, 217);
+ this.save.Name = "save";
+ this.save.Size = new System.Drawing.Size(88, 23);
+ this.save.TabIndex = 2;
+ this.save.Text = "Save";
+ this.save.UseVisualStyleBackColor = true;
+ this.save.Click += new System.EventHandler(this.save_Click);
//
// load
//
this.load.Location = new System.Drawing.Point(6, 217);
this.load.Name = "load";
- this.load.Size = new System.Drawing.Size(115, 23);
+ this.load.Size = new System.Drawing.Size(90, 23);
this.load.TabIndex = 1;
this.load.Text = "Load";
this.load.UseVisualStyleBackColor = true;
this.load.Click += new System.EventHandler(this.load_Click);
//
- // save
+ // programinput
//
- this.save.Location = new System.Drawing.Point(127, 217);
- this.save.Name = "save";
- this.save.Size = new System.Drawing.Size(114, 23);
- this.save.TabIndex = 2;
- this.save.Text = "Save";
- this.save.UseVisualStyleBackColor = true;
- this.save.Click += new System.EventHandler(this.save_Click);
+ this.programinput.Location = new System.Drawing.Point(3, 0);
+ this.programinput.Multiline = true;
+ this.programinput.Name = "programinput";
+ this.programinput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.programinput.Size = new System.Drawing.Size(378, 218);
+ this.programinput.TabIndex = 0;
//
- // memptr
+ // monitor
//
- this.memptr.AutoSize = true;
- this.memptr.Location = new System.Drawing.Point(8, 8);
- this.memptr.Name = "memptr";
- this.memptr.Size = new System.Drawing.Size(56, 13);
- this.memptr.TabIndex = 0;
- this.memptr.Text = "Memory: 0";
+ this.monitor.Controls.Add(this.reset);
+ this.monitor.Controls.Add(this.memlist);
+ this.monitor.Controls.Add(this.instptr);
+ this.monitor.Controls.Add(this.memptr);
+ this.monitor.Location = new System.Drawing.Point(4, 22);
+ this.monitor.Name = "monitor";
+ this.monitor.Size = new System.Drawing.Size(384, 243);
+ this.monitor.TabIndex = 2;
+ this.monitor.Text = "Monitor";
+ this.monitor.UseVisualStyleBackColor = true;
//
- // instptr
+ // reset
//
- this.instptr.AutoSize = true;
- this.instptr.Location = new System.Drawing.Point(8, 21);
- this.instptr.Name = "instptr";
- this.instptr.Size = new System.Drawing.Size(68, 13);
- this.instptr.TabIndex = 1;
- this.instptr.Text = "Instruction: 0";
+ this.reset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.reset.Location = new System.Drawing.Point(306, 8);
+ this.reset.Name = "reset";
+ this.reset.Size = new System.Drawing.Size(75, 23);
+ this.reset.TabIndex = 3;
+ this.reset.Text = "Reset";
+ this.reset.UseVisualStyleBackColor = true;
+ this.reset.Click += new System.EventHandler(this.reset_Click);
//
// memlist
//
@@ -162,15 +181,23 @@
this.memlist.Size = new System.Drawing.Size(370, 199);
this.memlist.TabIndex = 2;
//
- // run
+ // instptr
//
- this.run.Location = new System.Drawing.Point(247, 217);
- this.run.Name = "run";
- this.run.Size = new System.Drawing.Size(131, 23);
- this.run.TabIndex = 3;
- this.run.Text = "Run";
- this.run.UseVisualStyleBackColor = true;
- this.run.Click += new System.EventHandler(this.run_Click);
+ this.instptr.AutoSize = true;
+ this.instptr.Location = new System.Drawing.Point(8, 21);
+ this.instptr.Name = "instptr";
+ this.instptr.Size = new System.Drawing.Size(68, 13);
+ this.instptr.TabIndex = 1;
+ this.instptr.Text = "Instruction: 0";
+ //
+ // memptr
+ //
+ this.memptr.AutoSize = true;
+ this.memptr.Location = new System.Drawing.Point(8, 8);
+ this.memptr.Name = "memptr";
+ this.memptr.Size = new System.Drawing.Size(56, 13);
+ this.memptr.TabIndex = 0;
+ this.memptr.Text = "Memory: 0";
//
// MindBlow
//
@@ -205,5 +232,7 @@
private System.Windows.Forms.Label memptr;
private System.Windows.Forms.ListBox memlist;
private System.Windows.Forms.Button run;
+ private System.Windows.Forms.Button stop;
+ private System.Windows.Forms.Button reset;
}
}
diff --git a/ShiftOS.WinForms/Applications/MindBlow.cs b/ShiftOS.WinForms/Applications/MindBlow.cs
index 6cfaea7..54167da 100644
--- a/ShiftOS.WinForms/Applications/MindBlow.cs
+++ b/ShiftOS.WinForms/Applications/MindBlow.cs
@@ -10,6 +10,8 @@ using System.Windows.Forms;
using ShiftOS.Engine;
using System.IO;
using System.Threading;
+using System.Collections;
+using System.Collections.Concurrent;
namespace ShiftOS.WinForms.Applications
{
@@ -18,10 +20,17 @@ namespace ShiftOS.WinForms.Applications
[RequiresUpgrade("mindblow")]
public partial class MindBlow : UserControl, IShiftOSWindow, IBFListener
{
+ private bool running = true;
+ private Action updateMemPtr = null, updateIPtr = null;
+ private Action[] updateMem = new Action[30000];
+ private AutoResetEvent evwaiting = new AutoResetEvent(false);
+ private object evlock = new object();
+
private class TextBoxStream : Stream
{
private TextBox box;
private KeysConverter kc;
+ public KeyPressEventHandler handler;
public TextBoxStream(TextBox mybox)
{
kc = new KeysConverter();
@@ -53,23 +62,20 @@ namespace ShiftOS.WinForms.Applications
public override int Read(byte[] buffer, int offset, int count)
{
- object lck = new object();
int ptr = offset;
- KeyPressEventHandler handler = (o, a) =>
+ var hnd = new AutoResetEvent(false);
+ handler = (o, a) =>
{
- lock (lck)
+ if (ptr < offset + count)
{
buffer[ptr] = (byte)a.KeyChar;
ptr++;
}
+ if (ptr >= offset + count)
+ hnd.Set();
};
Desktop.InvokeOnWorkerThread(() => box.KeyPress += handler);
- while (true)
- {
- lock (lck)
- if (ptr >= offset + count)
- break;
- }
+ hnd.WaitOne();
Desktop.InvokeOnWorkerThread(() => box.KeyPress -= handler);
return count;
}
@@ -94,7 +100,8 @@ namespace ShiftOS.WinForms.Applications
}
private static string[] DefaultMem;
private BFInterpreter Interpreter;
-
+ private Thread InterpreterThread;
+ private TextBoxStream consolestr;
private void DoLayout()
{
memlist.Left = 0;
@@ -104,9 +111,11 @@ namespace ShiftOS.WinForms.Applications
program.Left = 0;
programinput.Width = program.Width;
programinput.Height = program.Height - load.Height;
- load.Top = save.Top = run.Top = programinput.Height;
- load.Width = save.Width = run.Width = save.Left = program.Width / 3;
+ load.Top = save.Top = run.Top = stop.Top = programinput.Height;
+ load.Width = save.Width = run.Width = stop.Width = save.Left = program.Width / 4;
+ load.Left = 0;
run.Left = save.Left * 2;
+ stop.Left = save.Left * 3;
}
public MindBlow()
@@ -116,17 +125,29 @@ namespace ShiftOS.WinForms.Applications
for (ushort i = 0; i < 30000; i++)
DefaultMem[i] = "0";
memlist.Items.AddRange(DefaultMem);
- Interpreter = new BFInterpreter(new TextBoxStream(consoleout), this);
+ consolestr = new TextBoxStream(consoleout);
+ Interpreter = new BFInterpreter(consolestr, this);
}
public void IPtrMoved(int newval)
{
- Desktop.InvokeOnWorkerThread(() => instptr.Text = "Instruction: " + newval.ToString());
+ lock (evlock)
+ {
+ updateIPtr = () => instptr.Text = "Instruction: " + newval.ToString();
+ evwaiting.Set();
+ }
}
public void MemChanged(ushort pos, byte newval)
{
- Desktop.InvokeOnWorkerThread(() => memlist.Items[pos] = newval.ToString());
+ lock (evlock)
+ {
+ updateMem[pos] = () =>
+ {
+ memlist.Items[pos] = newval.ToString();
+ };
+ evwaiting.Set();
+ }
}
public void MemReset()
@@ -141,6 +162,36 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
DoLayout();
+ new Thread(() =>
+ {
+ while (running)
+ {
+ evwaiting.WaitOne();
+ try
+ {
+ lock (evlock)
+ {
+ if (updateIPtr != null)
+ {
+ Desktop.InvokeOnWorkerThread(updateIPtr);
+ updateIPtr = null;
+ }
+ if (updateMemPtr != null)
+ {
+ Desktop.InvokeOnWorkerThread(updateMemPtr);
+ updateMemPtr = null;
+ }
+ for (int i = 0; i < updateMem.Length; i++)
+ if (updateMem[i] != null)
+ {
+ Desktop.InvokeOnWorkerThread(updateMem[i]);
+ updateMem[i] = null;
+ }
+ }
+ } catch { }
+ evwaiting.Reset();
+ }
+ }).Start();
}
public void OnSkinLoad()
@@ -149,6 +200,9 @@ namespace ShiftOS.WinForms.Applications
public bool OnUnload()
{
+ running = false;
+ evwaiting.Set(); // allow the display loop to die of old age
+ KillThread(); // mercilessly slaughter the interpreter thread
return true;
}
@@ -158,7 +212,11 @@ namespace ShiftOS.WinForms.Applications
public void PointerMoved(ushort newval)
{
- Desktop.InvokeOnWorkerThread(() => memptr.Text = "Memory: " + newval.ToString());
+ lock (evlock)
+ {
+ updateMemPtr = () => memptr.Text = "Memory: " + newval.ToString();
+ evwaiting.Set();
+ }
}
private void MindBlow_Resize(object sender, EventArgs e)
@@ -168,18 +226,20 @@ namespace ShiftOS.WinForms.Applications
private void run_Click(object sender, EventArgs e)
{
- new Thread(() =>
+ InterpreterThread = new Thread(() =>
{
try
{
Interpreter.Reset();
Interpreter.Execute(programinput.Text);
}
+ catch (ThreadAbortException) { } // ignore
catch (Exception ex)
{
Desktop.InvokeOnWorkerThread(() => Infobox.Show("Program Error", "An error occurred while executing your program: " + ex.GetType().ToString()));
}
- }).Start();
+ });
+ InterpreterThread.Start();
}
private void tabs_Selected(object sender, TabControlEventArgs e)
@@ -196,5 +256,30 @@ namespace ShiftOS.WinForms.Applications
{
AppearanceManager.SetupDialog(new FileDialog(new string[] { ".bf" }, FileOpenerStyle.Save, new Action<string>((file) => Objects.ShiftFS.Utils.WriteAllText(file, programinput.Text))));
}
+
+ private void KillThread()
+ {
+ if (InterpreterThread != null)
+ try
+ {
+ InterpreterThread.Abort();
+ }
+ catch { }
+ consoleout.KeyPress -= consolestr.handler;
+ }
+
+ private void stop_Click(object sender, EventArgs e)
+ {
+ KillThread();
+ }
+
+ private void reset_Click(object sender, EventArgs e)
+ {
+ if (InterpreterThread != null)
+ if (InterpreterThread.IsAlive)
+ Infobox.Show("Cannot Reset", "The program is still running.");
+ else
+ Interpreter.Reset();
+ }
}
}
diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
index a9291d3..9ef91ad 100644
--- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
+++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
@@ -50,6 +50,8 @@
this.lbcurrentui = new System.Windows.Forms.Label();
this.shiftos = new System.Windows.Forms.PictureBox();
this.lbbuilddetails = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.cblanguage = new System.Windows.Forms.ComboBox();
this.flmenu.SuspendLayout();
this.pnloptions.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
@@ -138,6 +140,8 @@
//
// pnloptions
//
+ this.pnloptions.Controls.Add(this.cblanguage);
+ this.pnloptions.Controls.Add(this.label3);
this.pnloptions.Controls.Add(this.txtdsport);
this.pnloptions.Controls.Add(this.label2);
this.pnloptions.Controls.Add(this.txtdsaddress);
@@ -145,7 +149,7 @@
this.pnloptions.Controls.Add(this.flowLayoutPanel1);
this.pnloptions.Location = new System.Drawing.Point(49, 26);
this.pnloptions.Name = "pnloptions";
- this.pnloptions.Size = new System.Drawing.Size(432, 167);
+ this.pnloptions.Size = new System.Drawing.Size(432, 198);
this.pnloptions.TabIndex = 2;
//
// txtdsport
@@ -188,7 +192,7 @@
this.flowLayoutPanel1.Controls.Add(this.btnsave);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
- this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 136);
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 167);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(432, 31);
this.flowLayoutPanel1.TabIndex = 0;
@@ -295,6 +299,23 @@
this.lbbuilddetails.TabIndex = 6;
this.lbbuilddetails.Text = "label4";
//
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(25, 117);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(139, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "{MAINMENU_LANGUAGE}";
+ //
+ // cblanguage
+ //
+ this.cblanguage.FormattingEnabled = true;
+ this.cblanguage.Location = new System.Drawing.Point(146, 117);
+ this.cblanguage.Name = "cblanguage";
+ this.cblanguage.Size = new System.Drawing.Size(225, 21);
+ this.cblanguage.TabIndex = 6;
+ //
// MainMenu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -348,5 +369,7 @@
private System.Windows.Forms.Label lbcurrentui;
private System.Windows.Forms.PictureBox shiftos;
private System.Windows.Forms.Label lbbuilddetails;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.ComboBox cblanguage;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs
index f6bc833..b957c28 100644
--- a/ShiftOS.WinForms/MainMenu/MainMenu.cs
+++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs
@@ -156,6 +156,15 @@ namespace ShiftOS.WinForms.MainMenu
txtdsaddress.Text = conf.DigitalSocietyAddress;
txtdsport.Text = conf.DigitalSocietyPort.ToString();
+ cblanguage.Items.Clear();
+ foreach(var lang in Localization.GetAllLanguages())
+ {
+ var finf = new System.IO.FileInfo(lang);
+ int nameindex = finf.Name.Length - 5;
+ cblanguage.Items.Add(finf.Name.Remove(nameindex, 5));
+ }
+
+ cblanguage.Text = conf.Language;
pnloptions.Show();
pnloptions.BringToFront();
@@ -186,9 +195,20 @@ namespace ShiftOS.WinForms.MainMenu
conf.DigitalSocietyPort = p;
+ bool requiresRestart = (conf.Language != cblanguage.Text);
+ conf.Language = cblanguage.Text;
+
+
System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented));
HideOptions();
+ if(requiresRestart == true)
+ {
+ Infobox.Show("{TITLE_RESTARTREQUIRED}", "{PROMPT_RESTARTREQUIRED}", () =>
+ {
+ Application.Restart();
+ });
+ }
}
private void button10_Click(object sender, EventArgs e)
diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs
index f56285a..cd17a31 100644
--- a/ShiftOS.WinForms/Properties/Resources.Designer.cs
+++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs
@@ -1329,6 +1329,23 @@ namespace ShiftOS.WinForms.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to /*
+ /// * French translation
+ /// *
+ /// * Made by Michael VanOverbeek with his grade 9 french skills because why not.
+ /// *
+ /// */
+ ///
+ ///{
+ ///}.
+ /// </summary>
+ internal static string strings_fr {
+ get {
+ return ResourceManager.GetString("strings_fr", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap SuperDesk_screenshot {
diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx
index 5e5555b..175c52d 100644
--- a/ShiftOS.WinForms/Properties/Resources.resx
+++ b/ShiftOS.WinForms/Properties/Resources.resx
@@ -34615,4 +34615,7 @@
<data name="austmicrotrends" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\austmicrotrends.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="strings_fr" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\strings_fr.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Resources/strings_en.txt b/ShiftOS.WinForms/Resources/strings_en.txt
index 6fc2524..dbbaf26 100644
--- a/ShiftOS.WinForms/Resources/strings_en.txt
+++ b/ShiftOS.WinForms/Resources/strings_en.txt
@@ -141,7 +141,8 @@
"{TITLE_SHIFTSWEEPER}": "ShiftSweeper",
"{TITLE_TERMINAL}": "Terminal",
"{TITLE_TEXTPAD}": "TextPad",
-
+ "{TITLE_RESTARTREQUIRED}": "Restart required.",
+
//App Launcher categories
"{AL_PROGRAMMING}": "Programming",
@@ -161,6 +162,7 @@
"{PROMPT_ENTERSYSNAME}": "Please enter a system name for your computer.",
"{PROMPT_INVALIDNAME}": "The name you entered cannot be blank. Please enter another name.",
"{PROMPT_SMALLSYSNAME}": "Your system name must have at least 5 characters in it.",
+ "{PROMPT_RESTARTREQUIRED}": "For the changes you made to take effect, a restart of ShiftOS is required.",
//Pong
"{PONG_LEVELREACHED}": "You've reached level %level!",
@@ -189,6 +191,7 @@
//Main menu - Settings
"{MAINMENU_DSADDRESS}": "Digital Society address: ",
"{MAINMENU_DSPORT": "Digital Society port: ",
+ "{MAINMENU_LANGUAGE}": "Language:",
//Main Menu - General text
"{MAINMENU_TITLE}": "Main menu",
@@ -236,6 +239,7 @@
"{LOADINGMSG2_7}": "[systemd] There's no antidote...",
"{LOADINGMSG2_8}": "[systemd] Can I at least have a muffin?",
"{LOADINGMSG2_9}": "[systemd] System initiated, but I still want a cake.",
+ "{LOADINGMSG2_10}": "[sysvinit] Your init system has been upgraded.",
//Format editor
"{FORMATEDITOR_COMMAND_LOWER}": "command",
diff --git a/ShiftOS.WinForms/Resources/strings_fr.txt b/ShiftOS.WinForms/Resources/strings_fr.txt
new file mode 100644
index 0000000..73b5788
--- /dev/null
+++ b/ShiftOS.WinForms/Resources/strings_fr.txt
@@ -0,0 +1,259 @@
+/*
+ * ShiftOS French Language Pack
+ *
+ * This is a default language pack distributed within the game.
+ */
+
+{
+ //General strings
+ //These strings can be used anywhere in the UI where language context isn't necessary.
+ "{GEN_PROGRAMS}": "Les programmes",
+ "{GEN_COMMANDS}": "Les ordres",
+ "{GEN_OBJECTIVES}": "Les objectifs",
+ "{GEN_CURRENTPROCESSES}": "Les proc�dures actuelles",
+ "{GEN_WELCOME}": "Bienvenue au ShiftOS.",
+ "{GEN_SYSTEMNAME}": "Nom de syst�me",
+ "{GEN_PASSWORD}": "Mot de passe",
+ "{GEN_LPROMPT}": "ouverture de session de %sysname: ",
+ "{GEN_SYSTEMSTATUS}": "�tat de syst�me",
+ "{GEN_USERS}": "Personnes",
+ "{GEN_CODEPOINTS}": "Codepoints",
+ "{GEN_LOADING}": "Remplissons...",
+ "{GEN_SAVE}": "Garder",
+ "{GEN_LOAD}": "Remplir",
+ "{GEN_APPLY}": "Appliquer",
+ "{GEN_RESET}": "Rer�gler",
+ "{GEN_LOADDEFAULT}": "Remplir la valeur par d�fault",
+ "{GEN_CANCEL}": "Annuter",
+ "{GEN_CONTINUE}": "Continuer",
+ "{GEN_BACK}": "Retourner",
+ "{GEN_YES}": "Oui",
+ "{GEN_NO}": "Non",
+ "{GEN_OK}": "D'accord",
+ "{GEN_SETTINGS}": "Les param�tres",
+ "{GEN_ABOUT}": "Les d�tails",
+ "{GEN_EXIT}": "Sortir",
+ "{GEN_CLOSE}": "Se fermer",
+
+ //General errors
+ //Syntax errors, command errors, you name it..
+ "{ERR_BADBOOL}": "La valeur tu es entr� faut qu'�tre solt \"true\", solt \"false\".",
+ "{ERR_BADPERCENT}": "La valeur tu es entr� faut qu'�tre une valeur entre 0 et 100.",
+ "{ERR_NOLANG}": "La langue tu es entr� n'exister pas!",
+ "{ERR_NOTENOUGHCODEPOINTS}": "Tu n'as pas assez de Codepoints � faire cela.",
+ "{ERR_NOUPGRADE}": "Nous ne pouvons pas trouver cela mise � jour.",
+ "{ERR_GENERAL}": "Une erreur a appair� en faisons l'op�ration.",
+ "{ERR_EMPTYCATEGORY}": "The category you specified either has no items in it, or was not found.",
+ "{ERR_NOMOREUPGRADES}": "There are no more Shiftorium Upgrades to show!",
+ "{ERR_BADWINID}": "You must specify a value between 0 and %max.",
+ "{ERR_USERFOUND}": "That user already exists.",
+ "{ERR_NOUSER}": "That user was not found.",
+ "{ERR_REMOVEYOU}": "You can't remove your own user account.",
+ "{ERR_BADACL}": "You must specify a value between 0 (guest) and 3 (root) for a user permission.",
+ "{ERR_ACLHIGHERVALUE}": "You can't set a user's permissions to a value higher than your own.",
+ "{ERR_HIGHERPERMS}": "That user has more rights than you!",
+ "{ERR_PASSWD_MISMATCH}": "Passwords don't match!",
+ "{ERR_SYNTAXERROR}": "Syntax error.",
+
+ //Command results
+ "{RES_ACLUPDATED}": "User permissions updated.",
+ "{RES_LANGUAGE_CHANGED}": "System language changed successfully.",
+ "{RES_NOOBJECTIVES}": "No objectives to display! Check back for more.",
+ "{RES_UPGRADEINSTALLED}": "Upgrade installed!",
+ "{RES_WINDOWCLOSED}": "The window was closed.",
+ "{RES_CREATINGUSER}": "Creating new user with username %name.",
+ "{RES_REMOVINGUSER}": "Removing user with username %name from your system.",
+ "{RES_DENIED}": "Access denied.",
+ "{RES_GRANTED}": "Access granted.",
+ "{RES_PASSWD_SET}": "Password set successfully.",
+
+ //Shiftorium messages.
+ "{SHFM_UPGRADE}": "%id - %cost Codepoints",
+ "{SHFM_CATEGORY}": " - %name: %available upgrades left.",
+ "{SHFM_QUERYERROR}": "Shiftorium Query Error",
+ "{SHFM_NOUPGRADES}": "No upgrades!",
+
+ //Command data strings
+ "{COM_STATUS}": "ShiftOS build %version\r\n\r\nCodepoints: %cp \r\n Upgrades: %installed installed, %available available\r\n\r\n",
+ "{COM_UPGRADEINFO}": "%category: %name - %cost Codepoints.\r\n\r\n%description\r\n\r\nUpgrade ID: %id",
+
+ //Terminal Command Descriptions
+ //These strings show up when running the "commands" command in your Terminal.
+ "{DESC_CLEAR}": "Clears the screen of the current Terminal.",
+ "{DESC_SETSFXENABLED}": "Sets whether or not system sounds are enabled.",
+ "{DESC_SETMUSICENABLED}": "Sets whether or not music is enabled in ShiftOS.",
+ "{DESC_SETVOLUME}": "Sets the volume of sounds and music if they're enabled.",
+ "{DESC_SHUTDOWN}": "Safely shuts down your computer.",
+ "{DESC_LANG}": "Change the system language of ShiftOS.",
+ "{DESC_COMMANDS}": "Shows a list of Terminal commands inside ShiftOS.",
+ "{DESC_HELP}": "Type this command to get general help with using ShiftOS.",
+ "{DESC_SAVE}": "Saves the in-memory configuration of ShiftOS.",
+ "{DESC_STATUS}": "Shows basic status information such as how many Codepoints you have and your current objective.",
+ "{DESC_BUY}": "Buys the specified Shiftorium upgrade.",
+ "{DESC_BULKBUY}": "Buys the specified Shiftorium upgrades in bulk.",
+ "{DESC_UPGRADEINFO}": "Shows information about the specified Shiftorium upgrade.",
+ "{DESC_UPGRADECATEGORIES}": "Shows all the available Shiftorium categories and how many upgrades are available in them.",
+ "{DESC_UPGRADES}": "Shows a list of available Shiftorium upgrades.",
+ "{DESC_PROCESSES}": "Shows a list of currently running app processes.",
+ "{DESC_PROGRAMS}": "Shows a list of programs you can run.",
+ "{DESC_CLOSE}": "Closes the specified application window.",
+ "{DESC_ADDUSER}": "Add a user to your system.",
+ "{DESC_REMOVEUSER}": "Remove a user from your computer.",
+ "{DESC_SETUSERPERMISSIONS}": "Set the permissions of a user.",
+ "{DESC_USERS}": "Lists all users on your computer.",
+ "{DESC_SU}": "Change your identity to another user's.",
+ "{DESC_PASSWD}": "Change your user account password.",
+ "{DESC_NAMECHANGER}": "Change the name of virtually any program within ShiftOS!",
+ "{DESC_FILENOTFOUND}": "The file you requested could not be found.",
+
+ //Window titles.
+ "{TITLE_FILENOTFOUND}": "File not found.",
+ "{TITLE_PONG_YOULOSE}": "You lose",
+ "{TITLE_CODEPOINTSTRANSFERRED}": "Codepoints transferred.",
+ "{TITLE_INVALIDPORT}": "Invalid port number.",
+ "{TITLE_ENTERSYSNAME}": "Enter system name",
+ "{TITLE_INVALIDNAME}": "Invalid name",
+ "{TITLE_VALUETOOSMALL}": "Value too small.",
+ "{TITLE_TEMPLATE}": "Template",
+ "{TITLE_SKINLOADER}": "Skin loader",
+ "{TITLE_NAMECHANGER}": "Name Changer",
+ "{TITLE_ADDRESSBOOK}": "Address Book",
+ "{TITLE_ARTPAD}": "ArtPad",
+ "{TITLE_SIMPLESRC}": "SimpleSRC Client",
+ "{TITLE_INFOBOX}": "Information",
+ "{TITLE_COLORPICKER}": "Choose color",
+ "{TITLE_AUDIOPLAYER}": "Audio Player",
+ "{TITLE_CALCULATOR}": "Calculator",
+ "{TITLE_DOWNLOADER}": "Downloader",
+ "{TITLE_ABOUT}": "About ShiftOS",
+ "{TITLE_FILESKIMMER}": "File Skimmer",
+ "{TITLE_CHOOSEGRAPHIC}": "Choose graphic",
+ "{TITLE_ICONMANAGER}": "Icon Manager",
+ "{TITLE_INSTALLER}": "Installer",
+ "{TITLE_MINDBLOW}": "MindBlow",
+ "{TITLE_PONG}": "Pong",
+ "{TITLE_SHIFTER}": "Shifter",
+ "{TITLE_SHIFTLETTERS}": "ShiftLetters",
+ "{TITLE_SHIFTLOTTO}": "ShiftLotto",
+ "{TITLE_SHIFTNET}": "Shiftnet",
+ "{TITLE_SHIFTORIUM}": "Shiftorium",
+ "{TITLE_SHIFTSWEEPER}": "ShiftSweeper",
+ "{TITLE_TERMINAL}": "Terminal",
+ "{TITLE_TEXTPAD}": "TextPad",
+ "{TITLE_RESTARTREQUIRED}": "Restart required.",
+
+
+ //App Launcher categories
+ "{AL_PROGRAMMING}": "Programming",
+ "{AL_CUSTOMIZATION}": "Customization",
+ "{AL_NETWORKING}": "Networking",
+ "{AL_UTILITIES}": "Utilities",
+ "{AL_GRAPHICS}": "Graphics",
+ "{AL_ACCESSORIES}": "Accessories",
+ "{AL_ENTERTAINMENT}": "Entertainment",
+ "{AL_OFFICE}": "Office",
+ "{AL_GAMES}": "Games",
+
+ //Infobox prompt messages
+ "{PROMPT_PONGLOST}": "You lost this game of Pong. Guess you should've cashed out...",
+ "{PROMPT_CODEPOINTSTRANSFERRED}": "%transferrer has transferred %amount Codepoints to your system.",
+ "{PROMPT_INVALIDPORT}": "The Digital Society Port must be a valid whole number between 0 and 65535.",
+ "{PROMPT_ENTERSYSNAME}": "Please enter a system name for your computer.",
+ "{PROMPT_INVALIDNAME}": "The name you entered cannot be blank. Please enter another name.",
+ "{PROMPT_SMALLSYSNAME}": "Your system name must have at least 5 characters in it.",
+ "{PROMPT_RESTARTREQUIRED}": "For the changes you made to take effect, a restart of ShiftOS is required.",
+
+ //Pong
+ "{PONG_LEVELREACHED}": "You've reached level %level!",
+ "{PONG_BEATAI}": "You've beaten the opponent! %amount Codepoints!",
+ "{PONG_STATUSCP}": "Codepoints: %cp",
+ "{PONG_STATUSLEVEL}": "Level %level. %time seconds to go!",
+ "{PONG_PLAY}": "Play some Pong!",
+ "{PONG_DESC}": "Pong is the modern-day recreation of the classic 70s game called, you guessed it, Pong.\r\n\r\nIn Pong, you must try your best to keep the fast-moving ball from going past your side of the screen using your mouse to move your paddle in the way of the ball, while getting the ball to go past the opponent's paddle.\r\n\r\nOnce you start Pong, you have 60 seconds to beat the opponent and survive as much as possible. The game will get faster as you play, and the more 60-second levels you play, the more Codepoints you'll earn. If you lose the level, you will start back at Level 1 with 0 Codepoints. At the end of the level, you may choose to cash out or play on.",
+ "{PONG_WELCOME}": "Welcome to Pong.",
+ "{PONG_BEATLEVELDESC}": "You have survived this level of Pong. You now have a chance to cash out your Codepoints or play on for more.",
+ "{PONG_PLAYON}": "Play on",
+ "{PONG_CASHOUT}": "Cash out",
+
+ //Main menu tip messages
+ "{MAINMENU_TIPTEXT_0}": "Press CTRL+T to open a Terminal from any application within ShiftOS.",
+ "{MAINMENU_TIPTEXT_1}": "Codepoints can be used in the Shiftorium to buy upgrades for your system using the \"buy\" command.",
+ "{MAINMENU_TIPTEXT_2}": "The Shifter is a VERY powerful application. Not only can you customize ShiftOS to look however you want, but you'll earn heaps of Codepoints while you do so.",
+ "{MAINMENU_TIPTEXT_3}": "Not the language you want? Head over to \"Settings\" to choose the proper language for you. You may need to head to the forums if your language isn't supported.",
+ "{MAINMENU_TIPTEXT_4}": "Sandbox Mode is a nice way to use ShiftOS without having to progress through the main campaign. There's no Codepoints, no upgrades, and everything's unlocked.",
+ "{MAINMENU_TIPTEXT_5}": "The Skin Loader is an essential application. It can load in skins from anywhere - from your personal collection and from the forums, and you can even generate your own sharable skins for others to use!",
+ "{MAINMENU_TIPTEXT_6}": "ArtPad not cutting it for you? You can use any image editor you like on your host system and just import the assets into the ShiftOS Shared Folder to use in your skins.",
+ "{MAINMENU_TIPTEXT_7}": "What is that \"System Color Key-OUt\" you speak of, Shifter? Well, when composing skin assets, use that color to mark areas to be rendered as transparent!",
+ "{MAINMENU_TIPTEXT_8}": "Use the Format Editor to change the way Terminal commands are interpreted.",
+ "{MAINMENU_TIPTEXT_9}": "The Shiftnet is a wonderland of applications, games and services - only available in ShiftOS. Feel free to explore!",
+
+ //Main menu - Settings
+ "{MAINMENU_DSADDRESS}": "Digital Society address: ",
+ "{MAINMENU_DSPORT": "Digital Society port: ",
+ "{MAINMENU_LANGUAGE}": "Language:",
+
+ //Main Menu - General text
+ "{MAINMENU_TITLE}": "Main menu",
+ "{MAINMENU_CAMPAIGN}": "Campaign",
+ "{MAINMENU_SANDBOX}": "Sandbox",
+ "{MAINMENU_NEWGAME}": "New game",
+
+ //Miscelaneous strings
+ "{MISC_KERNELVERSION}": "ShiftKernel - v0.9.4",
+ "{MISC_KERNELBOOTED}": "[sys] Kernel startup completed.",
+ "{MISC_SHIFTFSDRV}": "[sfs] ShiftFS core driver, version 2.7",
+ "{MISC_SHIFTFSBLOCKSREAD}": "[sfs] Driver initiated. 4096 blocks read.",
+ "{MISC_LOADINGCONFIG}": "[confd] Loading system configuration... success",
+ "{MISC_BUILDINGCMDS}": "[termdb] Terminal database is being parsed...",
+ "{MISC_CONNECTINGTONETWORK}": "[inetd] Connecting to network...",
+ "{MISC_CONNECTIONSUCCESSFUL}": "[inetd] Connection successful.",
+ "{MISC_DHCPHANDSHAKEFINISHED}": "[inetd] DHCP handshake finished.",
+ "{MISC_NONETWORK}": "[inetd] No network access points found.",
+ "{MISC_SANDBOXMODE}": "[sos] Sandbox Mode initiating...",
+ "{MISC_ACCEPTINGLOGINS}": "[systemd] Accepting logins on local tty1.",
+
+ //ShiftOS engine strings
+ "{ENGINE_CANNOTLOADSAVE}": "[sos] Error. Cannot load user save file.",
+
+ //Pre-connection loading messages
+ "{LOADINGMSG1_0}": "[systemd] The light is so bright...",
+ "{LOADINGMSG1_1}": "[systemd] Hold your colors...",
+ "{LOADINGMSG1_2}": "[systemd] Time to shift it my way...",
+ "{LOADINGMSG1_3}": "[systemd] Does anybody even read this?",
+ "{LOADINGMSG1_4}": "[systemd] I....just wanna play it right... We're....gonna get there tonight...",
+ "{LOADINGMSG1_5}": "[systemd] I'm a computer.",
+ "{LOADINGMSG1_6}": "[systemd] What ya gonna do, what ya gonna do, when DevX comes for you?",
+ "{LOADINGMSG1_7}": "[systemd] Artificial intelligence do everything now.",
+ "{LOADINGMSG1_8}": "[systemd] Nobody is really here.",
+ "{LOADINGMSG1_9}": "[systemd] I so want a giant cake for breakfast.",
+
+ //Post-connection loading messages
+ "{LOADINGMSG2_0}": "[systemd] It's all yours, Shifter.",
+ "{LOADINGMSG2_1}": "[systemd] That's a nice network you got there...",
+ "{LOADINGMSG2_2}": "[systemd] Leave me alone and go earn some Codepoints.",
+ "{LOADINGMSG2_3}": "[systemd] I'm hungry... Cake would be appreciated.",
+ "{LOADINGMSG2_4}": "[systemd] SEVERE: CAKE NOT FOUND. PLEASE INSERT CAKE INTO DRIVE 1:/ AND PRESS ANY KEY TO CONTINUE.",
+ "{LOADINGMSG2_5}": "[systemd] Now SCREAM!",
+ "{LOADINGMSG2_6}": "[systemd] Yes, I'd like to order a giant 6-mile-long tripple-chocolate ice cream cake?",
+ "{LOADINGMSG2_7}": "[systemd] There's no antidote...",
+ "{LOADINGMSG2_8}": "[systemd] Can I at least have a muffin?",
+ "{LOADINGMSG2_9}": "[systemd] System initiated, but I still want a cake.",
+ "{LOADINGMSG2_10}": "[sysvinit] Your init system has been upgraded.",
+
+ //Format editor
+ "{FORMATEDITOR_COMMAND_LOWER}": "command",
+ "{FORMATEDITOR_ARGUMENT_LOWER}": "argument",
+ "{FORMATEDITOR_VALUE_LOWER}": "value",
+ "{FORMATEDITOR_ENTERSYNTAX}": "Enter syntax here",
+
+ //BIOS screen text
+ "{MISC_BIOSCOPYRIGHT}": "AMIBIOS (C) %year Australian Microtrends, Plc",
+ "{MISC_BIOSVERSION}": "Shiftsoft 480-L ACPI BIOS Revision 1002",
+ "{MISC_BIOSCPU}": "CPU : VTC 210-N %cores CPU 1.33GHz",
+ "{MISC_CLOCKSPEED}": " Speed : 1.337Ghz",
+ "{MISC_RUNSETUP}": "Press DEL to run Setup",
+ "{MISC_BBSPOPUP}": "Press <F8> for BBS POPUP",
+ "{MISC_RAMFREQ}": "DDR3 Frequency 1337MHz, Dual Channel, Linear Mode",
+ "{MISC_CHECKINGNVRAM}": "Checking NVRAM",
+ "{MISC_RAM}": "1337 MB OK",
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index a6d9ff7..8c1accc 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -436,12 +436,6 @@
<Compile Include="Tools\DitheringEngine.cs" />
<Compile Include="Tools\ShiftOSMenuRenderer.cs" />
<Compile Include="TrailerCommands.cs" />
- <Compile Include="UniteLoginDialog.cs">
- <SubType>UserControl</SubType>
- </Compile>
- <Compile Include="UniteLoginDialog.Designer.cs">
- <DependentUpon>UniteLoginDialog.cs</DependentUpon>
- </Compile>
<Compile Include="UniteSignupDialog.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -642,9 +636,6 @@
<EmbeddedResource Include="StatusIcons\Volume.resx">
<DependentUpon>Volume.cs</DependentUpon>
</EmbeddedResource>
- <EmbeddedResource Include="UniteLoginDialog.resx">
- <DependentUpon>UniteLoginDialog.cs</DependentUpon>
- </EmbeddedResource>
<EmbeddedResource Include="UniteSignupDialog.resx">
<DependentUpon>UniteSignupDialog.cs</DependentUpon>
</EmbeddedResource>
@@ -873,6 +864,7 @@
<None Include="Resources\ShiftOSFull.png" />
<Content Include="Resources\GuessTheNumber.py" />
<None Include="Resources\mindblow.png" />
+ <None Include="Resources\strings_fr.txt" />
<Content Include="SystemIcons\iconArtpad.png" />
<Content Include="SystemIcons\iconAudioPlayer.png" />
<Content Include="SystemIcons\iconBitnoteDigger.png" />
diff --git a/ShiftOS.WinForms/ShiftnetSites/MindBlow.cs b/ShiftOS.WinForms/ShiftnetSites/MindBlow.cs
index e5d035d..eec6115 100644
--- a/ShiftOS.WinForms/ShiftnetSites/MindBlow.cs
+++ b/ShiftOS.WinForms/ShiftnetSites/MindBlow.cs
@@ -65,6 +65,7 @@ namespace ShiftOS.WinForms.ShiftnetSites
public void OnSkinLoad()
{
+ Tools.ControlManager.SetupControls(this);
}
public void OnUpgrade()
diff --git a/ShiftOS.WinForms/UniteLoginDialog.Designer.cs b/ShiftOS.WinForms/UniteLoginDialog.Designer.cs
deleted file mode 100644
index f510393..0000000
--- a/ShiftOS.WinForms/UniteLoginDialog.Designer.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-namespace ShiftOS.WinForms
-{
- partial class UniteLoginDialog
- {
- /// <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 Component 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.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.txtusername = new System.Windows.Forms.TextBox();
- this.txtpassword = new System.Windows.Forms.TextBox();
- this.btnlogin = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 15);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(84, 13);
- this.label1.TabIndex = 0;
- this.label1.Tag = "header2";
- this.label1.Text = "Login to ShiftOS";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(16, 82);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(35, 13);
- this.label2.TabIndex = 1;
- this.label2.Text = "Email:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(16, 115);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(56, 13);
- this.label3.TabIndex = 2;
- this.label3.Text = "Password:";
- //
- // txtusername
- //
- this.txtusername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.txtusername.Location = new System.Drawing.Point(112, 79);
- this.txtusername.Name = "txtusername";
- this.txtusername.Size = new System.Drawing.Size(424, 20);
- this.txtusername.TabIndex = 3;
- //
- // txtpassword
- //
- this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.txtpassword.Location = new System.Drawing.Point(112, 112);
- this.txtpassword.Name = "txtpassword";
- this.txtpassword.Size = new System.Drawing.Size(424, 20);
- this.txtpassword.TabIndex = 4;
- this.txtpassword.UseSystemPasswordChar = true;
- //
- // btnlogin
- //
- this.btnlogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnlogin.Location = new System.Drawing.Point(460, 148);
- this.btnlogin.Name = "btnlogin";
- this.btnlogin.Size = new System.Drawing.Size(75, 23);
- this.btnlogin.TabIndex = 5;
- this.btnlogin.Text = "Login";
- this.btnlogin.UseVisualStyleBackColor = true;
- this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click);
- //
- // UniteLoginDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.btnlogin);
- this.Controls.Add(this.txtpassword);
- this.Controls.Add(this.txtusername);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Name = "UniteLoginDialog";
- this.Size = new System.Drawing.Size(573, 192);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.TextBox txtusername;
- private System.Windows.Forms.TextBox txtpassword;
- private System.Windows.Forms.Button btnlogin;
- }
-}
diff --git a/ShiftOS.WinForms/UniteLoginDialog.cs b/ShiftOS.WinForms/UniteLoginDialog.cs
deleted file mode 100644
index c78e987..0000000
--- a/ShiftOS.WinForms/UniteLoginDialog.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using ShiftOS.Engine;
-using System.Net;
-using ShiftOS.Objects;
-
-namespace ShiftOS.WinForms
-{
- public partial class UniteLoginDialog : UserControl, IShiftOSWindow
- {
- public UniteLoginDialog(Action<string> callback)
- {
- InitializeComponent();
- Callback = callback;
- }
-
- private Action<string> Callback { get; set; }
-
- public void OnLoad()
- {
- this.ParentForm.AcceptButton = btnlogin;
- }
-
- public void OnSkinLoad()
- {
- }
-
- public bool OnUnload()
- {
- return true;
- }
-
- public void OnUpgrade()
- {
- }
-
- private void btnlogin_Click(object sender, EventArgs e)
- {
- string u = txtusername.Text;
- string p = txtpassword.Text;
-
- if (string.IsNullOrWhiteSpace(u))
- {
- Infobox.Show("Please enter a username.", "You must enter a proper email address.");
- return;
- }
-
- if (string.IsNullOrWhiteSpace(p))
- {
- Infobox.Show("Please enter a password.", "You must enter a valid password.");
- return;
- }
-
- try
- {
- var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Login?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4");
- string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}"));
- webrequest.Headers.Add("Authentication: Basic " + base64);
- var response = webrequest.GetResponse();
- var str = response.GetResponseStream();
- var reader = new System.IO.StreamReader(str);
- string result = reader.ReadToEnd();
- reader.Close();
- str.Close();
- str.Dispose();
- response.Dispose();
- Callback?.Invoke(result);
- AppearanceManager.Close(this);
- }
-#if DEBUG
- catch(Exception ex)
- {
- Infobox.Show("Error", ex.ToString());
- }
-#else
- catch
- {
- Infobox.Show("Login failed.", "The login attempt failed due to an incorrect username and password pair.");
- }
-#endif
-
- }
- }
-}
diff --git a/ShiftOS.WinForms/UniteLoginDialog.resx b/ShiftOS.WinForms/UniteLoginDialog.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/ShiftOS.WinForms/UniteLoginDialog.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-<?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/WFLanguageProvider.cs b/ShiftOS.WinForms/WFLanguageProvider.cs
index 2a431f8..c6a8af0 100644
--- a/ShiftOS.WinForms/WFLanguageProvider.cs
+++ b/ShiftOS.WinForms/WFLanguageProvider.cs
@@ -35,46 +35,86 @@ namespace ShiftOS.WinForms
{
public class WFLanguageProvider : ILanguageProvider
{
+ private string resourcesPath
+ {
+ get
+ {
+ return System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ShiftOS", "languages");
+ }
+ }
+
public string[] GetAllLanguages()
{
- return JsonConvert.DeserializeObject<string[]>(Properties.Resources.languages);
+ if (!System.IO.Directory.Exists(resourcesPath))
+ {
+ System.IO.Directory.CreateDirectory(resourcesPath);
+ }
+ return System.IO.Directory.GetFiles(resourcesPath).Where(x => x.ToLower().EndsWith(".lang")).ToArray();
+
}
public string GetCurrentTranscript()
{
- try
+ string lang = ShiftOS.Objects.UserConfig.Get().Language;
+ if (string.IsNullOrWhiteSpace(lang))
{
- return getDefault();
+ lang = "english";
+ var conf = Objects.UserConfig.Get();
+ conf.Language = lang;
+ System.IO.File.WriteAllText("servers.json", JsonConvert.SerializeObject(conf, Formatting.Indented));
}
- catch (NullReferenceException)
+ string foundPath = GetAllLanguages().FirstOrDefault(x => x.ToLower().EndsWith(lang + ".lang"));
+ //Update the english file.
+ System.IO.File.WriteAllText(System.IO.Path.Combine(resourcesPath, "english.lang"), Properties.Resources.strings_en);
+ //Update the french language pack.
+ System.IO.File.WriteAllText(System.IO.Path.Combine(resourcesPath, "french.lang"), Properties.Resources.strings_fr);
+
+ if (!System.IO.File.Exists(foundPath))
+ {
+ lang = "english";
+ var conf = Objects.UserConfig.Get();
+ conf.Language = lang;
+ System.IO.File.WriteAllText("servers.json", JsonConvert.SerializeObject(conf, Formatting.Indented));
+ return Properties.Resources.strings_en;
+ }
+ else
{
- return getDefault();
+ return System.IO.File.ReadAllText(foundPath);
}
+
}
public string GetLanguagePath()
{
- switch (SaveSystem.CurrentSave.Language)
+ var lang = Objects.UserConfig.Get().Language;
+ if(string.IsNullOrWhiteSpace(lang) || !System.IO.File.Exists(System.IO.Path.Combine(resourcesPath, lang + ".lang")))
{
- case "deutsch":
- return Paths.GetPath("deutsch.local");
- default:
- return Paths.GetPath("english.local");
-
+ lang = "english";
+ var conf = Objects.UserConfig.Get();
+ conf.Language = lang;
+ System.IO.File.WriteAllText("servers.json", JsonConvert.SerializeObject(conf, Formatting.Indented));
+ System.IO.File.WriteAllText(System.IO.Path.Combine(resourcesPath, lang + ".lang"), Properties.Resources.strings_en);
}
+ return GetAllLanguages().FirstOrDefault(x => x.ToLower().EndsWith(lang + ".lang"));
}
public List<string> GetJSONTranscripts()
{
var strings = new List<string>();
- strings.Add(Properties.Resources.strings_en);
- strings.Add(Properties.Resources.strings_de);
+ foreach (var path in GetAllLanguages())
+ strings.Add(System.IO.File.ReadAllText(path));
return strings;
}
public void WriteDefaultTranscript()
{
- Utils.WriteAllText(Paths.GetPath("english.local"), getDefault());
+ if (!System.IO.Directory.Exists(resourcesPath))
+ System.IO.Directory.CreateDirectory(resourcesPath);
+
+ //Update the english file.
+ System.IO.File.WriteAllText(System.IO.Path.Combine(resourcesPath, "english.lang"), Properties.Resources.strings_en);
+ //Update the french language pack.
+ System.IO.File.WriteAllText(System.IO.Path.Combine(resourcesPath, "french.lang"), Properties.Resources.strings_fr);
}
public void WriteTranscript()
diff --git a/ShiftOS_TheReturn/BFInterpreter.cs b/ShiftOS_TheReturn/BFInterpreter.cs
index f2463a4..1ff5358 100644
--- a/ShiftOS_TheReturn/BFInterpreter.cs
+++ b/ShiftOS_TheReturn/BFInterpreter.cs
@@ -53,7 +53,9 @@ namespace ShiftOS.Engine
private Stream str;
public IBFListener lst = null;
-
+
+ private static byte[] newline = Encoding.UTF8.GetBytes(Environment.NewLine);
+
public BFInterpreter(Stream io, IBFListener listener = null, string program = "")
{
lck = new object();
@@ -62,22 +64,21 @@ namespace ShiftOS.Engine
Reset();
lst = listener;
}
- public void Execute()
+ public void Execute(string program, int offset = 0)
{
+ int c = 0;
lock (lck)
- for (int iptr = 0; iptr < prg.Length; iptr++)
+ while (c < program.Length)
{
- if (lst != null)
- lst.IPtrMoved(iptr);
- switch (prg[iptr])
+ switch (program[c++])
{
- case '>':
- ptr++;
+ case '<':
+ ptr--;
if (lst != null)
lst.PointerMoved(ptr);
break;
- case '<':
- ptr--;
+ case '>':
+ ptr++;
if (lst != null)
lst.PointerMoved(ptr);
break;
@@ -92,39 +93,45 @@ namespace ShiftOS.Engine
lst.MemChanged(ptr, mem[ptr]);
break;
case '.':
- str.WriteByte(mem[ptr]);
+ if (mem[ptr] == 10)
+ str.Write(newline, 0, newline.Length); // normalise newline
+ else
+ str.WriteByte(mem[ptr]);
break;
case ',':
mem[ptr] = (byte)str.ReadByte();
+ if (mem[ptr] == 13)
+ mem[ptr] = 10; // normalise newline
if (lst != null)
lst.MemChanged(ptr, mem[ptr]);
break;
case '[':
- if (mem[ptr] == 0)
- while (prg[iptr] != ']')
- {
- iptr++;
- if (lst != null)
- lst.IPtrMoved(iptr);
- }
+ int b;
+ int oldc = c;
+ for (b = 1; b != 0 && c < program.Length; c++)
+ {
+ if (program[c] == '[')
+ b++;
+ else if (program[c] == ']')
+ b--;
+ }
+ if (b == 0)
+ {
+ string block = program.Substring(oldc, c - oldc - 1);
+ while (mem[ptr] != 0)
+ Execute(block, offset + oldc);
+ }
break;
case ']':
- if (mem[ptr] != 0)
- while (prg[iptr] != '[')
- {
- iptr--;
- if (lst != null)
- lst.IPtrMoved(iptr);
- }
- break;
+ throw new Exception("Unbalanced brackets");
}
+ if (lst != null)
+ lst.IPtrMoved(offset + c);
}
}
- public void Execute(string program)
+ public void Execute()
{
- lock (lck)
- prg = program;
- Execute();
+ Execute(prg);
}
public void Reset()
{
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 8cd4d9b..8cfea4a 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -107,7 +107,7 @@ namespace ShiftOS.Engine
SkinEngine.Init();
Random rnd = new Random();
int loadingJoke1 = rnd.Next(10);
- int loadingJoke2 = rnd.Next(10);
+ int loadingJoke2 = rnd.Next(11);
TerminalBackend.OpenTerminal();