diff options
| author | Michael VanOverbeek <[email protected]> | 2017-05-21 12:29:53 +0000 |
|---|---|---|
| committer | Michael VanOverbeek <[email protected]> | 2017-05-21 12:29:53 +0000 |
| commit | 76b54853ba726179f9fddb30c6f838991b7aa71a (patch) | |
| tree | 8713f45ce26958659e3f4e507d73ecabebabfe49 /ShiftOS.WinForms | |
| parent | 31cc9148dd23737df16d8456a42d003cd31dd488 (diff) | |
| download | shiftos_thereturn-76b54853ba726179f9fddb30c6f838991b7aa71a.tar.gz shiftos_thereturn-76b54853ba726179f9fddb30c6f838991b7aa71a.tar.bz2 shiftos_thereturn-76b54853ba726179f9fddb30c6f838991b7aa71a.zip | |
Merge a fuckton of shit.
Diffstat (limited to 'ShiftOS.WinForms')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Terminal.cs | 496 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/UpdateManager.Designer.cs | 130 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs | 168 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Controls/ShiftedProgressBar.cs | 147 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Controls/TerminalBox.cs | 257 | ||||
| -rw-r--r-- | ShiftOS.WinForms/DownloadControl.Designer.cs | 116 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Oobe.cs | 600 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Program.cs | 269 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Properties/Resources.Designer.cs | 1394 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Tools/ControlManager.cs | 300 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Tools/DitheringEngine.cs | 402 | ||||
| -rw-r--r-- | ShiftOS.WinForms/WinformsDesktop.Designer.cs | 312 | ||||
| -rw-r--r-- | ShiftOS.WinForms/WinformsDesktop.cs | 1066 |
13 files changed, 0 insertions, 5657 deletions
diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs deleted file mode 100644 index 32c5363..0000000 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ /dev/null @@ -1,496 +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. - */ - -//#define TRAILER -//#define CRASHONSTART -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Text.RegularExpressions; -using System.Collections; -using static ShiftOS.Engine.SkinEngine; -using ShiftOS.Engine; -using ShiftOS.Objects; -using ShiftOS.WinForms.Tools; - -namespace ShiftOS.WinForms.Applications -{ - [Launcher("Terminal", false, null, "Utilities")] - [WinOpen("terminal")] - [DefaultIcon("iconTerminal")] - public partial class Terminal : UserControl, IShiftOSWindow - { - public static Stack<string> ConsoleStack = new Stack<string>(); - - public static System.Windows.Forms.Timer ti = new System.Windows.Forms.Timer(); - - public static string latestCommmand = ""; - - public static bool IsInRemoteSystem = false; - public static string RemoteGuid = ""; - - [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static bool PrefixEnabled - { - get - { - return TerminalBackend.PrefixEnabled; - } - set - { - TerminalBackend.PrefixEnabled = value; - } - } - - [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static bool InStory - { - get - { - return TerminalBackend.InStory; - } - set - { - TerminalBackend.InStory = value; - } - } - - [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static string LastCommand - { - get - { - return TerminalBackend.LastCommand; - } - set - { - TerminalBackend.LastCommand = value; - } - } - - public int TutorialProgress - { - get - { - throw new NotImplementedException(); - } - - set - { - throw new NotImplementedException(); - } - } - - [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static void InvokeCommand(string text) - { - - TerminalBackend.InvokeCommand(text); - } - - public Terminal() - { - - InitializeComponent(); - SaveSystem.GameReady += () => - { - try - { - this.Invoke(new Action(() => - { - ResetAllKeywords(); - rtbterm.Text = ""; - if (!Shiftorium.UpgradeInstalled("desktop")) - { - TerminalBackend.PrefixEnabled = true; - TerminalBackend.InStory = false; - TerminalBackend.PrintPrompt(); - if (Shiftorium.UpgradeInstalled("wm_free_placement")) - { - this.ParentForm.Width = 640; - this.ParentForm.Height = 480; - this.ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - 640) / 2; - this.ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - 480) / 2; - - } - } - else - { - AppearanceManager.Close(this); - } - })); - } - catch { } - }; - - - this.DoubleBuffered = true; - - } - - public void FocusOnTerminal() - { - rtbterm.Focus(); - } - - public static string GetTime() - { - var time = DateTime.Now; - if (ShiftoriumFrontend.UpgradeInstalled("full_precision_time")) - { - return DateTime.Now.ToString("h:mm:ss tt"); - } - else if (ShiftoriumFrontend.UpgradeInstalled("clock_am_and_pm")) - { - return time.TimeOfDay.TotalHours > 12 ? $"{time.Hour - 12} PM" : $"{time.Hour} AM"; - } - else if (ShiftoriumFrontend.UpgradeInstalled("clock_hours")) - { - return ((int)time.TimeOfDay.TotalHours).ToString(); - } - else if (ShiftoriumFrontend.UpgradeInstalled("clock_minutes")) - { - return ((int)time.TimeOfDay.TotalMinutes).ToString(); - } - else if (ShiftoriumFrontend.UpgradeInstalled("clock")) - { - return ((int)time.TimeOfDay.TotalSeconds).ToString(); - } - - return ""; - } - - - public static event TextSentEventHandler TextSent; - - public void ResetAllKeywords() - { - string primary = SaveSystem.CurrentUser.Username + " "; - string secondary = "shiftos "; - - - var asm = Assembly.GetExecutingAssembly(); - - var types = asm.GetTypes(); - - foreach (var type in types) - { - foreach (var a in type.GetCustomAttributes(false)) - { - if (ShiftoriumFrontend.UpgradeAttributesUnlocked(type)) - { - if (a is Namespace) - { - var ns = a as Namespace; - if (!primary.Contains(ns.name)) - { - primary += ns.name + " "; - } - foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) - { - if (ShiftoriumFrontend.UpgradeAttributesUnlocked(method)) - { - foreach (var ma in method.GetCustomAttributes(false)) - { - if (ma is Command) - { - var cmd = ma as Command; - if (!secondary.Contains(cmd.name)) - secondary += cmd.name + " "; - } - } - } - } - } - } - } - } - - - } - - public static void MakeWidget(Controls.TerminalBox txt) - { - AppearanceManager.StartConsoleOut(); - txt.GotFocus += (o, a) => - { - AppearanceManager.ConsoleOut = txt; - }; - txt.KeyDown += (o, a) => - { - if (a.Control == true || a.Alt == true) - { - a.SuppressKeyPress = true; - return; - } - - if (a.KeyCode == Keys.Enter) - { - try - { - a.SuppressKeyPress = true; - Console.WriteLine(""); - var text = txt.Lines.ToArray(); - var text2 = text[text.Length - 2]; - var text3 = ""; - var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); - - if (IsInRemoteSystem == true) - { - ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new - { - guid = RemoteGuid, - command = text4 - })); - } - else - { - if (TerminalBackend.PrefixEnabled) - { - 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") - { - CurrentCommandParser.parser = null; - } - else - { - if (CurrentCommandParser.parser == null) - { - TerminalBackend.InvokeCommand(text3); - } - else - { - var result = CurrentCommandParser.parser.ParseCommand(text3); - - if (result.Equals(default(KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>))) - { - Console.WriteLine("Syntax Error: Syntax Error"); - } - else - { - TerminalBackend.InvokeCommand(result.Key.Key, result.Key.Value, result.Value); - } - } - } - } - if (TerminalBackend.PrefixEnabled) - { - TerminalBackend.PrintPrompt(); - } - } - } - catch - { - } - } - else if (a.KeyCode == Keys.Back) - { - try - { - var tostring3 = txt.Lines[txt.Lines.Length - 1]; - var tostringlen = tostring3.Length + 1; - var workaround = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var derp = workaround.Length + 1; - if (tostringlen != derp) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.SuppressKeyPress = true; - } - } - catch - { - Debug.WriteLine("Drunky alert in terminal."); - } - } - else if (a.KeyCode == Keys.Left) - { - var getstring = txt.Lines[txt.Lines.Length - 1]; - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txt.SelectionStart; - var remstrlen = txt.TextLength - stringlen; - var finalnum = selstart - remstrlen; - - if (finalnum != headerlen) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.SuppressKeyPress = true; - } - } - else if (a.KeyCode == Keys.Up) - { - var tostring3 = txt.Lines[txt.Lines.Length - 1]; - if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") - Console.Write(TerminalBackend.LastCommand); - a.SuppressKeyPress = true; - - } - else - { - if (TerminalBackend.InStory) - { - a.SuppressKeyPress = true; - } - AppearanceManager.CurrentPosition++; - } - - }; - - AppearanceManager.ConsoleOut = txt; - - txt.Focus(); - - txt.Font = LoadedSkin.TerminalFont; - txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC); - txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC); - - } - - private void Terminal_Load(object sender, EventArgs e) - { - ServerManager.MessageReceived += (msg) => - { - if (msg.Name == "trm_handshake_guid") - { - IsInRemoteSystem = true; - RemoteGuid = msg.GUID; - } - else if (msg.Name == "trm_handshake_stop") - { - IsInRemoteSystem = false; - RemoteGuid = ""; - } - }; - } - - private void Terminal_FormClosing(object sender, FormClosingEventArgs e) - { - ti.Stop(); - IsInRemoteSystem = false; - RemoteGuid = ""; - } - - public void OnLoad() - { - MakeWidget(rtbterm); - - if (SaveSystem.CurrentSave != null) - { - if (!ShiftoriumFrontend.UpgradeInstalled("window_manager")) - { - rtbterm.Select(rtbterm.TextLength, 0); - } - } - - new Thread(() => - { - Thread.Sleep(1000); - TerminalBackend.PrintPrompt(); - }).Start(); - } - - public void OnSkinLoad() - { - try - { - rtbterm.Font = LoadedSkin.TerminalFont; - rtbterm.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC); - rtbterm.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC); - } - catch - { - - } - - } - - public bool OnUnload() - { - if (SaveSystem.ShuttingDown == false) - { - if (!ShiftoriumFrontend.UpgradeInstalled("desktop")) - { - if (AppearanceManager.OpenForms.Count <= 1) - { - Console.WriteLine(""); - Console.WriteLine("{WIN_CANTCLOSETERMINAL}"); - try - { - Console.WriteLine(""); - - if (TerminalBackend.PrefixEnabled) - { - Console.Write($"{SaveSystem.CurrentUser.Username}@shiftos:~$ "); - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - return false; - } - } - } - return true; - } - - public void OnUpgrade() - { - } - - private void rtbterm_TextChanged(object sender, EventArgs e) - { - - } - - internal void ClearText() - { - rtbterm.Text = ""; - } - } -}
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs deleted file mode 100644 index 0b23b8e..0000000 --- a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs +++ /dev/null @@ -1,130 +0,0 @@ -namespace ShiftOS.WinForms.Applications -{ - partial class UpdateManager - { - /// <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.lbupdatetitle = new System.Windows.Forms.Label(); - this.pnlupdatebar = new System.Windows.Forms.Panel(); - this.pgdownload = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); - this.btnaction = new System.Windows.Forms.Button(); - this.btnclose = new System.Windows.Forms.Button(); - this.wbstatus = new System.Windows.Forms.WebBrowser(); - this.pnlupdatebar.SuspendLayout(); - this.SuspendLayout(); - // - // lbupdatetitle - // - this.lbupdatetitle.AutoSize = true; - this.lbupdatetitle.Dock = System.Windows.Forms.DockStyle.Top; - this.lbupdatetitle.Location = new System.Drawing.Point(0, 0); - this.lbupdatetitle.Margin = new System.Windows.Forms.Padding(10); - this.lbupdatetitle.Name = "lbupdatetitle"; - this.lbupdatetitle.Size = new System.Drawing.Size(117, 13); - this.lbupdatetitle.TabIndex = 0; - this.lbupdatetitle.Tag = "header1"; - this.lbupdatetitle.Text = "Checking for updates..."; - // - // pnlupdatebar - // - this.pnlupdatebar.Controls.Add(this.pgdownload); - this.pnlupdatebar.Controls.Add(this.btnaction); - this.pnlupdatebar.Controls.Add(this.btnclose); - this.pnlupdatebar.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlupdatebar.Location = new System.Drawing.Point(0, 426); - this.pnlupdatebar.Name = "pnlupdatebar"; - this.pnlupdatebar.Size = new System.Drawing.Size(597, 33); - this.pnlupdatebar.TabIndex = 1; - // - // pgdownload - // - this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.pgdownload.BlockSize = 5; - this.pgdownload.Location = new System.Drawing.Point(86, 4); - this.pgdownload.Maximum = 100; - this.pgdownload.Name = "pgdownload"; - this.pgdownload.Size = new System.Drawing.Size(427, 23); - this.pgdownload.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.pgdownload.TabIndex = 2; - this.pgdownload.Text = "Updating..."; - this.pgdownload.Value = 0; - // - // btnaction - // - this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnaction.Location = new System.Drawing.Point(519, 4); - this.btnaction.Name = "btnaction"; - this.btnaction.Size = new System.Drawing.Size(75, 23); - this.btnaction.TabIndex = 1; - this.btnaction.Text = "Update"; - this.btnaction.UseVisualStyleBackColor = true; - // - // btnclose - // - this.btnclose.Location = new System.Drawing.Point(4, 4); - this.btnclose.Name = "btnclose"; - this.btnclose.Size = new System.Drawing.Size(75, 23); - this.btnclose.TabIndex = 0; - this.btnclose.Text = "{CLOSE}"; - this.btnclose.UseVisualStyleBackColor = true; - this.btnclose.Click += new System.EventHandler(this.btnclose_Click); - // - // wbstatus - // - this.wbstatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.wbstatus.Location = new System.Drawing.Point(0, 13); - this.wbstatus.MinimumSize = new System.Drawing.Size(20, 20); - this.wbstatus.Name = "wbstatus"; - this.wbstatus.Size = new System.Drawing.Size(597, 413); - this.wbstatus.TabIndex = 2; - // - // UpdateManager - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.wbstatus); - this.Controls.Add(this.pnlupdatebar); - this.Controls.Add(this.lbupdatetitle); - this.Name = "UpdateManager"; - this.Size = new System.Drawing.Size(597, 459); - this.pnlupdatebar.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label lbupdatetitle; - private System.Windows.Forms.Panel pnlupdatebar; - private Controls.ShiftedProgressBar pgdownload; - private System.Windows.Forms.Button btnaction; - private System.Windows.Forms.Button btnclose; - private System.Windows.Forms.WebBrowser wbstatus; - } -} diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs deleted file mode 100644 index d915c31..0000000 --- a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs +++ /dev/null @@ -1,168 +0,0 @@ -namespace ShiftOS.WinForms.Applications -{ - partial class VideoPlayer - { - /// <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(VideoPlayer)); - this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); - this.flcontrols = new System.Windows.Forms.FlowLayoutPanel(); - this.btnplay = new System.Windows.Forms.Button(); - this.pgplaytime = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.addSongToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.wpaudio = new AxWMPLib.AxWindowsMediaPlayer(); - this.toolStripContainer1.ContentPanel.SuspendLayout(); - this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); - this.toolStripContainer1.SuspendLayout(); - this.flcontrols.SuspendLayout(); - this.menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).BeginInit(); - this.SuspendLayout(); - // - // toolStripContainer1 - // - // - // toolStripContainer1.ContentPanel - // - this.toolStripContainer1.ContentPanel.Controls.Add(this.wpaudio); - this.toolStripContainer1.ContentPanel.Controls.Add(this.flcontrols); - this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(805, 402); - this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.toolStripContainer1.LeftToolStripPanelVisible = false; - this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); - this.toolStripContainer1.Name = "toolStripContainer1"; - this.toolStripContainer1.RightToolStripPanelVisible = false; - this.toolStripContainer1.Size = new System.Drawing.Size(805, 426); - this.toolStripContainer1.TabIndex = 3; - this.toolStripContainer1.Text = "toolStripContainer1"; - // - // toolStripContainer1.TopToolStripPanel - // - this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1); - // - // flcontrols - // - this.flcontrols.AutoSize = true; - this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flcontrols.Controls.Add(this.btnplay); - this.flcontrols.Controls.Add(this.pgplaytime); - this.flcontrols.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flcontrols.Location = new System.Drawing.Point(0, 373); - this.flcontrols.Name = "flcontrols"; - this.flcontrols.Size = new System.Drawing.Size(805, 29); - this.flcontrols.TabIndex = 0; - // - // btnplay - // - this.btnplay.AutoSize = true; - this.btnplay.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnplay.Location = new System.Drawing.Point(3, 3); - this.btnplay.Name = "btnplay"; - this.btnplay.Size = new System.Drawing.Size(37, 23); - this.btnplay.TabIndex = 0; - this.btnplay.Text = "Play"; - this.btnplay.UseVisualStyleBackColor = true; - this.btnplay.Click += new System.EventHandler(this.btnplay_Click); - // - // pgplaytime - // - this.pgplaytime.BlockSize = 5; - this.pgplaytime.Location = new System.Drawing.Point(46, 3); - this.pgplaytime.Maximum = 100; - this.pgplaytime.Name = "pgplaytime"; - this.pgplaytime.Size = new System.Drawing.Size(749, 23); - this.pgplaytime.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.pgplaytime.TabIndex = 1; - this.pgplaytime.Tag = "keepbg"; - this.pgplaytime.Text = "shiftedProgressBar1"; - this.pgplaytime.Value = 0; - this.pgplaytime.MouseDown += new System.Windows.Forms.MouseEventHandler(this.startScrub); - this.pgplaytime.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseMove); - this.pgplaytime.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseUp); - // - // menuStrip1 - // - this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None; - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addSongToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(805, 24); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // addSongToolStripMenuItem - // - this.addSongToolStripMenuItem.Name = "addSongToolStripMenuItem"; - this.addSongToolStripMenuItem.Size = new System.Drawing.Size(81, 20); - this.addSongToolStripMenuItem.Text = "Open Video"; - this.addSongToolStripMenuItem.Click += new System.EventHandler(this.addSongToolStripMenuItem_Click); - // - // wpaudio - // - this.wpaudio.Dock = System.Windows.Forms.DockStyle.Fill; - this.wpaudio.Enabled = true; - this.wpaudio.Location = new System.Drawing.Point(0, 0); - this.wpaudio.Name = "wpaudio"; - this.wpaudio.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wpaudio.OcxState"))); - this.wpaudio.Size = new System.Drawing.Size(805, 373); - this.wpaudio.TabIndex = 2; - this.wpaudio.Visible = false; - // - // VideoPlayer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.toolStripContainer1); - this.Name = "VideoPlayer"; - this.Size = new System.Drawing.Size(805, 426); - this.toolStripContainer1.ContentPanel.ResumeLayout(false); - this.toolStripContainer1.ContentPanel.PerformLayout(); - this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false); - this.toolStripContainer1.TopToolStripPanel.PerformLayout(); - this.toolStripContainer1.ResumeLayout(false); - this.toolStripContainer1.PerformLayout(); - this.flcontrols.ResumeLayout(false); - this.flcontrols.PerformLayout(); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.ToolStripContainer toolStripContainer1; - private System.Windows.Forms.FlowLayoutPanel flcontrols; - private System.Windows.Forms.Button btnplay; - private Controls.ShiftedProgressBar pgplaytime; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem addSongToolStripMenuItem; - private AxWMPLib.AxWindowsMediaPlayer wpaudio; - } -} diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs deleted file mode 100644 index e5a2c33..0000000 --- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs +++ /dev/null @@ -1,147 +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.Tasks; -using System.Windows.Forms; - -namespace ShiftOS.WinForms.Controls -{ - public partial class ShiftedProgressBar : Control - { - public ShiftedProgressBar() - { - this.SizeChanged += (o, a) => - { - this.Refresh(); - }; - var t = new Timer(); - t.Interval = 100; - t.Tick += (o, a) => - { - if(this._style == ProgressBarStyle.Marquee) - { - if(_marqueePos >= this.Width) - { - _marqueePos = 0 - (this.Width / 4); - } - else - { - _marqueePos++; - } - this.Refresh(); - } - }; - t.Start(); - } - - private int _value = 0; - private int _max = 100; - public int Value - { - get - { - return _value; - } - set - { - _value = value; - this.Refresh(); - } - } - public int Maximum - { - get - { - return _max; - } - set - { - _max = value; - this.Refresh(); - } - } - - public ProgressBarStyle _style = ProgressBarStyle.Continuous; - - public ProgressBarStyle Style - { - get { return _style; } - set { _style = value; this.Refresh(); } - } - - private int _blocksize = 5; - - public int BlockSize - { - get { return _blocksize; } - set - { - _blocksize = value; - this.Refresh(); - } - } - - protected override void OnPaint(PaintEventArgs pe) - { - pe.Graphics.Clear(Color.Black); - switch (_style) - { - case ProgressBarStyle.Continuous: - double width = linear(this.Value, 0, this.Maximum, 0, this.Width); - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new RectangleF(0, 0, (float)width, this.Height)); - break; - case ProgressBarStyle.Blocks: - int block_count = this.Width / (this._blocksize + 2); - int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); - for(int i = 0; i < blocks - 1; i++) - { - int position = i * (_blocksize + 2); - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new Rectangle(position, 0, _blocksize, this.Height)); - } - break; - case ProgressBarStyle.Marquee: - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); - break; - } - } - - private int _marqueePos = 0; - - static private double linear(double x, double x0, double x1, double y0, double y1) - { - if ((x1 - x0) == 0) - { - return (y0 + y1) / 2; - } - return y0 + (x - x0) * (y1 - y0) / (x1 - x0); - } - } -} diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs deleted file mode 100644 index ea7808c..0000000 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ /dev/null @@ -1,257 +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.Drawing; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using ShiftOS.WinForms.Tools; - -namespace ShiftOS.WinForms.Controls -{ - public class TerminalBox : RichTextBox, ITerminalWidget - { - public void SelectBottom() - { - try - { - this.Select(this.Text.Length, 0); - this.ScrollToCaret(); - } - catch { } - } - - protected override void Dispose(bool disposing) - { - if (disposing == true) - if(AppearanceManager.ConsoleOut == this) - AppearanceManager.ConsoleOut = null; - base.Dispose(disposing); - } - - protected override void OnClick(EventArgs e) - { - base.OnClick(e); - this.Select(this.TextLength, 0); - } - - public void Write(string text) - { - this.HideSelection = true; - this.SelectionFont = ConstructFont(); - this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); - this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); - this.AppendText(Localization.Parse(text)); - this.HideSelection = false; - } - - private Font ConstructFont() - { - FontStyle fs = FontStyle.Regular; - if (ConsoleEx.Bold) - fs = fs | FontStyle.Bold; - if (ConsoleEx.Italic) - fs = fs | FontStyle.Italic; - if (ConsoleEx.Underline) - fs = fs | FontStyle.Underline; - - return new Font(this.Font, fs); - } - - public void WriteLine(string text) - { - Engine.AudioManager.PlayStream(Properties.Resources.writesound); - this.HideSelection = true; - this.Select(this.TextLength, 0); - this.SelectionFont = ConstructFont(); - this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); - this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); - this.AppendText(Localization.Parse(text) + Environment.NewLine); - this.HideSelection = false; - } - - bool quickCopying = false; - - protected override void OnMouseDown(MouseEventArgs e) - { - //if right-clicking, then we initiate a quick-copy. - if (e.Button == MouseButtons.Right) - quickCopying = true; - - //Override the mouse event so that it's a left-click at all times. - base.OnMouseDown(new MouseEventArgs(MouseButtons.Left, e.Clicks, e.X, e.Y, e.Delta)); - } - - protected override void OnMouseUp(MouseEventArgs mevent) - { - if(quickCopying == true) - { - if (!string.IsNullOrWhiteSpace(this.SelectedText)) - { - this.Copy(); - } - } - base.OnMouseUp(mevent); - } - - protected override void OnKeyDown(KeyEventArgs e) - { - base.OnKeyDown(e); - if (!TerminalBackend.InStory) - { - switch (e.KeyCode) { - case Keys.Add: - case Keys.Alt: - case Keys.Apps: - case Keys.Attn: - case Keys.BrowserBack: - case Keys.BrowserFavorites: - case Keys.BrowserForward: - case Keys.BrowserHome: - case Keys.BrowserRefresh: - case Keys.BrowserSearch: - case Keys.BrowserStop: - case Keys.Cancel: - case Keys.Capital: - case Keys.Clear: - case Keys.Control: - case Keys.ControlKey: - case Keys.Crsel: - case Keys.Decimal: - case Keys.Divide: - case Keys.Down: - case Keys.End: - case Keys.Enter: - case Keys.EraseEof: - case Keys.Escape: - case Keys.Execute: - case Keys.Exsel: - case Keys.F1: - case Keys.F10: - case Keys.F11: - case Keys.F12: - case Keys.F13: - case Keys.F14: - case Keys.F15: - case Keys.F16: - case Keys.F17: - case Keys.F18: - case Keys.F19: - case Keys.F2: - case Keys.F20: - case Keys.F21: - case Keys.F22: - case Keys.F23: - case Keys.F24: - case Keys.F3: - case Keys.F4: - case Keys.F5: - case Keys.F6: - case Keys.F7: - case Keys.F8: - case Keys.F9: - case Keys.FinalMode: - case Keys.HanguelMode: - case Keys.HanjaMode: - case Keys.Help: - case Keys.Home: - case Keys.IMEAccept: - case Keys.IMEConvert: - case Keys.IMEModeChange: - case Keys.IMENonconvert: - case Keys.Insert: - case Keys.JunjaMode: - case Keys.KeyCode: - case Keys.LaunchApplication1: - case Keys.LaunchApplication2: - case Keys.LaunchMail: - case Keys.LButton: - case Keys.LControlKey: - case Keys.Left: - case Keys.LineFeed: - case Keys.LMenu: - case Keys.LShiftKey: - case Keys.LWin: - case Keys.MButton: - case Keys.MediaNextTrack: - case Keys.MediaPlayPause: - case Keys.MediaPreviousTrack: - case Keys.MediaStop: - case Keys.Menu: - case Keys.Modifiers: - case Keys.Multiply: - case Keys.Next: - case Keys.NoName: - case Keys.None: - case Keys.NumLock: - case Keys.Pa1: - case Keys.Packet: - case Keys.PageUp: - case Keys.Pause: - case Keys.Play: - case Keys.Print: - case Keys.PrintScreen: - case Keys.ProcessKey: - case Keys.RButton: - case Keys.RControlKey: - case Keys.Right: - case Keys.RMenu: - case Keys.RShiftKey: - case Keys.RWin: - case Keys.Scroll: - case Keys.Select: - case Keys.SelectMedia: - case Keys.Separator: - case Keys.Shift: - case Keys.ShiftKey: - case Keys.Sleep: - case Keys.Subtract: - case Keys.Tab: - case Keys.Up: - case Keys.VolumeDown: - case Keys.VolumeMute: - case Keys.VolumeUp: - case Keys.XButton1: - case Keys.XButton2: - case Keys.Zoom: - - break; - default: - //Engine.AudioManager.PlayStream(Properties.Resources.typesound); // infernal beeping noise only enable for the trailers - break; - } - } - } - - public TerminalBox() : base() - { - this.Tag = "keepbg keepfg keepfont"; - } - } -} diff --git a/ShiftOS.WinForms/DownloadControl.Designer.cs b/ShiftOS.WinForms/DownloadControl.Designer.cs deleted file mode 100644 index 2587b93..0000000 --- a/ShiftOS.WinForms/DownloadControl.Designer.cs +++ /dev/null @@ -1,116 +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 DownloadControl - { - /// <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.pcicon = new System.Windows.Forms.PictureBox(); - this.lbshiftneturl = new System.Windows.Forms.Label(); - this.pgprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); - ((System.ComponentModel.ISupportInitialize)(this.pcicon)).BeginInit(); - this.SuspendLayout(); - // - // pcicon - // - this.pcicon.BackColor = System.Drawing.Color.Black; - this.pcicon.Location = new System.Drawing.Point(4, 4); - this.pcicon.Name = "pcicon"; - this.pcicon.Size = new System.Drawing.Size(42, 42); - this.pcicon.TabIndex = 1; - this.pcicon.TabStop = false; - // - // lbshiftneturl - // - this.lbshiftneturl.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.lbshiftneturl.Location = new System.Drawing.Point(52, 4); - this.lbshiftneturl.Name = "lbshiftneturl"; - this.lbshiftneturl.Size = new System.Drawing.Size(323, 42); - this.lbshiftneturl.TabIndex = 2; - this.lbshiftneturl.Text = "label1"; - this.lbshiftneturl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // pgprogress - // - this.pgprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.pgprogress.BlockSize = 5; - this.pgprogress.Location = new System.Drawing.Point(4, 52); - this.pgprogress.Maximum = 100; - this.pgprogress.Name = "pgprogress"; - this.pgprogress.Size = new System.Drawing.Size(371, 23); - this.pgprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.pgprogress.TabIndex = 0; - this.pgprogress.Text = "shiftedProgressBar1"; - this.pgprogress.Value = 0; - // - // DownloadControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.lbshiftneturl); - this.Controls.Add(this.pcicon); - this.Controls.Add(this.pgprogress); - this.Name = "DownloadControl"; - this.Size = new System.Drawing.Size(382, 82); - ((System.ComponentModel.ISupportInitialize)(this.pcicon)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private Controls.ShiftedProgressBar pgprogress; - private System.Windows.Forms.PictureBox pcicon; - private System.Windows.Forms.Label lbshiftneturl; - } -} diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs deleted file mode 100644 index d5f28f8..0000000 --- a/ShiftOS.WinForms/Oobe.cs +++ /dev/null @@ -1,600 +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; -using ShiftOS.Objects; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Unite; -using ShiftOS.WinForms.Tools; - -namespace ShiftOS.WinForms -{ - public partial class Oobe : Form, IOobe, ITutorial - { - public Oobe() - { - InitializeComponent(); - this.FormBorderStyle = FormBorderStyle.None; - this.WindowState = FormWindowState.Maximized; - this.BackColor = Color.Black; - this.Load += (o, a) => - { - ControlManager.SetupControls(this); - }; - } - - - string rtext; - string gtexttotype; - int charcount; - int slashcount; - Label textgeninput; - public bool upgraded = false; - - private bool typing = false; - - public void TextType(string texttotype) - { - textgeninput.TextAlign = ContentAlignment.MiddleCenter; - while(typing == true) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - } - - charcount = texttotype.Length; - gtexttotype = texttotype; - slashcount = 1; - foreach (var c in gtexttotype) - { - typing = true; - rtext += c; - - this.Invoke(new Action(() => - { - textgeninput.Text = rtext + "|"; - })); - slashcount++; - if (slashcount == 5) - slashcount = 1; - Thread.Sleep(50); - } - rtext += Environment.NewLine; - typing = false; - } - - public Save MySave = null; - - public event EventHandler OnComplete; - - private int tutPrg = 0; - - public int TutorialProgress - { - get - { - return tutPrg; - } - - set - { - tutPrg = value; - } - } - - public void StartShowing(Save save) - { - var t = new Thread(new ThreadStart(() => - { - try - { - textgeninput = this.lblhackwords; - this.Invoke(new Action(() => - { - lblHijack.Hide(); - })); - - TextType(@"Throughout many years, man has tried to develop -a digital environment usable by anyone that never goes -offline, full of AIs and humans alike, thinking, interacting, -innovating. - -No one has ever come close to a digital society of such -properties yet, except for one sentient being. It does not -have a life, a gender, an age or a body, but simply one name. - -They call it ""DevX"". - -If anyone sees this message, my identity is anonymous, but I -need your help. I am trapped within ""DevX""'s digital society -with no way out, constantly under attack. - -You must join the digital society, rise up the ranks, and save us. - - - undisclosed_0x1DDFB5977."); - - Thread.Sleep(5000); - while(this.Opacity > 0f) - { - this.Invoke(new Action(() => - { - this.Opacity -= 0.01f; - })); - Thread.Sleep(25); - } - - Story.Start("mud_fundamentals"); - - this.Invoke(new Action(this.Close)); - } - catch (Exception e) - { - TextType("I have experienced an error."); - TextType(e.ToString()); - } - })); - this.Show(); - this.BringToFront(); - this.TopMost = true; - t.IsBackground = true; - t.Start(); - } - - public void Clear() - { - this.Invoke(new Action(() => - { - rtext = ""; - textgeninput.Text = ""; - })); - } - - public void ShowSaveTransfer(Save save) - { - //Stub. - } - - public void PerformUniteLogin() - { - - } - - public void PromptForLogin() - { - 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.", () => - { - Infobox.PromptYesNo("Website account", "Do you have an account at http://getshiftos.ml?", (hasAccount) => - { - if(hasAccount == true) - { - var loginDialog = new UniteLoginDialog((success)=> - { - 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.", () => - { - 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); - } - 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(); - sve.StoriesExperienced = new List<string>(); - sve.StoriesExperienced.Add("mud_fundamentals"); - 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; - Shiftorium.Silent = true; - SaveSystem.SaveGame(); - Shiftorium.Silent = false; - - }); - } - - 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() - { - while(AppearanceManager.OpenForms.Count > 0) - { - AppearanceManager.OpenForms[0].Close(); - } - - this.Show(); - this.TopMost = true; - this.TransparencyKey = Color.Magenta; - this.BackColor = this.TransparencyKey; - textgeninput = lblHijack; - textgeninput.BackColor = Color.Black; - textgeninput.Font = new Font("Lucida Console", 13F, FontStyle.Bold); - textgeninput.AutoSize = true; - textgeninput.TextAlign = ContentAlignment.MiddleCenter; - textgeninput.TextChanged += (o, a) => - { - textgeninput.Location = new Point( - (this.Width - textgeninput.Width) / 2, - (this.Height - textgeninput.Height) / 2 - ); - }; - var t = new Thread(() => - { - Clear(); - Thread.Sleep(5000); - TextType("Michael VanOverbeek"); - TextType("presents..."); - Thread.Sleep(2000); - Clear(); - Thread.Sleep(1000); - TextType("A community-developed game"); - Thread.Sleep(3000); - Clear(); - Thread.Sleep(1000); - this.Invoke(new Action(() => - { - textgeninput.Font = new Font("Lucida Console", 14F, FontStyle.Bold); - this.BackColor = Color.Black; - })); - TextType("Welcome to ShiftOS."); - Thread.Sleep(4000); - Clear(); - textgeninput = lblhackwords; - TextType("Hello."); - Thread.Sleep(500); - TextType("You have been cordially and involuntarily selected to participate in the development and testing of an experimental operating system called ShiftOS."); - Thread.Sleep(500); - TextType("I want ShiftOS to be the most advanced operating system in the world."); - Thread.Sleep(500); - TextType("In ShiftOS, you start out with nothing."); - Thread.Sleep(500); - TextType("And your goal is to upgrade the operating system from a barebones command line to a fully graphical operating system."); - Thread.Sleep(500); - TextType("Along the way, you'll meet many people - hackers, rebels, programmers, administrators and many more."); - Thread.Sleep(500); - TextType("You'll meet new friends and foes."); - Thread.Sleep(500); - TextType("Your goal: Take it over. Upgrade the operating system, and take over its multi-user domain."); - Thread.Sleep(500); - TextType("I won't reveal quite what you have to do, but if you can handle it, head over to http://getshiftos.ml/ and download the operating system now."); - Thread.Sleep(5000); - Clear(); - textgeninput = lblHijack; - TextType("Think you can handle it?"); - }); - t.IsBackground = false; - t.Start(); - } - - public void Start() - { - Shiftorium.Silent = false; - foreach(var frm in AppearanceManager.OpenForms) - { - (frm as Form).Invoke(new Action(() => { - frm.Close(); - })); - } - - TerminalBackend.CommandProcessed += (cmd, args) => - { - if(cmd == "sos.help") - { - if (TutorialProgress == 0) - TutorialProgress = 1; - } - else if(cmd == "sos.status") - { - if (TutorialProgress == 1) - TutorialProgress = 2; - - } - else if(cmd == "shiftorium.list") - { - if (TutorialProgress == 2) - { - TutorialProgress = 3; - SaveSystem.TransferCodepointsFrom("sys", 50); - } - } - else if(cmd == "shiftorium.info" && args == "{\"upgrade\":\"mud_fundamentals\"}") - { - if (TutorialProgress == 3) - TutorialProgress = 4; - } - else if(cmd == "win.open") - { - if (TutorialProgress == 4) - TutorialProgress = 5; - } - }; - if(this.Visible == false) - this.Show(); - var t = new Thread(() => - { - textgeninput = lblHijack; - Clear(); - textgeninput = lblhackwords; - Clear(); - - this.Invoke(new Action(() => - { - textgeninput.Font = SkinEngine.LoadedSkin.TerminalFont; - })); - TextType("ShiftOS has been installed successfully."); - Thread.Sleep(500); - TextType("Before you can continue to the operating system, here's a little tutorial on how to use it."); - Thread.Sleep(500); - TextType("Starting a Terminal..."); - Applications.Terminal term = null; - this.Invoke(new Action(() => - { - term = new Applications.Terminal(); - this.Controls.Add(term); - term.Location = new Point( - (this.Width - term.Width) / 2, - (this.Height - term.Height) / 2 - ); - term.Show(); - term.OnLoad(); - term.OnSkinLoad(); - term.OnUpgrade(); - })); - TextType("This little text box is called a Terminal."); - Thread.Sleep(500); - TextType("Normally, it would appear in full-screen, but this window is hosting it as a control so you can see this text as well."); - Thread.Sleep(500); - TextType("In ShiftOS, the Terminal is your main control centre for the operating system. You can see system status, check Codepoints, open other programs, buy upgrades, and more."); - Thread.Sleep(500); - TextType("Go ahead and type 'sos.help' to see a list of commands."); - while (TutorialProgress == 0) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - } - TextType("As you can see, sos.help gives you a list of all commands in the system."); - Thread.Sleep(500); - TextType("You can run any command, by typing in their Namespace, followed by a period (.), followed by their Command Name."); - Thread.Sleep(500); - TextType("Go ahead and run the 'status' command within the 'sos' namespace to see what the command does."); - while (TutorialProgress == 1) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - } - TextType("Brilliant. The sos.status command will tell you how many Codepoints you have, as well as how many upgrades you have installed and how many are available."); - Thread.Sleep(500); - TextType("Codepoints, as you know, are a special currency within ShiftOS. They are used to buy things within the multi-user domain, such as upgrades, scripts, and applications."); - Thread.Sleep(500); - TextType("You can earn Codepoints by doing things in ShiftOS - such as completing jobs for other users, making things like skins, scripts, documents, etc, and playing games like Pong."); - Thread.Sleep(500); - TextType("At times, you'll be given Codepoints to help complete a task. You will receive Codepoints from 'sys' - the multi-user domain itself."); - //SaveSystem.TransferCodepointsFrom("sys", 50); - TextType("Right now, you don't have any upgrades. Upgrades can give ShiftOS additional features and capabilities - like new core applications, supported file types, and new Terminal commands."); - Thread.Sleep(500); - TextType("You can easily get upgrades using the Shiftorium - a repository of approved ShiftOS upgrades."); - Thread.Sleep(500); - TextType("To start using the Shiftorium, simply type 'shiftorium.list' to see available upgrades."); - while (TutorialProgress == 2) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - } - Clear(); - TextType("Right now, you have enough Codepoints to buy the 'mud_fundamentals' upgrade. You can use shiftorium.info to see information about this upgrade."); - Thread.Sleep(500); - TextType("Some commands, like shiftorium.info, require you to pass information to them in the form of arguments."); - Thread.Sleep(500); - TextType("Argument pairs sit at the end of the command, and are enclosed in curly braces."); - Thread.Sleep(500); - TextType("Inside these curly braces, you can input an argument key, followed by a colon, followed by the value. Then, if you need multiple arguments, you can put a comma after the value, and then insert another argument pair."); - Thread.Sleep(500); - TextType("There are different value types - numeric values, which can be any positive or negative 32-bit integer"); - Thread.Sleep(500); - TextType("Then there are boolean values which can be either 'true' or 'false'"); - Thread.Sleep(500); - TextType("Then there are string values, which are enclosed in double-quotes."); - Thread.Sleep(500); - TextType(" If for some reason you need to use a double-quote inside a string, you must escape it using a single backslash followed by the quote, like this: key:\"My \\\"awesome\\\" value.\""); - Thread.Sleep(500); - TextType("If you want to escape a backslash inside a string, simply type two backslashes instead of one - for example key:\"Back\\\\slash.\""); - Thread.Sleep(500); - TextType("shiftorium.info requires an upgrade argument, which is a string type. Go ahead and give shiftorium.info's upgrade argument the 'mud_fundamentals' upgrade's ID."); - while (TutorialProgress == 3) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - } - TextType("As you can see, mud_fundamentals is very useful. In fact, a lot of useful upgrades depend on it. You should buy it!"); - Thread.Sleep(500); - TextType("shiftorium.info already gave you a command that will let you buy the upgrade - go ahead and run that command!"); - while (!Shiftorium.UpgradeInstalled("mud_fundamentals")) - { //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - - } - TextType("Hooray! You now have the MUD Fundamentals upgrade."); - Thread.Sleep(500); - TextType("You can also earn more Codepoints by playing Pong. To open Pong, you can use the win.open command."); - Thread.Sleep(500); - TextType("If you run win.open without arguments, you can see a list of applications that you can open."); - Thread.Sleep(500); - TextType("Just run win.open without arguments, and this tutorial will be completed!"); - while (TutorialProgress == 4) - { - //JESUS CHRIST PAST MICHAEL. - - //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. - Thread.Sleep(100); - - } - TextType("This concludes the ShiftOS beginners' guide brought to you by the multi-user domain. Stay safe in a connected world."); - Thread.Sleep(2000); - Desktop.InvokeOnWorkerThread(() => - { - OnComplete?.Invoke(this, EventArgs.Empty); - SaveSystem.CurrentSave.StoryPosition = 2; - this.Close(); - SaveSystem.SaveGame(); - AppearanceManager.SetupWindow(new Applications.Terminal()); - }); - - }); - t.IsBackground = true; - t.Start(); - } - } -} diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs deleted file mode 100644 index ad8fc83..0000000 --- a/ShiftOS.WinForms/Program.cs +++ /dev/null @@ -1,269 +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.Drawing; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using Newtonsoft.Json; -using static ShiftOS.Objects.ShiftFS.Utils; -using ShiftOS.WinForms.Applications; -using ShiftOS.WinForms.Tools; -using System.Reflection; -using System.IO; - -namespace ShiftOS.WinForms -{ - public static class Program - { - /// <summary> - /// The main entry point for the application. - /// </summary> - [STAThread] - public static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael - LoginManager.Init(new GUILoginFrontend()); - CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); - SkinEngine.SetIconProber(new ShiftOSIconProvider()); - ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider()); - Localization.RegisterProvider(new WFLanguageProvider()); - AppearanceManager.OnExit += () => - { - Environment.Exit(0); - }; - - TutorialManager.RegisterTutorial(new Oobe()); - - TerminalBackend.TerminalRequested += () => - { - AppearanceManager.SetupWindow(new Applications.Terminal()); - }; - Infobox.Init(new Dialog()); - FileSkimmerBackend.Init(new WinformsFSFrontend()); - var desk = new WinformsDesktop(); - Desktop.Init(desk); - OutOfBoxExperience.Init(new Oobe()); - AppearanceManager.Initiate(new WinformsWindowManager()); - Application.Run(desk); - } - } - - internal class ShiftOSIconProvider : IIconProber - { - public Image GetIcon(DefaultIconAttribute attr) - { - - var res = typeof(Properties.Resources); - foreach(var prop in res.GetProperties(BindingFlags.NonPublic | BindingFlags.Static)) - { - if(prop.PropertyType.BaseType == typeof(Image)) - { - if(prop.Name == attr.ID) - { - return prop.GetValue(null) as Image; - } - } - } - return new Bitmap(16, 16); - } - } - - [ShiftoriumProvider] - internal class WinformsShiftoriumProvider : IShiftoriumProvider - { - public List<ShiftoriumUpgrade> GetDefaults() - { - var defaultList = JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium); - - foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) - { - if (exe.EndsWith(".exe") || exe.EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) - { - var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute; - if (attrib != null) - { - var upgrade = new ShiftoriumUpgrade - { - Id = attrib.Name.ToLower().Replace(" ", "_"), - Name = attrib.Name, - Description = attrib.Description, - Cost = attrib.Cost, - Category = attrib.Category, - Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString - }; - defaultList.Add(upgrade); - } - - var sattrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is StpContents) as StpContents; - if (sattrib != null) - { - var upgrade = new ShiftoriumUpgrade - { - Id = sattrib.Upgrade, - Name = sattrib.Name, - Description = "This is a hidden dummy upgrade for the .stp file installation attribute \"" + sattrib.Name + "\".", - Cost = 0, - Category = "If this is shown, there's a bug in the Shiftorium Provider or the user is a supreme Shifter.", - Dependencies = "dummy_nodisplay" - }; - defaultList.Add(upgrade); - } - - } - - - - - } - catch { } - } - } - return defaultList; - } - } - - public class WinformsFSFrontend : IFileSkimmer - { - - - public void OpenDirectory(string path) - { - var fs = new Applications.FileSkimmer(); - AppearanceManager.SetupWindow(fs); - fs.ChangeDirectory(path); - } - - public void GetPath(string[] filetypes, FileOpenerStyle style, Action<string> callback) - { - AppearanceManager.SetupDialog(new Applications.FileDialog(filetypes, style, callback)); - } - - public void OpenFile(string path) - { - try - { - switch (FileSkimmerBackend.GetFileType(path)) - { - case FileType.TextFile: - if (!Shiftorium.UpgradeInstalled("textpad")) - throw new Exception(); - - var txt = new TextPad(); - AppearanceManager.SetupWindow(txt); - txt.LoadFile(path); - break; - case FileType.Executable: - //NYI - throw new Exception(); - case FileType.Lua: - try - { - var runner = new Engine.Scripting.LuaInterpreter(); - runner.ExecuteFile(path); - } - catch (Exception ex) - { - Infobox.Show("{LUA_ERROR}", ex.Message); - } - break; - case FileType.JSON: - //NYI - throw new Exception(); - case FileType.Filesystem: - MountPersistent(path); - //If this doesn't fail... - FileSkimmerBackend.OpenDirectory((Mounts.Count - 1).ToString() + ":"); - break; - case FileType.Skin: - if (!Shiftorium.UpgradeInstalled("skinning")) - throw new Exception(); - - var sl = new Skin_Loader(); - AppearanceManager.SetupWindow(sl); - sl.LoadedSkin = JsonConvert.DeserializeObject<Skin>(ReadAllText(path)); - sl.SetupUI(); - break; - case FileType.Image: - if (!Shiftorium.UpgradeInstalled("artpad_open")) - throw new Exception(); - - var ap = new Artpad(); - AppearanceManager.SetupWindow(ap); - ap.LoadPicture(path); - break; - default: - throw new Exception(); - - } - } - catch - { - Infobox.Show("{NO_APP_TO_OPEN}", "{NO_APP_TO_OPEN_EXP}"); - } - - } - - public Image GetImage(string path) - { - return Applications.FileSkimmer.GetImage(FileSkimmerBackend.GetFileType(path)); - } - - public string GetFileExtension(FileType fileType) - { - switch (fileType) - { - case FileType.Executable: - return ".saa"; - case FileType.Filesystem: - return ".mfs"; - case FileType.Image: - return ".pic"; - case FileType.JSON: - return ".json"; - case FileType.Lua: - return ".lua"; - case FileType.Python: - return ".py"; - case FileType.Skin: - return ".skn"; - case FileType.TextFile: - return ".txt"; - default: - return ".bin"; - - } - } - } -} diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs deleted file mode 100644 index caaf503..0000000 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ /dev/null @@ -1,1394 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace ShiftOS.WinForms.Properties { - using System; - - - /// <summary> - /// A strongly-typed resource class, for looking up localized strings, etc. - /// </summary> - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// <summary> - /// Returns the cached ResourceManager instance used by this class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.WinForms.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// <summary> - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// <summary> - /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. - /// </summary> - internal static System.IO.UnmanagedMemoryStream _3beepvirus { - get { - return ResourceManager.GetStream("_3beepvirus", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadcirclerubber { - get { - object obj = ResourceManager.GetObject("ArtPadcirclerubber", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadcirclerubberselected { - get { - object obj = ResourceManager.GetObject("ArtPadcirclerubberselected", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPaderacer { - get { - object obj = ResourceManager.GetObject("ArtPaderacer", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadfloodfill { - get { - object obj = ResourceManager.GetObject("ArtPadfloodfill", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadlinetool { - get { - object obj = ResourceManager.GetObject("ArtPadlinetool", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadmagnify { - get { - object obj = ResourceManager.GetObject("ArtPadmagnify", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadnew { - get { - object obj = ResourceManager.GetObject("ArtPadnew", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadopen { - get { - object obj = ResourceManager.GetObject("ArtPadopen", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadOval { - get { - object obj = ResourceManager.GetObject("ArtPadOval", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadpaintbrush { - get { - object obj = ResourceManager.GetObject("ArtPadpaintbrush", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadpencil { - get { - object obj = ResourceManager.GetObject("ArtPadpencil", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadpixelplacer { - get { - object obj = ResourceManager.GetObject("ArtPadpixelplacer", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadRectangle { - get { - object obj = ResourceManager.GetObject("ArtPadRectangle", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadredo { - get { - object obj = ResourceManager.GetObject("ArtPadredo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadsave { - get { - object obj = ResourceManager.GetObject("ArtPadsave", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadsquarerubber { - get { - object obj = ResourceManager.GetObject("ArtPadsquarerubber", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadsquarerubberselected { - get { - object obj = ResourceManager.GetObject("ArtPadsquarerubberselected", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadtexttool { - get { - object obj = ResourceManager.GetObject("ArtPadtexttool", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap ArtPadundo { - get { - object obj = ResourceManager.GetObject("ArtPadundo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap DefaultMouse { - get { - object obj = ResourceManager.GetObject("DefaultMouse", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. - /// </summary> - internal static System.IO.UnmanagedMemoryStream dial_up_modem_02 { - get { - return ResourceManager.GetStream("dial_up_modem_02", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon0 { - get { - object obj = ResourceManager.GetObject("fileicon0", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon1 { - get { - object obj = ResourceManager.GetObject("fileicon1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon10 { - get { - object obj = ResourceManager.GetObject("fileicon10", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon11 { - get { - object obj = ResourceManager.GetObject("fileicon11", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon12 { - get { - object obj = ResourceManager.GetObject("fileicon12", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon13 { - get { - object obj = ResourceManager.GetObject("fileicon13", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon14 { - get { - object obj = ResourceManager.GetObject("fileicon14", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon15 { - get { - object obj = ResourceManager.GetObject("fileicon15", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon16 { - get { - object obj = ResourceManager.GetObject("fileicon16", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon17 { - get { - object obj = ResourceManager.GetObject("fileicon17", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon18 { - get { - object obj = ResourceManager.GetObject("fileicon18", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon19 { - get { - object obj = ResourceManager.GetObject("fileicon19", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon2 { - get { - object obj = ResourceManager.GetObject("fileicon2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon3 { - get { - object obj = ResourceManager.GetObject("fileicon3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon4 { - get { - object obj = ResourceManager.GetObject("fileicon4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon5 { - get { - object obj = ResourceManager.GetObject("fileicon5", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon6 { - get { - object obj = ResourceManager.GetObject("fileicon6", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon7 { - get { - object obj = ResourceManager.GetObject("fileicon7", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon8 { - get { - object obj = ResourceManager.GetObject("fileicon8", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileicon9 { - get { - object obj = ResourceManager.GetObject("fileicon9", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileiconcf { - get { - object obj = ResourceManager.GetObject("fileiconcf", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap fileiconsaa { - get { - object obj = ResourceManager.GetObject("fileiconsaa", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap FloppyDriveIcon { - get { - object obj = ResourceManager.GetObject("FloppyDriveIcon", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized string similar to . - /// </summary> - internal static string hello { - get { - return ResourceManager.GetString("hello", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconArtpad { - get { - object obj = ResourceManager.GetObject("iconArtpad", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconAudioPlayer { - get { - object obj = ResourceManager.GetObject("iconAudioPlayer", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconBitnoteDigger { - get { - object obj = ResourceManager.GetObject("iconBitnoteDigger", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconBitnoteWallet { - get { - object obj = ResourceManager.GetObject("iconBitnoteWallet", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconCalculator { - get { - object obj = ResourceManager.GetObject("iconCalculator", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconClock { - get { - object obj = ResourceManager.GetObject("iconClock", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconColourPicker_fw { - get { - object obj = ResourceManager.GetObject("iconColourPicker_fw", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconDodge { - get { - object obj = ResourceManager.GetObject("iconDodge", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconDownloader { - get { - object obj = ResourceManager.GetObject("iconDownloader", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconFileOpener_fw { - get { - object obj = ResourceManager.GetObject("iconFileOpener_fw", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconFileSaver_fw { - get { - object obj = ResourceManager.GetObject("iconFileSaver_fw", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconFileSkimmer { - get { - object obj = ResourceManager.GetObject("iconFileSkimmer", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconfloodgate { - get { - object obj = ResourceManager.GetObject("iconfloodgate", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconFormatEditor { - get { - object obj = ResourceManager.GetObject("iconFormatEditor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap icongraphicpicker { - get { - object obj = ResourceManager.GetObject("icongraphicpicker", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconIconManager { - get { - object obj = ResourceManager.GetObject("iconIconManager", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconInfoBox_fw { - get { - object obj = ResourceManager.GetObject("iconInfoBox_fw", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconKnowledgeInput { - get { - object obj = ResourceManager.GetObject("iconKnowledgeInput", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconmaze { - get { - object obj = ResourceManager.GetObject("iconmaze", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconNameChanger { - get { - object obj = ResourceManager.GetObject("iconNameChanger", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconoctocat { - get { - object obj = ResourceManager.GetObject("iconoctocat", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconorcwrite { - get { - object obj = ResourceManager.GetObject("iconorcwrite", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconPong { - get { - object obj = ResourceManager.GetObject("iconPong", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShifter { - get { - object obj = ResourceManager.GetObject("iconShifter", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShiftLetters { - get { - object obj = ResourceManager.GetObject("iconShiftLetters", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShiftLotto { - get { - object obj = ResourceManager.GetObject("iconShiftLotto", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShiftnet { - get { - object obj = ResourceManager.GetObject("iconShiftnet", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShiftorium { - get { - object obj = ResourceManager.GetObject("iconShiftorium", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconShiftSweeper { - get { - object obj = ResourceManager.GetObject("iconShiftSweeper", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconshutdown { - get { - object obj = ResourceManager.GetObject("iconshutdown", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconshutdown1 { - get { - object obj = ResourceManager.GetObject("iconshutdown1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconSkinLoader { - get { - object obj = ResourceManager.GetObject("iconSkinLoader", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconSkinShifter { - get { - object obj = ResourceManager.GetObject("iconSkinShifter", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconSnakey { - get { - object obj = ResourceManager.GetObject("iconSnakey", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconSysinfo { - get { - object obj = ResourceManager.GetObject("iconSysinfo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconTerminal { - get { - object obj = ResourceManager.GetObject("iconTerminal", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconTextPad { - get { - object obj = ResourceManager.GetObject("iconTextPad", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconunitytoggle { - get { - object obj = ResourceManager.GetObject("iconunitytoggle", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconVideoPlayer { - get { - object obj = ResourceManager.GetObject("iconVideoPlayer", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconvirusscanner { - get { - object obj = ResourceManager.GetObject("iconvirusscanner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap iconWebBrowser { - get { - object obj = ResourceManager.GetObject("iconWebBrowser", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. - /// </summary> - internal static System.IO.UnmanagedMemoryStream infobox { - get { - return ResourceManager.GetStream("infobox", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap justthes { - get { - object obj = ResourceManager.GetObject("justthes", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized string similar to [ - /// "english" - /// "deutsch" - ///]. - /// </summary> - internal static string languages { - get { - return ResourceManager.GetString("languages", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap RegularDesktopGlyph { - get { - object obj = ResourceManager.GetObject("RegularDesktopGlyph", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized string similar to [ - /// { - /// Name: "Freebie Solutions", - /// DownloadSpeed: 256, - /// CostPerMonth: 0, - /// Description: "The Shiftnet is a wonderful place full of apps, games, websites and skins for ShiftOS. - /// - ///With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet without any worry about monthly fees.", - /// Company: "ShiftSoft" - /// }, - /// { - /// Company: "Shiftcast", - /// Name: "NetXtreme Hyper Edition", - /// CostPerMonth: 1500, - /// DownloadSpeed: 524288, //512 kb/s - /// Description: "It's time to supercharge your Shif [rest of string was truncated]";. - /// </summary> - internal static string ShiftnetServices { - get { - return ResourceManager.GetString("ShiftnetServices", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to [ - /// //TEMPORARY - /// { - /// Name: "Desktop Widgets", - /// Cost: 0, - /// Description: "Temporary upgrade. Will be replaced by either a Shiftnet app or a story element.", - /// Dependencies: "advanced_app_launcher;wm_free_placement", - /// Category: "Work-in-progress" - /// }, - /// - /// - /// - ///// SCREENSAVER - /// { - /// Name: "Screensavers", - /// Cost: 750, - /// Description: "Like to leave your PC idle for long periods of time? Save some energy and keep your screen from being tired by hiding the desktop behind a black screen with an image on it." [rest of string was truncated]";. - /// </summary> - internal static string Shiftorium { - get { - return ResourceManager.GetString("Shiftorium", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} - ///{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fl [rest of string was truncated]";. - /// </summary> - internal static string ShiftOS { - get { - return ResourceManager.GetString("ShiftOS", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyBG { - get { - object obj = ResourceManager.GetObject("SnakeyBG", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyBody { - get { - object obj = ResourceManager.GetObject("SnakeyBody", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyFruit { - get { - object obj = ResourceManager.GetObject("SnakeyFruit", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyHeadD { - get { - object obj = ResourceManager.GetObject("SnakeyHeadD", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyHeadL { - get { - object obj = ResourceManager.GetObject("SnakeyHeadL", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyHeadR { - get { - object obj = ResourceManager.GetObject("SnakeyHeadR", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyHeadU { - get { - object obj = ResourceManager.GetObject("SnakeyHeadU", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyTailD { - get { - object obj = ResourceManager.GetObject("SnakeyTailD", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyTailL { - get { - object obj = ResourceManager.GetObject("SnakeyTailL", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyTailR { - get { - object obj = ResourceManager.GetObject("SnakeyTailR", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SnakeyTailU { - get { - object obj = ResourceManager.GetObject("SnakeyTailU", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized string similar to [ - /// "http://downloads.michaeltheshifter.me/music/blockride.mp3", - /// "http://downloads.michaeltheshifter.me/music/nightcoding.mp3" - ///]. - /// </summary> - internal static string Songs { - get { - return ResourceManager.GetString("Songs", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to { - /// "{SUBMIT}":"Bestätigen", - /// - ///"{TERMINAL_TUTORIAL_1}":"Wilkommen zum ShiftOS Terminal. Hier wirst du die meiste Zeit in ShiftOS verbringen. - /// - ///Eine kurze Erklärung wie du das Terminal benutzt lautet wiefolgt. Du kannst das command 'sos.help' benutzen um eine Liste aller commands aufzurufen. Schreib es - ///einfach in das Terminal und drücke <enter> um alle commands anzuzeigen. - /// - ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Be [rest of string was truncated]";. - /// </summary> - internal static string strings_de { - get { - return ResourceManager.GetString("strings_de", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to { - /// "{SUBMIT}":"Submit", - /// - ///"{TERMINAL_TUTORIAL_1}":"Welcome to the ShiftOS terminal. This is where you will spend the bulk of your time within ShiftOS. - /// - ///A brief rundown of how to use the terminal is as follows. You can use the 'sos.help' command to show a list of all commands. Simply type it in and strike <enter> to view all commands. - /// - ///Commands can be sent arguments by specifying a key-value pair inside a {} block at the end of the command. For example: - /// - ///some.command{print:\"hello\"} - ///math.add{op1 [rest of string was truncated]";. - /// </summary> - internal static string strings_en { - get { - return ResourceManager.GetString("strings_en", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SuperDesk_screenshot { - get { - object obj = ResourceManager.GetObject("SuperDesk screenshot", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperClickFace { - get { - object obj = ResourceManager.GetObject("SweeperClickFace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperLoseFace { - get { - object obj = ResourceManager.GetObject("SweeperLoseFace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperNormalFace { - get { - object obj = ResourceManager.GetObject("SweeperNormalFace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile0 { - get { - object obj = ResourceManager.GetObject("SweeperTile0", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile1 { - get { - object obj = ResourceManager.GetObject("SweeperTile1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile2 { - get { - object obj = ResourceManager.GetObject("SweeperTile2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile3 { - get { - object obj = ResourceManager.GetObject("SweeperTile3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile4 { - get { - object obj = ResourceManager.GetObject("SweeperTile4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile5 { - get { - object obj = ResourceManager.GetObject("SweeperTile5", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile6 { - get { - object obj = ResourceManager.GetObject("SweeperTile6", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile7 { - get { - object obj = ResourceManager.GetObject("SweeperTile7", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTile8 { - get { - object obj = ResourceManager.GetObject("SweeperTile8", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTileBlock { - get { - object obj = ResourceManager.GetObject("SweeperTileBlock", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTileBomb { - get { - object obj = ResourceManager.GetObject("SweeperTileBomb", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperTileFlag { - get { - object obj = ResourceManager.GetObject("SweeperTileFlag", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// </summary> - internal static System.Drawing.Bitmap SweeperWinFace { - get { - object obj = ResourceManager.GetObject("SweeperWinFace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// <summary> - /// Looks up a localized string similar to { - /// Character: "sys", - /// Lines:[ - /// "Hello there, %user.", - /// "Welcome to ShiftOS.", - /// "This is an automated message to all new sentiences within the ShiftOS multi-user domain.", - /// "Before you can begin with ShiftOS, you'll need to know a few things about it.", - /// "One: Terminal command syntax.", - /// "Inside ShiftOS, the bulk of your time is going to be spent within the Terminal.", - /// "The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, ope [rest of string was truncated]";. - /// </summary> - internal static string sys_shiftoriumstory { - get { - return ResourceManager.GetString("sys_shiftoriumstory", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. - /// </summary> - internal static System.IO.UnmanagedMemoryStream typesound { - get { - return ResourceManager.GetStream("typesound", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. - /// </summary> - internal static System.IO.UnmanagedMemoryStream writesound { - get { - return ResourceManager.GetStream("writesound", resourceCulture); - } - } - } -} diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs deleted file mode 100644 index 3d66b2b..0000000 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ /dev/null @@ -1,300 +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.Drawing; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using static ShiftOS.Engine.AppearanceManager; - - -namespace ShiftOS.WinForms.Tools -{ - public static class ControlManager - { - [DllImport("user32.dll")] - public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam); - - private const int WM_SETREDRAW = 11; - - public static void SuspendDrawing(Control parent) - { - SendMessage(parent.Handle, WM_SETREDRAW, false, 0); - } - - public static void ResumeDrawing(Control parent) - { - SendMessage(parent.Handle, WM_SETREDRAW, true, 0); - parent.Refresh(); - } - - public static void Close(this UserControl ctrl) - { - for (int i = 0; i < AppearanceManager.OpenForms.Count; i++) - { - if (OpenForms[i].ParentWindow == ctrl) - { - (OpenForms[i] as Form).Close(); - return; - } - } - } - - - internal static Color ConvertColor(ConsoleColor cCol) - { - switch (cCol) - { - case ConsoleColor.Black: - return Color.Black; - case ConsoleColor.Gray: - return Color.Gray; - case ConsoleColor.DarkGray: - return Color.DarkGray; - case ConsoleColor.Blue: - return Color.Blue; - case ConsoleColor.Cyan: - return Color.Cyan; - case ConsoleColor.DarkBlue: - return Color.DarkBlue; - case ConsoleColor.DarkCyan: - return Color.DarkCyan; - case ConsoleColor.DarkGreen: - return Color.DarkGreen; - case ConsoleColor.DarkMagenta: - return Color.DarkMagenta; - case ConsoleColor.DarkRed: - return Color.DarkRed; - case ConsoleColor.DarkYellow: - return Color.YellowGreen; - case ConsoleColor.Yellow: - return Color.Yellow; - case ConsoleColor.Green: - return Color.Green; - case ConsoleColor.Magenta: - return Color.Magenta; - case ConsoleColor.Red: - return Color.Red; - case ConsoleColor.White: - return Color.White; - default: - return Color.Black; - } - - } - - public static void SetCursor(Control ctrl) - { -#if STUPID - if (!(ctrl is WebBrowser)) - { - var mouse = SkinEngine.GetImage("mouse"); - if (mouse == null) - mouse = Properties.Resources.DefaultMouse; - - var mBmp = new Bitmap(mouse); - mBmp.MakeTransparent(Color.FromArgb(1, 0, 1)); - var gfx = Graphics.FromImage(mBmp); - var handle = mBmp.GetHicon(); - - var cursor = new Cursor(handle); - ctrl.Cursor = cursor; - } -#endif - } - - /// <summary> - /// Centers the control along its parent. - /// </summary> - /// <param name="ctrl">The control to center (this is an extension method - you can call it on a control as though it was a method in that control)</param> - public static void CenterParent(this Control ctrl) - { - ctrl.Location = new Point( - (ctrl.Parent.Width - ctrl.Width) / 2, - (ctrl.Parent.Height - ctrl.Height) / 2 - ); - } - - public static void SetupControl(Control ctrl) - { - Desktop.InvokeOnWorkerThread(new Action(() => - { - ctrl.SuspendLayout(); - })); - if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) - { - string tag = ""; - - try - { - if(ctrl.Tag != null) - tag = ctrl.Tag.ToString(); - } - catch { } - - if (!tag.Contains("keepbg")) - { - if (ctrl.BackColor != Control.DefaultBackColor) - { - Desktop.InvokeOnWorkerThread(() => - { - ctrl.BackColor = SkinEngine.LoadedSkin.ControlColor; - }); - } - } - - if (!tag.Contains("keepfont")) - { - Desktop.InvokeOnWorkerThread(() => - { - ctrl.ForeColor = SkinEngine.LoadedSkin.ControlTextColor; - ctrl.Font = SkinEngine.LoadedSkin.MainFont; - }); - if (tag.Contains("header1")) - { - Desktop.InvokeOnWorkerThread(() => - { - ctrl.Font = SkinEngine.LoadedSkin.HeaderFont; - }); - } - - if (tag.Contains("header2")) - { - Desktop.InvokeOnWorkerThread(() => - { - ctrl.Font = SkinEngine.LoadedSkin.Header2Font; - }); - } - - if (tag.Contains("header3")) - { - Desktop.InvokeOnWorkerThread(() => - { - - ctrl.Font = SkinEngine.LoadedSkin.Header3Font; - }); - } - } - try - { - string ctrlText = Localization.Parse(ctrl.Text); - Desktop.InvokeOnWorkerThread(() => - { - ctrl.Text = ctrlText; - }); - } - catch - { - - } - ctrl.KeyDown += (o, a) => - { - if (a.Control && a.KeyCode == Keys.T) - { - a.SuppressKeyPress = true; - - - Engine.AppearanceManager.SetupWindow(new Applications.Terminal()); - } - - ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a); - //a.Handled = true; - }; - if (ctrl is Button) - { - Desktop.InvokeOnWorkerThread(() => - { - (ctrl as Button).FlatStyle = FlatStyle.Flat; - }); - } - else if (ctrl is WindowBorder) - { - Desktop.InvokeOnWorkerThread(() => - { - (ctrl as WindowBorder).Setup(); - }); - } - } - Desktop.InvokeOnWorkerThread(() => - { - - MakeDoubleBuffered(ctrl); - ctrl.ResumeLayout(); - }); - ControlSetup?.Invoke(ctrl); - } - - public static event Action<Control> ControlSetup; - - public static void MakeDoubleBuffered(Control c) - { - if (System.Windows.Forms.SystemInformation.TerminalServerSession) - return; - - System.Reflection.PropertyInfo aProp = - typeof(System.Windows.Forms.Control).GetProperty( - "DoubleBuffered", - System.Reflection.BindingFlags.NonPublic | - System.Reflection.BindingFlags.Instance); - - aProp.SetValue(c, true, null); - - } - - public static void SetupControls(Control frm, bool runInThread = true) - { - SetupControl(frm); - frm.Click += (o, a) => - { - Desktop.HideAppLauncher(); - }; - ThreadStart ts = () => - { - for (int i = 0; i < frm.Controls.Count; i++) - { - SetupControls(frm.Controls[i], false); - } - - }; - - if (runInThread == true) - { - var t = new Thread(ts); - t.IsBackground = true; - t.Start(); - } - else - { - ts?.Invoke(); - } - } - - } -} diff --git a/ShiftOS.WinForms/Tools/DitheringEngine.cs b/ShiftOS.WinForms/Tools/DitheringEngine.cs deleted file mode 100644 index 8509a0b..0000000 --- a/ShiftOS.WinForms/Tools/DitheringEngine.cs +++ /dev/null @@ -1,402 +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. - */ - -#define FLOYDSTEINBERG - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Drawing; -using System.Threading; -using ShiftOS.Engine; -using System.Runtime.InteropServices; - -namespace ShiftOS.WinForms.Tools -{ - public static class DitheringEngine - { - public static Color GetColor(Color source) - { - if (Shiftorium.UpgradeInstalled("color_depth_24_bits")) - { - return Color.FromArgb(source.R, source.G, source.B); //get rid of the alpha channel. - } - else - { - if (Shiftorium.UpgradeInstalled("color_depth_16_bits")) - { - byte r = (byte)linear(source.R, 0, 0xFF, 0, 0x1F); - byte g = (byte)linear(source.G, 0, 0xFF, 0, 0x3F); - byte b = (byte)linear(source.B, 0, 0xFF, 0, 0x1F); - - return Color.FromArgb(r, g, b); - } - else - { - int gray = (source.R + source.G + source.B) / 3; - - if (Shiftorium.UpgradeInstalled("color_depth_8_bits")) - return Color.FromArgb(gray, gray, gray); - else - { - if (Shiftorium.UpgradeInstalled("color_depth_6_bits")) - { - int gray6 = (int)linear(gray, 0, 0xFF, 0, 0x3F) * 3; - - - - return Color.FromArgb(gray6, gray6, gray6); - } - else - { - if (Shiftorium.UpgradeInstalled("color_depth_4_bits")) - { - int gray4 = (int)linear(linear(gray, 0, 0xFF, 0, 0xF), 0, 0xF, 0, 0xFF) * 0xF; - return Color.FromArgb(gray4, gray4, gray4); - } - else - { - if (Shiftorium.UpgradeInstalled("color_depth_2_bits")) - { - int gray2 = (int)linear(linear(gray, 0, 0xFF, 0, 0x3), 0, 0x3, 0, 0xFF) * 63; - return Color.FromArgb(gray2, gray2, gray2); - } - else { - if (gray >= 127) - { - return Color.Black; - } - else - { - return Color.White; - } - } - } - } - } - } - } - } - - public static void DitherColor(Color source, int width, int height, Action<Image> result) - { - var bmp = new Bitmap(width + 1, height + 1); - var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - byte[] rgb = new byte[Math.Abs(data.Stride) * data.Height]; - Marshal.Copy(data.Scan0, rgb, 0, rgb.Length); - for (int i = 0; i < rgb.Length - 3; i += 3) - { - rgb[i] = source.R; - rgb[i + 1] = source.G; - rgb[i + 2] = source.B; - } - Marshal.Copy(rgb, 0, data.Scan0, rgb.Length); - bmp.UnlockBits(data); - DitherImage(bmp, result); - - } - - static private double linear(double x, double x0, double x1, double y0, double y1) - { - if ((x1 - x0) == 0) - { - return (y0 + y1) / 2; - } - return y0 + (x - x0) * (y1 - y0) / (x1 - x0); - } - -#if NODITHER - public static void DitherImage(Image source, Action<Image> result) - { - Desktop.InvokeOnWorkerThread(new Action(() => - { - result?.Invoke(source); - })); - } -#endif - -#if BINARIZE - public static void DitherImage(Image source, Action<Image> result) - { - if (source == null) - { - result?.Invoke(source); - return; - } - - - var t = new Thread(new ThreadStart(() => - { - var bmp = new Bitmap(source.Width, source.Height); - var sourceBmp = (Bitmap)source; - int error = 0; - for (int y = 0; y < bmp.Height; y++) - { - for (int x = 0; x < bmp.Width; x++) - { - - Color c = sourceBmp.GetPixel(x, y); - int gray = ((c.R + c.G + c.B) / 3); - if (gray >= 127) - { - error = gray - 255; - bmp.SetPixel(x, y, Color.White); - } - else - { - error = gray; - bmp.SetPixel(x, y, Color.Black); - } - - - } - } - Desktop.InvokeOnWorkerThread(new Action(() => { result?.Invoke(bmp); })); - })); - t.IsBackground = true; - t.Start(); - - } -#endif - -#if DITHER1D - public static void DitherImage(Image source, Action<Image> result) - { - if (source == null) - { - result?.Invoke(source); - return; - } - - - var t = new Thread(new ThreadStart(() => - { - var bmp = new Bitmap(source.Width, source.Height); - var sourceBmp = (Bitmap)source; - int error = 0; - for (int y = 0; y < bmp.Height; y++) - { - for (int x = 0; x < bmp.Width; x++) - { - - Color c = sourceBmp.GetPixel(x, y); - int gray = ((c.R + c.G + c.B) / 3) + error; - if (gray >= 127) - { - error = gray - 255; - bmp.SetPixel(x, y, Color.White); - } - else - { - error = gray; - bmp.SetPixel(x, y, Color.Black); - } - - - } - } - Desktop.InvokeOnWorkerThread(new Action(() => { result?.Invoke(bmp); })); - })); - t.IsBackground = true; - t.Start(); - } -#endif - -#if FLOYDSTEINBERG - public static void DitherImage(Image source, Action<Image> result) - { - if (source == null) - { - result?.Invoke(source); - return; - } - - - var bmp = new Bitmap(source.Width, source.Height); - var sourceBmp = (Bitmap)source; - var sourceLck = sourceBmp.LockBits(new Rectangle(0, 0, sourceBmp.Width, sourceBmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - var destLck = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - int error_r = 0; - - - int sourceBytes = Math.Abs(sourceLck.Stride) * sourceLck.Height; - int destBytes = Math.Abs(destLck.Stride) * destLck.Height; - - IntPtr sourcePtr = sourceLck.Scan0; - IntPtr destPtr = destLck.Scan0; - - byte[] destArr = new byte[destBytes]; - byte[] sourceArr = new byte[sourceBytes]; - - byte[] grays = new byte[destBytes]; - - Marshal.Copy(sourcePtr, sourceArr, 0, sourceBytes); - Marshal.Copy(destPtr, destArr, 0, destBytes); - - int width = Math.Abs(destLck.Stride); - int height = destLck.Height; - - bool sixteenBits = Shiftorium.UpgradeInstalled("color_depth_16_bits"); - bool twoBits = Shiftorium.UpgradeInstalled("color_depth_2_bits"); - bool sixBits = Shiftorium.UpgradeInstalled("color_depth_6_bits"); - bool fourBits = Shiftorium.UpgradeInstalled("color_depth_4_bits"); - bool eightBits = Shiftorium.UpgradeInstalled("color_depth_8_bits"); - bool color_depth_floydsteinberg = Shiftorium.UpgradeInstalled("color_depth_floyd-steinberg_dithering"); - bool dithering = Shiftorium.UpgradeInstalled("color_depth_dithering"); - - for (int y = 0; y < (destLck.Height); y++) - { - for (int x = 0; x < (Math.Abs(destLck.Stride)); x += 3) - { - int i = getIndexFromXY(x, y, width); - byte red = sourceArr[i]; - byte green = sourceArr[i + 1]; - byte blue = sourceArr[i + 2]; - - Color oldc = Color.FromArgb(red, green, blue); - Color newc; - - if (sixteenBits) - { - newc = GetColor(oldc); - } - else - { - int gray = ((oldc.R + oldc.G + oldc.B) / 3); - - byte newgray = 0; - - if (dithering && !color_depth_floydsteinberg) - gray += error_r; - - - - if (eightBits) - { - newgray = (byte)gray; - error_r = 0; - } - else if(sixBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0x3F) * 3); - error_r = newgray - gray; - } - else if (fourBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0xF) * 0xF); - error_r = newgray - gray; - } - else if (twoBits) - { - if (gray >= 191) - newgray = 0xFF; - else if (gray >= 127) - newgray = Color.LightGray.R; - else if (gray >= 64) - newgray = Color.DarkGray.R; - else - newgray = 0x00; - error_r = newgray - gray; - } - else - { - if (gray >= 127) - newgray = 0xFF; - else - newgray = 0x00; - error_r = newgray - gray; - } - newc = Color.FromArgb(newgray, newgray, newgray); - } - - int nextIndex = getIndexFromXY(x + 3, y, width); - int nextRow = getIndexFromXY(x, y + 1, width); - int nextIndexOnNextRow = getIndexFromXY(x + 3, y + 1, width); - int prevIndexOnNextRow = getIndexFromXY(x - 3, y + 1, width); - - grays[i] = newc.R; - grays[i + 1] = newc.G; - grays[i + 2] = newc.B; - - if (dithering) - { - if (color_depth_floydsteinberg) - { - if (x + 3 < width) - { - sourceArr[nextIndex] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 1] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 2] += (byte)((error_r * 7) / 16); - } - if (y + 1 < height) - { - sourceArr[nextRow] += (byte)((error_r) / 16); - sourceArr[nextRow + 1] += (byte)((error_r) / 16); - sourceArr[nextRow + 2] += (byte)((error_r) / 16); - } - if (x + 3 < width && y + 1 < height) - { - sourceArr[nextIndexOnNextRow] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 1] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 2] += (byte)((error_r * 3) / 16); - - } - if (x - 3 > 0 && y + 1 < height) - { - sourceArr[prevIndexOnNextRow] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 1] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 2] += (byte)((error_r * 5) / 16); - - } - } - } - } - } - - for (int i = 0; i < destArr.Length - 3; i++) - { - destArr[i] = grays[i]; - - } - - Marshal.Copy(destArr, 0, destPtr, destBytes); - - - bmp.UnlockBits(destLck); - - - - Desktop.InvokeOnWorkerThread(new Action(() => { result?.Invoke(bmp); })); - - } -#endif - - private static int getIndexFromXY(int x, int y, int width) - { - return (width * y) + x; - } - } -} diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs deleted file mode 100644 index 71ef161..0000000 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ /dev/null @@ -1,312 +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 WinformsDesktop - { - /// <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.desktoppanel = new System.Windows.Forms.Panel(); - this.btnnotifications = new System.Windows.Forms.Button(); - this.lbtime = new System.Windows.Forms.Label(); - this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel(); - this.sysmenuholder = new System.Windows.Forms.Panel(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.apps = new System.Windows.Forms.ToolStripMenuItem(); - this.pnlscreensaver = new System.Windows.Forms.Panel(); - this.pnlwidgetlayer = new System.Windows.Forms.Panel(); - this.pnlssicon = new System.Windows.Forms.Panel(); - this.pnladvancedal = new System.Windows.Forms.Panel(); - this.flapps = new System.Windows.Forms.FlowLayoutPanel(); - this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); - this.pnlalsystemactions = new System.Windows.Forms.Panel(); - this.btnshutdown = new System.Windows.Forms.Button(); - this.pnlstatus = new System.Windows.Forms.Panel(); - this.lbalstatus = new System.Windows.Forms.Label(); - this.desktoppanel.SuspendLayout(); - this.sysmenuholder.SuspendLayout(); - this.menuStrip1.SuspendLayout(); - this.pnlscreensaver.SuspendLayout(); - this.pnladvancedal.SuspendLayout(); - this.pnlalsystemactions.SuspendLayout(); - this.pnlstatus.SuspendLayout(); - this.SuspendLayout(); - // - // desktoppanel - // - this.desktoppanel.BackColor = System.Drawing.Color.Green; - this.desktoppanel.Controls.Add(this.btnnotifications); - this.desktoppanel.Controls.Add(this.lbtime); - this.desktoppanel.Controls.Add(this.panelbuttonholder); - this.desktoppanel.Controls.Add(this.sysmenuholder); - this.desktoppanel.Dock = System.Windows.Forms.DockStyle.Top; - this.desktoppanel.Location = new System.Drawing.Point(0, 0); - this.desktoppanel.Name = "desktoppanel"; - this.desktoppanel.Size = new System.Drawing.Size(1296, 24); - this.desktoppanel.TabIndex = 0; - this.desktoppanel.Paint += new System.Windows.Forms.PaintEventHandler(this.desktoppanel_Paint); - // - // btnnotifications - // - this.btnnotifications.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnnotifications.AutoSize = true; - this.btnnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnnotifications.BackColor = System.Drawing.Color.Transparent; - this.btnnotifications.FlatAppearance.BorderSize = 0; - this.btnnotifications.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnnotifications.Location = new System.Drawing.Point(1066, -2); - this.btnnotifications.Name = "btnnotifications"; - this.btnnotifications.Size = new System.Drawing.Size(136, 24); - this.btnnotifications.TabIndex = 3; - this.btnnotifications.Text = "Notifications (0)"; - this.btnnotifications.UseVisualStyleBackColor = false; - this.btnnotifications.Click += new System.EventHandler(this.btnnotifications_Click); - // - // lbtime - // - this.lbtime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.lbtime.AutoSize = true; - this.lbtime.Location = new System.Drawing.Point(3, 0); - this.lbtime.Name = "lbtime"; - this.lbtime.Size = new System.Drawing.Size(49, 14); - this.lbtime.TabIndex = 0; - this.lbtime.Text = "label1"; - this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.lbtime.Click += new System.EventHandler(this.lbtime_Click); - // - // panelbuttonholder - // - this.panelbuttonholder.AutoSize = true; - this.panelbuttonholder.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.panelbuttonholder.Location = new System.Drawing.Point(107, -77); - this.panelbuttonholder.Name = "panelbuttonholder"; - this.panelbuttonholder.Size = new System.Drawing.Size(0, 0); - this.panelbuttonholder.TabIndex = 2; - // - // sysmenuholder - // - this.sysmenuholder.Controls.Add(this.menuStrip1); - this.sysmenuholder.Location = new System.Drawing.Point(12, 5); - this.sysmenuholder.Name = "sysmenuholder"; - this.sysmenuholder.Size = new System.Drawing.Size(68, 24); - this.sysmenuholder.TabIndex = 1; - // - // menuStrip1 - // - this.menuStrip1.Dock = System.Windows.Forms.DockStyle.Fill; - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.apps}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Padding = new System.Windows.Forms.Padding(0); - this.menuStrip1.Size = new System.Drawing.Size(68, 24); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // apps - // - this.apps.AutoSize = false; - this.apps.Name = "apps"; - this.apps.Padding = new System.Windows.Forms.Padding(0); - this.apps.Size = new System.Drawing.Size(58, 20); - this.apps.Tag = "applauncherbutton"; - this.apps.Text = "ShiftOS"; - this.apps.Click += new System.EventHandler(this.apps_Click); - // - // pnlscreensaver - // - this.pnlscreensaver.Controls.Add(this.pnlssicon); - this.pnlscreensaver.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlscreensaver.Location = new System.Drawing.Point(0, 24); - this.pnlscreensaver.Name = "pnlscreensaver"; - this.pnlscreensaver.Size = new System.Drawing.Size(1296, 714); - this.pnlscreensaver.TabIndex = 1; - this.pnlscreensaver.Visible = false; - // - // pnlwidgetlayer - // - this.pnlwidgetlayer.BackColor = System.Drawing.Color.Transparent; - this.pnlwidgetlayer.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlwidgetlayer.Location = new System.Drawing.Point(0, 24); - this.pnlwidgetlayer.Name = "pnlwidgetlayer"; - this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); - this.pnlwidgetlayer.TabIndex = 1; - // - // pnlssicon - // - this.pnlssicon.Location = new System.Drawing.Point(303, 495); - this.pnlssicon.Name = "pnlssicon"; - this.pnlssicon.Size = new System.Drawing.Size(200, 100); - this.pnlssicon.TabIndex = 0; - // - // pnladvancedal - // - this.pnladvancedal.Controls.Add(this.flapps); - this.pnladvancedal.Controls.Add(this.flcategories); - this.pnladvancedal.Controls.Add(this.pnlalsystemactions); - this.pnladvancedal.Controls.Add(this.pnlstatus); - this.pnladvancedal.Location = new System.Drawing.Point(0, 24); - this.pnladvancedal.Name = "pnladvancedal"; - this.pnladvancedal.Size = new System.Drawing.Size(433, 417); - this.pnladvancedal.TabIndex = 1; - this.pnladvancedal.Visible = false; - // - // flapps - // - this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; - this.flapps.Location = new System.Drawing.Point(221, 58); - this.flapps.Name = "flapps"; - this.flapps.Size = new System.Drawing.Size(212, 328); - this.flapps.TabIndex = 3; - // - // flcategories - // - this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; - this.flcategories.Location = new System.Drawing.Point(0, 58); - this.flcategories.Name = "flcategories"; - this.flcategories.Size = new System.Drawing.Size(221, 328); - this.flcategories.TabIndex = 2; - // - // pnlalsystemactions - // - this.pnlalsystemactions.Controls.Add(this.btnshutdown); - this.pnlalsystemactions.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlalsystemactions.Location = new System.Drawing.Point(0, 386); - this.pnlalsystemactions.Name = "pnlalsystemactions"; - this.pnlalsystemactions.Size = new System.Drawing.Size(433, 31); - this.pnlalsystemactions.TabIndex = 1; - // - // btnshutdown - // - this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnshutdown.AutoSize = true; - this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnshutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnshutdown.Location = new System.Drawing.Point(355, 3); - this.btnshutdown.Name = "btnshutdown"; - this.btnshutdown.Size = new System.Drawing.Size(75, 26); - this.btnshutdown.TabIndex = 0; - this.btnshutdown.Text = "Shutdown"; - this.btnshutdown.UseVisualStyleBackColor = true; - this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click); - // - // pnlstatus - // - this.pnlstatus.Controls.Add(this.lbalstatus); - this.pnlstatus.Dock = System.Windows.Forms.DockStyle.Top; - this.pnlstatus.Location = new System.Drawing.Point(0, 0); - this.pnlstatus.Name = "pnlstatus"; - this.pnlstatus.Size = new System.Drawing.Size(433, 58); - this.pnlstatus.TabIndex = 0; - // - // lbalstatus - // - this.lbalstatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbalstatus.Location = new System.Drawing.Point(0, 0); - this.lbalstatus.Name = "lbalstatus"; - this.lbalstatus.Size = new System.Drawing.Size(433, 58); - this.lbalstatus.TabIndex = 0; - this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available"; - this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // WinformsDesktop - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(1296, 738); - this.Controls.Add(this.pnlwidgetlayer); - this.Controls.Add(this.pnladvancedal); - this.Controls.Add(this.pnlscreensaver); - this.Controls.Add(this.desktoppanel); - this.Font = new System.Drawing.Font("Consolas", 9F); - this.ForeColor = System.Drawing.Color.LightGreen; - this.MainMenuStrip = this.menuStrip1; - this.Name = "WinformsDesktop"; - this.Text = "Desktop"; - this.Load += new System.EventHandler(this.Desktop_Load); - this.desktoppanel.ResumeLayout(false); - this.desktoppanel.PerformLayout(); - this.sysmenuholder.ResumeLayout(false); - this.sysmenuholder.PerformLayout(); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.pnlscreensaver.ResumeLayout(false); - this.pnladvancedal.ResumeLayout(false); - this.pnlalsystemactions.ResumeLayout(false); - this.pnlalsystemactions.PerformLayout(); - this.pnlstatus.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel desktoppanel; - private System.Windows.Forms.Label lbtime; - private System.Windows.Forms.Panel sysmenuholder; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem apps; - private System.Windows.Forms.FlowLayoutPanel panelbuttonholder; - private System.Windows.Forms.Button btnnotifications; - private System.Windows.Forms.Panel pnlscreensaver; - private System.Windows.Forms.Panel pnlssicon; - private System.Windows.Forms.Panel pnladvancedal; - private System.Windows.Forms.Panel pnlalsystemactions; - private System.Windows.Forms.Button btnshutdown; - private System.Windows.Forms.Panel pnlstatus; - private System.Windows.Forms.Label lbalstatus; - private System.Windows.Forms.FlowLayoutPanel flapps; - private System.Windows.Forms.FlowLayoutPanel flcategories; - private System.Windows.Forms.Panel pnlwidgetlayer; - } - -} - diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs deleted file mode 100644 index 6825f34..0000000 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ /dev/null @@ -1,1066 +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.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using static ShiftOS.Engine.SkinEngine; -using ShiftOS.WinForms.Tools; -using ShiftOS.WinForms.Applications; -using Newtonsoft.Json; -using ShiftOS.Engine.Scripting; -using System.Threading; - -/// <summary> -/// Winforms desktop. -/// </summary> -namespace ShiftOS.WinForms -{ - /// <summary> - /// Winforms desktop. - /// </summary> - public partial class WinformsDesktop : Form, IDesktop - { - public List<IDesktopWidget> Widgets = new List<IDesktopWidget>(); - - - private int millisecondsUntilScreensaver = 300000; - - /// <summary> - /// Initializes a new instance of the <see cref="ShiftOS.WinForms.WinformsDesktop"/> class. - /// </summary> - public WinformsDesktop() - { - InitializeComponent(); - pnlwidgetlayer.Click += (o, a) => - { - HideAppLauncher(); - }; - ControlManager.MakeDoubleBuffered(pnlwidgetlayer); - this.Click += (o, a) => - { - HideAppLauncher(); - }; - SetupControl(desktoppanel); - Shiftorium.Installed += () => - { - foreach(var widget in Widgets) - { - widget.OnUpgrade(); - } - - //Only if the DevX Legions story hasn't been experienced yet. - if (!Shiftorium.UpgradeInstalled("devx_legions")) - { - //Check for shiftnet story experience - if (Shiftorium.UpgradeInstalled("shiftnet")) - { - //Check for saturation of the "GUI" upgrade set - if (Shiftorium.IsCategoryEmptied("GUI")) - { - //Start the MUD Control Centre story. - Story.Start("devx_legions"); - } - } - } - - if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) - { - if (SaveSystem.CurrentSave.Codepoints >= 50000) - { - if (Shiftorium.IsCategoryEmptied("Applications")) - { - Story.Start("victortran_shiftnet"); - } - } - } - }; - this.TopMost = false; - - NotificationDaemon.NotificationMade += (note) => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - - NotificationDaemon.NotificationRead += () => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - - this.LocationChanged += (o, a) => - { - if (this.Left != 0) - this.Left = 0; - if (this.Top != 0) - this.Top = 0; - }; - - this.SizeChanged += (o, a) => - { - if (this.ClientRectangle != Screen.PrimaryScreen.Bounds) - { - this.WindowState = FormWindowState.Maximized; - } - }; - - SaveSystem.GameReady += () => - { - if (this.Visible == true) - this.Invoke(new Action(() => SetupDesktop())); - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - Shiftorium.Installed += () => - { - if (this.Visible == true) - this.Invoke(new Action(() => SetupDesktop())); - }; - var time = new System.Windows.Forms.Timer(); - time.Interval = 100; - this.KeyDown += (o, a) => - { - if (a.Control && a.KeyCode == Keys.T) - { - Engine.AppearanceManager.SetupWindow(new Applications.Terminal()); - } - /*if (a.Control && a.KeyCode == Keys.Tab) - { - // CtrlTabMenu - CtrlTabMenu.Show(); - if (a.Shift) CtrlTabMenu.CycleBack(); - else CtrlTabMenu.CycleForwards(); - }*/ //nyi - - ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a); - }; - SkinEngine.SkinLoaded += () => - { - foreach (var widget in Widgets) - { - widget.OnSkinLoad(); - } - - SetupDesktop(); - }; - time.Tick += (o, a) => - { - if (Shiftorium.IsInitiated == true) - { - if (SaveSystem.CurrentSave != null && TutorialManager.IsInTutorial == false) - { - lbtime.Text = Applications.Terminal.GetTime(); - lbtime.Left = desktoppanel.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; - lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; - } - } - - try - { - if (SaveSystem.CurrentSave != null) - { - if (SaveSystem.CurrentSave.LastMonthPaid != DateTime.Now.Month) - { - if (SaveSystem.CurrentSave.Codepoints >= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth) - { - SaveSystem.CurrentSave.Codepoints -= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth; - SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; - } - else - { - SaveSystem.CurrentSave.ShiftnetSubscription = 0; - SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; - Infobox.Show("Shiftnet", "You do not have enough Codepoints to pay for your Shiftnet subscription this month. You have been downgraded to the free plan."); - } - } - } - } - catch { } - - - btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2; - btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2; - }; - time.Start(); - - var ssThread = new Thread(() => - { - while(this.Visible == true) - { - var mousePos = Cursor.Position; - while(Cursor.Position == mousePos) - { - if(millisecondsUntilScreensaver <= 0) - { - ShowScreensaver(); - } - millisecondsUntilScreensaver--; - Thread.Sleep(1); - } - millisecondsUntilScreensaver = 300000; - HideScreensaver(); - } - }); - ssThread.IsBackground = true; - ssThread.Start(); - - this.DoubleBuffered = true; - } - - public void HideScreensaver() - { - if (ResetDesktop == true) - { - this.Invoke(new Action(() => - { - this.TopMost = false; - pnlscreensaver.Hide(); - Cursor.Show(); - SetupDesktop(); - ResetDesktop = false; - - })); - } - } - - private bool ResetDesktop = false; - - private void ShowScreensaver() - { - } - - - /// <summary> - /// Populates the panel buttons. - /// </summary> - /// <returns>The panel buttons.</returns> - public void PopulatePanelButtons() - { - if (DesktopFunctions.ShowDefaultElements == true) - { - panelbuttonholder.Controls.Clear(); - if (Shiftorium.IsInitiated == true) - { - if (Shiftorium.UpgradeInstalled("wm_panel_buttons")) - { - foreach (WindowBorder form in Engine.AppearanceManager.OpenForms) - { - if (form != null) - { - if (form.Visible == true) - { - EventHandler onClick = (o, a) => - { - if (form == focused) - { - if (form.IsMinimized) - { - RestoreWindow(form); - } - else - { - MinimizeWindow(form); - } - } - else - { - form.BringToFront(); - focused = form; - } - HideAppLauncher(); - }; - - var pnlbtn = new Panel(); - pnlbtn.Margin = new Padding(2, LoadedSkin.PanelButtonFromTop, 0, 0); - pnlbtn.BackColor = LoadedSkin.PanelButtonColor; - pnlbtn.BackgroundImage = GetImage("panelbutton"); - pnlbtn.BackgroundImageLayout = GetImageLayout("panelbutton"); - - var pnlbtntext = new Label(); - pnlbtntext.Text = NameChangerBackend.GetName(form.ParentWindow); - pnlbtntext.AutoSize = true; - pnlbtntext.Location = LoadedSkin.PanelButtonFromLeft; - pnlbtntext.ForeColor = LoadedSkin.PanelButtonTextColor; - pnlbtntext.BackColor = Color.Transparent; - - pnlbtn.BackColor = LoadedSkin.PanelButtonColor; - if (pnlbtn.BackgroundImage != null) - { - pnlbtntext.BackColor = Color.Transparent; - } - pnlbtn.Size = LoadedSkin.PanelButtonSize; - pnlbtn.Tag = "keepbg"; - pnlbtntext.Tag = "keepbg"; - pnlbtn.Controls.Add(pnlbtntext); - this.panelbuttonholder.Controls.Add(pnlbtn); - pnlbtn.Show(); - pnlbtntext.Show(); - - if (Shiftorium.UpgradeInstalled("useful_panel_buttons")) - { - pnlbtn.Click += onClick; - pnlbtntext.Click += onClick; - } - pnlbtntext.Font = LoadedSkin.PanelButtonFont; - - } - } - } - } - } - } - - LuaInterpreter.RaiseEvent("on_panelbutton_populate", this); - } - - /// <summary> - /// Setups the desktop. - /// </summary> - /// <returns>The desktop.</returns> - public void SetupDesktop() - { - if (DesktopFunctions.ShowDefaultElements == true) - { - ToolStripManager.Renderer = new ShiftOSMenuRenderer(); - - this.DoubleBuffered = true; - this.FormBorderStyle = FormBorderStyle.None; - this.WindowState = FormWindowState.Maximized; - desktoppanel.BackColor = Color.Green; - - //upgrades - - if (Shiftorium.IsInitiated == true) - { - desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop"); - lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget"); - - btnnotifications.Visible = Shiftorium.UpgradeInstalled("panel_notifications"); - - //skinning - lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; - - panelbuttonholder.Top = 0; - panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft; - panelbuttonholder.Height = desktoppanel.Height; - panelbuttonholder.BackColor = Color.Transparent; - panelbuttonholder.Margin = new Padding(0, 0, 0, 0); - - sysmenuholder.Visible = Shiftorium.UpgradeInstalled("app_launcher"); - - //The Color Picker can give us transparent colors - which Windows Forms fucking despises when dealing with form backgrounds. - //To compensate, we must recreate the desktop color and make the alpha channel '255'. - this.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); - //Not doing this will cause an ArgumentException. - - DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action<Image>((img) => - { - this.BackgroundImage = img; - })); - this.BackgroundImageLayout = GetImageLayout("desktopbackground"); - desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; - - var pnlimg = GetImage("desktoppanel"); - if (pnlimg != null) - { - var bmp = new Bitmap(pnlimg); - bmp.MakeTransparent(Color.FromArgb(1, 0, 1)); - pnlimg = bmp; - } - - desktoppanel.BackgroundImage = pnlimg; - if (desktoppanel.BackgroundImage != null) - { - desktoppanel.BackColor = Color.Transparent; - } - var appimg = GetImage("applauncher"); - if (appimg != null) - { - var bmp = new Bitmap(appimg); - bmp.MakeTransparent(Color.FromArgb(1, 0, 1)); - appimg = bmp; - } - menuStrip1.BackgroundImage = appimg; - lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; - lbtime.Font = LoadedSkin.DesktopPanelClockFont; - if (desktoppanel.BackgroundImage == null) - { - lbtime.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor; - } - else - { - lbtime.BackColor = Color.Transparent; - } - apps.Text = LoadedSkin.AppLauncherText; - sysmenuholder.Location = LoadedSkin.AppLauncherFromLeft; - sysmenuholder.Size = LoadedSkin.AppLauncherHolderSize; - apps.Size = sysmenuholder.Size; - menuStrip1.Renderer = new ShiftOSMenuRenderer(new AppLauncherColorTable()); - desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel"); - desktoppanel.Height = LoadedSkin.DesktopPanelHeight; - if (LoadedSkin.DesktopPanelPosition == 1) - { - desktoppanel.Dock = DockStyle.Bottom; - } - else - { - desktoppanel.Dock = DockStyle.Top; - } - } - - pnlwidgetlayer.Show(); - pnlwidgetlayer.BringToFront(); - - if (Shiftorium.UpgradeInstalled("desktop_widgets")) - { - Widgets.Clear(); - pnlwidgetlayer.Controls.Clear(); - foreach(var widget in WidgetManager.GetAllWidgetTypes()) - { - UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); - - w.Location = WidgetManager.LoadDetails(w.GetType()).Location; - pnlwidgetlayer.Controls.Add(w); - MakeWidgetMovable(w); - Widgets.Add(w as IDesktopWidget); - } - } - - int lastHeight = 5; - foreach (var widget in Widgets) - { - if (WidgetManager.LoadDetails(widget.GetType()).IsVisible && Shiftorium.UpgradeInstalled("desktop_widgets")) - { - widget.OnSkinLoad(); - - widget.OnUpgrade(); - widget.Setup(); - widget.Show(); - if (widget.Location.X == -1 && widget.Location.Y == -1) - { - widget.Location = new Point(5, lastHeight); - lastHeight += widget.Size.Height + 5; - } - } - else - { - widget.Hide(); - } - } - pnlwidgetlayer.Show(); - pnlwidgetlayer.BringToFront(); - - - } - else - { - desktoppanel.Hide(); - } - - LuaInterpreter.RaiseEvent("on_desktop_skin", this); - - PopulatePanelButtons(); - } - - public void MakeWidgetMovable(Control w, Control startCtrl = null) - { - if (startCtrl == null) - startCtrl = w; - - bool moving = false; - - w.MouseDown += (o, a) => - { - HideAppLauncher(); - moving = true; - }; - - w.MouseMove += (o, a) => - { - if (moving == true) - { - var mPos = Cursor.Position; - int mY = mPos.Y - desktoppanel.Height; - int mX = mPos.X; - - int ctrlHeight = startCtrl.Height / 2; - int ctrlWidth = startCtrl.Width / 2; - - startCtrl.Location = new Point( - mX - ctrlWidth, - mY - ctrlHeight - ); - - } - }; - - w.MouseUp += (o, a) => - { - moving = false; - var details = WidgetManager.LoadDetails(startCtrl.GetType()); - details.Location = startCtrl.Location; - WidgetManager.SaveDetails(startCtrl.GetType(), details); - }; - - foreach (Control c in w.Controls) - MakeWidgetMovable(c, startCtrl); - - } - - public ToolStripMenuItem GetALCategoryWithName(string text) - { - foreach (ToolStripMenuItem menuitem in apps.DropDownItems) - { - if (menuitem.Text == text) - return menuitem; - } - - var itm = new ToolStripMenuItem(); - itm.Text = text; - apps.DropDownItems.Add(itm); - return itm; - } - - public Dictionary<string, List<LauncherItem>> LauncherItemList = new Dictionary<string, List<LauncherItem>>(); - - /// <summary> - /// Populates the app launcher. - /// </summary> - /// <returns>The app launcher.</returns> - /// <param name="items">Items.</param> - public void PopulateAppLauncher(LauncherItem[] items) - { - if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) - { - pnladvancedal.Visible = false; - flapps.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - flcategories.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground; - lbalstatus.BackColor = LoadedSkin.ALStatusPanelBackColor; - //Fonts - lbalstatus.Font = LoadedSkin.ALStatusPanelFont; - lbalstatus.ForeColor = LoadedSkin.ALStatusPanelTextColor; - btnshutdown.Font = LoadedSkin.ShutdownFont; - - //Upgrades - btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown"); - - //Alignments and positions. - lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment; - if (LoadedSkin.ShutdownButtonStyle == 2) - btnshutdown.Hide(); - else if (LoadedSkin.ShutdownButtonStyle == 1) - { - btnshutdown.Parent = pnlstatus; - btnshutdown.BringToFront(); - } - else - btnshutdown.Parent = pnlalsystemactions; - if (LoadedSkin.ShutdownOnLeft) - { - btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide; - } - else - { - btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X; - btnshutdown.Top = LoadedSkin.ShutdownButtonFromSide.Y; - } - - //Images - lbalstatus.BackgroundImage = GetImage("al_bg_status"); - lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status"); - - pnlalsystemactions.BackgroundImage = GetImage("al_bg_system"); - pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system"); - if (pnlalsystemactions.BackgroundImage != null) - btnshutdown.BackColor = Color.Transparent; - - btnshutdown.Font = LoadedSkin.ShutdownFont; - btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor; - - pnladvancedal.Size = LoadedSkin.AALSize; - - pnlalsystemactions.Height = LoadedSkin.ALSystemActionHeight; - pnlstatus.Height = LoadedSkin.ALSystemStatusHeight; - - flcategories.Width = LoadedSkin.AALCategoryViewWidth; - this.flapps.Width = LoadedSkin.AALItemViewWidth; - } - - - if (DesktopFunctions.ShowDefaultElements == true) - { - apps.DropDownItems.Clear(); - - Dictionary<string, List<ToolStripMenuItem>> sortedItems = new Dictionary<string, List<ToolStripMenuItem>>(); - - flcategories.Controls.Clear(); - - LauncherItemList.Clear(); - - - foreach (var kv in items) - { - var item = new ToolStripMenuItem(); - item.Text = (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType); - item.Image = (kv.LaunchType == null) ? null : SkinEngine.GetIcon(kv.LaunchType.Name); - item.Click += (o, a) => - { - if (kv is LuaLauncherItem) - { - var interpreter = new Engine.Scripting.LuaInterpreter(); - interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath); - } - else - { - Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); - } - - }; - if (sortedItems.ContainsKey(kv.DisplayData.Category)) - { - sortedItems[kv.DisplayData.Category].Add(item); - LauncherItemList[kv.DisplayData.Category].Add(kv); - } - else - { - sortedItems.Add(kv.DisplayData.Category, new List<ToolStripMenuItem>()); - sortedItems[kv.DisplayData.Category].Add(item); - LauncherItemList.Add(kv.DisplayData.Category, new List<LauncherItem> { kv }); - } - } - - foreach (var kv in sortedItems) - { - if (Shiftorium.IsInitiated == true) - { - if (Shiftorium.UpgradeInstalled("app_launcher_categories")) - { - var cat = GetALCategoryWithName(kv.Key); - foreach (var subItem in kv.Value) - { - cat.DropDownItems.Add(subItem); - } - if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) - { - var catbtn = new Button(); - catbtn.Font = LoadedSkin.AdvALItemFont; - catbtn.FlatStyle = FlatStyle.Flat; - catbtn.FlatAppearance.BorderSize = 0; - catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; - catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; - catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - catbtn.TextAlign = ContentAlignment.MiddleLeft; - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - catbtn.MouseEnter += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; - }; - catbtn.MouseLeave += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - }; - catbtn.Text = kv.Key; - catbtn.Width = flcategories.Width; - catbtn.Height = 24; - flcategories.Controls.Add(catbtn); - catbtn.Show(); - catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text); - } - } - - else - { - foreach (var subItem in kv.Value) - { - apps.DropDownItems.Add(subItem); - } - } - } - } - - if (Shiftorium.IsInitiated == true) - { - if (Shiftorium.UpgradeInstalled("al_shutdown")) - { - apps.DropDownItems.Add(new ToolStripSeparator()); - var item = new ToolStripMenuItem(); - item.Text = Localization.Parse("{SHUTDOWN}"); - item.Click += (o, a) => - { - TerminalBackend.InvokeCommand("sos.shutdown"); - }; - apps.DropDownItems.Add(item); - if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) - { - if (LoadedSkin.ShutdownButtonStyle == 2) { - var catbtn = new Button(); - catbtn.Font = LoadedSkin.AdvALItemFont; - catbtn.FlatStyle = FlatStyle.Flat; - catbtn.FlatAppearance.BorderSize = 0; - catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; - catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; - catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - catbtn.MouseEnter += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; - }; - catbtn.MouseLeave += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - }; - - catbtn.TextAlign = ContentAlignment.MiddleLeft; - catbtn.Text = "Shutdown"; - catbtn.Width = flcategories.Width; - catbtn.Height = 24; - flcategories.Controls.Add(catbtn); - catbtn.Show(); - catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("sos.shutdown"); - } - } - } - } - } - LuaInterpreter.RaiseEvent("on_al_populate", items); - } - - public void SetupAdvancedCategory(string cat) - { - flapps.Controls.Clear(); - - foreach(var app in LauncherItemList[cat]) - { - var catbtn = new Button(); - catbtn.Font = LoadedSkin.AdvALItemFont; - catbtn.FlatStyle = FlatStyle.Flat; - catbtn.FlatAppearance.BorderSize = 0; - catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; - catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; - catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - catbtn.MouseEnter += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; - }; - catbtn.MouseLeave += (o, a) => - { - catbtn.ForeColor = LoadedSkin.Menu_TextColor; - }; - catbtn.TextAlign = ContentAlignment.MiddleLeft; - catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); - catbtn.Width = flapps.Width; - catbtn.ImageAlign = ContentAlignment.MiddleRight; - catbtn.Height = 24; - catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); - - flapps.Controls.Add(catbtn); - catbtn.Show(); - catbtn.Click += (o, a) => - { - pnladvancedal.Hide(); - if(app is LuaLauncherItem) - { - var interp = new LuaInterpreter(); - interp.ExecuteFile((app as LuaLauncherItem).LaunchPath); - } - else - { - IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow; - AppearanceManager.SetupWindow(win); - } - - - - }; - - } - } - - /// <summary> - /// Desktops the load. - /// </summary> - /// <returns>The load.</returns> - /// <param name="sender">Sender.</param> - /// <param name="e">E.</param> - private void Desktop_Load(object sender, EventArgs e) - { - - SaveSystem.Begin(); - - SetupDesktop(); - - SaveSystem.GameReady += () => - { - this.Invoke(new Action(() => - { - LuaInterpreter.RaiseEvent("on_desktop_load", this); - })); - }; - } - - /// <summary> - /// Shows the window. - /// </summary> - /// <returns>The window.</returns> - /// <param name="border">Border.</param> - public void ShowWindow(IWindowBorder border) - { - var brdr = border as Form; - focused = border; - brdr.GotFocus += (o, a) => - { - focused = border; - }; - brdr.FormBorderStyle = FormBorderStyle.None; - brdr.Show(); - brdr.TopMost = true; - } - - /// <summary> - /// Kills the window. - /// </summary> - /// <returns>The window.</returns> - /// <param name="border">Border.</param> - public void KillWindow(IWindowBorder border) - { - border.Close(); - } - - private IWindowBorder focused = null; - - public string DesktopName - { - get - { - return "ShiftOS Desktop"; - } - } - - - /// <summary> - /// Minimizes the window. - /// </summary> - /// <param name="brdr">Brdr.</param> - public void MinimizeWindow(IWindowBorder brdr) - { - var loc = (brdr as WindowBorder).Location; - var sz = (brdr as WindowBorder).Size; - (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new - { - Size = sz, - Location = loc - }); - (brdr as WindowBorder).Location = new Point(this.GetSize().Width * 2, this.GetSize().Height * 2); - } - - /// <summary> - /// Maximizes the window. - /// </summary> - /// <returns>The window.</returns> - /// <param name="brdr">Brdr.</param> - public void MaximizeWindow(IWindowBorder brdr) - { - int startY = (LoadedSkin.DesktopPanelPosition == 1) ? 0 : LoadedSkin.DesktopPanelHeight; - int h = this.GetSize().Height - LoadedSkin.DesktopPanelHeight; - var loc = (brdr as WindowBorder).Location; - var sz = (brdr as WindowBorder).Size; - (brdr as WindowBorder).Tag = JsonConvert.SerializeObject(new - { - Size = sz, - Location = loc - }); - (brdr as WindowBorder).Location = new Point(0, startY); - (brdr as WindowBorder).Size = new Size(this.GetSize().Width, h); - - } - - /// <summary> - /// Restores the window. - /// </summary> - /// <returns>The window.</returns> - /// <param name="brdr">Brdr.</param> - public void RestoreWindow(IWindowBorder brdr) - { - dynamic tag = JsonConvert.DeserializeObject<dynamic>((brdr as WindowBorder).Tag.ToString()); - (brdr as WindowBorder).Location = tag.Location; - (brdr as WindowBorder).Size = tag.Size; - - } - - /// <summary> - /// Invokes the on worker thread. - /// </summary> - /// <returns>The on worker thread.</returns> - /// <param name="act">Act.</param> - public void InvokeOnWorkerThread(Action act) - { - try - { - this.Invoke(new Action(() => - { - act?.Invoke(); - })); - } - catch - { - - } - } - - public void OpenAppLauncher(Point loc) - { - apps.DropDown.Left = loc.X; - apps.DropDown.Top = loc.Y; - apps.ShowDropDown(); - } - - /// <summary> - /// Gets the size. - /// </summary> - /// <returns>The size.</returns> - public Size GetSize() - { - return this.Size; - } - - private void btnnotifications_Click(object sender, EventArgs e) - { - AppearanceManager.SetupWindow(new Applications.Notifications()); - } - - private void desktoppanel_Paint(object sender, PaintEventArgs e) - { - e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; - } - - private void lbtime_Click(object sender, EventArgs e) - { - } - - public void SetupControl(Control ctrl) - { - foreach (Control c in ctrl.Controls) - SetupControl(c); - ctrl.Click += (o, a) => HideAppLauncher(); - } - - private void apps_Click(object sender, EventArgs e) - { - if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) - { - lbalstatus.Text = $@"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName} -{SaveSystem.CurrentSave.Codepoints} Codepoints -{Shiftorium.GetAvailable().Length} available, {SaveSystem.CurrentSave.CountUpgrades()} installed."; - - flapps.Controls.Clear(); - apps.DropDown.Hide(); - pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); - pnladvancedal.Visible = !pnladvancedal.Visible; - pnladvancedal.BringToFront(); - } - - } - - private void btnshutdown_Click(object sender, EventArgs e) - { - TerminalBackend.InvokeCommand("sos.shutdown"); - } - - public void HideAppLauncher() - { - this.Invoke(new Action(() => - { - pnladvancedal.Hide(); - })); - } - } - - [ShiftOS.Engine.Scripting.Exposed("desktop")] - public class DesktopFunctions - { - public static bool ShowDefaultElements = true; - - public dynamic getWindow() - { - return Desktop.CurrentDesktop; - } - - public void showDefaultElements(bool val) - { - ShowDefaultElements = val; - SkinEngine.LoadSkin(); - } - - public dynamic getOpenWindows() - { - return AppearanceManager.OpenForms; - } - - public string getALItemName(LauncherItem kv) - { - return (kv.LaunchType == null) ? kv.DisplayData.Name : Applications.NameChangerBackend.GetNameRaw(kv.LaunchType); - } - - public void openAppLauncher(Point loc) - { - Desktop.OpenAppLauncher(loc); - } - - public string getWindowTitle(IWindowBorder form) - { - return NameChangerBackend.GetName(form.ParentWindow); - } - - public void openApp(LauncherItem kv) - { - if (kv is LuaLauncherItem) - { - var interpreter = new Engine.Scripting.LuaInterpreter(); - interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath); - } - else - { - Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow); - } - } - } -}
\ No newline at end of file |
