Merge pull request #4 from shiftos-game/master

pulling
This commit is contained in:
william341 2017-06-19 12:16:31 -07:00 committed by GitHub
commit 09e2268bc2
19 changed files with 628 additions and 493 deletions

View file

@ -23,7 +23,7 @@ namespace ShiftOS.Unite
{
get
{
return UserConfig.Get().UniteUrl;
return "";
}
}

View file

@ -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
};

View file

@ -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 { }
}

View file

@ -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.save = new System.Windows.Forms.Button();
this.memptr = new System.Windows.Forms.Label();
this.instptr = new System.Windows.Forms.Label();
this.memlist = new System.Windows.Forms.ListBox();
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.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.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,8 +98,58 @@
this.program.Text = "Program";
this.program.UseVisualStyleBackColor = true;
//
// stop
//
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);
//
// run
//
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);
//
// save
//
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(90, 23);
this.load.TabIndex = 1;
this.load.Text = "Load";
this.load.UseVisualStyleBackColor = true;
this.load.Click += new System.EventHandler(this.load_Click);
//
// programinput
//
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;
//
// monitor
//
this.monitor.Controls.Add(this.reset);
this.monitor.Controls.Add(this.memlist);
this.monitor.Controls.Add(this.instptr);
this.monitor.Controls.Add(this.memptr);
@ -96,61 +160,16 @@
this.monitor.Text = "Monitor";
this.monitor.UseVisualStyleBackColor = true;
//
// consoleout
// reset
//
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;
//
// programinput
//
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;
//
// 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.TabIndex = 1;
this.load.Text = "Load";
this.load.UseVisualStyleBackColor = true;
this.load.Click += new System.EventHandler(this.load_Click);
//
// save
//
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);
//
// 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";
//
// instptr
//
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;
}
}

View file

@ -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();
}
}
}

View file

@ -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;
}
}

View file

@ -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)

View file

@ -1328,6 +1328,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>

View file

@ -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>

View file

@ -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",

View file

@ -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",
}

View file

@ -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" />

View file

@ -65,6 +65,7 @@ namespace ShiftOS.WinForms.ShiftnetSites
public void OnSkinLoad()
{
Tools.ControlManager.SetupControls(this);
}
public void OnUpgrade()

View file

@ -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;
}
}

View file

@ -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
}
}
}

View file

@ -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>

View file

@ -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))
{
return getDefault();
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 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()

View file

@ -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()
{

View file

@ -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();