mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-23 02:12:14 +00:00
Merge remote-tracking branch 'refs/remotes/shiftos-game/master'
This commit is contained in:
commit
d30eb35c97
30 changed files with 1641 additions and 1355 deletions
|
@ -34,5 +34,14 @@ namespace ShiftOS.Objects
|
|||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public UserPermissions Permissions { get; set; }
|
||||
}
|
||||
|
||||
public enum UserPermissions
|
||||
{
|
||||
Root,
|
||||
Admin,
|
||||
User,
|
||||
Guest
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,11 @@ namespace ShiftOS.Objects
|
|||
//Better to store this stuff server-side so we can do some neat stuff with hacking...
|
||||
public class Save
|
||||
{
|
||||
|
||||
[Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")]
|
||||
public string Username { get; set; }
|
||||
|
||||
|
||||
public long Codepoints { get; set; }
|
||||
public Dictionary<string, bool> Upgrades { get; set; }
|
||||
public int StoryPosition { get; set; }
|
||||
|
@ -45,6 +49,8 @@ namespace ShiftOS.Objects
|
|||
public int MinorVersion { get; set; }
|
||||
public int Revision { get; set; }
|
||||
|
||||
public string UniteAuthToken { get; set; }
|
||||
|
||||
public bool IsPatreon { get; set; }
|
||||
|
||||
public UserClass Class { get; set; }
|
||||
|
@ -91,6 +97,8 @@ namespace ShiftOS.Objects
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<ClientSave> Users = new List<ClientSave>();
|
||||
}
|
||||
|
||||
public class SettingsObject : DynamicObject
|
||||
|
|
|
@ -86,7 +86,18 @@ namespace ShiftOS.Server
|
|||
/// <param name="args">The command-line arguments.</param>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
System.Timers.Timer tmr = new System.Timers.Timer(5000);
|
||||
tmr.Elapsed += (o, a) =>
|
||||
{
|
||||
if (server.IsOnline)
|
||||
{
|
||||
server.DispatchAll(new NetObject("heartbeat", new ServerMessage
|
||||
{
|
||||
Name = "heartbeat",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
};
|
||||
if (!Directory.Exists("saves"))
|
||||
{
|
||||
Directory.CreateDirectory("saves");
|
||||
|
@ -106,11 +117,13 @@ namespace ShiftOS.Server
|
|||
{
|
||||
Console.WriteLine($"Server started on address {server.Address}, port {server.Port}.");
|
||||
ServerStarted?.Invoke(server.Address.ToString());
|
||||
};
|
||||
tmr.Start();
|
||||
};
|
||||
|
||||
server.OnStopped += (o, a) =>
|
||||
{
|
||||
Console.WriteLine("WARNING! Server stopped.");
|
||||
tmr.Stop();
|
||||
};
|
||||
|
||||
server.OnError += (o, a) =>
|
||||
|
@ -283,8 +296,6 @@ namespace ShiftOS.Server
|
|||
/// <param name="msg">Message.</param>
|
||||
public static void Interpret(ServerMessage msg)
|
||||
{
|
||||
Dictionary<string, object> args = null;
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine($@"[{DateTime.Now}] Message received from {msg.GUID}: {msg.Name}");
|
||||
|
@ -312,8 +323,7 @@ namespace ShiftOS.Server
|
|||
try
|
||||
{
|
||||
object contents = null;
|
||||
bool throwOnNull = false;
|
||||
|
||||
|
||||
|
||||
if (mAttrib.ExpectedType == typeof(int))
|
||||
{
|
||||
|
@ -341,7 +351,6 @@ namespace ShiftOS.Server
|
|||
}
|
||||
else if (mAttrib.ExpectedType == typeof(bool))
|
||||
{
|
||||
throwOnNull = true;
|
||||
if (msg.Contents.ToLower() == "true")
|
||||
{
|
||||
contents = true;
|
||||
|
@ -358,7 +367,6 @@ namespace ShiftOS.Server
|
|||
}
|
||||
else if (mAttrib.ExpectedType == null)
|
||||
{
|
||||
throwOnNull = false;
|
||||
}
|
||||
else if(mAttrib.ExpectedType == typeof(string))
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.IO;
|
|||
using Newtonsoft.Json;
|
||||
using NetSockets;
|
||||
using static ShiftOS.Server.Program;
|
||||
using System.Net;
|
||||
|
||||
namespace ShiftOS.Server
|
||||
{
|
||||
|
@ -172,6 +173,9 @@ namespace ShiftOS.Server
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
|
||||
Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_saved",
|
||||
|
@ -179,6 +183,60 @@ namespace ShiftOS.Server
|
|||
}));
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
//Update the shiftos website with the user's codepoints.
|
||||
if (!string.IsNullOrWhiteSpace(sav.UniteAuthToken))
|
||||
{
|
||||
var wreq = WebRequest.Create("http://getshiftos.ml/API/SetCodepoints/" + sav.Codepoints.ToString());
|
||||
wreq.Headers.Add("Authentication: Token " + sav.UniteAuthToken);
|
||||
wreq.GetResponse();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
|
||||
[MudRequest("mud_token_login", typeof(string))]
|
||||
public static void TokenLogin(string guid, string token)
|
||||
{
|
||||
foreach (var savefile in Directory.GetFiles("saves"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var save = JsonConvert.DeserializeObject<Save>(ReadEncFile(savefile));
|
||||
|
||||
|
||||
if (save.UniteAuthToken==token)
|
||||
{
|
||||
if (save.ID == new Guid())
|
||||
{
|
||||
save.ID = Guid.NewGuid();
|
||||
WriteEncFile(savefile, JsonConvert.SerializeObject(save));
|
||||
}
|
||||
|
||||
|
||||
Program.server.DispatchTo(new Guid(guid), new NetObject("mud_savefile", new ServerMessage
|
||||
{
|
||||
Name = "mud_savefile",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(save)
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
try
|
||||
{
|
||||
Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage
|
||||
{
|
||||
Name = "mud_login_denied",
|
||||
GUID = "server"
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
[MudRequest("delete_save", typeof(ClientSave))]
|
||||
|
|
36
ShiftOS.Unite/Properties/AssemblyInfo.cs
Normal file
36
ShiftOS.Unite/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShiftOS.Unite")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShiftOS.Unite")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e57ff1e6-3780-4510-b7ef-64731ec81bb8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
54
ShiftOS.Unite/ShiftOS.Unite.csproj
Normal file
54
ShiftOS.Unite/ShiftOS.Unite.csproj
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E57FF1E6-3780-4510-B7EF-64731EC81BB8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ShiftOS.Unite</RootNamespace>
|
||||
<AssemblyName>ShiftOS.Unite</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UniteClient.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -69,7 +69,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
}
|
||||
|
||||
internal void OpenInternal(string title, string msg)
|
||||
internal void OpenInternal(string title, string msg, Action c)
|
||||
{
|
||||
Title = title;
|
||||
AppearanceManager.SetupDialog(this);
|
||||
|
@ -80,17 +80,14 @@ namespace ShiftOS.WinForms.Applications
|
|||
btnok.Click += (o, a) =>
|
||||
{
|
||||
AppearanceManager.Close(this);
|
||||
OpenCallback?.Invoke();
|
||||
c?.Invoke();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private Action OpenCallback = null;
|
||||
|
||||
public void Open(string title, string msg, Action c = null)
|
||||
{
|
||||
OpenCallback = c;
|
||||
new Dialog().OpenInternal(title, msg);
|
||||
new Dialog().OpenInternal(title, msg, c);
|
||||
}
|
||||
|
||||
public void PromptTextInternal(string title, string message, Action<string> callback, bool isPassword)
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
public void ResetAllKeywords()
|
||||
{
|
||||
string primary = SaveSystem.CurrentSave.Username + " ";
|
||||
string primary = SaveSystem.CurrentUser.Username + " ";
|
||||
string secondary = "shiftos ";
|
||||
|
||||
|
||||
|
@ -279,10 +279,11 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
if (TerminalBackend.PrefixEnabled)
|
||||
{
|
||||
text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
|
||||
text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
|
||||
}
|
||||
TerminalBackend.LastCommand = text3;
|
||||
TextSent?.Invoke(text4);
|
||||
TerminalBackend.SendText(text4);
|
||||
if (TerminalBackend.InStory == false)
|
||||
{
|
||||
if (text3 == "stop theme")
|
||||
|
@ -326,7 +327,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
var tostring3 = txt.Lines[txt.Lines.Length - 1];
|
||||
var tostringlen = tostring3.Length + 1;
|
||||
var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var workaround = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var derp = workaround.Length + 1;
|
||||
if (tostringlen != derp)
|
||||
{
|
||||
|
@ -346,7 +347,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
var getstring = txt.Lines[txt.Lines.Length - 1];
|
||||
var stringlen = getstring.Length + 1;
|
||||
var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
|
||||
var headerlen = header.Length + 1;
|
||||
var selstart = txt.SelectionStart;
|
||||
var remstrlen = txt.TextLength - stringlen;
|
||||
|
@ -364,7 +365,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
else if (a.KeyCode == Keys.Up)
|
||||
{
|
||||
var tostring3 = txt.Lines[txt.Lines.Length - 1];
|
||||
if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
|
||||
if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
|
||||
Console.Write(TerminalBackend.LastCommand);
|
||||
a.SuppressKeyPress = true;
|
||||
|
||||
|
@ -464,7 +465,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
if (TerminalBackend.PrefixEnabled)
|
||||
{
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@shiftos:~$ ");
|
||||
Console.Write($"{SaveSystem.CurrentUser.Username}@shiftos:~$ ");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
105
ShiftOS.WinForms/Applications/TriWrite.Designer.cs
generated
Normal file
105
ShiftOS.WinForms/Applications/TriWrite.Designer.cs
generated
Normal file
|
@ -0,0 +1,105 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class TriWrite
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddressBook));
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tvcontacts = new System.Windows.Forms.TreeView();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtbody = new System.Windows.Forms.Label();
|
||||
this.lbtitle = new System.Windows.Forms.Label();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addContactToolStripMenuItem,
|
||||
this.removeToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(872, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// tvcontacts
|
||||
//
|
||||
this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.tvcontacts.Location = new System.Drawing.Point(0, 24);
|
||||
this.tvcontacts.Name = "tvcontacts";
|
||||
this.tvcontacts.Size = new System.Drawing.Size(224, 551);
|
||||
this.tvcontacts.TabIndex = 1;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.txtbody);
|
||||
this.panel1.Controls.Add(this.lbtitle);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(224, 24);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(648, 551);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// txtbody
|
||||
//
|
||||
this.txtbody.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtbody.Location = new System.Drawing.Point(7, 54);
|
||||
this.txtbody.Name = "txtbody";
|
||||
this.txtbody.Size = new System.Drawing.Size(626, 481);
|
||||
this.txtbody.TabIndex = 1;
|
||||
this.txtbody.Text = resources.GetString("txtbody.Text");
|
||||
//
|
||||
// lbtitle
|
||||
//
|
||||
this.lbtitle.AutoSize = true;
|
||||
this.lbtitle.Location = new System.Drawing.Point(7, 4);
|
||||
this.lbtitle.Name = "lbtitle";
|
||||
this.lbtitle.Size = new System.Drawing.Size(73, 13);
|
||||
this.lbtitle.TabIndex = 0;
|
||||
this.lbtitle.Tag = "header1";
|
||||
this.lbtitle.Text = "TriWrite";
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem addContactToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
|
||||
private System.Windows.Forms.TreeView tvcontacts;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label txtbody;
|
||||
private System.Windows.Forms.Label lbtitle;
|
||||
}
|
||||
}
|
42
ShiftOS.WinForms/Applications/TriWrite.cs
Normal file
42
ShiftOS.WinForms/Applications/TriWrite.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
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 static ShiftOS.Objects.ShiftFS.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
[WinOpen("triwrite")]
|
||||
[AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, null, "Office")]
|
||||
[DefaultTitle("TriWrite")]
|
||||
[Launcher("TriWrite", false, null, "Office")]
|
||||
public partial class TriWrite : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
130
ShiftOS.WinForms/Applications/TriWrite.resx
Normal file
130
ShiftOS.WinForms/Applications/TriWrite.resx
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?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>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="txtbody.Text" xml:space="preserve">
|
||||
<value>The Address Book helps you keep track of all your contacts within the digital society, whether they be friends, enemies, or whatnot.
|
||||
|
||||
On the left, we have made a list of all your contacts. You can click on one to view full details on the contact.
|
||||
|
||||
To add a contact, simply click "Add Contact", and to remove one, click "Remove". Some contacts may not be removed as they are integral to the progression of your adventures within the digital society.</value>
|
||||
</data>
|
||||
</root>
|
624
ShiftOS.WinForms/FakeSetupScreen.Designer.cs
generated
624
ShiftOS.WinForms/FakeSetupScreen.Designer.cs
generated
|
@ -1,624 +0,0 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
partial class FakeSetupScreen
|
||||
{
|
||||
/// <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.pnlheader = new System.Windows.Forms.Panel();
|
||||
this.flbuttons = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnnext = new System.Windows.Forms.Button();
|
||||
this.btnback = new System.Windows.Forms.Button();
|
||||
this.page1 = new System.Windows.Forms.Panel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.page2 = new System.Windows.Forms.Panel();
|
||||
this.lbbyteszeroed = new System.Windows.Forms.Label();
|
||||
this.pgformatprogress = new System.Windows.Forms.ProgressBar();
|
||||
this.lbformattitle = new System.Windows.Forms.Label();
|
||||
this.page3 = new System.Windows.Forms.Panel();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtnewusername = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtnewpassword = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtnewsysname = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.page4 = new System.Windows.Forms.Panel();
|
||||
this.txtlicenseagreement = new System.Windows.Forms.RichTextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.pgrereg = new System.Windows.Forms.Panel();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtruname = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.txtrpass = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.txtrsys = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.pglogin = new System.Windows.Forms.Panel();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.txtluser = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.txtlpass = new System.Windows.Forms.TextBox();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.btnnlogin = new System.Windows.Forms.Button();
|
||||
this.flbuttons.SuspendLayout();
|
||||
this.page1.SuspendLayout();
|
||||
this.page2.SuspendLayout();
|
||||
this.page3.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.page4.SuspendLayout();
|
||||
this.pgrereg.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.pglogin.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlheader
|
||||
//
|
||||
this.pnlheader.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.pnlheader.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pnlheader.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlheader.Name = "pnlheader";
|
||||
this.pnlheader.Size = new System.Drawing.Size(138, 300);
|
||||
this.pnlheader.TabIndex = 0;
|
||||
//
|
||||
// flbuttons
|
||||
//
|
||||
this.flbuttons.AutoSize = true;
|
||||
this.flbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flbuttons.Controls.Add(this.btnnext);
|
||||
this.flbuttons.Controls.Add(this.btnback);
|
||||
this.flbuttons.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flbuttons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
|
||||
this.flbuttons.Location = new System.Drawing.Point(0, 300);
|
||||
this.flbuttons.Name = "flbuttons";
|
||||
this.flbuttons.Size = new System.Drawing.Size(490, 29);
|
||||
this.flbuttons.TabIndex = 1;
|
||||
//
|
||||
// btnnext
|
||||
//
|
||||
this.btnnext.Location = new System.Drawing.Point(412, 3);
|
||||
this.btnnext.Name = "btnnext";
|
||||
this.btnnext.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnnext.TabIndex = 0;
|
||||
this.btnnext.Text = "Next";
|
||||
this.btnnext.UseVisualStyleBackColor = true;
|
||||
this.btnnext.Click += new System.EventHandler(this.btnnext_Click);
|
||||
//
|
||||
// btnback
|
||||
//
|
||||
this.btnback.Location = new System.Drawing.Point(331, 3);
|
||||
this.btnback.Name = "btnback";
|
||||
this.btnback.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnback.TabIndex = 1;
|
||||
this.btnback.Text = "Back";
|
||||
this.btnback.UseVisualStyleBackColor = true;
|
||||
this.btnback.Click += new System.EventHandler(this.btnback_Click);
|
||||
//
|
||||
// page1
|
||||
//
|
||||
this.page1.Controls.Add(this.label2);
|
||||
this.page1.Controls.Add(this.label1);
|
||||
this.page1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.page1.Location = new System.Drawing.Point(138, 0);
|
||||
this.page1.Name = "page1";
|
||||
this.page1.Size = new System.Drawing.Size(352, 300);
|
||||
this.page1.TabIndex = 2;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label2.Location = new System.Drawing.Point(20, 87);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(320, 199);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "This wizard will guide you through the installation and configuration of ShiftOS." +
|
||||
"\r\n\r\nPress Next to continue.";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.label1.Location = new System.Drawing.Point(19, 22);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(321, 44);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Welcome to the ShiftOS installation wizard.";
|
||||
//
|
||||
// page2
|
||||
//
|
||||
this.page2.Controls.Add(this.lbbyteszeroed);
|
||||
this.page2.Controls.Add(this.pgformatprogress);
|
||||
this.page2.Controls.Add(this.lbformattitle);
|
||||
this.page2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.page2.Location = new System.Drawing.Point(138, 0);
|
||||
this.page2.Name = "page2";
|
||||
this.page2.Size = new System.Drawing.Size(352, 300);
|
||||
this.page2.TabIndex = 2;
|
||||
//
|
||||
// lbbyteszeroed
|
||||
//
|
||||
this.lbbyteszeroed.AutoSize = true;
|
||||
this.lbbyteszeroed.Location = new System.Drawing.Point(20, 91);
|
||||
this.lbbyteszeroed.Name = "lbbyteszeroed";
|
||||
this.lbbyteszeroed.Size = new System.Drawing.Size(127, 13);
|
||||
this.lbbyteszeroed.TabIndex = 5;
|
||||
this.lbbyteszeroed.Text = "Bytes zeroed: 0/1000000";
|
||||
//
|
||||
// pgformatprogress
|
||||
//
|
||||
this.pgformatprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pgformatprogress.Location = new System.Drawing.Point(23, 61);
|
||||
this.pgformatprogress.Name = "pgformatprogress";
|
||||
this.pgformatprogress.Size = new System.Drawing.Size(317, 23);
|
||||
this.pgformatprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||
this.pgformatprogress.TabIndex = 4;
|
||||
//
|
||||
// lbformattitle
|
||||
//
|
||||
this.lbformattitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbformattitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.lbformattitle.Location = new System.Drawing.Point(16, 9);
|
||||
this.lbformattitle.Name = "lbformattitle";
|
||||
this.lbformattitle.Size = new System.Drawing.Size(321, 26);
|
||||
this.lbformattitle.TabIndex = 3;
|
||||
this.lbformattitle.Text = "Formatting your drive...";
|
||||
//
|
||||
// page3
|
||||
//
|
||||
this.page3.Controls.Add(this.btnnlogin);
|
||||
this.page3.Controls.Add(this.tableLayoutPanel1);
|
||||
this.page3.Controls.Add(this.label4);
|
||||
this.page3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.page3.Location = new System.Drawing.Point(138, 0);
|
||||
this.page3.Name = "page3";
|
||||
this.page3.Size = new System.Drawing.Size(352, 300);
|
||||
this.page3.TabIndex = 6;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtnewusername, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtnewpassword, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtnewsysname, 1, 2);
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 61);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(212, 72);
|
||||
this.tableLayoutPanel1.TabIndex = 4;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(58, 13);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "Username:";
|
||||
//
|
||||
// txtnewusername
|
||||
//
|
||||
this.txtnewusername.Location = new System.Drawing.Point(109, 3);
|
||||
this.txtnewusername.Name = "txtnewusername";
|
||||
this.txtnewusername.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtnewusername.TabIndex = 1;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(3, 26);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(56, 13);
|
||||
this.label5.TabIndex = 2;
|
||||
this.label5.Text = "Password:";
|
||||
//
|
||||
// txtnewpassword
|
||||
//
|
||||
this.txtnewpassword.Location = new System.Drawing.Point(109, 29);
|
||||
this.txtnewpassword.Name = "txtnewpassword";
|
||||
this.txtnewpassword.PasswordChar = '*';
|
||||
this.txtnewpassword.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtnewpassword.TabIndex = 3;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(3, 52);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(75, 13);
|
||||
this.label6.TabIndex = 4;
|
||||
this.label6.Text = "System Name:";
|
||||
//
|
||||
// txtnewsysname
|
||||
//
|
||||
this.txtnewsysname.Location = new System.Drawing.Point(109, 55);
|
||||
this.txtnewsysname.Name = "txtnewsysname";
|
||||
this.txtnewsysname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtnewsysname.TabIndex = 5;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.label4.Location = new System.Drawing.Point(16, 9);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(321, 26);
|
||||
this.label4.TabIndex = 3;
|
||||
this.label4.Text = "User information";
|
||||
//
|
||||
// page4
|
||||
//
|
||||
this.page4.Controls.Add(this.txtlicenseagreement);
|
||||
this.page4.Controls.Add(this.label10);
|
||||
this.page4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.page4.Location = new System.Drawing.Point(138, 0);
|
||||
this.page4.Name = "page4";
|
||||
this.page4.Size = new System.Drawing.Size(352, 300);
|
||||
this.page4.TabIndex = 7;
|
||||
//
|
||||
// txtlicenseagreement
|
||||
//
|
||||
this.txtlicenseagreement.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtlicenseagreement.Location = new System.Drawing.Point(23, 58);
|
||||
this.txtlicenseagreement.Name = "txtlicenseagreement";
|
||||
this.txtlicenseagreement.ReadOnly = true;
|
||||
this.txtlicenseagreement.Size = new System.Drawing.Size(326, 228);
|
||||
this.txtlicenseagreement.TabIndex = 4;
|
||||
this.txtlicenseagreement.Text = "";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.label10.Location = new System.Drawing.Point(16, 9);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(321, 26);
|
||||
this.label10.TabIndex = 3;
|
||||
this.label10.Text = "License Agreement";
|
||||
//
|
||||
// pgrereg
|
||||
//
|
||||
this.pgrereg.Controls.Add(this.tableLayoutPanel2);
|
||||
this.pgrereg.Controls.Add(this.label11);
|
||||
this.pgrereg.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pgrereg.Location = new System.Drawing.Point(138, 0);
|
||||
this.pgrereg.Name = "pgrereg";
|
||||
this.pgrereg.Size = new System.Drawing.Size(352, 300);
|
||||
this.pgrereg.TabIndex = 8;
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.AutoSize = true;
|
||||
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel2.ColumnCount = 2;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtruname, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.label8, 0, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtrpass, 1, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.label9, 0, 2);
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtrsys, 1, 2);
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(20, 61);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 3;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(212, 72);
|
||||
this.tableLayoutPanel2.TabIndex = 4;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 0);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(58, 13);
|
||||
this.label7.TabIndex = 0;
|
||||
this.label7.Text = "Username:";
|
||||
//
|
||||
// txtruname
|
||||
//
|
||||
this.txtruname.Location = new System.Drawing.Point(109, 3);
|
||||
this.txtruname.Name = "txtruname";
|
||||
this.txtruname.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtruname.TabIndex = 1;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(3, 26);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(56, 13);
|
||||
this.label8.TabIndex = 2;
|
||||
this.label8.Text = "Password:";
|
||||
//
|
||||
// txtrpass
|
||||
//
|
||||
this.txtrpass.Location = new System.Drawing.Point(109, 29);
|
||||
this.txtrpass.Name = "txtrpass";
|
||||
this.txtrpass.PasswordChar = '*';
|
||||
this.txtrpass.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtrpass.TabIndex = 3;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(3, 52);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(75, 13);
|
||||
this.label9.TabIndex = 4;
|
||||
this.label9.Text = "System Name:";
|
||||
//
|
||||
// txtrsys
|
||||
//
|
||||
this.txtrsys.Location = new System.Drawing.Point(109, 55);
|
||||
this.txtrsys.Name = "txtrsys";
|
||||
this.txtrsys.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtrsys.TabIndex = 5;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.label11.Location = new System.Drawing.Point(16, 9);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(321, 26);
|
||||
this.label11.TabIndex = 3;
|
||||
this.label11.Text = "User information";
|
||||
//
|
||||
// pglogin
|
||||
//
|
||||
this.pglogin.Controls.Add(this.tableLayoutPanel3);
|
||||
this.pglogin.Controls.Add(this.label15);
|
||||
this.pglogin.Controls.Add(this.button1);
|
||||
this.pglogin.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pglogin.Location = new System.Drawing.Point(138, 0);
|
||||
this.pglogin.Name = "pglogin";
|
||||
this.pglogin.Size = new System.Drawing.Size(352, 300);
|
||||
this.pglogin.TabIndex = 9;
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.AutoSize = true;
|
||||
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel3.ColumnCount = 2;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.txtluser, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label13, 0, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.txtlpass, 1, 1);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(20, 61);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 3;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(212, 72);
|
||||
this.tableLayoutPanel3.TabIndex = 4;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(3, 0);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(58, 13);
|
||||
this.label12.TabIndex = 0;
|
||||
this.label12.Text = "Username:";
|
||||
//
|
||||
// txtluser
|
||||
//
|
||||
this.txtluser.Location = new System.Drawing.Point(109, 3);
|
||||
this.txtluser.Name = "txtluser";
|
||||
this.txtluser.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtluser.TabIndex = 1;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(3, 26);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(56, 13);
|
||||
this.label13.TabIndex = 2;
|
||||
this.label13.Text = "Password:";
|
||||
//
|
||||
// txtlpass
|
||||
//
|
||||
this.txtlpass.Location = new System.Drawing.Point(109, 29);
|
||||
this.txtlpass.Name = "txtlpass";
|
||||
this.txtlpass.PasswordChar = '*';
|
||||
this.txtlpass.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtlpass.TabIndex = 3;
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F);
|
||||
this.label15.Location = new System.Drawing.Point(16, 9);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(321, 26);
|
||||
this.label15.TabIndex = 3;
|
||||
this.label15.Text = "User information";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(129, 142);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 21);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.Text = "Register";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// btnnlogin
|
||||
//
|
||||
this.btnnlogin.Location = new System.Drawing.Point(129, 156);
|
||||
this.btnnlogin.Name = "btnnlogin";
|
||||
this.btnnlogin.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnnlogin.TabIndex = 5;
|
||||
this.btnnlogin.Text = "Log in";
|
||||
this.btnnlogin.UseVisualStyleBackColor = true;
|
||||
this.btnnlogin.Click += new System.EventHandler(this.btnnlogin_Click);
|
||||
//
|
||||
// FakeSetupScreen
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(490, 329);
|
||||
this.Controls.Add(this.pglogin);
|
||||
this.Controls.Add(this.page3);
|
||||
this.Controls.Add(this.pgrereg);
|
||||
this.Controls.Add(this.page4);
|
||||
this.Controls.Add(this.page2);
|
||||
this.Controls.Add(this.page1);
|
||||
this.Controls.Add(this.pnlheader);
|
||||
this.Controls.Add(this.flbuttons);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FakeSetupScreen";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ShiftOS";
|
||||
this.TopMost = true;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FakeSetupScreen_FormClosing);
|
||||
this.flbuttons.ResumeLayout(false);
|
||||
this.page1.ResumeLayout(false);
|
||||
this.page2.ResumeLayout(false);
|
||||
this.page2.PerformLayout();
|
||||
this.page3.ResumeLayout(false);
|
||||
this.page3.PerformLayout();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.page4.ResumeLayout(false);
|
||||
this.pgrereg.ResumeLayout(false);
|
||||
this.pgrereg.PerformLayout();
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.PerformLayout();
|
||||
this.pglogin.ResumeLayout(false);
|
||||
this.pglogin.PerformLayout();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel pnlheader;
|
||||
private System.Windows.Forms.FlowLayoutPanel flbuttons;
|
||||
private System.Windows.Forms.Button btnnext;
|
||||
private System.Windows.Forms.Button btnback;
|
||||
private System.Windows.Forms.Panel page1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Panel page2;
|
||||
private System.Windows.Forms.Label lbformattitle;
|
||||
private System.Windows.Forms.Label lbbyteszeroed;
|
||||
private System.Windows.Forms.ProgressBar pgformatprogress;
|
||||
private System.Windows.Forms.Panel page3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtnewusername;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtnewpassword;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtnewsysname;
|
||||
private System.Windows.Forms.Panel page4;
|
||||
private System.Windows.Forms.RichTextBox txtlicenseagreement;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Panel pgrereg;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtruname;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox txtrpass;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox txtrsys;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Panel pglogin;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TextBox txtluser;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.TextBox txtlpass;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button btnnlogin;
|
||||
}
|
||||
}
|
|
@ -1,395 +0,0 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
public partial class FakeSetupScreen : Form
|
||||
{
|
||||
private Oobe oobe = null;
|
||||
|
||||
public Action<bool> MUDUserFound = null;
|
||||
|
||||
public FakeSetupScreen(Oobe _oobe, int page = 0)
|
||||
{
|
||||
oobe = _oobe;
|
||||
InitializeComponent();
|
||||
currentPage = page;
|
||||
SetupUI();
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
{
|
||||
if (this.Visible == true)
|
||||
{
|
||||
if (msg.Name == "mud_notfound")
|
||||
this.Invoke(new Action(() => { MUDUserFound?.Invoke(false); }));
|
||||
else if (msg.Name == "mud_found")
|
||||
this.Invoke(new Action(() => { MUDUserFound?.Invoke(true); }));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public event Action<string> TextSent;
|
||||
bool isTyping = false;
|
||||
|
||||
private int currentPage = 0;
|
||||
|
||||
public void SetupUI()
|
||||
{
|
||||
btnback.Show();
|
||||
pnlheader.Dock = DockStyle.Top;
|
||||
pnlheader.Height = 50;
|
||||
switch (currentPage)
|
||||
{
|
||||
case 0:
|
||||
page1.BringToFront();
|
||||
pnlheader.Dock = DockStyle.Left;
|
||||
pnlheader.Width = 100;
|
||||
btnback.Hide();
|
||||
break;
|
||||
case 1:
|
||||
btnnext.Hide();
|
||||
btnback.Hide();
|
||||
page2.BringToFront();
|
||||
pgformatprogress.Value = 0;
|
||||
var dinf = new System.IO.DriveInfo("C:");
|
||||
StartWipingInBackground(((dinf.TotalSize / 1024) / 1024) / 1024);
|
||||
TextType($@"So I see you're progressing through.
|
||||
I really hope you aren't one of those newbies who just next-next-next-finish their way through these things.
|
||||
I see you've named your drive " + dinf.VolumeLabel + $@"
|
||||
And it can contain up to {dinf.TotalSize} bytes of information.
|
||||
And you've formatted this drive with a partition of type " + dinf.DriveFormat + $@".
|
||||
Interesting...
|
||||
Very interesting...");
|
||||
break;
|
||||
case 2:
|
||||
btnnext.Show();
|
||||
btnback.Hide();
|
||||
TextType(@"Now it's all gone. Now I need some user input so I can install ShiftOS.
|
||||
Firstly, please enter a username, password, and system name.
|
||||
Make the username and system name unique so I can identify exactly who you are. You're not the only one here.
|
||||
Also, make sure the password is secure... There have been people known to breach users' accounts in ShiftOS and steal their stuff.
|
||||
So make sure your password is secure enough that it can't be guessed, but easy for you to remember, and don't put any personal information in your account.");
|
||||
page3.BringToFront();
|
||||
break;
|
||||
case 3:
|
||||
if (string.IsNullOrEmpty(txtnewusername.Text))
|
||||
{
|
||||
TextType("You must specify a valid username!");
|
||||
currentPage--;
|
||||
//SetupUI();
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtnewpassword.Text))
|
||||
{
|
||||
TextType("A password would seriously be recommended.");
|
||||
currentPage--;
|
||||
//SetupUI();
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtnewsysname.Text))
|
||||
{
|
||||
TextType("You must name your computer.");
|
||||
currentPage--;
|
||||
//SetupUI();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
MUDUserFound = (val) =>
|
||||
{
|
||||
if(val == true)
|
||||
{
|
||||
TextType("I have just verified that your username and password already exists on my end. Please choose another.");
|
||||
currentPage--;
|
||||
//SetupUI();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
TextType("I am going to keep that info on my checklist for installing ShiftOS on your system. Now, onto some legal stuff. I highly suggest you read this.");
|
||||
currentPage++;
|
||||
oobe.MySave.Username = txtnewusername.Text;
|
||||
oobe.MySave.Password = txtnewpassword.Text;
|
||||
oobe.MySave.SystemName = txtnewsysname.Text;
|
||||
SetupUI();
|
||||
}
|
||||
};
|
||||
ServerManager.SendMessage("mud_checkuserexists", $@"{{
|
||||
username: ""{txtnewusername.Text}"",
|
||||
password: ""{txtnewpassword.Text}""
|
||||
}}");
|
||||
break;
|
||||
case 4:
|
||||
page4.BringToFront();
|
||||
txtlicenseagreement.Rtf = Properties.Resources.ShiftOS;
|
||||
break;
|
||||
case 5:
|
||||
CanClose = true;
|
||||
this.Close();
|
||||
break;
|
||||
case 7:
|
||||
btnnext.Show();
|
||||
btnback.Hide();
|
||||
pgrereg.BringToFront();
|
||||
TextType("You have two choices - either you can migrate your local user file to this multi-user domain, or you can restart with 0 Codepoints, no upgrades, and still keep your files.");
|
||||
break;
|
||||
case 8:
|
||||
btnnext.Hide();
|
||||
ServerMessageReceived rc = null;
|
||||
|
||||
rc = (msg) =>
|
||||
{
|
||||
if(msg.Name == "mud_found")
|
||||
{
|
||||
TextType("That username and password already exists in this multi-user domain. Please choose another.");
|
||||
currentPage = 7;
|
||||
}
|
||||
else if(msg.Name == "mud_notfound")
|
||||
{
|
||||
currentPage = 9;
|
||||
SetupUI();
|
||||
}
|
||||
ServerManager.MessageReceived -= rc;
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(txtruname.Text))
|
||||
{
|
||||
TextType("You must provide a username.");
|
||||
currentPage = 7;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtrpass.Text))
|
||||
{
|
||||
TextType("You must provide a password.");
|
||||
currentPage = 7;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtrsys.Text))
|
||||
{
|
||||
TextType("You must provide a system hostname.");
|
||||
currentPage = 7;
|
||||
}
|
||||
|
||||
if (currentPage == 7)
|
||||
return;
|
||||
|
||||
ServerManager.MessageReceived += rc;
|
||||
ServerManager.SendMessage("mud_checkuserexists", $@"{{
|
||||
username: ""{txtruname.Text}"",
|
||||
password: ""{txtrpass.Text}""
|
||||
}}");
|
||||
break;
|
||||
case 9:
|
||||
UserReregistered?.Invoke(txtruname.Text, txtrpass.Text, txtrsys.Text);
|
||||
this.CanClose = true;
|
||||
this.Close();
|
||||
break;
|
||||
case 10:
|
||||
btnnext.Show();
|
||||
btnback.Hide();
|
||||
pglogin.BringToFront();
|
||||
break;
|
||||
case 11:
|
||||
btnnext.Hide();
|
||||
ServerMessageReceived login = null;
|
||||
|
||||
login = (msg) =>
|
||||
{
|
||||
if (msg.Name == "mud_found")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
currentPage = 12;
|
||||
SetupUI();
|
||||
}));
|
||||
|
||||
ServerManager.MessageReceived -= login;
|
||||
}
|
||||
else if (msg.Name == "mud_notfound")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
currentPage = 10;
|
||||
SetupUI();
|
||||
}));
|
||||
|
||||
ServerManager.MessageReceived -= login;
|
||||
}
|
||||
};
|
||||
|
||||
ServerManager.MessageReceived += login;
|
||||
if(!string.IsNullOrWhiteSpace(txtluser.Text) && !string.IsNullOrWhiteSpace(txtlpass.Text))
|
||||
{
|
||||
ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new
|
||||
{
|
||||
username = txtluser.Text,
|
||||
password = txtlpass.Text
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
btnnext.Hide();
|
||||
ServerMessageReceived getsave = null;
|
||||
|
||||
getsave = (msg) =>
|
||||
{
|
||||
if (msg.Name == "mud_savefile")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
SaveSystem.CurrentSave = JsonConvert.DeserializeObject<ShiftOS.Objects.Save>(msg.Contents);
|
||||
SaveSystem.SaveGame();
|
||||
CreateNewSave = false;
|
||||
DoneLoggingIn?.Invoke();
|
||||
this.CanClose = true;
|
||||
this.Close();
|
||||
|
||||
}));
|
||||
}
|
||||
else if (msg.Name == "mud_notfound")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
currentPage = 10;
|
||||
SetupUI();
|
||||
}));
|
||||
}
|
||||
ServerManager.MessageReceived -= getsave;
|
||||
};
|
||||
|
||||
ServerManager.MessageReceived += getsave;
|
||||
|
||||
ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
|
||||
{
|
||||
username = txtluser.Text,
|
||||
password = txtlpass.Text
|
||||
}));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action DoneLoggingIn;
|
||||
|
||||
public bool CreateNewSave = true;
|
||||
|
||||
public event Action<string, string, string> UserReregistered;
|
||||
|
||||
public void StartWipingInBackground(long arbitraryAmountOfBytes)
|
||||
{
|
||||
pgformatprogress.Maximum = (int)arbitraryAmountOfBytes;
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
for(long i = 0; i <= arbitraryAmountOfBytes; i++)
|
||||
{
|
||||
Thread.Sleep(40);
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
pgformatprogress.Value = (int)i;
|
||||
lbbyteszeroed.Text = $"Gigabytes zeroed: {i}/{arbitraryAmountOfBytes}";
|
||||
}));
|
||||
}
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
currentPage++;
|
||||
SetupUI();
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void TextType(string text)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
while(isTyping == true)
|
||||
{
|
||||
|
||||
}
|
||||
isTyping = true;
|
||||
TextSent?.Invoke(text);
|
||||
isTyping = false;
|
||||
}).Start();
|
||||
}
|
||||
|
||||
bool CanClose = false;
|
||||
|
||||
private void FakeSetupScreen_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CanClose)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
TextType("Don't try to close the dialog. It's a futile attempt.");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnback_Click(object sender, EventArgs e)
|
||||
{
|
||||
currentPage--;
|
||||
SetupUI();
|
||||
}
|
||||
|
||||
private void btnnext_Click(object sender, EventArgs e)
|
||||
{
|
||||
currentPage++;
|
||||
SetupUI();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShiftOS.Objects.ShiftFS.Utils.Delete(Paths.GetPath("user.dat"));
|
||||
System.IO.File.WriteAllText(Paths.SaveFile, ShiftOS.Objects.ShiftFS.Utils.ExportMount(0));
|
||||
SaveSystem.NewSave();
|
||||
this.CanClose = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnnlogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
currentPage = 10;
|
||||
SetupUI();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ using Newtonsoft.Json;
|
|||
using ShiftOS.Engine;
|
||||
using ShiftOS.Objects;
|
||||
using ShiftOS.Objects.ShiftFS;
|
||||
using ShiftOS.Unite;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
|
@ -184,90 +185,148 @@ You must join the digital society, rise up the ranks, and save us.
|
|||
|
||||
public void ShowSaveTransfer(Save save)
|
||||
{
|
||||
this.Show();
|
||||
var fSetup = new FakeSetupScreen(this, 7);
|
||||
//Stub.
|
||||
}
|
||||
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
textgeninput = lblhackwords;
|
||||
Clear();
|
||||
TextType("Welcome back to ShiftOS.");
|
||||
Thread.Sleep(500);
|
||||
TextType("Since your last time inside ShiftOS, the operating system has changed. Your user account is no longer stored on your local system.");
|
||||
Thread.Sleep(500);
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
//UPS is drunky heaven over here... it's a liquor store, I think... - Drunk Michael
|
||||
fSetup.UserReregistered += (u, p, s) =>
|
||||
{
|
||||
save.Username = u;
|
||||
save.Password = p;
|
||||
save.SystemName = s;
|
||||
SaveSystem.CurrentSave = save;
|
||||
SaveSystem.CurrentSave.Upgrades = new Dictionary<string, bool>();
|
||||
Shiftorium.Init();
|
||||
public void PerformUniteLogin()
|
||||
{
|
||||
|
||||
SaveSystem.SaveGame();
|
||||
if(Utils.FileExists(Paths.SaveFileInner))
|
||||
Utils.Delete(Paths.SaveFileInner);
|
||||
this.Close();
|
||||
};
|
||||
fSetup.Show();
|
||||
}));
|
||||
});
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public void PromptForLogin()
|
||||
{
|
||||
ServerMessageReceived MessageReceived = null;
|
||||
MessageReceived = (msg) =>
|
||||
Infobox.Show("Login", "Since the last time you've played ShiftOS, some changes have been made to the login system. You must now login using your website credentials.", () =>
|
||||
{
|
||||
if(msg.Name == "mud_savefile")
|
||||
Infobox.PromptYesNo("Website account", "Do you have an account at http://getshiftos.ml?", (hasAccount) =>
|
||||
{
|
||||
SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
SaveSystem.SaveGame();
|
||||
Application.Restart();
|
||||
}
|
||||
else if(msg.Name == "mud_notfound")
|
||||
{
|
||||
ServerManager.MessageReceived -= MessageReceived;
|
||||
|
||||
PromptForLogin();
|
||||
}
|
||||
};
|
||||
ServerManager.MessageReceived += MessageReceived;
|
||||
Infobox.PromptYesNo("Login", "You are missing a digital society authentication link. Would you like to generate a new link with an existing account? Choosing \"No\" will restart the session in the out-of-box experience.", (result)=>
|
||||
{
|
||||
if (result == true)
|
||||
{
|
||||
Infobox.PromptText("Login", "Please enter your digital society username.", (uname) =>
|
||||
if(hasAccount == true)
|
||||
{
|
||||
Infobox.PromptText("Login", "Please enter your password.", (pword) =>
|
||||
var loginDialog = new UniteLoginDialog((success)=>
|
||||
{
|
||||
ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
|
||||
string token = success;
|
||||
var uClient = new UniteClient("http://getshiftos.ml", token);
|
||||
Infobox.Show("Welcome to ShiftOS.", $"Hello, {uClient.GetDisplayName()}! We've signed you into your account. We'll now try to link your ShiftOS account with your save file.", () =>
|
||||
{
|
||||
username = uname,
|
||||
password = pword
|
||||
}));
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
//restart in OOBE
|
||||
if (Objects.ShiftFS.Utils.FileExists(Paths.GetPath("user.dat")))
|
||||
{
|
||||
Utils.Delete(Paths.GetPath("user.dat"));
|
||||
ServerMessageReceived smr = null;
|
||||
smr = (msg) =>
|
||||
{
|
||||
ServerManager.MessageReceived -= smr;
|
||||
if (msg.Name == "mud_savefile")
|
||||
{
|
||||
SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
SaveSystem.SaveGame();
|
||||
}
|
||||
else if(msg.Name=="mud_login_denied")
|
||||
{
|
||||
LinkSaveFile(token);
|
||||
}
|
||||
};
|
||||
ServerManager.MessageReceived += smr;
|
||||
ServerManager.SendMessage("mud_token_login", token);
|
||||
});
|
||||
});
|
||||
AppearanceManager.SetupDialog(loginDialog);
|
||||
}
|
||||
string json = Utils.ExportMount(0);
|
||||
System.IO.File.WriteAllText(Paths.SaveFile, json);
|
||||
System.Diagnostics.Process.Start(Application.ExecutablePath);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var signupDialog = new UniteSignupDialog((token) =>
|
||||
{
|
||||
ServerMessageReceived smr = null;
|
||||
smr = (msg) =>
|
||||
{
|
||||
ServerManager.MessageReceived -= smr;
|
||||
if (msg.Name == "mud_savefile")
|
||||
{
|
||||
SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
SaveSystem.SaveGame();
|
||||
}
|
||||
else if (msg.Name == "mud_login_denied")
|
||||
{
|
||||
LinkSaveFile(token);
|
||||
}
|
||||
};
|
||||
ServerManager.MessageReceived += smr;
|
||||
ServerManager.SendMessage("mud_token_login", token);
|
||||
|
||||
});
|
||||
AppearanceManager.SetupDialog(signupDialog);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void LinkSaveFile(string token)
|
||||
{
|
||||
if (Utils.FileExists(Paths.GetPath("user.dat")))
|
||||
{
|
||||
try
|
||||
{
|
||||
var details = JsonConvert.DeserializeObject<ClientSave>(Utils.ReadAllText(Paths.GetPath("user.dat")));
|
||||
ServerMessageReceived smr = null;
|
||||
bool msgreceived = false;
|
||||
bool found = false;
|
||||
smr = (msg) =>
|
||||
{
|
||||
if (msg.Name == "mud_savefile")
|
||||
{
|
||||
var save = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
save.UniteAuthToken = token;
|
||||
Infobox.Show("Migration complete.", "We have migrated your old save file to the new system successfully. You can still log in using the old system on old builds of ShiftOS.", () =>
|
||||
{
|
||||
SaveSystem.CurrentSave = save;
|
||||
SaveSystem.SaveGame();
|
||||
found = true;
|
||||
msgreceived = true;
|
||||
});
|
||||
}
|
||||
else if (msg.Name == "mud_login_denied")
|
||||
{
|
||||
found = false;
|
||||
msgreceived = true;
|
||||
}
|
||||
ServerManager.MessageReceived -= smr;
|
||||
};
|
||||
ServerManager.MessageReceived += smr;
|
||||
ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
|
||||
{
|
||||
username = details.Username,
|
||||
password = details.Password
|
||||
}));
|
||||
while (msgreceived == false)
|
||||
Thread.Sleep(10);
|
||||
if (found == true)
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var client = new UniteClient("http://getshiftos.ml", token);
|
||||
var sve = new Save();
|
||||
sve.Username = client.GetEmail();
|
||||
sve.Password = Guid.NewGuid().ToString();
|
||||
sve.SystemName = client.GetSysName();
|
||||
sve.UniteAuthToken = token;
|
||||
sve.Codepoints = 0;
|
||||
sve.Upgrades = new Dictionary<string, bool>();
|
||||
sve.ID = Guid.NewGuid();
|
||||
Infobox.Show("Welcome to ShiftOS.", "Welcome to ShiftOS, " + client.GetDisplayName() + ". We have created a save file for you. Now, go on and Shift It Your Way.", () =>
|
||||
{
|
||||
sve.StoryPosition = 8675309;
|
||||
SaveSystem.CurrentSave = sve;
|
||||
SaveSystem.SaveGame();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void ForceReboot()
|
||||
{
|
||||
string json = Utils.ExportMount(0);
|
||||
System.IO.File.WriteAllText(Paths.SaveFile, json);
|
||||
System.Diagnostics.Process.Start(Application.ExecutablePath);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
public void StartTrailer()
|
||||
|
|
|
@ -141,173 +141,8 @@ namespace ShiftOS.WinForms
|
|||
Console.WriteLine();
|
||||
Console.WriteLine("Next, let's get user information.");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Please enter a system hostname.");
|
||||
string allowed_chars = "abcdefghijklmnopqrstuvwxyz1234567890_";
|
||||
bool userExists = false;
|
||||
Applications.Terminal.TextSent += (text) =>
|
||||
{
|
||||
if(position == 0)
|
||||
{
|
||||
if(text.Length < 5)
|
||||
{
|
||||
Console.WriteLine("Your hostname must be at least 5 characters long.");
|
||||
return;
|
||||
}
|
||||
ShiftOS.Engine.OutOfBoxExperience.PromptForLogin();
|
||||
|
||||
if(!isValid(text, allowed_chars))
|
||||
{
|
||||
Console.WriteLine("Your hostname contains illegal characters. You can only use these characters: " + allowed_chars);
|
||||
return;
|
||||
}
|
||||
SaveSystem.CurrentSave.SystemName = text;
|
||||
position = 1;
|
||||
}
|
||||
else if(position == 1)
|
||||
{
|
||||
if (text.Length < 5)
|
||||
{
|
||||
Console.WriteLine("Your username must be at least 5 characters long.");
|
||||
return;
|
||||
}
|
||||
if (!isValid(text, allowed_chars))
|
||||
{
|
||||
Console.WriteLine("Your username contains illegal characters. You can only use these characters: " + allowed_chars);
|
||||
return;
|
||||
}
|
||||
SaveSystem.CurrentSave.Username = text;
|
||||
position = 2;
|
||||
}
|
||||
else if(position == 3)
|
||||
{
|
||||
if (!userExists)
|
||||
{
|
||||
if (text.Length < 5)
|
||||
{
|
||||
Console.WriteLine("Your password must be at least 5 characters long.");
|
||||
return;
|
||||
}
|
||||
SaveSystem.CurrentSave.Password = text;
|
||||
position = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new
|
||||
{
|
||||
username = SaveSystem.CurrentSave.Username,
|
||||
password = text
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TerminalBackend.InStory = false;
|
||||
|
||||
while (position == 0)
|
||||
Thread.Sleep(10);
|
||||
Console.WriteLine("Connecting to the multi-user domain as " + SaveSystem.CurrentSave.SystemName + "...");
|
||||
bool connected = false;
|
||||
Engine.AudioManager.PlayCompleted += () => { connected = true; };
|
||||
Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02);
|
||||
while (connected == false)
|
||||
Thread.Sleep(10);
|
||||
Console.WriteLine("Connection successful, system spinning up...");
|
||||
Thread.Sleep(200);
|
||||
UsernameWait:
|
||||
Console.WriteLine("No users associated with this system. Please enter a username.");
|
||||
Console.WriteLine(" - If the username is registered as a digital being, you will be prompted for your password. Else, you will be prompted to create a new account.");
|
||||
while(position == 1)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
bool goBack = false;
|
||||
int incorrectChances = 2;
|
||||
Console.WriteLine("Checking sentience records...");
|
||||
ServerMessageReceived smr = (msg) =>
|
||||
{
|
||||
if (position == 2)
|
||||
{
|
||||
if (msg.Name == "mud_found")
|
||||
{
|
||||
Console.WriteLine("Your username has been taken by another sentient being within the digital society.");
|
||||
Console.WriteLine("If you are that sentience, you have two chances to type the correct password.");
|
||||
userExists = true;
|
||||
}
|
||||
else if (msg.Name == "mud_notfound")
|
||||
{
|
||||
Console.WriteLine("Please enter a password for this new user.");
|
||||
userExists = false;
|
||||
}
|
||||
position = 3;
|
||||
}
|
||||
else if (position == 3)
|
||||
{
|
||||
if(userExists == true)
|
||||
{
|
||||
if(msg.Name == "mud_savefile")
|
||||
{
|
||||
Console.WriteLine("Your sentience profile has been assigned to your system successfully. We will bring you to your system shortly.");
|
||||
SaveSystem.CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
position = 4;
|
||||
}
|
||||
else if(msg.Name == "mud_login_denied")
|
||||
{
|
||||
if (incorrectChances > 0)
|
||||
{
|
||||
incorrectChances--;
|
||||
Console.WriteLine("Access denied. Chances: " + incorrectChances);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Access denied.");
|
||||
position = 2;
|
||||
goBack = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ServerManager.MessageReceived += smr;
|
||||
ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new { username = SaveSystem.CurrentSave.Username }));
|
||||
while (position == 2)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
while (position == 3)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
if (goBack)
|
||||
{
|
||||
ServerManager.MessageReceived -= smr;
|
||||
goto UsernameWait;
|
||||
}
|
||||
Console.WriteLine("Sentience linkup successful.");
|
||||
Console.WriteLine("We will bring you to your system in 5 seconds.");
|
||||
Thread.Sleep(5000);
|
||||
Desktop.InvokeOnWorkerThread(() =>
|
||||
{
|
||||
SaveSystem.CurrentSave.StoryPosition = 3;
|
||||
SaveSystem.SaveGame();
|
||||
while (!Shiftorium.IsInitiated)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
if (!Shiftorium.UpgradeInstalled("desktop"))
|
||||
{
|
||||
SaveSystem.GameReady += () =>
|
||||
{
|
||||
term.ClearText();
|
||||
TerminalBackend.PrintPrompt();
|
||||
Console.Write("sos.status");
|
||||
TerminalBackend.InvokeCommand("sos.status");
|
||||
TerminalBackend.PrintPrompt();
|
||||
Console.Write("sos.help");
|
||||
TerminalBackend.InvokeCommand("sos.help");
|
||||
Thread.Sleep(1000);
|
||||
TerminalBackend.PrintPrompt();
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
private static bool isValid(string text, string chars)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,12 @@
|
|||
<Compile Include="Applications\About.Designer.cs">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\TriWrite.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Applications\TriWrite.Designer.cs">
|
||||
<DependentUpon>TriWrite.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\AddressBook.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -310,12 +316,6 @@
|
|||
<Compile Include="DownloadControl.Designer.cs">
|
||||
<DependentUpon>DownloadControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FakeSetupScreen.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FakeSetupScreen.Designer.cs">
|
||||
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GUIFunctions.cs" />
|
||||
<Compile Include="HackerCommands.cs" />
|
||||
<Compile Include="IDesktopWidget.cs" />
|
||||
|
@ -361,6 +361,18 @@
|
|||
<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>
|
||||
<Compile Include="UniteSignupDialog.Designer.cs">
|
||||
<DependentUpon>UniteSignupDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VisualBasicStuff.cs" />
|
||||
<Compile Include="WFLanguageProvider.cs" />
|
||||
<Compile Include="WidgetManager.cs" />
|
||||
|
@ -388,6 +400,9 @@
|
|||
<EmbeddedResource Include="Applications\About.resx">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\TriWrite.resx">
|
||||
<DependentUpon>TriWrite.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\AddressBook.resx">
|
||||
<DependentUpon>AddressBook.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -496,9 +511,6 @@
|
|||
<EmbeddedResource Include="DownloadControl.resx">
|
||||
<DependentUpon>DownloadControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FakeSetupScreen.resx">
|
||||
<DependentUpon>FakeSetupScreen.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Oobe.resx">
|
||||
<DependentUpon>Oobe.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -516,6 +528,12 @@
|
|||
<EmbeddedResource Include="ShiftnetSites\MainHomepage.resx">
|
||||
<DependentUpon>MainHomepage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UniteLoginDialog.resx">
|
||||
<DependentUpon>UniteLoginDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UniteSignupDialog.resx">
|
||||
<DependentUpon>UniteSignupDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WindowBorder.resx">
|
||||
<DependentUpon>WindowBorder.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
123
ShiftOS.WinForms/UniteLoginDialog.Designer.cs
generated
Normal file
123
ShiftOS.WinForms/UniteLoginDialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,123 @@
|
|||
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;
|
||||
}
|
||||
}
|
90
ShiftOS.WinForms/UniteLoginDialog.cs
Normal file
90
ShiftOS.WinForms/UniteLoginDialog.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
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;
|
||||
|
||||
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("http://getshiftos.ml/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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
211
ShiftOS.WinForms/UniteSignupDialog.Designer.cs
generated
Normal file
211
ShiftOS.WinForms/UniteSignupDialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,211 @@
|
|||
namespace ShiftOS.WinForms
|
||||
{
|
||||
partial class UniteSignupDialog
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UniteSignupDialog));
|
||||
this.btnlogin = new System.Windows.Forms.Button();
|
||||
this.txtpassword = new System.Windows.Forms.TextBox();
|
||||
this.txtusername = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtconfirm = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtdisplay = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtsysname = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// 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(462, 479);
|
||||
this.btnlogin.Name = "btnlogin";
|
||||
this.btnlogin.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnlogin.TabIndex = 11;
|
||||
this.btnlogin.Text = "Submit";
|
||||
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.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtpassword.Location = new System.Drawing.Point(113, 133);
|
||||
this.txtpassword.Name = "txtpassword";
|
||||
this.txtpassword.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtpassword.TabIndex = 10;
|
||||
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(113, 100);
|
||||
this.txtusername.Name = "txtusername";
|
||||
this.txtusername.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtusername.TabIndex = 9;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(17, 136);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(56, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Password:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(17, 103);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(76, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Email Address:";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(17, 36);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(120, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Tag = "header2";
|
||||
this.label1.Text = "Create ShiftOS Account";
|
||||
//
|
||||
// txtconfirm
|
||||
//
|
||||
this.txtconfirm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtconfirm.Location = new System.Drawing.Point(113, 159);
|
||||
this.txtconfirm.Name = "txtconfirm";
|
||||
this.txtconfirm.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtconfirm.TabIndex = 13;
|
||||
this.txtconfirm.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(17, 162);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(45, 13);
|
||||
this.label4.TabIndex = 12;
|
||||
this.label4.Text = "Confirm:";
|
||||
//
|
||||
// txtdisplay
|
||||
//
|
||||
this.txtdisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtdisplay.Location = new System.Drawing.Point(113, 197);
|
||||
this.txtdisplay.Name = "txtdisplay";
|
||||
this.txtdisplay.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtdisplay.TabIndex = 15;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(17, 200);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(73, 13);
|
||||
this.label5.TabIndex = 14;
|
||||
this.label5.Text = "Display name:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label6.Location = new System.Drawing.Point(20, 267);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(517, 209);
|
||||
this.label6.TabIndex = 16;
|
||||
this.label6.Text = resources.GetString("label6.Text");
|
||||
//
|
||||
// txtsysname
|
||||
//
|
||||
this.txtsysname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtsysname.Location = new System.Drawing.Point(113, 223);
|
||||
this.txtsysname.Name = "txtsysname";
|
||||
this.txtsysname.Size = new System.Drawing.Size(424, 20);
|
||||
this.txtsysname.TabIndex = 18;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(17, 226);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(73, 13);
|
||||
this.label7.TabIndex = 17;
|
||||
this.label7.Text = "System name:";
|
||||
//
|
||||
// UniteSignupDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.txtsysname);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.txtdisplay);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.txtconfirm);
|
||||
this.Controls.Add(this.label4);
|
||||
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 = "UniteSignupDialog";
|
||||
this.Size = new System.Drawing.Size(555, 519);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnlogin;
|
||||
private System.Windows.Forms.TextBox txtpassword;
|
||||
private System.Windows.Forms.TextBox txtusername;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtconfirm;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtdisplay;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtsysname;
|
||||
private System.Windows.Forms.Label label7;
|
||||
}
|
||||
}
|
136
ShiftOS.WinForms/UniteSignupDialog.cs
Normal file
136
ShiftOS.WinForms/UniteSignupDialog.cs
Normal file
|
@ -0,0 +1,136 @@
|
|||
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 Newtonsoft.Json;
|
||||
using System.Net;
|
||||
|
||||
namespace ShiftOS.WinForms
|
||||
{
|
||||
public partial class UniteSignupDialog : UserControl, IShiftOSWindow
|
||||
{
|
||||
public UniteSignupDialog(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;
|
||||
}
|
||||
|
||||
if(p != txtconfirm.Text)
|
||||
{
|
||||
Infobox.Show("Passwords don't match.", "The \"Password\" and \"Confirm\" boxes must match.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(txtdisplay.Text))
|
||||
{
|
||||
Infobox.Show("Empty display name", "Please choose a proper display name.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(txtsysname.Text))
|
||||
{
|
||||
Infobox.Show("Empty system name", "Please name your computer!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(p.Length < 7)
|
||||
{
|
||||
Infobox.Show("Password error", "Your password must have at least 7 characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(p.Any(char.IsUpper) &&
|
||||
p.Any(char.IsLower) &&
|
||||
p.Any(char.IsDigit)))
|
||||
{
|
||||
Infobox.Show("Password error", "Your password must contain at least one uppercase, lowercase, digit and symbol character.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u.Contains("@"))
|
||||
{
|
||||
Infobox.Show("Valid email required.", "You must specify a valid email address.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var webrequest = HttpWebRequest.Create("http://getshiftos.ml/Auth/Register?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4&displayname=" + txtdisplay.Text + "&sysname=" + txtsysname.Text);
|
||||
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();
|
||||
if (result.StartsWith("{"))
|
||||
{
|
||||
var exc = JsonConvert.DeserializeObject<Exception>(result);
|
||||
Infobox.Show("Error", exc.Message);
|
||||
return;
|
||||
}
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
131
ShiftOS.WinForms/UniteSignupDialog.resx
Normal file
131
ShiftOS.WinForms/UniteSignupDialog.resx
Normal file
|
@ -0,0 +1,131 @@
|
|||
<?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>
|
||||
<data name="label6.Text" xml:space="preserve">
|
||||
<value>Your ShiftOS Account is your gateway to the world of ShiftOS.
|
||||
|
||||
What does this account do for you?
|
||||
|
||||
- It holds all your Codepoints, Shiftorium Upgrades, and other in-game save details in a secure spot.
|
||||
- It gives you access to the ShiftOS Forums, Wiki, Developer Blog and the bugtracker.
|
||||
- It gives you your own personal profile that you can shift your own way - just like you can ShiftOS.
|
||||
|
||||
You can customize more information for this account at http://getshiftos.ml/, but first, we must create it.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -52,7 +52,6 @@ namespace ShiftOS.WinForms
|
|||
public List<IDesktopWidget> Widgets = new List<IDesktopWidget>();
|
||||
|
||||
|
||||
private bool InScreensaver = false;
|
||||
private int millisecondsUntilScreensaver = 300000;
|
||||
|
||||
/// <summary>
|
||||
|
@ -231,13 +230,11 @@ namespace ShiftOS.WinForms
|
|||
if(millisecondsUntilScreensaver <= 0)
|
||||
{
|
||||
ShowScreensaver();
|
||||
InScreensaver = true;
|
||||
}
|
||||
millisecondsUntilScreensaver--;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
millisecondsUntilScreensaver = 300000;
|
||||
InScreensaver = false;
|
||||
HideScreensaver();
|
||||
}
|
||||
});
|
||||
|
@ -990,7 +987,7 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
if (Shiftorium.UpgradeInstalled("advanced_app_launcher"))
|
||||
{
|
||||
lbalstatus.Text = $@"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}
|
||||
lbalstatus.Text = $@"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}
|
||||
{SaveSystem.CurrentSave.Codepoints} Codepoints
|
||||
{Shiftorium.GetAvailable().Length} available, {SaveSystem.CurrentSave.CountUpgrades()} installed.";
|
||||
|
||||
|
|
|
@ -98,8 +98,6 @@ namespace ShiftOS.Engine
|
|||
int firstValuePos = -1;
|
||||
int lastValuePos = -1;
|
||||
|
||||
string syntaxError = "";
|
||||
|
||||
for (int ii = 0; ii < parts.Count; ii++)
|
||||
{
|
||||
CommandFormat part = parts[ii];
|
||||
|
@ -184,7 +182,6 @@ namespace ShiftOS.Engine
|
|||
else
|
||||
{
|
||||
position = text.Length;
|
||||
syntaxError = "Syntax Error";
|
||||
command = "+FALSE+";
|
||||
}
|
||||
help = -1;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace ShiftOS.Engine
|
|||
TerminalBackend.IsForwardingConsoleWrites = forwarding;
|
||||
TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null;
|
||||
string resultFriendly = (result == true) ? "yes" : "no";
|
||||
Console.WriteLine($"{SaveSystem.CurrentSave.Username} says {resultFriendly}.");
|
||||
Console.WriteLine($"{SaveSystem.CurrentUser.Username} says {resultFriendly}.");
|
||||
TerminalBackend.IsForwardingConsoleWrites = false;
|
||||
};
|
||||
Desktop.InvokeOnWorkerThread(new Action(() =>
|
||||
|
|
|
@ -50,6 +50,9 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
public static bool ShuttingDown = false;
|
||||
|
||||
public static ClientSave CurrentUser { get; set; }
|
||||
|
||||
|
||||
public static Save CurrentSave { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -156,17 +159,23 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
KernelWatchdog.Log("mud_handshake", "handshake successful: kernel watchdog access code is \"" + ServerManager.thisGuid.ToString() + "\"");
|
||||
|
||||
ServerManager.MessageReceived += (msg) =>
|
||||
ServerMessageReceived savehandshake = null;
|
||||
|
||||
savehandshake = (msg) =>
|
||||
{
|
||||
if (msg.Name == "mud_savefile")
|
||||
{
|
||||
CurrentSave = JsonConvert.DeserializeObject<Save>(msg.Contents);
|
||||
ServerManager.MessageReceived -= savehandshake;
|
||||
}
|
||||
else if (msg.Name == "mud_login_denied")
|
||||
{
|
||||
oobe.PromptForLogin();
|
||||
ServerManager.MessageReceived -= savehandshake;
|
||||
}
|
||||
};
|
||||
ServerManager.MessageReceived += savehandshake;
|
||||
|
||||
|
||||
ReadSave();
|
||||
|
||||
|
@ -189,28 +198,96 @@ namespace ShiftOS.Engine
|
|||
Thread.Sleep(50);
|
||||
Console.WriteLine("{SYSTEM_INITIATED}");
|
||||
|
||||
|
||||
|
||||
if(CurrentSave.Users.Count == 0)
|
||||
{
|
||||
CurrentSave.Users.Add(new ClientSave
|
||||
{
|
||||
Username = "root",
|
||||
Password = "",
|
||||
Permissions = UserPermissions.Root
|
||||
});
|
||||
Console.WriteLine("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 (progress == 0)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
if (CurrentSave.Users.FirstOrDefault(x => x.Username == text) == null)
|
||||
{
|
||||
Console.WriteLine("User not found.");
|
||||
goback = true;
|
||||
progress++;
|
||||
TerminalBackend.TextSent -= ev;
|
||||
return;
|
||||
}
|
||||
username = text;
|
||||
progress++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Username not provided.");
|
||||
TerminalBackend.TextSent -= ev;
|
||||
goback = true;
|
||||
progress++;
|
||||
}
|
||||
}
|
||||
else if (progress == 1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
};
|
||||
TerminalBackend.TextSent += ev;
|
||||
Console.WriteLine(CurrentSave.SystemName + " login:");
|
||||
while(progress == 0)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
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(() =>
|
||||
{
|
||||
ShiftOS.Engine.Scripting.LuaInterpreter.RunSft(Paths.GetPath("kernel.sft"));
|
||||
}));
|
||||
Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher()));
|
||||
if (CurrentSave.StoryPosition == 1)
|
||||
{
|
||||
Desktop.InvokeOnWorkerThread(new Action(() =>
|
||||
{
|
||||
TutorialManager.StartTutorial();
|
||||
|
||||
}));
|
||||
while (TutorialManager.IsInTutorial == true) { }
|
||||
GameReady?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameReady?.Invoke();
|
||||
}
|
||||
|
||||
Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher()));
|
||||
GameReady?.Invoke();
|
||||
}
|
||||
|
||||
public delegate void EmptyEventHandler();
|
||||
|
@ -266,12 +343,9 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
if (Utils.FileExists(Paths.GetPath("user.dat")))
|
||||
{
|
||||
var userdat = JsonConvert.DeserializeObject<ClientSave>(Utils.ReadAllText(Paths.GetPath("user.dat")));
|
||||
string token = Utils.ReadAllText(Paths.GetPath("user.dat"));
|
||||
|
||||
ServerManager.SendMessage("mud_login", $@"{{
|
||||
username: ""{userdat.Username}"",
|
||||
password: ""{userdat.Password}""
|
||||
}}");
|
||||
ServerManager.SendMessage("mud_token_login", token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -301,14 +375,7 @@ namespace ShiftOS.Engine
|
|||
Console.Write("{SE_SAVING}... ");
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
{
|
||||
string username = CurrentSave.Username;
|
||||
string password = CurrentSave.Password;
|
||||
|
||||
Utils.WriteAllText(Paths.GetPath("user.dat"), $@"{{
|
||||
username: ""{username}"",
|
||||
password: ""{password}""
|
||||
}}");
|
||||
|
||||
Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken);
|
||||
ServerManager.SendMessage("mud_save", JsonConvert.SerializeObject(CurrentSave, Formatting.Indented));
|
||||
}
|
||||
if (!Shiftorium.Silent)
|
||||
|
|
|
@ -131,6 +131,8 @@
|
|||
<Compile Include="TerminalBackend.cs" />
|
||||
<Compile Include="TerminalTextWriter.cs" />
|
||||
<Compile Include="TutorialManager.cs" />
|
||||
<Compile Include="UniteClient.cs" />
|
||||
<Compile Include="UniteTestCommands.cs" />
|
||||
<Compile Include="VirusEngine.cs" />
|
||||
<Compile Include="WinOpenAttribute.cs" />
|
||||
<EmbeddedResource Include="Infobox.resx">
|
||||
|
|
|
@ -32,21 +32,26 @@ using System.Threading.Tasks;
|
|||
using Newtonsoft.Json;
|
||||
using static ShiftOS.Engine.SaveSystem;
|
||||
|
||||
namespace ShiftOS.Engine {
|
||||
public static class TerminalBackend {
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
public static class TerminalBackend
|
||||
{
|
||||
public static event Action<string, string> CommandProcessed;
|
||||
|
||||
public static bool Elevated { get; set; }
|
||||
|
||||
public static Dictionary<string, string> GetArgs(ref string text) {
|
||||
public static Dictionary<string, string> GetArgs(ref string text)
|
||||
{
|
||||
bool shouldParse = false;
|
||||
int argStart = 0;
|
||||
if (text.Contains("{")) {
|
||||
if (text.Contains("{"))
|
||||
{
|
||||
shouldParse = true;
|
||||
argStart = text.IndexOf('{');
|
||||
}
|
||||
|
||||
if (shouldParse == false) {
|
||||
if (shouldParse == false)
|
||||
{
|
||||
string replacement = Regex.Replace(text, @"\t|\n|\r", "");
|
||||
text = replacement + "{}";
|
||||
shouldParse = true;
|
||||
|
@ -61,15 +66,18 @@ namespace ShiftOS.Engine {
|
|||
|
||||
public static string LastCommand = "";
|
||||
|
||||
public static void InvokeCommand(string ns, string command, Dictionary<string, string> arguments, bool isRemote = false) {
|
||||
try {
|
||||
public static void InvokeCommand(string ns, string command, Dictionary<string, string> arguments, bool isRemote = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ns))
|
||||
return;
|
||||
|
||||
|
||||
bool commandWasClient = RunClient(ns, command, arguments, isRemote);
|
||||
|
||||
if (!commandWasClient && !string.IsNullOrWhiteSpace(ns)) {
|
||||
if (!commandWasClient && !string.IsNullOrWhiteSpace(ns))
|
||||
{
|
||||
PrefixEnabled = false;
|
||||
|
||||
ServerManager.SendMessage("script", $@"{{
|
||||
|
@ -80,23 +88,29 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
|
||||
CommandProcessed?.Invoke(ns + "." + command, JsonConvert.SerializeObject(arguments));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Command parse error: {ex.Message}"); // This shouldn't ever be called now
|
||||
PrefixEnabled = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetSentArgs(Dictionary<string, string> argss) {
|
||||
public static string GetSentArgs(Dictionary<string, string> argss)
|
||||
{
|
||||
Dictionary<string, object> args = new Dictionary<string, object>();
|
||||
foreach (KeyValuePair<string, string> arg in argss) {
|
||||
foreach (KeyValuePair<string, string> arg in argss)
|
||||
{
|
||||
args[arg.Key] = arg.Value;
|
||||
}
|
||||
return JsonConvert.SerializeObject(args);
|
||||
}
|
||||
|
||||
public static void InvokeCommand(string text, bool isRemote = false) {
|
||||
try {
|
||||
public static void InvokeCommand(string text, bool isRemote = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
|
||||
|
@ -104,7 +118,8 @@ namespace ShiftOS.Engine {
|
|||
|
||||
bool commandWasClient = RunClient(text, args, isRemote);
|
||||
|
||||
if (!commandWasClient) {
|
||||
if (!commandWasClient)
|
||||
{
|
||||
PrefixEnabled = false;
|
||||
|
||||
ServerManager.SendMessage("script", $@"{{
|
||||
|
@ -114,7 +129,9 @@ namespace ShiftOS.Engine {
|
|||
}}");
|
||||
}
|
||||
CommandProcessed?.Invoke(text, GetSentArgs(args));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Command parse error: {ex.Message}");
|
||||
PrefixEnabled = true;
|
||||
|
||||
|
@ -129,15 +146,18 @@ namespace ShiftOS.Engine {
|
|||
|
||||
public static event EmptyEventHandler TerminalRequested;
|
||||
|
||||
internal static void OpenTerminal() {
|
||||
internal static void OpenTerminal()
|
||||
{
|
||||
TerminalRequested?.Invoke();
|
||||
}
|
||||
|
||||
public static bool CanRunRemotely(MethodInfo mth, bool isRemote) {
|
||||
public static bool CanRunRemotely(MethodInfo mth, bool isRemote)
|
||||
{
|
||||
if (!isRemote)
|
||||
return true;
|
||||
|
||||
foreach (var attr in mth.GetCustomAttributes(false)) {
|
||||
foreach (var attr in mth.GetCustomAttributes(false))
|
||||
{
|
||||
if (attr is RemoteLockAttribute)
|
||||
return false;
|
||||
}
|
||||
|
@ -145,26 +165,32 @@ namespace ShiftOS.Engine {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool RunClient(string ns, string cmd, Dictionary<string, string> args, bool isRemote = false) {
|
||||
public static bool RunClient(string ns, string cmd, Dictionary<string, string> args, bool isRemote = false)
|
||||
{
|
||||
return RunClient(ns + "." + cmd, args, isRemote);
|
||||
}
|
||||
|
||||
|
||||
public static bool RunClient(string text, Dictionary<string, string> argss, bool isRemote = false) {
|
||||
public static bool RunClient(string text, Dictionary<string, string> argss, bool isRemote = false)
|
||||
{
|
||||
Dictionary<string, object> args = new Dictionary<string, object>();
|
||||
foreach (KeyValuePair<string, string> arg in argss) {
|
||||
foreach (KeyValuePair<string, string> arg in argss)
|
||||
{
|
||||
args[arg.Key] = arg.Value;
|
||||
}
|
||||
return RunClient(text, args, isRemote);
|
||||
}
|
||||
|
||||
public static bool RunClient(string text, Dictionary<string, object> args, bool isRemote = false) {
|
||||
public static bool RunClient(string text, Dictionary<string, object> args, bool isRemote = false)
|
||||
{
|
||||
latestCommmand = text;
|
||||
|
||||
//Console.WriteLine(text + " " + "{" + string.Join(",", args.Select(kv => kv.Key + "=" + kv.Value).ToArray()) + "}" + " " + isRemote);
|
||||
|
||||
foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) {
|
||||
try {
|
||||
foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory))
|
||||
{
|
||||
try
|
||||
{
|
||||
var asm = Assembly.LoadFile(asmExec);
|
||||
|
||||
var types = asm.GetTypes();
|
||||
|
@ -315,7 +341,9 @@ namespace ShiftOS.Engine {
|
|||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(text + " cannot be ran in a remote session");
|
||||
return true;
|
||||
}
|
||||
|
@ -360,13 +388,14 @@ namespace ShiftOS.Engine {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void PrintPrompt()
|
||||
{
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
if (SaveSystem.CurrentSave != null && CurrentUser != null)
|
||||
{
|
||||
ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC;
|
||||
ConsoleEx.Italic = false;
|
||||
|
@ -375,7 +404,7 @@ namespace ShiftOS.Engine {
|
|||
ConsoleEx.ForegroundColor = ConsoleColor.Magenta;
|
||||
ConsoleEx.Bold = true;
|
||||
|
||||
Console.Write(SaveSystem.CurrentSave.Username);
|
||||
Console.Write(SaveSystem.CurrentUser.Username);
|
||||
ConsoleEx.Bold = false;
|
||||
ConsoleEx.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("@");
|
||||
|
@ -410,26 +439,34 @@ namespace ShiftOS.Engine {
|
|||
string text3 = "";
|
||||
string text4 = msg.Contents;
|
||||
|
||||
if (TerminalBackend.PrefixEnabled) {
|
||||
if (TerminalBackend.PrefixEnabled)
|
||||
{
|
||||
text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
|
||||
}
|
||||
IsForwardingConsoleWrites = true;
|
||||
if (TerminalBackend.InStory == false) {
|
||||
if (TerminalBackend.InStory == false)
|
||||
{
|
||||
TerminalBackend.InvokeCommand(text3, true);
|
||||
}
|
||||
if (TerminalBackend.PrefixEnabled) {
|
||||
if (TerminalBackend.PrefixEnabled)
|
||||
{
|
||||
Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
|
||||
}
|
||||
IsForwardingConsoleWrites = false;
|
||||
} else if (msg.Name == "pleasewrite") {
|
||||
}
|
||||
else if (msg.Name == "pleasewrite")
|
||||
{
|
||||
Console.Write(msg.Contents);
|
||||
} else if (msg.Name == "handshake_from") {
|
||||
}
|
||||
else if (msg.Name == "handshake_from")
|
||||
{
|
||||
var a = JsonConvert.DeserializeObject<Dictionary<string, object>>(msg.Contents);
|
||||
string uName = a["username"] as string;
|
||||
string pass = a["password"] as string;
|
||||
string sys = a["sysname"] as string;
|
||||
string guid = msg.GUID;
|
||||
if (SaveSystem.CurrentSave.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) {
|
||||
if (SaveSystem.CurrentSave.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys)
|
||||
{
|
||||
ForwardGUID = guid;
|
||||
ServerManager.SendMessage("trm_handshake_accept", $@"{{
|
||||
guid: ""{ServerManager.thisGuid}"",
|
||||
|
@ -450,5 +487,12 @@ namespace ShiftOS.Engine {
|
|||
public static bool IsForwardingConsoleWrites { get; internal set; }
|
||||
public static string ForwardGUID { get; internal set; }
|
||||
|
||||
public static event TextSentEventHandler TextSent;
|
||||
|
||||
public static void SendText(string text)
|
||||
{
|
||||
TextSent?.Invoke(text);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
83
ShiftOS_TheReturn/UniteClient.cs
Normal file
83
ShiftOS_TheReturn/UniteClient.cs
Normal file
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Unite
|
||||
{
|
||||
public class UniteClient
|
||||
{
|
||||
public string Token { get; private set; }
|
||||
public string BaseURL { get; private set; }
|
||||
|
||||
public UniteClient(string baseurl, string usertoken)
|
||||
{
|
||||
BaseURL = baseurl;
|
||||
Token = usertoken;
|
||||
}
|
||||
|
||||
internal string MakeCall(string url)
|
||||
{
|
||||
var webrequest = WebRequest.Create(BaseURL + url);
|
||||
webrequest.Headers.Add("Authentication: Token " + Token);
|
||||
using (var response = webrequest.GetResponse())
|
||||
{
|
||||
using (var stream = response.GetResponseStream())
|
||||
{
|
||||
using (var reader = new System.IO.StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetEmail()
|
||||
{
|
||||
return MakeCall("/API/GetEmail");
|
||||
}
|
||||
|
||||
public string GetSysName()
|
||||
{
|
||||
return MakeCall("/API/GetSysName");
|
||||
}
|
||||
|
||||
public void SetSysName(string value)
|
||||
{
|
||||
MakeCall("/API/SetSysName/" + value);
|
||||
}
|
||||
|
||||
public string GetDisplayName()
|
||||
{
|
||||
return MakeCall("/API/GetDisplayName");
|
||||
}
|
||||
|
||||
public void SetDisplayName(string value)
|
||||
{
|
||||
MakeCall("/API/SetDisplayName/" + value.ToString());
|
||||
}
|
||||
|
||||
public string GetFullName()
|
||||
{
|
||||
return MakeCall("/API/GetFullName");
|
||||
}
|
||||
|
||||
public void SetFullName(string value)
|
||||
{
|
||||
MakeCall("/API/SetFullName/" + value.ToString());
|
||||
}
|
||||
|
||||
|
||||
public long GetCodepoints()
|
||||
{
|
||||
return Convert.ToInt64(MakeCall("/API/GetCodepoints"));
|
||||
}
|
||||
|
||||
public void SetCodepoints(long value)
|
||||
{
|
||||
MakeCall("/API/SetCodepoints/" + value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
64
ShiftOS_TheReturn/UniteTestCommands.cs
Normal file
64
ShiftOS_TheReturn/UniteTestCommands.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
[Namespace("unite")]
|
||||
public static class UniteTestCommands
|
||||
{
|
||||
[Command("login")]
|
||||
[RequiresArgument("username")]
|
||||
[RequiresArgument("password")]
|
||||
public static bool LoginTest(Dictionary<string, object> args)
|
||||
{
|
||||
string u = args["username"].ToString();
|
||||
string p = args["password"].ToString();
|
||||
var webrequest = HttpWebRequest.Create("http://getshiftos.ml/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();
|
||||
Console.WriteLine("Server returned: " + result);
|
||||
reader.Close();
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
response.Dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("linklogin")]
|
||||
[RequiresArgument("username")]
|
||||
[RequiresArgument("password")]
|
||||
public static bool LinkLogin(Dictionary<string, object> args)
|
||||
{
|
||||
string u = args["username"].ToString();
|
||||
string p = args["password"].ToString();
|
||||
var webrequest = HttpWebRequest.Create("http://getshiftos.ml/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();
|
||||
//If we get this far, the token is OURS. :D
|
||||
SaveSystem.CurrentSave.UniteAuthToken = result;
|
||||
Console.WriteLine("Unite says \"Access Granted!\"");
|
||||
SaveSystem.SaveGame();
|
||||
reader.Close();
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
response.Dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue