aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs12
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.cs64
-rw-r--r--ShiftOS.WinForms/Applications/Pong.cs17
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs125
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs18
-rw-r--r--ShiftOS.WinForms/Controls/TerminalBox.cs2
-rw-r--r--ShiftOS.WinForms/GUILogin.Designer.cs135
-rw-r--r--ShiftOS.WinForms/GUILogin.cs136
-rw-r--r--ShiftOS.WinForms/GUILogin.resx120
-rw-r--r--ShiftOS.WinForms/Program.cs1
-rw-r--r--ShiftOS.WinForms/Resources/Shiftorium.txt7
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj9
-rw-r--r--ShiftOS.WinForms/WindowBorder.cs55
-rw-r--r--ShiftOS_TheReturn/LoginManager.cs65
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs161
-rw-r--r--ShiftOS_TheReturn/ShiftOS.Engine.csproj1
-rw-r--r--ShiftOS_TheReturn/Skinning.cs16
-rw-r--r--ShiftOS_TheReturn/UserManagementCommands.cs52
18 files changed, 858 insertions, 138 deletions
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
index ea9fcec..965e4eb 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
@@ -70,9 +70,9 @@ namespace ShiftOS.WinForms.Applications
// lvitems
//
this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lvitems.Location = new System.Drawing.Point(0, 0);
+ this.lvitems.Location = new System.Drawing.Point(149, 0);
this.lvitems.Name = "lvitems";
- this.lvitems.Size = new System.Drawing.Size(634, 332);
+ this.lvitems.Size = new System.Drawing.Size(485, 332);
this.lvitems.TabIndex = 0;
this.lvitems.UseCompatibleStateImageBehavior = false;
this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged);
@@ -81,8 +81,8 @@ namespace ShiftOS.WinForms.Applications
//
// panel1
//
- this.panel1.Controls.Add(this.pinnedItems);
this.panel1.Controls.Add(this.lvitems);
+ this.panel1.Controls.Add(this.pinnedItems);
this.panel1.Controls.Add(this.lbcurrentfolder);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 24);
@@ -92,10 +92,12 @@ namespace ShiftOS.WinForms.Applications
//
// pinnedItems
//
- this.pinnedItems.Location = new System.Drawing.Point(437, 208);
+ this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pinnedItems.Location = new System.Drawing.Point(0, 0);
this.pinnedItems.Name = "pinnedItems";
- this.pinnedItems.Size = new System.Drawing.Size(197, 124);
+ this.pinnedItems.Size = new System.Drawing.Size(149, 332);
this.pinnedItems.TabIndex = 3;
+ this.pinnedItems.Click += new System.EventHandler(this.pinnedItems_Click);
//
// lbcurrentfolder
//
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs
index c1ffd40..218e9e2 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs
@@ -35,6 +35,7 @@ using System.Windows.Forms;
using static ShiftOS.Objects.ShiftFS.Utils;
using ShiftOS.Engine;
+using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
@@ -128,8 +129,14 @@ namespace ShiftOS.WinForms.Applications
{
int amountsCalled = -1;
amountsCalled = amountsCalled + 1;
- pinnedItems.Nodes.Add(path);
- pinnedItems.Nodes[amountsCalled].Nodes.Add("test");
+ List<string> Pinned = new List<string>();
+ if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
+ {
+ Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
+ }
+ Pinned.Add(path);
+ WriteAllText(Paths.GetPath("data") + "/pinned_items.dat", JsonConvert.SerializeObject(Pinned));
+ ResetList();
}
public void ChangeDirectory(string path)
@@ -152,8 +159,40 @@ namespace ShiftOS.WinForms.Applications
}
}
+ public void PopulatePinned(TreeNode node, string[] items)
+ {
+ foreach(var dir in items)
+ {
+ var treenode = new TreeNode();
+ if (DirectoryExists(dir))
+ {
+ var dinf = GetDirectoryInfo(dir);
+ treenode.Text = dinf.Name;
+ }
+ else if (FileExists(dir))
+ {
+ var finf = GetFileInfo(dir);
+ treenode.Text = finf.Name;
+ }
+ treenode.Tag = dir;
+ node.Nodes.Add(treenode);
+ }
+ }
+
public void ResetList()
{
+ pinnedItems.Nodes.Clear();
+ List<string> Pinned = new List<string>();
+ if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
+ {
+ Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
+ }
+ var node = new TreeNode();
+ node.Text = "Pinned";
+ PopulatePinned(node, Pinned.ToArray());
+ pinnedItems.Nodes.Add(node);
+ node.ExpandAll();
+
if(lvitems.LargeImageList == null)
{
lvitems.LargeImageList = new ImageList();
@@ -437,5 +476,26 @@ namespace ShiftOS.WinForms.Applications
}
catch { }
}
+
+ private void pinnedItems_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (pinnedItems.SelectedNode != null)
+ {
+ string path = pinnedItems.SelectedNode.Tag.ToString();
+ if (DirectoryExists(path))
+ {
+ currentdir = path;
+ ResetList();
+ }
+ else if (FileExists(path))
+ {
+ FileSkimmerBackend.OpenFile(path);
+ }
+ }
+ }
+ catch { }
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs
index 92a2039..02d9963 100644
--- a/ShiftOS.WinForms/Applications/Pong.cs
+++ b/ShiftOS.WinForms/Applications/Pong.cs
@@ -981,6 +981,10 @@ namespace ShiftOS.WinForms.Applications
var hs = unite.GetPongHighscores();
foreach (var score in hs.Highscores)
{
+ if(this.ParentForm.Visible == false)
+ {
+ Thread.CurrentThread.Abort();
+ }
string username = unite.GetDisplayNameId(score.UserId);
this.Invoke(new Action(() =>
{
@@ -994,8 +998,15 @@ namespace ShiftOS.WinForms.Applications
}
catch
{
- Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time.");
- this.Invoke(new Action(pnlgamestats.BringToFront));
+ try
+ {
+ if (this.ParentForm.Visible == true)
+ {
+ Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time.");
+ this.Invoke(new Action(pnlgamestats.BringToFront));
+ }
+ }
+ catch { } //JUST. ABORT. THE. FUCKING. THREAD.
return;
}
});
@@ -1095,8 +1106,8 @@ namespace ShiftOS.WinForms.Applications
{
if(!string.IsNullOrWhiteSpace(OpponentGUID))
ServerManager.Forward(OpponentGUID, "pong_mp_left", null);
+ LeaveMatchmake();
}
- LeaveMatchmake();
ServerManager.MessageReceived -= this.ServerMessageReceivedHandler;
return true;
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
index 32d508b..f9d0bb4 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
@@ -61,16 +61,16 @@ namespace ShiftOS.WinForms.Applications
this.btnbuy = new System.Windows.Forms.Button();
this.lbupgradetitle = new System.Windows.Forms.Label();
this.pnllist = new System.Windows.Forms.Panel();
+ this.lbnoupgrades = new System.Windows.Forms.Label();
+ this.panel3 = new System.Windows.Forms.Panel();
+ this.lblcategorytext = new System.Windows.Forms.Label();
+ this.btncat_forward = new System.Windows.Forms.Button();
+ this.btncat_back = new System.Windows.Forms.Button();
this.lbcodepoints = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pgupgradeprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
this.lbupgrades = new System.Windows.Forms.ListBox();
this.label3 = new System.Windows.Forms.Label();
- this.panel3 = new System.Windows.Forms.Panel();
- this.btncat_back = new System.Windows.Forms.Button();
- this.btncat_forward = new System.Windows.Forms.Button();
- this.lblcategorytext = new System.Windows.Forms.Label();
- this.lbnoupgrades = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.pnlupgradeactions.SuspendLayout();
@@ -159,6 +159,64 @@ namespace ShiftOS.WinForms.Applications
this.pnllist.Size = new System.Drawing.Size(406, 427);
this.pnllist.TabIndex = 0;
//
+ // lbnoupgrades
+ //
+ this.lbnoupgrades.AutoSize = true;
+ this.lbnoupgrades.Location = new System.Drawing.Point(69, 183);
+ this.lbnoupgrades.Name = "lbnoupgrades";
+ this.lbnoupgrades.Size = new System.Drawing.Size(71, 13);
+ this.lbnoupgrades.TabIndex = 6;
+ this.lbnoupgrades.Tag = "header2";
+ this.lbnoupgrades.Text = "No upgrades!";
+ this.lbnoupgrades.Visible = false;
+ //
+ // panel3
+ //
+ this.panel3.Controls.Add(this.lblcategorytext);
+ this.panel3.Controls.Add(this.btncat_forward);
+ this.panel3.Controls.Add(this.btncat_back);
+ this.panel3.Location = new System.Drawing.Point(6, 76);
+ this.panel3.Name = "panel3";
+ this.panel3.Size = new System.Drawing.Size(394, 23);
+ this.panel3.TabIndex = 5;
+ //
+ // lblcategorytext
+ //
+ this.lblcategorytext.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblcategorytext.Location = new System.Drawing.Point(29, 0);
+ this.lblcategorytext.Name = "lblcategorytext";
+ this.lblcategorytext.Size = new System.Drawing.Size(336, 23);
+ this.lblcategorytext.TabIndex = 2;
+ this.lblcategorytext.Text = "No Upgrades";
+ this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_Click);
+ //
+ // btncat_forward
+ //
+ this.btncat_forward.AutoSize = true;
+ this.btncat_forward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btncat_forward.Dock = System.Windows.Forms.DockStyle.Right;
+ this.btncat_forward.Location = new System.Drawing.Point(365, 0);
+ this.btncat_forward.Name = "btncat_forward";
+ this.btncat_forward.Size = new System.Drawing.Size(29, 23);
+ this.btncat_forward.TabIndex = 1;
+ this.btncat_forward.Text = "-->";
+ this.btncat_forward.UseVisualStyleBackColor = true;
+ this.btncat_forward.Click += new System.EventHandler(this.btncat_forward_Click);
+ //
+ // btncat_back
+ //
+ this.btncat_back.AutoSize = true;
+ this.btncat_back.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btncat_back.Dock = System.Windows.Forms.DockStyle.Left;
+ this.btncat_back.Location = new System.Drawing.Point(0, 0);
+ this.btncat_back.Name = "btncat_back";
+ this.btncat_back.Size = new System.Drawing.Size(29, 23);
+ this.btncat_back.TabIndex = 0;
+ this.btncat_back.Text = "<--";
+ this.btncat_back.UseVisualStyleBackColor = true;
+ this.btncat_back.Click += new System.EventHandler(this.btncat_back_Click);
+ //
// lbcodepoints
//
this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -215,63 +273,6 @@ namespace ShiftOS.WinForms.Applications
this.label3.Size = new System.Drawing.Size(137, 13);
this.label3.TabIndex = 2;
//
- // panel3
- //
- this.panel3.Controls.Add(this.lblcategorytext);
- this.panel3.Controls.Add(this.btncat_forward);
- this.panel3.Controls.Add(this.btncat_back);
- this.panel3.Location = new System.Drawing.Point(6, 76);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(394, 23);
- this.panel3.TabIndex = 5;
- //
- // btncat_back
- //
- this.btncat_back.AutoSize = true;
- this.btncat_back.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btncat_back.Dock = System.Windows.Forms.DockStyle.Left;
- this.btncat_back.Location = new System.Drawing.Point(0, 0);
- this.btncat_back.Name = "btncat_back";
- this.btncat_back.Size = new System.Drawing.Size(29, 23);
- this.btncat_back.TabIndex = 0;
- this.btncat_back.Text = "<--";
- this.btncat_back.UseVisualStyleBackColor = true;
- this.btncat_back.Click += new System.EventHandler(this.btncat_back_Click);
- //
- // btncat_forward
- //
- this.btncat_forward.AutoSize = true;
- this.btncat_forward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btncat_forward.Dock = System.Windows.Forms.DockStyle.Right;
- this.btncat_forward.Location = new System.Drawing.Point(365, 0);
- this.btncat_forward.Name = "btncat_forward";
- this.btncat_forward.Size = new System.Drawing.Size(29, 23);
- this.btncat_forward.TabIndex = 1;
- this.btncat_forward.Text = "-->";
- this.btncat_forward.UseVisualStyleBackColor = true;
- this.btncat_forward.Click += new System.EventHandler(this.btncat_forward_Click);
- //
- // lblcategorytext
- //
- this.lblcategorytext.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lblcategorytext.Location = new System.Drawing.Point(29, 0);
- this.lblcategorytext.Name = "lblcategorytext";
- this.lblcategorytext.Size = new System.Drawing.Size(336, 23);
- this.lblcategorytext.TabIndex = 2;
- this.lblcategorytext.Text = "label2";
- this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // lbnoupgrades
- //
- this.lbnoupgrades.AutoSize = true;
- this.lbnoupgrades.Location = new System.Drawing.Point(69, 183);
- this.lbnoupgrades.Name = "lbnoupgrades";
- this.lbnoupgrades.Size = new System.Drawing.Size(71, 13);
- this.lbnoupgrades.TabIndex = 6;
- this.lbnoupgrades.Tag = "header2";
- this.lbnoupgrades.Text = "No upgrades!";
- this.lbnoupgrades.Visible = false;
- //
// ShiftoriumFrontend
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
index 06266c3..08e6c8f 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
@@ -134,9 +134,16 @@ namespace ShiftOS.WinForms.Applications
Desktop.InvokeOnWorkerThread(() =>
{
- lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
- btncat_back.Visible = (CategoryId > 0);
- btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
+ try
+ {
+ lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
+ btncat_back.Visible = (CategoryId > 0);
+ btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
+ }
+ catch
+ {
+
+ }
});
}
catch
@@ -304,5 +311,10 @@ namespace ShiftOS.WinForms.Applications
PopulateShiftorium();
}
}
+
+ private void lblcategorytext_Click(object sender, EventArgs e)
+ {
+
+ }
}
}
diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs
index f85daa6..ea7808c 100644
--- a/ShiftOS.WinForms/Controls/TerminalBox.cs
+++ b/ShiftOS.WinForms/Controls/TerminalBox.cs
@@ -243,7 +243,7 @@ namespace ShiftOS.WinForms.Controls
break;
default:
- Engine.AudioManager.PlayStream(Properties.Resources.typesound);
+ //Engine.AudioManager.PlayStream(Properties.Resources.typesound); // infernal beeping noise only enable for the trailers
break;
}
}
diff --git a/ShiftOS.WinForms/GUILogin.Designer.cs b/ShiftOS.WinForms/GUILogin.Designer.cs
new file mode 100644
index 0000000..e10071f
--- /dev/null
+++ b/ShiftOS.WinForms/GUILogin.Designer.cs
@@ -0,0 +1,135 @@
+namespace ShiftOS.WinForms
+{
+ partial class GUILogin
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.pnlloginform = new System.Windows.Forms.Panel();
+ this.btnlogin = new System.Windows.Forms.Button();
+ this.txtpassword = new System.Windows.Forms.TextBox();
+ this.txtusername = new System.Windows.Forms.TextBox();
+ this.lblogintitle = new System.Windows.Forms.Label();
+ this.btnshutdown = new System.Windows.Forms.Button();
+ this.pnlloginform.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // pnlloginform
+ //
+ this.pnlloginform.Controls.Add(this.btnlogin);
+ this.pnlloginform.Controls.Add(this.txtpassword);
+ this.pnlloginform.Controls.Add(this.txtusername);
+ this.pnlloginform.Location = new System.Drawing.Point(13, 13);
+ this.pnlloginform.Name = "pnlloginform";
+ this.pnlloginform.Size = new System.Drawing.Size(358, 236);
+ this.pnlloginform.TabIndex = 0;
+ this.pnlloginform.Tag = "";
+ //
+ // btnlogin
+ //
+ this.btnlogin.AutoSize = true;
+ this.btnlogin.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnlogin.Location = new System.Drawing.Point(159, 163);
+ this.btnlogin.Name = "btnlogin";
+ this.btnlogin.Size = new System.Drawing.Size(43, 23);
+ this.btnlogin.TabIndex = 2;
+ this.btnlogin.Text = "Login";
+ this.btnlogin.UseVisualStyleBackColor = true;
+ this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click);
+ //
+ // txtpassword
+ //
+ this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtpassword.Location = new System.Drawing.Point(69, 115);
+ this.txtpassword.Name = "txtpassword";
+ this.txtpassword.Size = new System.Drawing.Size(300, 20);
+ this.txtpassword.TabIndex = 1;
+ this.txtpassword.UseSystemPasswordChar = true;
+ //
+ // 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(3, 14);
+ this.txtusername.Name = "txtusername";
+ this.txtusername.Size = new System.Drawing.Size(300, 20);
+ this.txtusername.TabIndex = 0;
+ //
+ // lblogintitle
+ //
+ this.lblogintitle.AutoSize = true;
+ this.lblogintitle.Location = new System.Drawing.Point(99, 553);
+ this.lblogintitle.Name = "lblogintitle";
+ this.lblogintitle.Size = new System.Drawing.Size(103, 13);
+ this.lblogintitle.TabIndex = 1;
+ this.lblogintitle.Tag = "header1 keepbg";
+ this.lblogintitle.Text = "Welcome to ShiftOS";
+ //
+ // btnshutdown
+ //
+ this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnshutdown.AutoSize = true;
+ this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnshutdown.Location = new System.Drawing.Point(924, 652);
+ this.btnshutdown.Name = "btnshutdown";
+ this.btnshutdown.Size = new System.Drawing.Size(65, 23);
+ this.btnshutdown.TabIndex = 2;
+ this.btnshutdown.Text = "Shutdown";
+ this.btnshutdown.UseVisualStyleBackColor = true;
+ this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click);
+ //
+ // GUILogin
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.Black;
+ this.ClientSize = new System.Drawing.Size(1001, 687);
+ this.Controls.Add(this.btnshutdown);
+ this.Controls.Add(this.lblogintitle);
+ this.Controls.Add(this.pnlloginform);
+ this.ForeColor = System.Drawing.Color.White;
+ this.Name = "GUILogin";
+ this.Text = "GUILogin";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GUILogin_FormClosing);
+ this.Load += new System.EventHandler(this.GUILogin_Load);
+ this.pnlloginform.ResumeLayout(false);
+ this.pnlloginform.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel pnlloginform;
+ private System.Windows.Forms.Button btnlogin;
+ private System.Windows.Forms.TextBox txtpassword;
+ private System.Windows.Forms.TextBox txtusername;
+ private System.Windows.Forms.Label lblogintitle;
+ private System.Windows.Forms.Button btnshutdown;
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/GUILogin.cs b/ShiftOS.WinForms/GUILogin.cs
new file mode 100644
index 0000000..078061c
--- /dev/null
+++ b/ShiftOS.WinForms/GUILogin.cs
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using ShiftOS.Objects;
+using ShiftOS.WinForms.Tools;
+
+namespace ShiftOS.WinForms
+{
+ public partial class GUILogin : Form
+ {
+ public GUILogin()
+ {
+ InitializeComponent();
+ uiTimer.Tick += (o, a) =>
+ {
+ btnlogin.Left = txtusername.Left + ((txtusername.Width - btnlogin.Width) / 2);
+ btnlogin.Top = txtpassword.Top + txtpassword.Height + 5;
+
+ lblogintitle.Left = pnlloginform.Left + ((pnlloginform.Width - lblogintitle.Width) / 2);
+ lblogintitle.Top = pnlloginform.Top - lblogintitle.Width - 5;
+
+ };
+ uiTimer.Interval = 100;
+ this.FormBorderStyle = FormBorderStyle.None;
+ this.WindowState = FormWindowState.Maximized;
+ this.TopMost = true;
+ }
+
+ Timer uiTimer = new Timer();
+
+ public event Action<ClientSave> LoginComplete;
+
+ private void GUILogin_Load(object sender, EventArgs e)
+ {
+ uiTimer.Start();
+ ControlManager.SetupControl(lblogintitle);
+ ControlManager.SetupControls(pnlloginform);
+ ControlManager.SetupControl(btnshutdown);
+ pnlloginform.CenterParent();
+ txtusername.CenterParent();
+ txtusername.Location = new System.Drawing.Point(txtusername.Location.X, 77);
+ txtpassword.CenterParent();
+ btnlogin.CenterParent();
+ btnlogin.Location = new System.Drawing.Point(btnlogin.Location.X, 143);
+ this.BackColor = SkinEngine.LoadedSkin.LoginScreenColor;
+ this.BackgroundImage = SkinEngine.GetImage("login");
+ this.BackgroundImageLayout = SkinEngine.GetImageLayout("login");
+ }
+
+ private ClientSave User = null;
+
+ bool userRequestClose = true;
+ bool shuttingdown = false;
+
+ private void GUILogin_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ e.Cancel = userRequestClose;
+ if (!e.Cancel)
+ {
+ uiTimer.Stop();
+ if (shuttingdown == false)
+ {
+ LoginComplete?.Invoke(User);
+ }
+ }
+ }
+
+ private void btnlogin_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(txtusername.Text))
+ {
+ Infobox.Show("Enter a username", "You must enter your username to login.");
+ return;
+ }
+
+ //Don't check for blank passwords.
+
+ var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == txtusername.Text);
+ if(user == null)
+ {
+ Infobox.Show("Invalid username", "That username was not found on your system.");
+ return;
+ }
+
+ if (user.Password != txtpassword.Text)
+ {
+ Infobox.Show("Access denied.", "That password didn't work. Please try a different one.");
+ return;
+ }
+
+ User = user;
+ userRequestClose = false;
+ shuttingdown = false;
+ this.Close();
+ }
+
+ private void btnshutdown_Click(object sender, EventArgs e)
+ {
+ userRequestClose = false;
+ shuttingdown = true;
+ this.Close();
+ SaveSystem.CurrentUser = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == "root");
+ TerminalBackend.InvokeCommand("sos.shutdown");
+ }
+ }
+
+ public class GUILoginFrontend : ILoginFrontend
+ {
+ public bool UseGUILogin
+ {
+ get
+ {
+ return Shiftorium.UpgradeInstalled("gui_based_login_screen");
+ }
+ }
+
+ public event Action<ClientSave> LoginComplete;
+
+ public void Login()
+ {
+ var lform = new GUILogin();
+ lform.LoginComplete += (user) =>
+ {
+ LoginComplete?.Invoke(user);
+ };
+ lform.Show();
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/GUILogin.resx b/ShiftOS.WinForms/GUILogin.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/GUILogin.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index b2f064d..ad8fc83 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -49,6 +49,7 @@ namespace ShiftOS.WinForms
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael
+ LoginManager.Init(new GUILoginFrontend());
CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
SkinEngine.SetIconProber(new ShiftOSIconProvider());
ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider());
diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt
index b528c72..c3d27ae 100644
--- a/ShiftOS.WinForms/Resources/Shiftorium.txt
+++ b/ShiftOS.WinForms/Resources/Shiftorium.txt
@@ -8,6 +8,13 @@
Category: "Enhancements",
},
{
+ Name: "GUI Based Login Screen",
+ Cost: 500,
+ Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, why not use these tools to create a functioning and awesome-looking login screen?",
+ Dependencies: "skinning;desktop;wm_free_placement",
+ Category: "Kernel & System"
+ },
+ {
Name: "Shift Screensavers",
Cost: 100,
Description: "This Shifter upgrade will allow you to customize the screensaver.",
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index 1607ae9..411d701 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -323,6 +323,12 @@
<DependentUpon>DownloadControl.cs</DependentUpon>
</Compile>
<Compile Include="GUIFunctions.cs" />
+ <Compile Include="GUILogin.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="GUILogin.Designer.cs">
+ <DependentUpon>GUILogin.cs</DependentUpon>
+ </Compile>
<Compile Include="HackerCommands.cs" />
<Compile Include="IDesktopWidget.cs" />
<Compile Include="JobTasks.cs" />
@@ -520,6 +526,9 @@
<EmbeddedResource Include="DownloadControl.resx">
<DependentUpon>DownloadControl.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="GUILogin.resx">
+ <DependentUpon>GUILogin.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Oobe.resx">
<DependentUpon>Oobe.cs</DependentUpon>
</EmbeddedResource>
diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs
index 25c7639..40dc629 100644
--- a/ShiftOS.WinForms/WindowBorder.cs
+++ b/ShiftOS.WinForms/WindowBorder.cs
@@ -515,6 +515,17 @@ namespace ShiftOS.WinForms
if(resizing == true)
{
this.Width += e.X;
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
}
}
@@ -522,6 +533,17 @@ namespace ShiftOS.WinForms
{
resizing = false;
pnlcontents.Show();
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
}
private void pnlleft_MouseMove(object sender, MouseEventArgs e)
@@ -530,6 +552,17 @@ namespace ShiftOS.WinForms
{
this.Left += e.X;
this.Width -= e.X;
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
}
}
@@ -547,6 +580,17 @@ namespace ShiftOS.WinForms
{
this.Width += e.X;
this.Height += e.Y;
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
}
}
@@ -557,6 +601,17 @@ namespace ShiftOS.WinForms
this.Width -= e.X;
this.Height += e.Y;
this.Left += e.X;
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
}
}
diff --git a/ShiftOS_TheReturn/LoginManager.cs b/ShiftOS_TheReturn/LoginManager.cs
new file mode 100644
index 0000000..d326f2c
--- /dev/null
+++ b/ShiftOS_TheReturn/LoginManager.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Objects;
+
+namespace ShiftOS.Engine
+{
+ public static class LoginManager
+ {
+ private static ILoginFrontend _login = null;
+
+ public static void Init(ILoginFrontend login)
+ {
+ _login = login;
+ }
+
+ public static void PromptForLogin()
+ {
+ _login.LoginComplete += (user) =>
+ {
+ LoginComplete?.Invoke(user);
+ };
+ _login.Login();
+ }
+
+ public static bool ShouldUseGUILogin
+ {
+ get
+ {
+ if (_login == null)
+ return false;
+ return _login.UseGUILogin;
+ }
+ }
+
+ public static event Action<ClientSave> LoginComplete;
+ }
+
+ /// <summary>
+ /// Interface for GUI-based logins.
+ /// </summary>
+ public interface ILoginFrontend
+ {
+ /// <summary>
+ /// When implemented, shows the login UI.
+ /// </summary>
+ void Login();
+
+ /// <summary>
+ /// Gets whether the ShiftOS engine should use a GUI-based login system or the default one.
+ /// </summary>
+ bool UseGUILogin { get; }
+
+
+ /// <summary>
+ /// Occurs when the login is complete.
+ /// </summary>
+ event Action<ClientSave> LoginComplete;
+
+
+
+ }
+}
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index f29e5b8..e635a7a 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -98,13 +98,25 @@ namespace ShiftOS.Engine
}
Thread.Sleep(350);
- Console.WriteLine("Initiating kernel...");
+ Console.WriteLine("ShiftKernel v0.4.2");
+ Console.WriteLine("(MIT) DevX 2017, Very Little Rights Reserved");
+ Console.WriteLine("");
+ Console.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR");
+ Console.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
+ Console.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
+ Console.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER");
+ Console.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,");
+ Console.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE");
+ Console.WriteLine("SOFTWARE.");
+ Console.WriteLine("");
Thread.Sleep(250);
- Console.WriteLine("Reading filesystem...");
+ Console.WriteLine("[init] Kernel boot complete.");
+ Console.WriteLine("[sfs] Loading SFS driver v3");
Thread.Sleep(100);
- Console.WriteLine("Reading configuration...");
+ Console.WriteLine("[sfs] 4096 blocks read.");
+ Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)");
- Console.WriteLine("{CONNECTING_TO_MUD}");
+ Console.WriteLine("[inetd] Connecting to network...");
if (defaultConf.ConnectToMud == true)
{
@@ -113,7 +125,7 @@ namespace ShiftOS.Engine
{
//Connection successful! Stop waiting!
guidReceived = true;
- Console.WriteLine("Connection successful.");
+ Console.WriteLine("[inetd] Connection successful.");
};
try
@@ -125,20 +137,20 @@ namespace ShiftOS.Engine
{
Thread.Sleep(10);
}
- Console.WriteLine("GUID received - bootstrapping complete.");
+ Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
FinishBootstrap();
}
catch (Exception ex)
{
//No errors, this never gets called.
- Console.WriteLine("{ERROR}: " + ex.Message);
+ Console.WriteLine("[inetd] SEVERE: " + ex.Message);
Thread.Sleep(3000);
ServerManager.StartLANServer();
while (ServerManager.thisGuid == new Guid())
{
Thread.Sleep(10);
}
- Console.WriteLine("GUID received - bootstrapping complete.");
+ Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
FinishBootstrap();
}
}
@@ -196,7 +208,7 @@ namespace ShiftOS.Engine
Thread.Sleep(75);
Thread.Sleep(50);
- Console.WriteLine("{SYSTEM_INITIATED}");
+ Console.WriteLine("[usr-man] Accepting logins on local tty 1.");
Sysname:
bool waitingForNewSysName = false;
@@ -204,7 +216,7 @@ namespace ShiftOS.Engine
if (string.IsNullOrWhiteSpace(CurrentSave.SystemName))
{
- Infobox.PromptText("Enter a system name", "Your system does not have a name. All systems within the digital society must have a name. Please enter one.", (name)=>
+ Infobox.PromptText("Enter a system name", "Your system does not have a name. All systems within the digital society must have a name. Please enter one.", (name) =>
{
if (string.IsNullOrWhiteSpace(name))
Infobox.Show("Invalid name", "Please enter a valid name.", () =>
@@ -249,7 +261,7 @@ namespace ShiftOS.Engine
CurrentSave.Users = new List<ClientSave>();
- if(CurrentSave.Users.Count == 0)
+ if (CurrentSave.Users.Count == 0)
{
CurrentSave.Users.Add(new ClientSave
{
@@ -257,76 +269,101 @@ namespace ShiftOS.Engine
Password = "",
Permissions = UserPermissions.Root
});
- Console.WriteLine("No users found. Creating new user with username \"root\", with no password.");
+ Console.WriteLine("[usr-man] WARN: No users found. Creating new user with username \"root\", with no password.");
}
TerminalBackend.InStory = false;
TerminalBackend.PrefixEnabled = false;
- Login:
- string username = "";
- int progress = 0;
- bool goback = false;
- TextSentEventHandler ev = null;
- ev = (text) =>
+ if (LoginManager.ShouldUseGUILogin)
{
- if (progress == 0)
+ Action<ClientSave> Completed = null;
+ Completed += (user) =>
+ {
+ CurrentUser = user;
+ LoginManager.LoginComplete -= Completed;
+ };
+ LoginManager.LoginComplete += Completed;
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ LoginManager.PromptForLogin();
+ });
+ while (CurrentUser == null)
{
- if (!string.IsNullOrWhiteSpace(text))
+ Thread.Sleep(10);
+ }
+ }
+ else
+ {
+
+ Login:
+ string username = "";
+ int progress = 0;
+ bool goback = false;
+ TextSentEventHandler ev = null;
+ ev = (text) =>
+ {
+ if (progress == 0)
{
- if (CurrentSave.Users.FirstOrDefault(x => x.Username == text) == null)
+ string loginstr = CurrentSave.SystemName + " login: ";
+ string getuser = text.Remove(0, loginstr.Length);
+ if (!string.IsNullOrWhiteSpace(getuser))
{
- Console.WriteLine("User not found.");
- goback = true;
+ if (CurrentSave.Users.FirstOrDefault(x => x.Username == getuser) == null)
+ {
+ Console.WriteLine("User not found.");
+ goback = true;
+ progress++;
+ TerminalBackend.TextSent -= ev;
+ return;
+ }
+ username = getuser;
progress++;
+ }
+ else
+ {
+ Console.WriteLine("Username not provided.");
TerminalBackend.TextSent -= ev;
- return;
+ goback = true;
+ progress++;
}
- username = text;
- progress++;
}
- else
+ else if (progress == 1)
{
- Console.WriteLine("Username not provided.");
+ string passwordstr = "password: ";
+ string getpass = text.Remove(0, passwordstr.Length);
+ var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username);
+ if (user.Password == getpass)
+ {
+ Console.WriteLine("Welcome to ShiftOS.");
+ CurrentUser = user;
+ Thread.Sleep(2000);
+ progress++;
+ }
+ else
+ {
+ Console.WriteLine("Access denied.");
+ goback = true;
+ progress++;
+ }
TerminalBackend.TextSent -= ev;
- goback = true;
- progress++;
}
- }
- else if (progress == 1)
+ };
+ TerminalBackend.TextSent += ev;
+
+ Console.Write(CurrentSave.SystemName + " login: ");
+ while (progress == 0)
{
- var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username);
- if (user.Password == text)
- {
- Console.WriteLine("Welcome to ShiftOS.");
- CurrentUser = user;
- Thread.Sleep(2000);
- progress++;
- }
- else
- {
- Console.WriteLine("Access denied.");
- goback = true;
- progress++;
- }
- TerminalBackend.TextSent -= ev;
+ Thread.Sleep(10);
}
- };
- TerminalBackend.TextSent += ev;
- Console.WriteLine(CurrentSave.SystemName + " login:");
- while(progress == 0)
- {
- Thread.Sleep(10);
+ if (goback)
+ goto Login;
+ Console.Write("password: ");
+ while (progress == 1)
+ Thread.Sleep(10);
+ if (goback)
+ goto Login;
}
- if (goback)
- goto Login;
- Console.WriteLine("password:");
- while (progress == 1)
- Thread.Sleep(10);
- if (goback)
- goto Login;
-
-
TerminalBackend.PrefixEnabled = true;
Shiftorium.LogOrphanedUpgrades = true;
Desktop.InvokeOnWorkerThread(new Action(() =>
diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
index fb33dc5..3b5eadd 100644
--- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj
+++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
@@ -111,6 +111,7 @@
<Compile Include="IShiftOSWindow.cs" />
<Compile Include="KernelWatchdog.cs" />
<Compile Include="Localization.cs" />
+ <Compile Include="LoginManager.cs" />
<Compile Include="NotificationDaemon.cs" />
<Compile Include="OutOfBoxExperience.cs" />
<Compile Include="Paths.cs" />
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index 4cc9bbd..b731c4f 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -267,6 +267,22 @@ namespace ShiftOS.Engine
[ShifterHidden]
public Dictionary<string, byte[]> AppIcons = new Dictionary<string, byte[]>();
+ [ShifterMeta("System")]
+ [ShifterCategory("Login Screen")]
+ [RequiresUpgrade("gui_based_login_screen")]
+ [ShifterName("Login Screen Background Color")]
+ [ShifterDescription("Change the background color of the login screen.")]
+ public Color LoginScreenColor = Skin.DesktopBG;
+
+ [ShifterMeta("System")]
+ [ShifterCategory("Login Screen")]
+ [RequiresUpgrade("skinning;gui_based_login_screen")]
+ [ShifterName("Login Screen Background Image")]
+ [ShifterDescription("Set an image as your login screen!")]
+ [Image("login")]
+ public byte[] LoginScreenBG = null;
+
+
[RequiresUpgrade("shift_screensaver")]
[ShifterMeta("System")]
[ShifterCategory("Screen saver")]
diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs
index 1c3c0ed..5702e08 100644
--- a/ShiftOS_TheReturn/UserManagementCommands.cs
+++ b/ShiftOS_TheReturn/UserManagementCommands.cs
@@ -47,12 +47,20 @@ namespace ShiftOS.Engine
}
var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name);
+ if(user.Username != SaveSystem.CurrentUser.Username)
+ {
+ Console.WriteLine("Error: Cannot remove yourself.");
+ return true;
+ }
SaveSystem.CurrentSave.Users.Remove(user);
Console.WriteLine($"Removing user \"{name}\" from system...");
SaveSystem.SaveGame();
return true;
}
+
+
+
[Command("set_acl")]
[RequiresArgument("user")]
[RequiresArgument("val")]
@@ -116,13 +124,57 @@ namespace ShiftOS.Engine
return true;
}
+
+ [Command("users", description = "Get a list of all users on the system.")]
+ public static bool GetUsers()
+ {
+ foreach (var u in SaveSystem.CurrentSave.Users)
+ {
+ if (u.Username == SaveSystem.CurrentUser.Username)
+ {
+ ConsoleEx.ForegroundColor = ConsoleColor.Magenta;
+ ConsoleEx.Bold = true;
+ }
+ else
+ {
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ ConsoleEx.Bold = false;
+ }
+ Console.WriteLine(u.Username);
+ }
+ return true;
+ }
}
[Namespace("user")]
[RequiresUpgrade("mud_fundamentals")]
public static class UserManagementCommands
{
+ [Command("login", description = "Log in as another user.")]
+ [RequiresArgument("user")]
+ [RequiresArgument("pass")]
+ public static bool Login(Dictionary<string, object> args)
+ {
+ string user = args["user"].ToString();
+ string pass = args["pass"].ToString();
+
+ var usr = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == user);
+ if(usr==null)
+ {
+ Console.WriteLine("Error: No such user.");
+ return true;
+ }
+ if (usr.Password != pass)
+ {
+ Console.WriteLine("Access denied.");
+ return true;
+ }
+
+ SaveSystem.CurrentUser = usr;
+ Console.WriteLine("Access granted.");
+ return true;
+ }
[Command("setpass", description ="Allows you to set your password to a new value.", usage ="old:,new:")]
[RequiresArgument("old")]