diff options
| author | Michael VanOverbeek <[email protected]> | 2017-05-21 13:05:31 +0000 |
|---|---|---|
| committer | Michael VanOverbeek <[email protected]> | 2017-05-21 13:05:31 +0000 |
| commit | 68785f73f027b9dd4555b9f1ab7a22a1ca8794f8 (patch) | |
| tree | f0c6dea13195bc516f90c2aa29cf85fa1488f6cf /ShiftOS.WinForms | |
| parent | 76b54853ba726179f9fddb30c6f838991b7aa71a (diff) | |
| parent | 9999324bd7751f536741c108322766421dae1a52 (diff) | |
| download | shiftos_thereturn-68785f73f027b9dd4555b9f1ab7a22a1ca8794f8.tar.gz shiftos_thereturn-68785f73f027b9dd4555b9f1ab7a22a1ca8794f8.tar.bz2 shiftos_thereturn-68785f73f027b9dd4555b9f1ab7a22a1ca8794f8.zip | |
Merge branch 'master' of https://github.com/shiftos-game/ShiftOS
I should hire Ash Ketchum to do this for me. He'd do a better job.
Diffstat (limited to 'ShiftOS.WinForms')
47 files changed, 10534 insertions, 33 deletions
diff --git a/ShiftOS.WinForms/Applications/About.Designer.cs b/ShiftOS.WinForms/Applications/About.Designer.cs index ab76eab..989d79b 100644 --- a/ShiftOS.WinForms/Applications/About.Designer.cs +++ b/ShiftOS.WinForms/Applications/About.Designer.cs @@ -55,7 +55,7 @@ namespace ShiftOS.WinForms.Applications this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.lbshiftit = new System.Windows.Forms.Label(); - this.lbaboutdesc = new System.Windows.Forms.Label(); + this.lbaboutdesc = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -94,11 +94,11 @@ namespace ShiftOS.WinForms.Applications this.lbaboutdesc.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.lbaboutdesc.Location = new System.Drawing.Point(14, 126); + this.lbaboutdesc.Location = new System.Drawing.Point(23, 158); + this.lbaboutdesc.Multiline = true; this.lbaboutdesc.Name = "lbaboutdesc"; - this.lbaboutdesc.Size = new System.Drawing.Size(498, 328); + this.lbaboutdesc.Size = new System.Drawing.Size(492, 302); this.lbaboutdesc.TabIndex = 3; - this.lbaboutdesc.Text = "label2"; // // About // @@ -121,6 +121,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lbshiftit; - private System.Windows.Forms.Label lbaboutdesc; + private System.Windows.Forms.TextBox lbaboutdesc; } } diff --git a/ShiftOS.WinForms/Applications/About.cs b/ShiftOS.WinForms/Applications/About.cs index f91e0cc..a27238d 100644 --- a/ShiftOS.WinForms/Applications/About.cs +++ b/ShiftOS.WinForms/Applications/About.cs @@ -53,18 +53,73 @@ namespace ShiftOS.WinForms.Applications lbaboutdesc.Text = $@"ShiftOS Copyright (c) 2015-{DateTime.Now.Year} Michael VanOverbeek and ShiftOS devs -Engine version: Milestone 3, 1.0 Beta Series (Developer mode ON) -Frontend version: 1.0 Beta 1.2 -Multi-user domain version: 1.0 Rolling-Release - -Music courtesy of Selulance. Listen to the Fractal Forest album here: -https://www.youtube.com/watch?v=LB5jAYDL3VU&t=913s +Engine version: Milestone 4, 1.0 Beta Series (Developer mode ON) +Frontend version: 1.0 Beta 2.5 +Digital Society version: 1.0 Rolling-Release +Project: Unite version: 1.0 Beta 1.7 Special thanks to Philip Adams, the original creator of ShiftOS for helping us grow our community of amazing Shifters by featuring us on the YouTube Millionaire series and advertising us throughout various other series ran by him. Also, thanks to Rylan Arbour, Victor Tran and the other community moderators and administrators for helping us keep the community peaceful. -Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game!"; +Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game! + + === Licensing information + +ShiftOS is licensed under the 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. + + == Credit where credit is due + + -- Development and staff team: + - Rylan Arbour (Lead community administrator) + - Victor Tran (Discord administrator) + - cjhannah (ShiftFS backend developer) + - AShifter (Project: Unite penetration tester) + - arencllc (ShiftLetters developer) + - Michael VanOverbeek (Lead developer, system administrator, the guy who wrote this text) + - fixylol, Nebble, TravisNC, Neptune (Community moderators) + - bandic00t_ (Skin Engine stresstesting) + + -- System audio + + - Default system event sounds (Infobox, Network Connecting, System Beeps) are from the original ShiftOS 0.0.x source code. + - Ambient music list courtesy of https://www.youtube.com/channel/UC56Qctnsu8wAyvzf4Yx6LIw (ArgoFox | Royalty Free Music) + +Tracklist: + + Dylan Hardy - Strangely Unaffected +Noxive - Home +Dylan Hardy and Abraham Alberto - Slow Drift +A Himitsu - Easier To Fade +Noxive - Resilience +Wanderflux - Visions +Aerocity - Cold Weather Kids +Aether - Wanderlust +Aerocity - Love Lost + + +Finally, special thanks to our Patreon supporters. Without you guys, our servers wouldn't be running, and you wouldn't be reading this."; } public string GetEngineVersion() @@ -107,7 +162,7 @@ Lastly, a huge special thanks to the community themselves - for testing, debuggi public bool OnUnload() { - return false; + return true; } public void OnUpgrade() diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs index 6263ff7..d7f03a0 100644 --- a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs +++ b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs @@ -141,12 +141,10 @@ namespace ShiftOS.WinForms.Applications // // 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"; diff --git a/ShiftOS.WinForms/Applications/Installer.Designer.cs b/ShiftOS.WinForms/Applications/Installer.Designer.cs index 48f9146..b01986d 100644 --- a/ShiftOS.WinForms/Applications/Installer.Designer.cs +++ b/ShiftOS.WinForms/Applications/Installer.Designer.cs @@ -118,12 +118,10 @@ // this.pginstall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pginstall.BlockSize = 5; this.pginstall.Location = new System.Drawing.Point(17, 161); this.pginstall.Maximum = 100; this.pginstall.Name = "pginstall"; this.pginstall.Size = new System.Drawing.Size(414, 23); - this.pginstall.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pginstall.TabIndex = 2; this.pginstall.Text = "shiftedProgressBar1"; this.pginstall.Value = 0; diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs new file mode 100644 index 0000000..0254e94 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -0,0 +1,811 @@ +/* + * 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. + */ + + +/* + * 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 ShiftOS.WinForms.Controls; + +namespace ShiftOS.WinForms.Applications +{ + partial class Pong + { + /// <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); + } + + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.gameTimer = new System.Windows.Forms.Timer(this.components); + this.counter = new System.Windows.Forms.Timer(this.components); + this.tmrcountdown = new System.Windows.Forms.Timer(this.components); + this.tmrstoryline = new System.Windows.Forms.Timer(this.components); + this.pgcontents = new ShiftOS.WinForms.Controls.Canvas(); + this.pnlmultiplayerhandshake = new System.Windows.Forms.Panel(); + this.lvotherplayers = new System.Windows.Forms.ListView(); + this.lbmpstatus = new System.Windows.Forms.Label(); + this.pnlintro = new System.Windows.Forms.Panel(); + this.btnmatchmake = new System.Windows.Forms.Button(); + this.Label6 = new System.Windows.Forms.Label(); + this.btnstartgame = new System.Windows.Forms.Button(); + this.Label8 = new System.Windows.Forms.Label(); + this.pnlhighscore = new System.Windows.Forms.Panel(); + this.lbhighscore = new System.Windows.Forms.ListView(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.button2 = new System.Windows.Forms.Button(); + this.label10 = new System.Windows.Forms.Label(); + this.pnlgamestats = new System.Windows.Forms.Panel(); + this.button1 = new System.Windows.Forms.Button(); + this.label12 = new System.Windows.Forms.Label(); + this.lblnextstats = new System.Windows.Forms.Label(); + this.Label7 = new System.Windows.Forms.Label(); + this.lblpreviousstats = new System.Windows.Forms.Label(); + this.Label4 = new System.Windows.Forms.Label(); + this.btnplayon = new System.Windows.Forms.Button(); + this.Label3 = new System.Windows.Forms.Label(); + this.btncashout = new System.Windows.Forms.Button(); + this.Label2 = new System.Windows.Forms.Label(); + this.lbllevelreached = new System.Windows.Forms.Label(); + this.pnlfinalstats = new System.Windows.Forms.Panel(); + this.btnplayagain = new System.Windows.Forms.Button(); + this.lblfinalcodepoints = new System.Windows.Forms.Label(); + this.Label11 = new System.Windows.Forms.Label(); + this.lblfinalcomputerreward = new System.Windows.Forms.Label(); + this.Label9 = new System.Windows.Forms.Label(); + this.lblfinallevelreward = new System.Windows.Forms.Label(); + this.lblfinallevelreached = new System.Windows.Forms.Label(); + this.lblfinalcodepointswithtext = new System.Windows.Forms.Label(); + this.pnllose = new System.Windows.Forms.Panel(); + this.lblmissedout = new System.Windows.Forms.Label(); + this.lblbutyougained = new System.Windows.Forms.Label(); + this.btnlosetryagain = new System.Windows.Forms.Button(); + this.Label5 = new System.Windows.Forms.Label(); + this.Label1 = new System.Windows.Forms.Label(); + this.lblbeatai = new System.Windows.Forms.Label(); + this.lblcountdown = new System.Windows.Forms.Label(); + this.ball = new ShiftOS.WinForms.Controls.Canvas(); + this.paddleHuman = new System.Windows.Forms.PictureBox(); + this.paddleComputer = new System.Windows.Forms.Panel(); + this.lbllevelandtime = new System.Windows.Forms.Label(); + this.lblstatscodepoints = new System.Windows.Forms.Label(); + this.lblstatsY = new System.Windows.Forms.Label(); + this.lblstatsX = new System.Windows.Forms.Label(); + this.pgcontents.SuspendLayout(); + this.pnlmultiplayerhandshake.SuspendLayout(); + this.pnlintro.SuspendLayout(); + this.pnlhighscore.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.pnlgamestats.SuspendLayout(); + this.pnlfinalstats.SuspendLayout(); + this.pnllose.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit(); + this.SuspendLayout(); + // + // gameTimer + // + this.gameTimer.Interval = 30; + this.gameTimer.Tick += new System.EventHandler(this.gameTimer_Tick); + // + // counter + // + this.counter.Interval = 1000; + this.counter.Tick += new System.EventHandler(this.counter_Tick); + // + // tmrcountdown + // + this.tmrcountdown.Interval = 1000; + this.tmrcountdown.Tick += new System.EventHandler(this.countdown_Tick); + // + // tmrstoryline + // + this.tmrstoryline.Interval = 1000; + this.tmrstoryline.Tick += new System.EventHandler(this.tmrstoryline_Tick); + // + // pgcontents + // + this.pgcontents.BackColor = System.Drawing.Color.White; + this.pgcontents.Controls.Add(this.pnlmultiplayerhandshake); + this.pgcontents.Controls.Add(this.pnlintro); + this.pgcontents.Controls.Add(this.pnlhighscore); + this.pgcontents.Controls.Add(this.pnlgamestats); + this.pgcontents.Controls.Add(this.pnlfinalstats); + this.pgcontents.Controls.Add(this.pnllose); + this.pgcontents.Controls.Add(this.lblbeatai); + this.pgcontents.Controls.Add(this.lblcountdown); + this.pgcontents.Controls.Add(this.ball); + this.pgcontents.Controls.Add(this.paddleHuman); + this.pgcontents.Controls.Add(this.paddleComputer); + this.pgcontents.Controls.Add(this.lbllevelandtime); + this.pgcontents.Controls.Add(this.lblstatscodepoints); + this.pgcontents.Controls.Add(this.lblstatsY); + this.pgcontents.Controls.Add(this.lblstatsX); + this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; + this.pgcontents.Location = new System.Drawing.Point(0, 0); + this.pgcontents.Name = "pgcontents"; + this.pgcontents.Size = new System.Drawing.Size(912, 504); + this.pgcontents.TabIndex = 20; + this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint); + this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); + // + // pnlmultiplayerhandshake + // + this.pnlmultiplayerhandshake.Controls.Add(this.lvotherplayers); + this.pnlmultiplayerhandshake.Controls.Add(this.lbmpstatus); + this.pnlmultiplayerhandshake.Location = new System.Drawing.Point(446, 88); + this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake"; + this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231); + this.pnlmultiplayerhandshake.TabIndex = 15; + this.pnlmultiplayerhandshake.Visible = false; + // + // lvotherplayers + // + this.lvotherplayers.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvotherplayers.Location = new System.Drawing.Point(0, 45); + this.lvotherplayers.MultiSelect = false; + this.lvotherplayers.Name = "lvotherplayers"; + this.lvotherplayers.Size = new System.Drawing.Size(396, 186); + this.lvotherplayers.TabIndex = 1; + this.lvotherplayers.UseCompatibleStateImageBehavior = false; + this.lvotherplayers.View = System.Windows.Forms.View.Details; + this.lvotherplayers.DoubleClick += new System.EventHandler(this.lvotherplayers_DoubleClick); + // + // lbmpstatus + // + this.lbmpstatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lbmpstatus.Location = new System.Drawing.Point(0, 0); + this.lbmpstatus.Name = "lbmpstatus"; + this.lbmpstatus.Size = new System.Drawing.Size(396, 45); + this.lbmpstatus.TabIndex = 0; + this.lbmpstatus.Tag = "header2"; + this.lbmpstatus.Text = "Waiting for other players..."; + this.lbmpstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // pnlintro + // + this.pnlintro.Controls.Add(this.btnmatchmake); + this.pnlintro.Controls.Add(this.Label6); + this.pnlintro.Controls.Add(this.btnstartgame); + this.pnlintro.Controls.Add(this.Label8); + this.pnlintro.Location = new System.Drawing.Point(0, 0); + this.pnlintro.Name = "pnlintro"; + this.pnlintro.Size = new System.Drawing.Size(595, 303); + this.pnlintro.TabIndex = 13; + this.pnlintro.Tag = "header2"; + // + // btnmatchmake + // + this.btnmatchmake.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnmatchmake.Location = new System.Drawing.Point(188, 253); + this.btnmatchmake.Name = "btnmatchmake"; + this.btnmatchmake.Size = new System.Drawing.Size(242, 28); + this.btnmatchmake.TabIndex = 16; + this.btnmatchmake.Text = "Or, play against another Shifter!"; + this.btnmatchmake.UseVisualStyleBackColor = true; + this.btnmatchmake.Click += new System.EventHandler(this.btnmatchmake_Click); + // + // Label6 + // + this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label6.Location = new System.Drawing.Point(3, 39); + this.Label6.Name = "Label6"; + this.Label6.Size = new System.Drawing.Size(589, 159); + this.Label6.TabIndex = 15; + this.Label6.Text = "{PONG_DESC}"; + this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.Label6.Click += new System.EventHandler(this.Label6_Click); + // + // btnstartgame + // + this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnstartgame.Location = new System.Drawing.Point(188, 215); + this.btnstartgame.Name = "btnstartgame"; + this.btnstartgame.Size = new System.Drawing.Size(242, 28); + this.btnstartgame.TabIndex = 15; + this.btnstartgame.Text = "{PLAY}"; + this.btnstartgame.UseVisualStyleBackColor = true; + this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click); + // + // Label8 + // + this.Label8.AutoSize = true; + this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label8.ForeColor = System.Drawing.Color.Black; + this.Label8.Location = new System.Drawing.Point(250, 5); + this.Label8.Name = "Label8"; + this.Label8.Size = new System.Drawing.Size(280, 31); + this.Label8.TabIndex = 14; + this.Label8.Text = "{PONG_WELCOME}"; + this.Label8.Click += new System.EventHandler(this.Label8_Click); + // + // pnlhighscore + // + this.pnlhighscore.Controls.Add(this.lbhighscore); + this.pnlhighscore.Controls.Add(this.flowLayoutPanel1); + this.pnlhighscore.Controls.Add(this.label10); + this.pnlhighscore.Location = new System.Drawing.Point(688, 302); + this.pnlhighscore.Name = "pnlhighscore"; + this.pnlhighscore.Size = new System.Drawing.Size(539, 311); + this.pnlhighscore.TabIndex = 14; + this.pnlhighscore.Visible = false; + // + // lbhighscore + // + this.lbhighscore.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbhighscore.Location = new System.Drawing.Point(0, 36); + this.lbhighscore.Name = "lbhighscore"; + this.lbhighscore.Size = new System.Drawing.Size(539, 246); + this.lbhighscore.TabIndex = 1; + this.lbhighscore.UseCompatibleStateImageBehavior = false; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.button2); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 282); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(539, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // button2 + // + this.button2.AutoSize = true; + this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.button2.Location = new System.Drawing.Point(476, 3); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(60, 23); + this.button2.TabIndex = 0; + this.button2.Text = "{CLOSE}"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // label10 + // + this.label10.Dock = System.Windows.Forms.DockStyle.Top; + this.label10.Location = new System.Drawing.Point(0, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(539, 36); + this.label10.TabIndex = 0; + this.label10.Text = "{HIGH_SCORES}"; + this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // pnlgamestats + // + this.pnlgamestats.Controls.Add(this.button1); + this.pnlgamestats.Controls.Add(this.label12); + this.pnlgamestats.Controls.Add(this.lblnextstats); + this.pnlgamestats.Controls.Add(this.Label7); + this.pnlgamestats.Controls.Add(this.lblpreviousstats); + this.pnlgamestats.Controls.Add(this.Label4); + this.pnlgamestats.Controls.Add(this.btnplayon); + this.pnlgamestats.Controls.Add(this.Label3); + this.pnlgamestats.Controls.Add(this.btncashout); + this.pnlgamestats.Controls.Add(this.Label2); + this.pnlgamestats.Controls.Add(this.lbllevelreached); + this.pnlgamestats.Location = new System.Drawing.Point(104, 375); + this.pnlgamestats.Name = "pnlgamestats"; + this.pnlgamestats.Size = new System.Drawing.Size(466, 284); + this.pnlgamestats.TabIndex = 6; + this.pnlgamestats.Visible = false; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button1.Location = new System.Drawing.Point(32, 223); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(191, 35); + this.button1.TabIndex = 10; + this.button1.Text = "{PONG_VIEW_HIGHSCORES}"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.btnhighscore_Click); + // + // label12 + // + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.Location = new System.Drawing.Point(8, 187); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(245, 33); + this.label12.TabIndex = 9; + this.label12.Text = "{PONG_HIGHSCORE_EXP}"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblnextstats + // + this.lblnextstats.AutoSize = true; + this.lblnextstats.Location = new System.Drawing.Point(278, 136); + this.lblnextstats.Name = "lblnextstats"; + this.lblnextstats.Size = new System.Drawing.Size(0, 13); + this.lblnextstats.TabIndex = 8; + // + // Label7 + // + this.Label7.AutoSize = true; + this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label7.Location = new System.Drawing.Point(278, 119); + this.Label7.Name = "Label7"; + this.Label7.Size = new System.Drawing.Size(124, 16); + this.Label7.TabIndex = 7; + this.Label7.Text = "Next Level Stats:"; + // + // lblpreviousstats + // + this.lblpreviousstats.AutoSize = true; + this.lblpreviousstats.Location = new System.Drawing.Point(278, 54); + this.lblpreviousstats.Name = "lblpreviousstats"; + this.lblpreviousstats.Size = new System.Drawing.Size(0, 13); + this.lblpreviousstats.TabIndex = 6; + // + // Label4 + // + this.Label4.AutoSize = true; + this.Label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label4.Location = new System.Drawing.Point(278, 37); + this.Label4.Name = "Label4"; + this.Label4.Size = new System.Drawing.Size(154, 16); + this.Label4.TabIndex = 5; + this.Label4.Text = "Previous Level Stats:"; + // + // btnplayon + // + this.btnplayon.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnplayon.Location = new System.Drawing.Point(32, 147); + this.btnplayon.Name = "btnplayon"; + this.btnplayon.Size = new System.Drawing.Size(191, 35); + this.btnplayon.TabIndex = 4; + this.btnplayon.Text = "Play on for 3 codepoints!"; + this.btnplayon.UseVisualStyleBackColor = true; + this.btnplayon.Click += new System.EventHandler(this.btnplayon_Click); + // + // Label3 + // + this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label3.Location = new System.Drawing.Point(8, 111); + this.Label3.Name = "Label3"; + this.Label3.Size = new System.Drawing.Size(245, 33); + this.Label3.TabIndex = 3; + this.Label3.Text = "{PONG_PLAYON_DESC}"; + this.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btncashout + // + this.btncashout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btncashout.Location = new System.Drawing.Point(32, 73); + this.btncashout.Name = "btncashout"; + this.btncashout.Size = new System.Drawing.Size(191, 35); + this.btncashout.TabIndex = 2; + this.btncashout.Text = "Cash out with 1 codepoint!"; + this.btncashout.UseVisualStyleBackColor = true; + this.btncashout.Click += new System.EventHandler(this.btncashout_Click); + // + // Label2 + // + this.Label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label2.Location = new System.Drawing.Point(8, 37); + this.Label2.Name = "Label2"; + this.Label2.Size = new System.Drawing.Size(245, 33); + this.Label2.TabIndex = 1; + this.Label2.Text = "{PONG_CASHOUT_DESC}"; + this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lbllevelreached + // + this.lbllevelreached.AutoSize = true; + this.lbllevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbllevelreached.Location = new System.Drawing.Point(149, 6); + this.lbllevelreached.Name = "lbllevelreached"; + this.lbllevelreached.Size = new System.Drawing.Size(185, 20); + this.lbllevelreached.TabIndex = 0; + this.lbllevelreached.Text = "You Reached Level 2!"; + // + // pnlfinalstats + // + this.pnlfinalstats.Controls.Add(this.btnplayagain); + this.pnlfinalstats.Controls.Add(this.lblfinalcodepoints); + this.pnlfinalstats.Controls.Add(this.Label11); + this.pnlfinalstats.Controls.Add(this.lblfinalcomputerreward); + this.pnlfinalstats.Controls.Add(this.Label9); + this.pnlfinalstats.Controls.Add(this.lblfinallevelreward); + this.pnlfinalstats.Controls.Add(this.lblfinallevelreached); + this.pnlfinalstats.Controls.Add(this.lblfinalcodepointswithtext); + this.pnlfinalstats.Location = new System.Drawing.Point(172, 74); + this.pnlfinalstats.Name = "pnlfinalstats"; + this.pnlfinalstats.Size = new System.Drawing.Size(362, 226); + this.pnlfinalstats.TabIndex = 9; + this.pnlfinalstats.Visible = false; + // + // btnplayagain + // + this.btnplayagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnplayagain.Location = new System.Drawing.Point(5, 194); + this.btnplayagain.Name = "btnplayagain"; + this.btnplayagain.Size = new System.Drawing.Size(352, 29); + this.btnplayagain.TabIndex = 16; + this.btnplayagain.Text = "{PLAY}"; + this.btnplayagain.UseVisualStyleBackColor = true; + this.btnplayagain.Click += new System.EventHandler(this.btnplayagain_Click); + // + // lblfinalcodepoints + // + this.lblfinalcodepoints.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblfinalcodepoints.Location = new System.Drawing.Point(3, 124); + this.lblfinalcodepoints.Name = "lblfinalcodepoints"; + this.lblfinalcodepoints.Size = new System.Drawing.Size(356, 73); + this.lblfinalcodepoints.TabIndex = 15; + this.lblfinalcodepoints.Tag = "header1"; + this.lblfinalcodepoints.Text = "134 CP"; + this.lblfinalcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Label11 + // + this.Label11.AutoSize = true; + this.Label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label11.Location = new System.Drawing.Point(162, 82); + this.Label11.Name = "Label11"; + this.Label11.Size = new System.Drawing.Size(33, 33); + this.Label11.TabIndex = 14; + this.Label11.Tag = "header2"; + this.Label11.Text = "+"; + this.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblfinalcomputerreward + // + this.lblfinalcomputerreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblfinalcomputerreward.Location = new System.Drawing.Point(193, 72); + this.lblfinalcomputerreward.Name = "lblfinalcomputerreward"; + this.lblfinalcomputerreward.Size = new System.Drawing.Size(151, 52); + this.lblfinalcomputerreward.TabIndex = 12; + this.lblfinalcomputerreward.Tag = "header2"; + this.lblfinalcomputerreward.Text = "34"; + this.lblfinalcomputerreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Label9 + // + this.Label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label9.Location = new System.Drawing.Point(179, 31); + this.Label9.Name = "Label9"; + this.Label9.Size = new System.Drawing.Size(180, 49); + this.Label9.TabIndex = 11; + this.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblfinallevelreward + // + this.lblfinallevelreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblfinallevelreward.Location = new System.Drawing.Point(12, 72); + this.lblfinallevelreward.Name = "lblfinallevelreward"; + this.lblfinallevelreward.Size = new System.Drawing.Size(151, 52); + this.lblfinallevelreward.TabIndex = 10; + this.lblfinallevelreward.Tag = "header2"; + this.lblfinallevelreward.Text = "100"; + this.lblfinallevelreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblfinallevelreached + // + this.lblfinallevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblfinallevelreached.Location = new System.Drawing.Point(3, 31); + this.lblfinallevelreached.Name = "lblfinallevelreached"; + this.lblfinallevelreached.Size = new System.Drawing.Size(170, 49); + this.lblfinallevelreached.TabIndex = 9; + this.lblfinallevelreached.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblfinalcodepointswithtext + // + this.lblfinalcodepointswithtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblfinalcodepointswithtext.Location = new System.Drawing.Point(3, 2); + this.lblfinalcodepointswithtext.Name = "lblfinalcodepointswithtext"; + this.lblfinalcodepointswithtext.Size = new System.Drawing.Size(356, 26); + this.lblfinalcodepointswithtext.TabIndex = 1; + this.lblfinalcodepointswithtext.Tag = "header2"; + this.lblfinalcodepointswithtext.Text = "You cashed out with 134 codepoints!"; + this.lblfinalcodepointswithtext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // pnllose + // + this.pnllose.Controls.Add(this.lblmissedout); + this.pnllose.Controls.Add(this.lblbutyougained); + this.pnllose.Controls.Add(this.btnlosetryagain); + this.pnllose.Controls.Add(this.Label5); + this.pnllose.Controls.Add(this.Label1); + this.pnllose.Location = new System.Drawing.Point(209, 71); + this.pnllose.Name = "pnllose"; + this.pnllose.Size = new System.Drawing.Size(266, 214); + this.pnllose.TabIndex = 10; + this.pnllose.Visible = false; + // + // lblmissedout + // + this.lblmissedout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblmissedout.Location = new System.Drawing.Point(3, 175); + this.lblmissedout.Name = "lblmissedout"; + this.lblmissedout.Size = new System.Drawing.Size(146, 35); + this.lblmissedout.TabIndex = 3; + this.lblmissedout.Text = "You Missed Out On: 500 Codepoints"; + this.lblmissedout.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblbutyougained + // + this.lblbutyougained.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblbutyougained.Location = new System.Drawing.Point(3, 125); + this.lblbutyougained.Name = "lblbutyougained"; + this.lblbutyougained.Size = new System.Drawing.Size(146, 35); + this.lblbutyougained.TabIndex = 3; + this.lblbutyougained.Text = "But you gained 5 Codepoints"; + this.lblbutyougained.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // btnlosetryagain + // + this.btnlosetryagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnlosetryagain.Location = new System.Drawing.Point(155, 176); + this.btnlosetryagain.Name = "btnlosetryagain"; + this.btnlosetryagain.Size = new System.Drawing.Size(106, 35); + this.btnlosetryagain.TabIndex = 2; + this.btnlosetryagain.Text = "Try Again"; + this.btnlosetryagain.UseVisualStyleBackColor = true; + this.btnlosetryagain.Click += new System.EventHandler(this.btnlosetryagain_Click); + // + // Label5 + // + this.Label5.Location = new System.Drawing.Point(7, 26); + this.Label5.Name = "Label5"; + this.Label5.Size = new System.Drawing.Size(260, 163); + this.Label5.TabIndex = 1; + // + // Label1 + // + this.Label1.Dock = System.Windows.Forms.DockStyle.Top; + this.Label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label1.Location = new System.Drawing.Point(0, 0); + this.Label1.Name = "Label1"; + this.Label1.Size = new System.Drawing.Size(266, 16); + this.Label1.TabIndex = 0; + this.Label1.Text = "You lose!"; + this.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // lblbeatai + // + this.lblbeatai.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblbeatai.Location = new System.Drawing.Point(47, 41); + this.lblbeatai.Name = "lblbeatai"; + this.lblbeatai.Size = new System.Drawing.Size(600, 30); + this.lblbeatai.TabIndex = 8; + this.lblbeatai.Tag = "header2"; + this.lblbeatai.Text = "You got 2 codepoints for beating the Computer!"; + this.lblbeatai.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lblbeatai.Visible = false; + // + // lblcountdown + // + this.lblcountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblcountdown.Location = new System.Drawing.Point(182, 152); + this.lblcountdown.Name = "lblcountdown"; + this.lblcountdown.Size = new System.Drawing.Size(315, 49); + this.lblcountdown.TabIndex = 7; + this.lblcountdown.Text = "3"; + this.lblcountdown.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lblcountdown.Visible = false; + // + // ball + // + this.ball.BackColor = System.Drawing.Color.Black; + this.ball.Location = new System.Drawing.Point(300, 152); + this.ball.Name = "ball"; + this.ball.Size = new System.Drawing.Size(20, 20); + this.ball.TabIndex = 2; + this.ball.MouseEnter += new System.EventHandler(this.ball_MouseEnter); + this.ball.MouseLeave += new System.EventHandler(this.ball_MouseLeave); + // + // paddleHuman + // + this.paddleHuman.BackColor = System.Drawing.Color.Black; + this.paddleHuman.Location = new System.Drawing.Point(10, 134); + this.paddleHuman.Name = "paddleHuman"; + this.paddleHuman.Size = new System.Drawing.Size(20, 100); + this.paddleHuman.TabIndex = 3; + this.paddleHuman.TabStop = false; + // + // paddleComputer + // + this.paddleComputer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.paddleComputer.BackColor = System.Drawing.Color.Black; + this.paddleComputer.Location = new System.Drawing.Point(878, 134); + this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 150); + this.paddleComputer.Name = "paddleComputer"; + this.paddleComputer.Size = new System.Drawing.Size(20, 100); + this.paddleComputer.TabIndex = 1; + // + // lbllevelandtime + // + this.lbllevelandtime.Dock = System.Windows.Forms.DockStyle.Top; + this.lbllevelandtime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbllevelandtime.Location = new System.Drawing.Point(0, 0); + this.lbllevelandtime.Name = "lbllevelandtime"; + this.lbllevelandtime.Size = new System.Drawing.Size(912, 22); + this.lbllevelandtime.TabIndex = 4; + this.lbllevelandtime.Tag = "header1"; + this.lbllevelandtime.Text = "Level: 1 - 58 Seconds Left"; + this.lbllevelandtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblstatscodepoints + // + this.lblstatscodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblstatscodepoints.AutoSize = true; + this.lblstatscodepoints.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblstatscodepoints.Location = new System.Drawing.Point(239, 460); + this.lblstatscodepoints.Name = "lblstatscodepoints"; + this.lblstatscodepoints.Size = new System.Drawing.Size(116, 23); + this.lblstatscodepoints.TabIndex = 12; + this.lblstatscodepoints.Tag = "header2"; + this.lblstatscodepoints.Text = "Codepoints: "; + this.lblstatscodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblstatsY + // + this.lblstatsY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.lblstatsY.AutoSize = true; + this.lblstatsY.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblstatsY.Location = new System.Drawing.Point(440, 460); + this.lblstatsY.Name = "lblstatsY"; + this.lblstatsY.Size = new System.Drawing.Size(76, 23); + this.lblstatsY.TabIndex = 11; + this.lblstatsY.Tag = "header2"; + this.lblstatsY.Text = "Yspeed:"; + this.lblstatsY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblstatsX + // + this.lblstatsX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblstatsX.AutoSize = true; + this.lblstatsX.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblstatsX.Location = new System.Drawing.Point(3, 460); + this.lblstatsX.Name = "lblstatsX"; + this.lblstatsX.Size = new System.Drawing.Size(83, 23); + this.lblstatsX.TabIndex = 5; + this.lblstatsX.Tag = "header2"; + this.lblstatsX.Text = "Xspeed: "; + this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Pong + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.pgcontents); + this.DoubleBuffered = true; + this.Name = "Pong"; + this.Size = new System.Drawing.Size(912, 504); + this.Load += new System.EventHandler(this.Pong_Load); + this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); + this.pgcontents.ResumeLayout(false); + this.pgcontents.PerformLayout(); + this.pnlmultiplayerhandshake.ResumeLayout(false); + this.pnlintro.ResumeLayout(false); + this.pnlintro.PerformLayout(); + this.pnlhighscore.ResumeLayout(false); + this.pnlhighscore.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.pnlgamestats.ResumeLayout(false); + this.pnlgamestats.PerformLayout(); + this.pnlfinalstats.ResumeLayout(false); + this.pnlfinalstats.PerformLayout(); + this.pnllose.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit(); + this.ResumeLayout(false); + + } + internal System.Windows.Forms.Panel paddleComputer; + internal System.Windows.Forms.Timer gameTimer; + internal System.Windows.Forms.PictureBox paddleHuman; + internal System.Windows.Forms.Label lbllevelandtime; + internal System.Windows.Forms.Label lblstatsX; + internal System.Windows.Forms.Timer counter; + internal System.Windows.Forms.Panel pnlgamestats; + internal System.Windows.Forms.Label lblnextstats; + internal System.Windows.Forms.Label Label7; + internal System.Windows.Forms.Label lblpreviousstats; + internal System.Windows.Forms.Label Label4; + internal System.Windows.Forms.Button btnplayon; + internal System.Windows.Forms.Label Label3; + internal System.Windows.Forms.Button btncashout; + internal System.Windows.Forms.Label Label2; + internal System.Windows.Forms.Label lbllevelreached; + internal System.Windows.Forms.Label lblcountdown; + internal System.Windows.Forms.Timer tmrcountdown; + internal System.Windows.Forms.Label lblbeatai; + internal System.Windows.Forms.Panel pnlfinalstats; + internal System.Windows.Forms.Button btnplayagain; + internal System.Windows.Forms.Label lblfinalcodepoints; + internal System.Windows.Forms.Label Label11; + internal System.Windows.Forms.Label lblfinalcomputerreward; + internal System.Windows.Forms.Label Label9; + internal System.Windows.Forms.Label lblfinallevelreward; + internal System.Windows.Forms.Label lblfinallevelreached; + internal System.Windows.Forms.Label lblfinalcodepointswithtext; + internal System.Windows.Forms.Panel pnllose; + internal System.Windows.Forms.Label lblmissedout; + internal System.Windows.Forms.Label lblbutyougained; + internal System.Windows.Forms.Button btnlosetryagain; + internal System.Windows.Forms.Label Label5; + internal System.Windows.Forms.Label Label1; + internal System.Windows.Forms.Label lblstatscodepoints; + internal System.Windows.Forms.Label lblstatsY; + internal System.Windows.Forms.Panel pnlintro; + internal System.Windows.Forms.Label Label6; + internal System.Windows.Forms.Button btnstartgame; + internal System.Windows.Forms.Label Label8; + internal System.Windows.Forms.Timer tmrstoryline; + private System.Windows.Forms.Panel pnlhighscore; + private System.Windows.Forms.ListView lbhighscore; + private System.Windows.Forms.Label label10; + internal Canvas pgcontents; + internal Canvas ball; + internal System.Windows.Forms.Button button1; + internal System.Windows.Forms.Label label12; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button button2; + internal System.Windows.Forms.Button btnmatchmake; + private System.Windows.Forms.Panel pnlmultiplayerhandshake; + private System.Windows.Forms.ListView lvotherplayers; + private System.Windows.Forms.Label lbmpstatus; + } +} diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs new file mode 100644 index 0000000..02d9963 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -0,0 +1,1143 @@ +/* + * 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.WinForms.Tools; + +namespace ShiftOS.WinForms.Applications +{ + [MultiplayerOnly] + [Launcher("Pong", true, "al_pong", "Games")] + [WinOpen("pong")] + [DefaultIcon("iconPong")] + public partial class Pong : UserControl, IShiftOSWindow + { + //I can assure you guaranteed that there is an acorn somewhere, in this place, and the sailors are looking for it + int xVel = 7; + int yVel = 8; + int computerspeed = 8; + int level = 1; + int secondsleft = 60; + int casualposition; + double xveldec = 3.0; + double yveldec = 3.0; + double incrementx = 0.4; + double incrementy = 0.2; + int levelxspeed = 3; + int levelyspeed = 3; + int beatairewardtotal; + int beataireward = 1; + int[] levelrewards = new int[50]; + int totalreward; + int countdown = 3; + + bool aiShouldIsbeEnabled = true; + + public Pong() + { + InitializeComponent(); + } + + private void Pong_Load(object sender, EventArgs e) + { + setuplevelrewards(); + } + + + + // Move the paddle according to the mouse position. + private void pongMain_MouseMove(object sender, MouseEventArgs e) + { + var loc = this.PointToClient(MousePosition); + if (IsMultiplayerSession) + { + if (IsLeader) + { + paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2)); + ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleHuman.Top.ToString()); + } + else + { + paddleComputer.Location = new Point(paddleComputer.Location.X, (loc.Y) - (paddleComputer.Height / 2)); + ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleComputer.Top.ToString()); + } + } + else + { + paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2)); + } + } + + private void CenterPanels() + { + pnlfinalstats.CenterParent(); + pnlgamestats.CenterParent(); + pnlhighscore.CenterParent(); + pnlintro.CenterParent(); + pnllose.CenterParent(); + lblcountdown.CenterParent(); + lblbeatai.Left = (this.Width - lblbeatai.Width) / 2; + SetupStats(); + } + + public void SetupStats() + { + lblstatsX.Location = new Point(5, this.Height - lblstatsX.Height - 5); + lblstatsY.Location = new Point(this.Width - lblstatsY.Width - 5, this.Height - lblstatsY.Height - 5); + lblstatscodepoints.Top = this.Height - lblstatscodepoints.Height - 5; + lblstatscodepoints.Left = (this.Width - lblstatscodepoints.Width) / 2; + } + + int OpponentY = 0; + + bool IsLeader = true; + + int LeaderX = 0; + int LeaderY = 0; + + // ERROR: Handles clauses are not supported in C# + private void gameTimer_Tick(object sender, EventArgs e) + { + if (this.Left < Screen.PrimaryScreen.Bounds.Width) + { + ball.BackColor = SkinEngine.LoadedSkin.ControlTextColor; + paddleComputer.BackColor = SkinEngine.LoadedSkin.ControlTextColor; + paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor; + + //Check if paddle upgrade has been bought and change paddles accordingly + //if (ShiftoriumFrontend.UpgradeInstalled("pong_increased_paddle_size")) + //{ + // paddleHuman.Height = 150; + // paddleComputer.Height = 150; + //} + //I don't know the point of this but I'm fucking 86ing it. - Michael + + //Set the computer player to move according to the ball's position. + if (IsMultiplayerSession == true) + { + //If we're multiplayer, then we want to set the computer Y to the opponent's Y. + //If we're the leader, we set the AI paddle, else we set the player paddle. + if (IsLeader) + paddleComputer.Top = OpponentY; + else + paddleHuman.Top = OpponentY; + } + else + { + if (aiShouldIsbeEnabled) + if (ball.Location.X > (this.Width - (this.Width / 3)) - xVel * 10 && xVel > 0) + { + if (ball.Location.Y > paddleComputer.Location.Y + 50) + { + paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); + } + if (ball.Location.Y < paddleComputer.Location.Y + 50) + { + paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); + } + casualposition = rand.Next(-150, 201); + } + else + { + //used to be me.location.y - except it's fucking C# and this comment is misleading as fuck. OH WAIT! I didn't write it! And none of the current devs did either! - Michael + if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition) + { + paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); + } + //Rylan is hot. Used to be //used to be me.location.y + if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition) + { + paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); + } + } + } + //Set Xvel and Yvel speeds from decimal + if (xVel > 0) + xVel = (int)Math.Round(xveldec); + if (xVel < 0) + xVel = (int)-Math.Round(xveldec); + if (yVel > 0) + yVel = (int)Math.Round(yveldec); + if (yVel < 0) + yVel = (int)-Math.Round(yveldec); + + bool BallPhysics = true; + + if (IsMultiplayerSession) + { + //Logic for moving the ball in Multiplayer. + if (IsLeader) + { + ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); + } + else + { + //Move it to the leader's ball position. + ball.Location = new Point(LeaderX, LeaderY); + BallPhysics = false; + } + } + else + {// Move the game ball. + ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); + } + if (BallPhysics) + { + // Check for top wall. + if (ball.Location.Y < 0) + { + ball.Location = new Point(ball.Location.X, 0); + yVel = -yVel; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + } + + // Check for bottom wall. + if (ball.Location.Y > pgcontents.Height - ball.Height) + { + ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height); + yVel = -yVel; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + } + + + // Check for player paddle. + if (ball.Bounds.IntersectsWith(paddleHuman.Bounds)) + { + ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width + 1, ball.Location.Y); + //randomly increase x or y speed of ball + switch (rand.Next(1, 3)) + { + case 1: + xveldec = xveldec + incrementx; + break; + case 2: + if (yveldec > 0) + yveldec = yveldec + incrementy; + if (yveldec < 0) + yveldec = yveldec - incrementy; + break; + } + xVel = -xVel; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); + + } + + // Check for computer paddle. + if (ball.Bounds.IntersectsWith(paddleComputer.Bounds)) + { + ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width - 1, ball.Location.Y); + xveldec = xveldec + incrementx; + xVel = -xVel; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); + } + } + + + + // Check for left wall. + if (ball.Location.X < -100) + { + //If we are in multiplayer, and not the leader, we won. + if (IsMultiplayerSession) + { + if (IsLeader) + { + //We lost. + NotifyLoseToTarget(); + } + else + { + //We won. + NotifyWinToTarget(); + Win(); + } + } + else + { + ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); + paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y); + if (xVel > 0) + xVel = -xVel; + pnllose.Show(); + gameTimer.Stop(); + counter.Stop(); + lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}"); + if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2")) + { + totalreward = levelrewards[level - 1] + beatairewardtotal; + double onePercent = (totalreward / 100); + lblbutyougained.Show(); + lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}")); + SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100)); + } + else + { + lblbutyougained.Hide(); + } + } + } + + // Check for right wall. + if (ball.Location.X > this.Width - ball.Size.Width - paddleComputer.Width + 100) + { + if (IsMultiplayerSession) + { + //If we are the leader we won. + if (IsLeader) + { + NotifyWinToTarget(); + Win(); + } + else + { + NotifyLoseToTarget(); + } + } + else + { + Win(); + } + } + + if (IsMultiplayerSession) + { + if (IsLeader) + { + ServerManager.Forward(OpponentGUID, "pong_mp_setballpos", JsonConvert.SerializeObject(ball.Location)); + } + } + + if (IsLeader) + { + //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy + lblstatsX.Text = Localization.Parse("{H_VEL}: ") + xveldec; + lblstatsY.Text = Localization.Parse("{V_VEL}: ") + yveldec; + lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString(); + lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); + + if (xVel > 20 || xVel < -20) + { + paddleHuman.Width = Math.Abs(xVel); + paddleComputer.Width = Math.Abs(xVel); + } + else + { + paddleHuman.Width = 20; + paddleComputer.Width = 20; + } + } + if (!IsMultiplayerSession) + { + computerspeed = Math.Abs(yVel); + } + } + } + + public void ServerMessageReceivedHandler(ServerMessage msg) + { + if (IsMultiplayerSession) + { + if (msg.Name == "pong_mp_setballpos") + { + var pt = JsonConvert.DeserializeObject<Point>(msg.Contents); + LeaderX = pt.X; + LeaderY = pt.Y; + } + else if (msg.Name == "pong_mp_left") + { + this.Invoke(new Action(() => + { + AppearanceManager.Close(this); + })); + Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped."); + } + else if (msg.Name == "pong_mp_youlose") + { + this.Invoke(new Action(LoseMP)); + } + else if (msg.Name == "pong_mp_setopponenty") + { + int y = Convert.ToInt32(msg.Contents); + OpponentY = y; + } + else if (msg.Name == "pong_handshake_matchmake") + { + if (!PossibleMatchmakes.Contains(msg.Contents)) + PossibleMatchmakes.Add(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); + } + else if (msg.Name == "pong_handshake_resendid") + { + ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID); + } + else if (msg.Name == "pong_handshake_complete") + { + IsLeader = true; + + OpponentGUID = msg.Contents; + LeaveMatchmake(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + StartLevel(); + })); + } + else if(msg.Name == "pong_mp_levelcompleted") + { + level = Convert.ToInt32(msg.Contents) + 1; + this.Invoke(new Action(CompleteLevel)); + } + else if (msg.Name == "pong_handshake_chosen") + { + IsLeader = false; + LeaveMatchmake(); + OpponentGUID = msg.Contents; + YouGUID = ServerManager.thisGuid.ToString(); + //Start the timers. + counter.Start(); + SendFollowerGUID(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + })); + } + else if(msg.Name == "pong_mp_cashedout") + { + this.Invoke(new Action(() => + { + btncashout_Click(this, EventArgs.Empty); + })); + Infobox.Show("Cashed out.", "The other player has cashed out their Codepoints. Therefore, we have automatically cashed yours out."); + } + else if(msg.Name == "pong_mp_startlevel") + { + OpponentAgrees = true; + if(YouAgree == false) + { + Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer)=> + { + YouAgree = answer; + ServerManager.Forward(OpponentGUID, "pong_mp_level_callback", YouAgree.ToString()); + }); + } + } + else if(msg.Name == "pong_mp_level_callback") + { + bool agreed = bool.Parse(msg.Contents); + OpponentAgrees = agreed; + if (OpponentAgrees) + { + if (IsLeader) + { + //this.Invoke(new Action(())) + } + } + } + else if (msg.Name == "pong_handshake_left") + { + if (this.PossibleMatchmakes.Contains(msg.Contents)) + this.PossibleMatchmakes.Remove(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); + } + else if(msg.Name == "pong_mp_clockupdate") + { + secondsleft = Convert.ToInt32(msg.Contents); + } + else if (msg.Name == "pong_mp_youwin") + { + this.Invoke(new Action(Win)); + } + } + } + + bool OpponentAgrees = false; + bool YouAgree = false; + + public void ListMatchmakes() + { + lvotherplayers.Items.Clear(); + var c = new ColumnHeader(); + c.Width = lvotherplayers.Width; + c.Text = "Player"; + lvotherplayers.Columns.Clear(); + lvotherplayers.Columns.Add(c); + + lvotherplayers.FullRowSelect = true; + foreach (var itm in PossibleMatchmakes) + { + if (itm != YouGUID) + { + var l = new ListViewItem(); + l.Text = itm; + lvotherplayers.Items.Add(l); + } + } + + if (PossibleMatchmakes.Count > 0) + { + lbmpstatus.Text = "Select a player."; + } + else + { + lbmpstatus.Text = "Waiting for players..."; + } + } + + public void NotifyLoseToTarget() + { + ServerManager.Forward(OpponentGUID, "pong_mp_youwin", null); + } + + public void NotifyWinToTarget() + { + ServerManager.Forward(OpponentGUID, "pong_mp_youlose", null); + } + + public void LeaveMatchmake() + { + ServerManager.Forward("all", "pong_handshake_left", YouGUID); + } + + List<string> PossibleMatchmakes = new List<string>(); + + public void SendLeaderGUID(string target) + { + ServerManager.Forward(target, "pong_handshake_chosen", YouGUID); + } + + + public void StartMultiplayer() + { + IsMultiplayerSession = true; + YouGUID = ServerManager.thisGuid.ToString(); + ServerManager.SendMessage("pong_handshake_matchmake", YouGUID); + StartMatchmake(); + } + + public void StartMatchmake() + { + pnlmultiplayerhandshake.Show(); + pnlmultiplayerhandshake.CenterParent(); + pnlmultiplayerhandshake.BringToFront(); + + ServerManager.Forward("all", "pong_handshake_resendid", null); + + } + + + public void SendFollowerGUID() + { + ServerManager.Forward(OpponentGUID, "pong_handshake_complete", YouGUID); + } + + public void LoseMP() + { + ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); + if(IsLeader) + if (xVel > 0) + xVel = -xVel; + lblbeatai.Show(); + lblbeatai.Text = "The opponent has beaten you!"; + tmrcountdown.Start(); + gameTimer.Stop(); + counter.Stop(); + + } + + public void Win() + { + ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); + paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y); + if (xVel > 0) + xVel = -xVel; + beatairewardtotal = beatairewardtotal + beataireward; + lblbeatai.Show(); + lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD_SECONDARY}}: {beataireward}"); + tmrcountdown.Start(); + gameTimer.Stop(); + counter.Stop(); + + } + + public void CompleteLevel() + { + if (SaveSystem.CurrentSave.UniteAuthToken != null) + { + try + { + var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); + if (unite.GetPongLevel() < level) + unite.SetPongLevel(level); + } + catch { } + } + //Only set these stats if the user is the leader. + if (IsLeader) + { + secondsleft = 60; + level = level + 1; + generatenextlevel(); + } + + pnlgamestats.Show(); + pnlgamestats.BringToFront(); + pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2)); + + counter.Stop(); + gameTimer.Stop(); + + } + + // ERROR: Handles clauses are not supported in C# + private void counter_Tick(object sender, EventArgs e) + { + if (IsLeader) + { + if (this.Left < Screen.PrimaryScreen.Bounds.Width) + { + secondsleft = secondsleft - 1; + if (secondsleft == 0) + { + CompleteLevel(); + } + + lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString(); + } + } + SetupStats(); + } + + [Obsolete("This method does nothing. Use UniteClient for highscore queries.")] + public void SendHighscores() + { + } + + // ERROR: Handles clauses are not supported in C# + private void btnplayon_Click(object sender, EventArgs e) + { + xveldec = levelxspeed; + yveldec = levelyspeed; + + secondsleft = 60; + + tmrcountdown.Start(); + lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}"); + pnlgamestats.Hide(); + lblbeatai.Show(); + ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, paddleHuman.Location.Y + paddleHuman.Height / 2); + if (xVel < 0) + xVel = Math.Abs(xVel); + lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); + } + + //Increase the ball speed stats for the next level + private void generatenextlevel() + { + lbllevelreached.Text = Localization.Parse("{YOU_REACHED_LEVEL} " + level + "!"); + + lblpreviousstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); + + switch (rand.Next(1, 3)) + { + case 1: + levelxspeed = levelxspeed + 1; + break; + case 2: + levelxspeed = levelxspeed + 2; + break; + } + + switch (rand.Next(1, 3)) + { + case 1: + levelyspeed = levelyspeed + 1; + break; + case 2: + levelyspeed = levelyspeed + 2; + break; + } + + switch (rand.Next(1, 6)) + { + case 1: + incrementx = incrementx + 0.1; + break; + case 2: + incrementx = incrementx + 0.2; + break; + case 3: + incrementy = incrementy + 0.1; + break; + case 4: + incrementy = incrementy + 0.2; + break; + case 5: + incrementy = incrementy + 0.3; + break; + } + + lblnextstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); + + if (level < 15) + { + if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) + { + beataireward = level * 10; + } else + { + beataireward = level * 5; + } + } + else + { + if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) + { + double br = levelrewards[level - 1] / 10; + beataireward = (int)Math.Round(br) * 10; + } else + { + double br = levelrewards[level - 1] / 10; + beataireward = (int)Math.Round(br) * 5; + } + } + + totalreward = levelrewards[level - 1] + beatairewardtotal; + + btncashout.Text = Localization.Parse("{CASH_OUT_WITH_CODEPOINTS}"); + btnplayon.Text = Localization.Parse("{PONG_PLAY_ON_FOR_MORE}"); + } + + private void setuplevelrewards() + { + if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) + { + levelrewards[0] = 0; + levelrewards[1] = 40; + levelrewards[2] = 120; + levelrewards[3] = 280; + levelrewards[4] = 580; + levelrewards[5] = 800; + levelrewards[6] = 1200; + levelrewards[7] = 1800; + levelrewards[8] = 2400; + levelrewards[9] = 3200; + levelrewards[10] = 4000; + levelrewards[11] = 5000; + levelrewards[12] = 6000; + levelrewards[13] = 8000; + levelrewards[14] = 10000; + levelrewards[15] = 12000; + levelrewards[16] = 16000; + levelrewards[17] = 20000; + levelrewards[18] = 26000; + levelrewards[19] = 32000; + levelrewards[20] = 40000; + levelrewards[21] = 50000; + levelrewards[22] = 64000; + levelrewards[23] = 80000; + levelrewards[24] = 100000; + levelrewards[25] = 120000; + levelrewards[26] = 150000; + levelrewards[27] = 180000; + levelrewards[28] = 220000; + levelrewards[29] = 280000; + levelrewards[30] = 360000; + levelrewards[31] = 440000; + levelrewards[32] = 540000; + levelrewards[33] = 640000; + levelrewards[34] = 800000; + levelrewards[35] = 1000000; + levelrewards[36] = 1280000; + levelrewards[37] = 1600000; + levelrewards[38] = 2000000; + levelrewards[39] = 3000000; + levelrewards[40] = 4000000; + } else + { + levelrewards[0] = 0; + levelrewards[1] = 20; + levelrewards[2] = 60; + levelrewards[3] = 140; + levelrewards[4] = 290; + levelrewards[5] = 400; + levelrewards[6] = 600; + levelrewards[7] = 900; + levelrewards[8] = 1200; + levelrewards[9] = 1600; + levelrewards[10] = 2000; + levelrewards[11] = 2500; + levelrewards[12] = 3000; + levelrewards[13] = 4000; + levelrewards[14] = 5000; + levelrewards[15] = 6000; + levelrewards[16] = 8000; + levelrewards[17] = 10000; + levelrewards[18] = 13000; + levelrewards[19] = 16000; + levelrewards[20] = 20000; + levelrewards[21] = 25000; + levelrewards[22] = 32000; + levelrewards[23] = 40000; + levelrewards[24] = 50000; + levelrewards[25] = 60000; + levelrewards[26] = 75000; + levelrewards[27] = 90000; + levelrewards[28] = 110000; + levelrewards[29] = 140000; + levelrewards[30] = 180000; + levelrewards[31] = 220000; + levelrewards[32] = 270000; + levelrewards[33] = 320000; + levelrewards[34] = 400000; + levelrewards[35] = 500000; + levelrewards[36] = 640000; + levelrewards[37] = 800000; + levelrewards[38] = 1000000; + levelrewards[39] = 1500000; + levelrewards[40] = 2000000; + } + } + + // ERROR: Handles clauses are not supported in C# + private void countdown_Tick(object sender, EventArgs e) + { + if (this.Left < Screen.PrimaryScreen.Bounds.Width) + { + switch (countdown) + { + case 0: + countdown = 3; + lblcountdown.Hide(); + lblbeatai.Hide(); + gameTimer.Start(); + counter.Start(); + tmrcountdown.Stop(); + break; + case 1: + lblcountdown.Text = "1"; + countdown = countdown - 1; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + break; + case 2: + lblcountdown.Text = "2"; + countdown = countdown - 1; + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + break; + case 3: + lblcountdown.Text = "3"; + countdown = countdown - 1; + lblcountdown.Show(); + ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); + break; + } + + } + } + + // ERROR: Handles clauses are not supported in C# + private void btncashout_Click(object sender, EventArgs e) + { + pnlgamestats.Hide(); + pnlfinalstats.Show(); + lblfinalcodepointswithtext.Text = Localization.Parse("{YOU_WON} " + totalreward + " {CODEPOINTS}!"); + lblfinallevelreached.Text = Localization.Parse("{CODEPOINTS_FOR_BEATING_LEVEL}: ") + (level - 1).ToString(); + lblfinallevelreward.Text = levelrewards[level - 1].ToString(); + lblfinalcomputerreward.Text = beatairewardtotal.ToString(); + lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}"); + SaveSystem.TransferCodepointsFrom("pong", totalreward); + if (!string.IsNullOrWhiteSpace(SaveSystem.CurrentSave.UniteAuthToken)) + { + var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); + if (unite.GetPongCP() < totalreward) + { + unite.SetPongCP(totalreward); + } + } + if (IsMultiplayerSession) + { + ServerManager.Forward(OpponentGUID, "pong_mp_cashedout", null); + StopMultiplayerSession(); + } + } + + public void StopMultiplayerSession() + { + IsMultiplayerSession = false; + IsLeader = true; + OpponentGUID = ""; + YouGUID = ""; + } + + private void newgame() + { + pnlfinalstats.Hide(); + pnllose.Hide(); + pnlintro.Hide(); + + level = 1; + totalreward = 0; + if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) + { + beataireward = 10; + } else + { + beataireward = 5; + } + beatairewardtotal = 0; + secondsleft = 60; + lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: "); + //reset stats text + lblstatsX.Text = Localization.Parse("{H_VEL}: "); + lblstatsY.Text = Localization.Parse("{V_VEL}: "); + + levelxspeed = 3; + levelyspeed = 3; + + incrementx = 0.4; + incrementy = 0.2; + + xveldec = levelxspeed; + yveldec = levelyspeed; + + tmrcountdown.Start(); + lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}"); + pnlgamestats.Hide(); + lblbeatai.Show(); + ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, (paddleHuman.Location.Y + paddleHuman.Height) / 2); + if (xVel < 0) + xVel = Math.Abs(xVel); + lbllevelandtime.Text = Localization.Parse("{{LEVEL}}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); + } + + public void btnhighscore_Click(object s, EventArgs a) + { + pnlhighscore.BringToFront(); + SetupHighScores(); + } + + bool IsMultiplayerSession = false; + + string YouGUID = ""; + string OpponentGUID = ""; + + public void SetupHighScores() + { + lbhighscore.Items.Clear(); + lbhighscore.View = View.Details; + lbhighscore.FullRowSelect = true; + lbhighscore.Columns.Clear(); + var n = new ColumnHeader(); + n.Text = "Player"; + n.Width = lbhighscore.Width / 3; + var l = new ColumnHeader(); + l.Text = "Level"; + l.Width = n.Width; + var c = new ColumnHeader(); + c.Text = "Codepoints"; + c.Width = n.Width; + lbhighscore.Columns.Add(n); + lbhighscore.Columns.Add(l); + lbhighscore.Columns.Add(c); + + var t = new Thread(() => + { + try + { + + var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); + var hs = unite.GetPongHighscores(); + foreach (var score in hs.Highscores) + { + if(this.ParentForm.Visible == false) + { + Thread.CurrentThread.Abort(); + } + string username = unite.GetDisplayNameId(score.UserId); + this.Invoke(new Action(() => + { + var name_item = new ListViewItem(); + name_item.Text = username; + lbhighscore.Items.Add(name_item); + name_item.SubItems.Add(score.Level.ToString()); + name_item.SubItems.Add(score.CodepointsCashout.ToString()); + })); + } + } + catch + { + try + { + if (this.ParentForm.Visible == true) + { + Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time."); + this.Invoke(new Action(pnlgamestats.BringToFront)); + } + } + catch { } //JUST. ABORT. THE. FUCKING. THREAD. + return; + } + }); + t.Start(); + pnlhighscore.Show(); + } + + // ERROR: Handles clauses are not supported in C# + private void btnplayagain_Click(object sender, EventArgs e) + { + newgame(); + } + + // ERROR: Handles clauses are not supported in C# + private void btnlosetryagain_Click(object sender, EventArgs e) + { + newgame(); + } + + public void StartLevel() + { + newgame(); + } + + // ERROR: Handles clauses are not supported in C# + private void btnstartgame_Click(object sender, EventArgs e) + { + newgame(); + } + + Random rand = new Random(); + // ERROR: Handles clauses are not supported in C# + private void tmrstoryline_Tick(object sender, EventArgs e) + { + // Random chance of showing getshiftnet storyline + int i = rand.Next(0, 100); + + if (i >= 25 && i <= 50) + { + tmrstoryline.Stop(); + } + + } + + // ERROR: Handles clauses are not supported in C# + private void me_closing(object sender, FormClosingEventArgs e) + { + tmrstoryline.Stop(); + } + + private void Label6_Click(object sender, EventArgs e) + { + + } + + private void Label8_Click(object sender, EventArgs e) + { + + } + + private void pgcontents_Paint(object sender, PaintEventArgs e) { + + } + + private void ball_MouseEnter(object sender, EventArgs e) { + aiShouldIsbeEnabled = false; + } + + private void ball_MouseLeave(object sender, EventArgs e) { + aiShouldIsbeEnabled = true; + } + + public void OnLoad() + { + pnlintro.BringToFront(); + pnlintro.Show(); + pnlhighscore.Hide(); + pnlgamestats.Hide(); + pnlfinalstats.Hide(); + CenterPanels(); + lblbeatai.Hide(); + ServerManager.MessageReceived += this.ServerMessageReceivedHandler; + } + + public void OnSkinLoad() + { + CenterPanels(); + this.SizeChanged += (o, a) => + { + CenterPanels(); + }; + } + + public bool OnUnload() + { + if(IsMultiplayerSession == true) + { + if(!string.IsNullOrWhiteSpace(OpponentGUID)) + ServerManager.Forward(OpponentGUID, "pong_mp_left", null); + LeaveMatchmake(); + } + ServerManager.MessageReceived -= this.ServerMessageReceivedHandler; + + return true; + } + + public void OnUpgrade() + { + CenterPanels(); + } + + private void button2_Click(object sender, EventArgs e) + { + pnlhighscore.Hide(); + } + + private void btnmatchmake_Click(object sender, EventArgs e) + { + this.StartMultiplayer(); + pnlintro.Hide(); + lblbeatai.Text = "Beat the other player to earn Codepoints."; + lblcountdown.Text = "Waiting for another player..."; + lblcountdown.Left = (this.Width - lblcountdown.Width) / 2; + } + + private void lvotherplayers_DoubleClick(object sender, EventArgs e) + { + if(lvotherplayers.SelectedItems.Count > 0) + { + SendLeaderGUID(lvotherplayers.SelectedItems[0].Text); + } + } + } +} diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 05ba638..edc3703 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -139,10 +139,7 @@ namespace ShiftOS.WinForms.Applications pnldesktoppreview.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) => - { - pnldesktoppreview.BackgroundImage = img; - })); + pnldesktoppreview.BackgroundImage = SkinEngine.GetImage("desktopbackground"); pnldesktoppreview.BackgroundImageLayout = GetImageLayout("desktopbackground"); desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs new file mode 100644 index 0000000..dc107c4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -0,0 +1,316 @@ +/* + * 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 ShiftOS.WinForms.Controls; + +namespace ShiftOS.WinForms.Applications +{ + partial class ShiftoriumFrontend + { + /// <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.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.lbupgradedesc = new System.Windows.Forms.Label(); + this.pnlupgradeactions = new System.Windows.Forms.Panel(); + this.btnbuy = new System.Windows.Forms.Button(); + this.lbupgradetitle = new System.Windows.Forms.Label(); + this.pnllist = new System.Windows.Forms.Panel(); + this.lbnoupgrades = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.lblcategorytext = new System.Windows.Forms.Label(); + this.btncat_forward = new System.Windows.Forms.Button(); + this.btncat_back = new System.Windows.Forms.Button(); + this.lbcodepoints = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.pgupgradeprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); + this.lbupgrades = new System.Windows.Forms.ListBox(); + this.label3 = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.pnlupgradeactions.SuspendLayout(); + this.pnllist.SuspendLayout(); + this.panel3.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.panel2); + this.panel1.Controls.Add(this.pnllist); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(782, 427); + this.panel1.TabIndex = 0; + // + // panel2 + // + this.panel2.Controls.Add(this.lbupgradedesc); + this.panel2.Controls.Add(this.pnlupgradeactions); + this.panel2.Controls.Add(this.lbupgradetitle); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(406, 0); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(376, 427); + this.panel2.TabIndex = 1; + // + // lbupgradedesc + // + this.lbupgradedesc.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbupgradedesc.Location = new System.Drawing.Point(0, 42); + this.lbupgradedesc.Name = "lbupgradedesc"; + this.lbupgradedesc.Size = new System.Drawing.Size(376, 348); + this.lbupgradedesc.TabIndex = 2; + this.lbupgradedesc.Text = "{SHIFTORIUM_EXP}"; + this.lbupgradedesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lbupgradedesc.UseCompatibleTextRendering = true; + // + // pnlupgradeactions + // + this.pnlupgradeactions.Controls.Add(this.btnbuy); + this.pnlupgradeactions.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlupgradeactions.Location = new System.Drawing.Point(0, 390); + this.pnlupgradeactions.Name = "pnlupgradeactions"; + this.pnlupgradeactions.Size = new System.Drawing.Size(376, 37); + this.pnlupgradeactions.TabIndex = 1; + // + // btnbuy + // + this.btnbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnbuy.AutoSize = true; + this.btnbuy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnbuy.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnbuy.Location = new System.Drawing.Point(327, 9); + this.btnbuy.Name = "btnbuy"; + this.btnbuy.Size = new System.Drawing.Size(37, 25); + this.btnbuy.TabIndex = 0; + this.btnbuy.Text = "Buy"; + this.btnbuy.UseVisualStyleBackColor = true; + this.btnbuy.Visible = false; + this.btnbuy.Click += new System.EventHandler(this.btnbuy_Click); + // + // lbupgradetitle + // + this.lbupgradetitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbupgradetitle.Location = new System.Drawing.Point(0, 0); + this.lbupgradetitle.Name = "lbupgradetitle"; + this.lbupgradetitle.Size = new System.Drawing.Size(376, 42); + this.lbupgradetitle.TabIndex = 0; + this.lbupgradetitle.Text = "{WELCOME_TO_SHIFTORIUM}"; + this.lbupgradetitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lbupgradetitle.UseCompatibleTextRendering = true; + // + // pnllist + // + this.pnllist.Controls.Add(this.lbnoupgrades); + this.pnllist.Controls.Add(this.panel3); + this.pnllist.Controls.Add(this.lbcodepoints); + this.pnllist.Controls.Add(this.label1); + this.pnllist.Controls.Add(this.pgupgradeprogress); + this.pnllist.Controls.Add(this.lbupgrades); + this.pnllist.Dock = System.Windows.Forms.DockStyle.Left; + this.pnllist.Location = new System.Drawing.Point(0, 0); + this.pnllist.Name = "pnllist"; + this.pnllist.Size = new System.Drawing.Size(406, 427); + this.pnllist.TabIndex = 0; + // + // lbnoupgrades + // + this.lbnoupgrades.AutoSize = true; + this.lbnoupgrades.Location = new System.Drawing.Point(69, 183); + this.lbnoupgrades.Name = "lbnoupgrades"; + this.lbnoupgrades.Size = new System.Drawing.Size(71, 13); + this.lbnoupgrades.TabIndex = 6; + this.lbnoupgrades.Tag = "header2"; + this.lbnoupgrades.Text = "No upgrades!"; + this.lbnoupgrades.Visible = false; + // + // panel3 + // + this.panel3.Controls.Add(this.lblcategorytext); + this.panel3.Controls.Add(this.btncat_forward); + this.panel3.Controls.Add(this.btncat_back); + this.panel3.Location = new System.Drawing.Point(6, 76); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(394, 23); + this.panel3.TabIndex = 5; + // + // lblcategorytext + // + this.lblcategorytext.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblcategorytext.Location = new System.Drawing.Point(29, 0); + this.lblcategorytext.Name = "lblcategorytext"; + this.lblcategorytext.Size = new System.Drawing.Size(336, 23); + this.lblcategorytext.TabIndex = 2; + this.lblcategorytext.Text = "No Upgrades"; + this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_Click); + // + // btncat_forward + // + this.btncat_forward.AutoSize = true; + this.btncat_forward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btncat_forward.Dock = System.Windows.Forms.DockStyle.Right; + this.btncat_forward.Location = new System.Drawing.Point(365, 0); + this.btncat_forward.Name = "btncat_forward"; + this.btncat_forward.Size = new System.Drawing.Size(29, 23); + this.btncat_forward.TabIndex = 1; + this.btncat_forward.Text = "-->"; + this.btncat_forward.UseVisualStyleBackColor = true; + this.btncat_forward.Click += new System.EventHandler(this.btncat_forward_Click); + // + // btncat_back + // + this.btncat_back.AutoSize = true; + this.btncat_back.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btncat_back.Dock = System.Windows.Forms.DockStyle.Left; + this.btncat_back.Location = new System.Drawing.Point(0, 0); + this.btncat_back.Name = "btncat_back"; + this.btncat_back.Size = new System.Drawing.Size(29, 23); + this.btncat_back.TabIndex = 0; + this.btncat_back.Text = "<--"; + this.btncat_back.UseVisualStyleBackColor = true; + this.btncat_back.Click += new System.EventHandler(this.btncat_back_Click); + // + // lbcodepoints + // + this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lbcodepoints.AutoSize = true; + this.lbcodepoints.Location = new System.Drawing.Point(128, 357); + this.lbcodepoints.Name = "lbcodepoints"; + this.lbcodepoints.Size = new System.Drawing.Size(135, 13); + this.lbcodepoints.TabIndex = 3; + this.lbcodepoints.Text = "You have: %cp Codepoints"; + this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 399); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(137, 13); + this.label1.TabIndex = 2; + this.label1.Text = "{UPGRADE_PROGRESS}:"; + // + // pgupgradeprogress + // + this.pgupgradeprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pgupgradeprogress.Location = new System.Drawing.Point(146, 390); + this.pgupgradeprogress.Maximum = 100; + this.pgupgradeprogress.Name = "pgupgradeprogress"; + this.pgupgradeprogress.Size = new System.Drawing.Size(254, 23); + this.pgupgradeprogress.TabIndex = 1; + this.pgupgradeprogress.Value = 25; + // + // lbupgrades + // + this.lbupgrades.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.lbupgrades.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.lbupgrades.FormattingEnabled = true; + this.lbupgrades.Location = new System.Drawing.Point(3, 105); + this.lbupgrades.Name = "lbupgrades"; + this.lbupgrades.Size = new System.Drawing.Size(397, 238); + this.lbupgrades.TabIndex = 0; + this.lbupgrades.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbupgrades_DrawItem); + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(3, 399); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(137, 13); + this.label3.TabIndex = 2; + // + // ShiftoriumFrontend + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.Controls.Add(this.panel1); + this.ForeColor = System.Drawing.Color.LightGreen; + this.Name = "ShiftoriumFrontend"; + this.Size = new System.Drawing.Size(782, 427); + this.Load += new System.EventHandler(this.Shiftorium_Load); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.pnlupgradeactions.ResumeLayout(false); + this.pnlupgradeactions.PerformLayout(); + this.pnllist.ResumeLayout(false); + this.pnllist.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel pnllist; + private System.Windows.Forms.ListBox lbupgrades; + private System.Windows.Forms.Label lbupgradedesc; + private System.Windows.Forms.Panel pnlupgradeactions; + private System.Windows.Forms.Label lbupgradetitle; + private System.Windows.Forms.Button btnbuy; + private ShiftedProgressBar pgupgradeprogress; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lbcodepoints; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label lblcategorytext; + private System.Windows.Forms.Button btncat_forward; + private System.Windows.Forms.Button btncat_back; + private System.Windows.Forms.Label lbnoupgrades; + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs new file mode 100644 index 0000000..08e6c8f --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -0,0 +1,320 @@ +/* + * 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.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using static ShiftOS.Engine.SkinEngine; +using backend = ShiftOS.Engine.Shiftorium; +namespace ShiftOS.WinForms.Applications +{ + [Launcher("Shiftorium", true, "al_shiftorium", "Utilities")] + [RequiresUpgrade("shiftorium_gui")] + [MultiplayerOnly] + [WinOpen("shiftorium")] + [DefaultTitle("Shiftorium")] + [DefaultIcon("iconShiftorium")] + public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow + { + public int CategoryId = 0; + public static System.Timers.Timer timer100; + + + public ShiftoriumFrontend() + { + cp_update = new System.Windows.Forms.Timer(); + cp_update.Tick += (o, a) => + { + lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; + }; + cp_update.Interval = 100; + InitializeComponent(); + PopulateShiftorium(); + lbupgrades.SelectedIndexChanged += (o, a) => + { + try + { + lbupgrades.Refresh(); + SelectUpgrade(lbupgrades.SelectedItem.ToString()); + } + catch { } + }; + this.pgupgradeprogress.Maximum = backend.GetDefaults().Count; + this.pgupgradeprogress.Value = SaveSystem.CurrentSave.CountUpgrades(); + backend.Installed += () => + { + this.pgupgradeprogress.Maximum = backend.GetDefaults().Count; + this.pgupgradeprogress.Value = SaveSystem.CurrentSave.CountUpgrades(); + }; + + } + + public void SelectUpgrade(string name) + { + btnbuy.Show(); + var upg = upgrades[name]; + lbupgradetitle.Text = Localization.Parse(upg.Name); + lbupgradedesc.Text = Localization.Parse(upg.Description); + } + + Dictionary<string, ShiftoriumUpgrade> upgrades = new Dictionary<string, ShiftoriumUpgrade>(); + + public void PopulateShiftorium() + { + var t = new Thread(() => + { + try + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Hide(); + lbupgrades.Items.Clear(); + upgrades.Clear(); + Timer(); + }); + + foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId])) + { + string name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP"; + upgrades.Add(name, upg); + Desktop.InvokeOnWorkerThread(() => + { + lbupgrades.Items.Add(name); + }); + } + + if (lbupgrades.Items.Count == 0) + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + }); + } + else + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Hide(); + }); + } + + Desktop.InvokeOnWorkerThread(() => + { + try + { + lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; + btncat_back.Visible = (CategoryId > 0); + btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); + } + catch + { + + } + }); + } + catch + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + }); + } + }); + t.IsBackground = true; + t.Start(); + } + + public static bool UpgradeInstalled(string upg) + { + return backend.UpgradeInstalled(upg); + } + + public static bool UpgradeAttributesUnlocked(FieldInfo finf) + { + return backend.UpgradeAttributesUnlocked(finf); + } + + public static bool UpgradeAttributesUnlocked(MethodInfo finf) + { + return backend.UpgradeAttributesUnlocked(finf); + } + + public static bool UpgradeAttributesUnlocked(Type finf) + { + return backend.UpgradeAttributesUnlocked(finf); + } + + public static bool UpgradeAttributesUnlocked(PropertyInfo finf) + { + return backend.UpgradeAttributesUnlocked(finf); + } + + private void lbupgrades_DrawItem(object sender, DrawItemEventArgs e) + { + var foreground = new SolidBrush(LoadedSkin.ControlTextColor); + var background = new SolidBrush(LoadedSkin.ControlColor); + + e.Graphics.FillRectangle(background, e.Bounds); + try + { + if (lbupgrades.GetSelected(e.Index) == true) + { + e.Graphics.FillRectangle(foreground, e.Bounds); + e.Graphics.DrawString(lbupgrades.Items[e.Index].ToString(), e.Font, background, e.Bounds.Location); + } + else + { + e.Graphics.FillRectangle(background, e.Bounds); + e.Graphics.DrawString(lbupgrades.Items[e.Index].ToString(), e.Font, foreground, e.Bounds.Location); + } + } + catch + { + } + } + + private void btnbuy_Click(object sender, EventArgs e) + { + long cpCost = 0; + backend.Silent = true; + Dictionary<string, long> UpgradesToBuy = new Dictionary<string, long>(); + foreach (var itm in lbupgrades.SelectedItems) + { + cpCost += upgrades[itm.ToString()].Cost; + UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost); + } + if (SaveSystem.CurrentSave.Codepoints < cpCost) + { + Infobox.Show("Insufficient Codepoints", $"You do not have enough Codepoints to perform this action. You need {cpCost - SaveSystem.CurrentSave.Codepoints} more."); + + } + else + { + foreach(var upg in UpgradesToBuy) + { + SaveSystem.CurrentSave.Codepoints -= upg.Value; + if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key)) + { + SaveSystem.CurrentSave.Upgrades[upg.Key] = true; + } + else + { + SaveSystem.CurrentSave.Upgrades.Add(upg.Key, true); + } + SaveSystem.SaveGame(); + backend.InvokeUpgradeInstalled(); + } + } + + backend.Silent = false; + PopulateShiftorium(); + btnbuy.Hide(); + } + + private void Shiftorium_Load(object sender, EventArgs e) { + + } + + public void OnLoad() + { + cp_update.Start(); + lbnoupgrades.Hide(); + } + + public void OnSkinLoad() + { + + } + + System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer(); + + public bool OnUnload() + { + cp_update.Stop(); + cp_update = null; + return true; + } + + public void OnUpgrade() + { + lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One; + lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display"); + } + + private void lbcodepoints_Click(object sender, EventArgs e) + { + + } + + void Timer() + { + timer100 = new System.Timers.Timer(); + timer100.Interval = 2000; + //CLARIFICATION: What is this supposed to do? - Michael + //timer100.Elapsed += ???; + timer100.AutoReset = true; + timer100.Enabled = true; + } + + private void btncat_back_Click(object sender, EventArgs e) + { + if(CategoryId > 0) + { + CategoryId--; + PopulateShiftorium(); + } + } + + private void btncat_forward_Click(object sender, EventArgs e) + { + if(CategoryId < backend.GetCategories().Length - 1) + { + CategoryId++; + PopulateShiftorium(); + } + } + + private void lblcategorytext_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs new file mode 100644 index 0000000..90b05a1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -0,0 +1,353 @@ +/* + * 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 Newtonsoft.Json; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.Applications +{ + [Launcher("Skin Loader", true, "al_skin_loader", "Customization")] + [RequiresUpgrade("skinning")] + [WinOpen("skin_loader")] + [DefaultTitle("Skin Loader")] + [DefaultIcon("iconSkinLoader")] + public partial class Skin_Loader : UserControl, IShiftOSWindow + { + public Skin_Loader() + { + InitializeComponent(); + SetupControls(pnlborder); + SetupControls(pnldesktop); + LoadedSkin = JsonConvert.DeserializeObject<Skin>(JsonConvert.SerializeObject(SkinEngine.LoadedSkin)); + this.Load += (o, a) => { SetupUI(); }; + + } + + public void SetupControls(Control ctrl) + { + ctrl.Tag = "keepbg keepfg keepfont"; + foreach (Control c in ctrl.Controls) + SetupControls(c); + } + + public Skin LoadedSkin { get; set; } + + public void SetupUI() + { + if (LoadedSkin != null) + { + SetupDesktop(); + Setup(); + } + } + + public void SetupDesktop() + { + menuStrip1.Renderer = new ShiftOSMenuRenderer(); + + this.DoubleBuffered = true; + desktoppanel.BackColor = Color.Green; + + //upgrades + + if (SaveSystem.CurrentSave != null && LoadedSkin != null) + { + desktoppanel.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop"); + lbtime.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop_clock_widget"); + + //skinning + lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; + + sysmenuholder.Visible = ShiftoriumFrontend.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'. + pnldesktop.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); + //Not doing this will cause an ArgumentException. + + pnldesktop.BackgroundImage = GetImage("desktopbackground"); + pnldesktop.BackgroundImageLayout = GetImageLayout("desktopbackground"); + desktoppanel.BackgroundImage = GetImage("desktoppanel"); + menuStrip1.BackgroundImage = GetImage("applauncher"); + lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; + lbtime.Font = LoadedSkin.DesktopPanelClockFont; + lbtime.Text = Applications.Terminal.GetTime(); + lbtime.Left = desktoppanel.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; + lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; + + 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.BackColor = LoadedSkin.DesktopPanelColor; + desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel"); + desktoppanel.Height = LoadedSkin.DesktopPanelHeight; + if (LoadedSkin.DesktopPanelPosition == 1) + { + desktoppanel.Dock = DockStyle.Bottom; + } + else + { + desktoppanel.Dock = DockStyle.Top; + } + } + + } + + public ImageLayout GetImageLayout(string img) + { + if (LoadedSkin.SkinImageLayouts.ContainsKey(img)) + { + return LoadedSkin.SkinImageLayouts[img]; + } + else + { + LoadedSkin.SkinImageLayouts.Add(img, ImageLayout.Tile); + return ImageLayout.Tile; + } + } + + public Image GetImage(string img) + { + var type = typeof(Skin); + + foreach (var field in type.GetFields()) + { + foreach (var attr in field.GetCustomAttributes(false)) + { + if (attr is ImageAttribute) + { + var iattr = attr as ImageAttribute; + if (iattr.Name == img) + { + byte[] image = (byte[])field.GetValue(LoadedSkin); + return SkinEngine.ImageFromBinary(image); + } + } + } + } + + return null; + } + + bool IsDialog = false; + + public void Setup() + { + pnlcontents.BackColor = LoadedSkin.ControlColor; + + this.lbtitletext.Text = Localization.Parse("{TEMPLATE}"); + this.Dock = DockStyle.Fill; + + if (SaveSystem.CurrentSave != null) + { + this.pnltitle.Visible = ShiftoriumFrontend.UpgradeInstalled("wm_titlebar"); + this.pnlclose.Visible = ShiftoriumFrontend.UpgradeInstalled("close_button"); + this.pnlminimize.Visible = (IsDialog == false) && ShiftoriumFrontend.UpgradeInstalled("minimize_button"); + this.pnlmaximize.Visible = (IsDialog == false) && ShiftoriumFrontend.UpgradeInstalled("maximize_button"); + SetupSkin(); + } + else + { + this.pnltitle.Visible = false; + this.pnlclose.Visible = false; + this.pnlminimize.Visible = false; + this.pnlmaximize.Visible = false; + + } + } + + public void SetupSkin() + { + pnltitlemaster.Height = LoadedSkin.TitlebarHeight; + pnltitle.BackColor = LoadedSkin.TitleBackgroundColor; + pnltitle.BackgroundImage = GetImage("titlebar"); + pnltitleleft.Visible = LoadedSkin.ShowTitleCorners; + pnltitleright.Visible = LoadedSkin.ShowTitleCorners; + pnltitleleft.BackColor = LoadedSkin.TitleLeftCornerBackground; + pnltitleright.BackColor = LoadedSkin.TitleRightCornerBackground; + pnltitleleft.Width = LoadedSkin.TitleLeftCornerWidth; + pnltitleright.Width = LoadedSkin.TitleRightCornerWidth; + pnltitleleft.BackgroundImage = GetImage("titleleft"); + pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleft"); + pnltitleright.BackgroundImage = GetImage("titleright"); + pnltitleright.BackgroundImageLayout = GetImageLayout("titleright"); + + + lbtitletext.BackColor = LoadedSkin.TitleBackgroundColor; + lbtitletext.ForeColor = LoadedSkin.TitleTextColor; + lbtitletext.Font = LoadedSkin.TitleFont; + + pnlleft.BackColor = LoadedSkin.BorderLeftBackground; + pnlleft.BackgroundImage = GetImage("leftborder"); + pnlleft.BackgroundImageLayout = GetImageLayout("leftborder"); + pnlleft.Width = LoadedSkin.LeftBorderWidth; + pnlright.BackColor = LoadedSkin.BorderRightBackground; + pnlright.BackgroundImage = GetImage("rightborder"); + pnlright.BackgroundImageLayout = GetImageLayout("rightborder"); + pnlright.Width = LoadedSkin.RightBorderWidth; + + pnlbottom.BackColor = LoadedSkin.BorderBottomBackground; + pnlbottom.BackgroundImage = GetImage("bottomborder"); + pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborder"); + pnlbottom.Height = LoadedSkin.BottomBorderWidth; + + pnlbottomr.BackColor = LoadedSkin.BorderBottomRightBackground; + pnlbottomr.BackgroundImage = GetImage("bottomrborder"); + pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborder"); + pnlbottoml.BackColor = LoadedSkin.BorderBottomLeftBackground; + pnlbottoml.BackgroundImage = GetImage("bottomlborder"); + pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborder"); + + lbtitletext.ForeColor = LoadedSkin.TitleTextColor; + lbtitletext.Font = LoadedSkin.TitleFont; + pnlclose.BackColor = LoadedSkin.CloseButtonColor; + pnlclose.BackgroundImage = GetImage("closebutton"); + pnlclose.BackgroundImageLayout = GetImageLayout("closebutton"); + pnlminimize.BackColor = LoadedSkin.MinimizeButtonColor; + pnlminimize.BackgroundImage = GetImage("minimizebutton"); + pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebutton"); + pnlmaximize.BackColor = LoadedSkin.MaximizeButtonColor; + pnlmaximize.BackgroundImage = GetImage("maximizebutton"); + pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebutton"); + + pnlclose.Size = LoadedSkin.CloseButtonSize; + pnlminimize.Size = LoadedSkin.MinimizeButtonSize; + pnlmaximize.Size = LoadedSkin.MaximizeButtonSize; + pnlclose.Location = FromRight(LoadedSkin.CloseButtonFromSide); + pnlminimize.Location = FromRight(LoadedSkin.MinimizeButtonFromSide); + pnlmaximize.Location = FromRight(LoadedSkin.MaximizeButtonFromSide); + pnlclose.Left -= pnlclose.Width; + pnlmaximize.Left -= pnlmaximize.Width; + pnlminimize.Left -= pnlminimize.Width; + + switch (LoadedSkin.TitleTextCentered) + { + case false: + lbtitletext.Location = LoadedSkin.TitleTextLeft; + break; + default: + lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2; + lbtitletext.Top = LoadedSkin.TitleTextLeft.Y; + break; + } + } + + public Point FromRight(Point input) + { + return new Point(pnltitle.Width - input.X, input.Y); + } + + private void btnapply_Click(object sender, EventArgs e) + { + ShiftOS.Objects.ShiftFS.Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin)); + SkinEngine.LoadSkin(); + } + + private void btnclose_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnloaddefault_Click(object sender, EventArgs e) + { + this.LoadedSkin = new ShiftOS.Engine.Skin(); + SetupUI(); + } + + private void btnexport_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Save, new Action<string>((filename) => + { + ShiftOS.Objects.ShiftFS.Utils.WriteAllText(filename, JsonConvert.SerializeObject(LoadedSkin)); + string fname = filename.Split('/')[filename.Split('/').Length - 1]; + if(!System.IO.Directory.Exists(Paths.SharedFolder + "\\skins")) + { + System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins"); + } + + string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname; + System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin)); + + }))); + } + + private void btnimport_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action<string>((filename) => + { + try + { + LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); + } + catch + { + Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS."); + } + + SetupUI(); + }))); + } + + public void OnLoad() + { + + SetupUI(); + } + + public void OnSkinLoad() + { + SetupUI(); + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + SetupUI(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs new file mode 100644 index 0000000..664b657 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -0,0 +1,623 @@ +/* + * 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("first_steps")) + { + 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); + } + } + else + { + Story.Start("first_steps"); + + } + })); + } + 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(); + } + + [Story("first_steps")] + public static void FirstSteps() + { + TerminalBackend.PrefixEnabled = false; + new Thread(() => + { + TerminalBackend.InStory = true; + Console.WriteLine("Hey there, and welcome to ShiftOS."); + Thread.Sleep(2000); + Console.WriteLine("My name is DevX. I am the developer of this operating system."); + Thread.Sleep(2000); + Console.WriteLine("Right now, I am using the Terminal application as a means of talking to you."); + Thread.Sleep(2000); + Console.WriteLine("ShiftOS is a very early operating system, but I have big plans for it."); + Thread.Sleep(2000); + Console.WriteLine("I can't reveal all my plans to you at this moment, but you play a big role."); + Thread.Sleep(2000); + Console.WriteLine("Your role in all of this is to help me develop ShiftOS more."); + Thread.Sleep(2000); + Console.WriteLine("You may not know how to program, but that's perfectly fine. You don't need to."); + Thread.Sleep(2000); + Console.WriteLine("What you do need to do, is simply use the operating system - like you would a regular computer."); + Thread.Sleep(2000); + Console.WriteLine("As you use ShiftOS, you will earn a special currency called Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("The more things you do, the more Codepoints you get! Simple, right?"); + Thread.Sleep(2000); + Console.WriteLine("Once you rack up enough Codepoints, you can use them inside the Shiftorium to buy new features for ShiftOS."); + Thread.Sleep(2000); + Console.WriteLine("These features include new programs, system enhancements, Terminal commands, and so much more!"); + Thread.Sleep(2000); + Console.WriteLine("Ahh, that reminds me. I suppose you don't know how to use the Terminal yet, do you..."); + Thread.Sleep(2000); + Console.WriteLine("Well, the ShiftOS terminal is similar to a regular Linux terminal, however things are a bit... how you say.... primitive."); + Thread.Sleep(2000); + Console.WriteLine("Let's just say.... I've been focusing more on function than form with this one.... Anyways, here's how the terminal works."); + Thread.Sleep(2000); + Console.WriteLine("Each command is categorized into a \"Namespace\". All a namespace is, is a nice way of distinguishing between commands."); + Thread.Sleep(2000); + Console.WriteLine("...For example you may have a bunch of commands for managing files, and others for opening/closing programs."); + Thread.Sleep(2000); + Console.WriteLine("The three main namespaces you'll be using for the next while are the \"sos\", \"shiftorium\", and \"win\" namespaces."); + Thread.Sleep(2000); + Console.WriteLine("To run a command, simply type its namespace, followed by a period/full-stop, followed by the command name."); + Thread.Sleep(2000); + Console.WriteLine("Give it a try! Type \"sos.help\" in the following prompt to view a list of all ShiftOS commands."); + Thread.Sleep(2000); + TerminalBackend.InStory = false; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + bool help_entered = false; + TerminalBackend.CommandProcessed += (text, args) => + { + if (text.EndsWith("sos.help") && help_entered == false) + help_entered = true; + }; + while (help_entered == false) + Thread.Sleep(10); + TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; + Thread.Sleep(2000); + Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as win.open."); + Thread.Sleep(2000); + Console.WriteLine("In ShiftOS, passing data to a command is quite simple! After the command name, place an opening and closing curly brace, like so: \"win.open{}\"."); + Thread.Sleep(2000); + Console.WriteLine("Everything between those two curly braces is treated as command data."); + Thread.Sleep(2000); + Console.WriteLine("However, you can't just spam a bunch of 1s and 0s and call it a day, nonono!"); + Thread.Sleep(2000); + Console.WriteLine("Command data is split into a list of keys and values."); + Thread.Sleep(2000); + Console.WriteLine("The key tells the command the name of the data, and the value is what the command will see when it looks at the key."); + Thread.Sleep(2000); + Console.WriteLine("There are three main types of values. Booleans, which can be either \"true\" or \"false\", Numbers, which can be any integer number, positive or negative, and Strings - any piece of text as long as it is surrounded by double-quotes."); + Thread.Sleep(2000); + Console.WriteLine("For example, we could write every programmer's first program - by typing \"trm.echo{msg:\"Hello, world!\"}\". Running this will cause the Terminal to print, well, \"Hello, world!\""); + Thread.Sleep(2000); + Console.WriteLine("To open an application in ShiftOS, you can use this principle with the \"win.open\" command."); + Thread.Sleep(2000); + Console.WriteLine("First, type \"win.open\" with no data to see a list of all installed programs."); + Thread.Sleep(2000); + TerminalBackend.InStory = false; + bool winopenEntered = false; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + TerminalBackend.CommandProcessed += (text, args) => + { + if (help_entered == true) + if (text.EndsWith("win.open") && winopenEntered == false) + winopenEntered = true; + }; + while (winopenEntered == false) + Thread.Sleep(10); + TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; + + Thread.Sleep(2000); + Console.WriteLine("Pretty cool, it gave you a nice list of other win.open commands that will let you open each program."); + Thread.Sleep(2000); + Console.WriteLine("You've got the just of using ShiftOS. Now, for your goal."); + Thread.Sleep(2000); + Console.WriteLine("As you know, ShiftOS doesn't have very many features."); + Thread.Sleep(2000); + Console.WriteLine("Using the applications you have, I need you to earn 50,000 Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("Start small, try to earn 500. Once you do, I'll contact you with more details."); + Thread.Sleep(2000); + Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal."); + Thread.Sleep(2000); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.InStory = false; + SaveSystem.SaveGame(); + 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/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs new file mode 100644 index 0000000..d0e704f --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs @@ -0,0 +1,312 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriPresent + { + /// <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.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addLabel = new System.Windows.Forms.Panel(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.yLabel = new System.Windows.Forms.Label(); + this.xLabel = new System.Windows.Forms.Label(); + this.yPosition = new System.Windows.Forms.NumericUpDown(); + this.xPosition = new System.Windows.Forms.NumericUpDown(); + this.labelContents = new System.Windows.Forms.TextBox(); + this.addItemLabel = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.designerPanel = new System.Windows.Forms.Panel(); + this.menuStrip1.SuspendLayout(); + this.addLabel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.yPosition)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.xPosition)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(758, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.openToolStripMenuItem.Text = "&Open"; + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.saveToolStripMenuItem.Text = "&Save"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // addToolStripMenuItem + // + this.addToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addLabelToolStripMenuItem}); + this.addToolStripMenuItem.Name = "addToolStripMenuItem"; + this.addToolStripMenuItem.Size = new System.Drawing.Size(96, 22); + this.addToolStripMenuItem.Text = "Add"; + // + // addLabelToolStripMenuItem + // + this.addLabelToolStripMenuItem.Name = "addLabelToolStripMenuItem"; + this.addLabelToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.addLabelToolStripMenuItem.Text = "Add Label"; + this.addLabelToolStripMenuItem.Click += new System.EventHandler(this.addLabelToolStripMenuItem_Click); + // + // addLabel + // + this.addLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.addLabel.Controls.Add(this.checkBox2); + this.addLabel.Controls.Add(this.checkBox1); + this.addLabel.Controls.Add(this.label1); + this.addLabel.Controls.Add(this.panel1); + this.addLabel.Controls.Add(this.yLabel); + this.addLabel.Controls.Add(this.xLabel); + this.addLabel.Controls.Add(this.yPosition); + this.addLabel.Controls.Add(this.xPosition); + this.addLabel.Controls.Add(this.labelContents); + this.addLabel.Controls.Add(this.addItemLabel); + this.addLabel.Dock = System.Windows.Forms.DockStyle.Fill; + this.addLabel.Location = new System.Drawing.Point(0, 0); + this.addLabel.Name = "addLabel"; + this.addLabel.Size = new System.Drawing.Size(252, 456); + this.addLabel.TabIndex = 1; + this.addLabel.Visible = false; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBox2.Location = new System.Drawing.Point(6, 163); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(48, 17); + this.checkBox2.TabIndex = 11; + this.checkBox2.Text = "Italic"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBox1.Location = new System.Drawing.Point(6, 140); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(51, 17); + this.checkBox1.TabIndex = 10; + this.checkBox1.Text = "Bold"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(115, 144); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 9; + this.label1.Text = "Text Color:"; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Black; + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.ForeColor = System.Drawing.Color.Black; + this.panel1.Location = new System.Drawing.Point(179, 141); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(35, 20); + this.panel1.TabIndex = 8; + this.panel1.Click += new System.EventHandler(this.panel1_Click); + // + // yLabel + // + this.yLabel.AutoSize = true; + this.yLabel.Location = new System.Drawing.Point(200, 96); + this.yLabel.Name = "yLabel"; + this.yLabel.Size = new System.Drawing.Size(14, 13); + this.yLabel.TabIndex = 5; + this.yLabel.Text = "Y"; + // + // xLabel + // + this.xLabel.AutoSize = true; + this.xLabel.Location = new System.Drawing.Point(3, 95); + this.xLabel.Name = "xLabel"; + this.xLabel.Size = new System.Drawing.Size(14, 13); + this.xLabel.TabIndex = 4; + this.xLabel.Text = "X"; + // + // yPosition + // + this.yPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.yPosition.Location = new System.Drawing.Point(127, 114); + this.yPosition.Maximum = new decimal(new int[] { + 999999999, + 0, + 0, + 0}); + this.yPosition.Name = "yPosition"; + this.yPosition.Size = new System.Drawing.Size(87, 20); + this.yPosition.TabIndex = 3; + // + // xPosition + // + this.xPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.xPosition.Location = new System.Drawing.Point(3, 114); + this.xPosition.Maximum = new decimal(new int[] { + 999999999, + 0, + 0, + 0}); + this.xPosition.Name = "xPosition"; + this.xPosition.Size = new System.Drawing.Size(87, 20); + this.xPosition.TabIndex = 2; + // + // labelContents + // + this.labelContents.Location = new System.Drawing.Point(3, 26); + this.labelContents.Multiline = true; + this.labelContents.Name = "labelContents"; + this.labelContents.Size = new System.Drawing.Size(211, 67); + this.labelContents.TabIndex = 1; + this.labelContents.Text = "Text"; + // + // addItemLabel + // + this.addItemLabel.Location = new System.Drawing.Point(0, 0); + this.addItemLabel.Name = "addItemLabel"; + this.addItemLabel.Size = new System.Drawing.Size(214, 23); + this.addItemLabel.TabIndex = 0; + this.addItemLabel.Text = "{ADD_ITEM_LABEL}"; + this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 24); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.addLabel); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.designerPanel); + this.splitContainer1.Size = new System.Drawing.Size(758, 456); + this.splitContainer1.SplitterDistance = 252; + this.splitContainer1.TabIndex = 2; + // + // designerPanel + // + this.designerPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.designerPanel.Location = new System.Drawing.Point(0, 0); + this.designerPanel.Name = "designerPanel"; + this.designerPanel.Size = new System.Drawing.Size(502, 456); + this.designerPanel.TabIndex = 0; + this.designerPanel.Click += new System.EventHandler(this.designerPanel_Click); + // + // TriPresent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Controls.Add(this.menuStrip1); + this.Name = "TriPresent"; + this.Size = new System.Drawing.Size(758, 480); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.addLabel.ResumeLayout(false); + this.addLabel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.yPosition)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.xPosition)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addLabelToolStripMenuItem; + private System.Windows.Forms.Panel addLabel; + private System.Windows.Forms.Label addItemLabel; + private System.Windows.Forms.Label yLabel; + private System.Windows.Forms.Label xLabel; + private System.Windows.Forms.NumericUpDown yPosition; + private System.Windows.Forms.NumericUpDown xPosition; + private System.Windows.Forms.TextBox labelContents; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Panel designerPanel; + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs new file mode 100644 index 0000000..dee7fda --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -0,0 +1,87 @@ +using ShiftOS.Objects.ShiftFS; +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 System.Threading; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("tripresent")] + [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 2048, 1500, "file_skimmer", "Office")] + [DefaultTitle("TriPresent")] + [Launcher("TriPresent", false, null, "Office")] + public partial class TriPresent : UserControl, IShiftOSWindow + { + public TriPresent() + { + InitializeComponent(); + } + + private void addLabelToolStripMenuItem_Click(object sender, EventArgs e) + { + addItemLabel.Text = "Add Label"; + addLabel.Show(); + } + + private void button2_Click(object sender, EventArgs e) + { + addLabel.Hide(); + } + + public void OnLoad() + { + panel1.ForeColor = Color.Black; + panel1.BackColor = Color.Black; + } + + public void OnSkinLoad() + { + + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + + } + + private void placeAdd_Click(object sender, EventArgs e) + { + + } + + private void panel1_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new ColorPicker(panel1.BackColor, "Text Color", new Action<Color>((col) => + { + panel1.ForeColor = col; + panel1.BackColor = col; + }))); + } + + private void designerPanel_Click(object sender, EventArgs e) + { + if (addLabel.Visible == true) + { + Label label = new Label(); + label.Parent = designerPanel; + label.BackColor = Color.Transparent; + label.ForeColor = panel1.BackColor; + label.Text = labelContents.Text; + label.Location = new Point(Cursor.Position.X / 3, Cursor.Position.Y); + label.Text = labelContents.Text; + } + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.resx b/ShiftOS.WinForms/Applications/TriPresent.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.resx @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/TriSheet.Designer.cs b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs new file mode 100644 index 0000000..b4aa1c4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs @@ -0,0 +1,65 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriSheet + { + /// <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.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.toolStripContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // toolStripContainer1 + // + // + // toolStripContainer1.ContentPanel + // + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(710, 464); + this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); + this.toolStripContainer1.Name = "toolStripContainer1"; + this.toolStripContainer1.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.TabIndex = 0; + this.toolStripContainer1.Text = "toolStripContainer1"; + // + // TriSheet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.toolStripContainer1); + this.Name = "TriSheet"; + this.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.ResumeLayout(false); + this.toolStripContainer1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ToolStripContainer toolStripContainer1; + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.cs b/ShiftOS.WinForms/Applications/TriSheet.cs new file mode 100644 index 0000000..1013bc7 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Applications +{ + public partial class TriSheet : UserControl + { + public TriSheet() + { + InitializeComponent(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.resx b/ShiftOS.WinForms/Applications/TriSheet.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/TriWrite.Designer.cs b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs new file mode 100644 index 0000000..a1432d8 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs @@ -0,0 +1,339 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriWrite + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TriWrite)); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.tvcontacts = new System.Windows.Forms.TreeView(); + this.panel1 = new System.Windows.Forms.Panel(); + this.txtbody = new System.Windows.Forms.Label(); + this.lbtitle = new System.Windows.Forms.Label(); + this.menuStrip2 = new System.Windows.Forms.MenuStrip(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.txtcontents = new System.Windows.Forms.RichTextBox(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.bold = new System.Windows.Forms.ToolStripButton(); + this.italic = new System.Windows.Forms.ToolStripButton(); + this.underline = new System.Windows.Forms.ToolStripButton(); + this.strikethrough = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.fonts = new System.Windows.Forms.ToolStripComboBox(); + this.size = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.left = new System.Windows.Forms.ToolStripButton(); + this.center = new System.Windows.Forms.ToolStripButton(); + this.right = new System.Windows.Forms.ToolStripButton(); + this.menuStrip1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.menuStrip2.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addContactToolStripMenuItem, + this.removeToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(872, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // addContactToolStripMenuItem + // + this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem"; + this.addContactToolStripMenuItem.Size = new System.Drawing.Size(12, 20); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(12, 20); + // + // tvcontacts + // + this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left; + this.tvcontacts.LineColor = System.Drawing.Color.Empty; + this.tvcontacts.Location = new System.Drawing.Point(0, 24); + this.tvcontacts.Name = "tvcontacts"; + this.tvcontacts.Size = new System.Drawing.Size(224, 551); + this.tvcontacts.TabIndex = 1; + // + // panel1 + // + this.panel1.Controls.Add(this.txtbody); + this.panel1.Controls.Add(this.lbtitle); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(224, 24); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(648, 551); + this.panel1.TabIndex = 2; + // + // txtbody + // + this.txtbody.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtbody.Location = new System.Drawing.Point(7, 54); + this.txtbody.Name = "txtbody"; + this.txtbody.Size = new System.Drawing.Size(626, 481); + this.txtbody.TabIndex = 1; + this.txtbody.Text = resources.GetString("txtbody.Text"); + // + // lbtitle + // + this.lbtitle.AutoSize = true; + this.lbtitle.Location = new System.Drawing.Point(7, 4); + this.lbtitle.Name = "lbtitle"; + this.lbtitle.Size = new System.Drawing.Size(44, 13); + this.lbtitle.TabIndex = 0; + this.lbtitle.Tag = "header1"; + this.lbtitle.Text = "TriWrite"; + // + // menuStrip2 + // + this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.saveToolStripMenuItem}); + this.menuStrip2.Location = new System.Drawing.Point(0, 0); + this.menuStrip2.Name = "menuStrip2"; + this.menuStrip2.Size = new System.Drawing.Size(652, 24); + this.menuStrip2.TabIndex = 2; + this.menuStrip2.Text = "menuStrip2"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.Size = new System.Drawing.Size(43, 20); + this.newToolStripMenuItem.Text = "New"; + this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(48, 20); + this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20); + this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // txtcontents + // + this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtcontents.Location = new System.Drawing.Point(0, 49); + this.txtcontents.Name = "txtcontents"; + this.txtcontents.Size = new System.Drawing.Size(652, 365); + this.txtcontents.TabIndex = 4; + this.txtcontents.Text = ""; + this.txtcontents.SelectionChanged += new System.EventHandler(this.txtcontents_SelectionChanged); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.bold, + this.italic, + this.underline, + this.strikethrough, + this.toolStripSeparator1, + this.fonts, + this.size, + this.toolStripSeparator2, + this.left, + this.center, + this.right}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(652, 25); + this.toolStrip1.TabIndex = 5; + this.toolStrip1.Text = "toolStrip1"; + // + // bold + // + this.bold.CheckOnClick = true; + this.bold.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.bold.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); + this.bold.Image = ((System.Drawing.Image)(resources.GetObject("bold.Image"))); + this.bold.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bold.Name = "bold"; + this.bold.Size = new System.Drawing.Size(23, 22); + this.bold.Text = "B"; + this.bold.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // italic + // + this.italic.CheckOnClick = true; + this.italic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.italic.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Italic); + this.italic.Image = ((System.Drawing.Image)(resources.GetObject("italic.Image"))); + this.italic.ImageTransparentColor = System.Drawing.Color.Magenta; + this.italic.Name = "italic"; + this.italic.Size = new System.Drawing.Size(23, 22); + this.italic.Text = "I"; + this.italic.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // underline + // + this.underline.CheckOnClick = true; + this.underline.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.underline.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline); + this.underline.Image = ((System.Drawing.Image)(resources.GetObject("underline.Image"))); + this.underline.ImageTransparentColor = System.Drawing.Color.Magenta; + this.underline.Name = "underline"; + this.underline.Size = new System.Drawing.Size(23, 22); + this.underline.Text = "U"; + this.underline.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // strikethrough + // + this.strikethrough.CheckOnClick = true; + this.strikethrough.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.strikethrough.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.strikethrough.Image = ((System.Drawing.Image)(resources.GetObject("strikethrough.Image"))); + this.strikethrough.ImageTransparentColor = System.Drawing.Color.Magenta; + this.strikethrough.Name = "strikethrough"; + this.strikethrough.Size = new System.Drawing.Size(23, 22); + this.strikethrough.Text = "S"; + this.strikethrough.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // fonts + // + this.fonts.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.fonts.Name = "fonts"; + this.fonts.Size = new System.Drawing.Size(121, 25); + this.fonts.SelectedIndexChanged += new System.EventHandler(this.fonts_SelectedIndexChanged); + // + // size + // + this.size.AutoSize = false; + this.size.MaxLength = 3; + this.size.Name = "size"; + this.size.Size = new System.Drawing.Size(40, 25); + this.size.TextChanged += new System.EventHandler(this.size_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + // + // left + // + this.left.CheckOnClick = true; + this.left.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.left.Image = ((System.Drawing.Image)(resources.GetObject("left.Image"))); + this.left.ImageTransparentColor = System.Drawing.Color.Magenta; + this.left.Name = "left"; + this.left.Size = new System.Drawing.Size(31, 22); + this.left.Text = "Left"; + this.left.Click += new System.EventHandler(this.left_Click); + // + // center + // + this.center.CheckOnClick = true; + this.center.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.center.Image = ((System.Drawing.Image)(resources.GetObject("center.Image"))); + this.center.ImageTransparentColor = System.Drawing.Color.Magenta; + this.center.Name = "center"; + this.center.Size = new System.Drawing.Size(46, 22); + this.center.Text = "Center"; + this.center.Click += new System.EventHandler(this.center_Click); + // + // right + // + this.right.CheckOnClick = true; + this.right.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.right.Image = ((System.Drawing.Image)(resources.GetObject("right.Image"))); + this.right.ImageTransparentColor = System.Drawing.Color.Magenta; + this.right.Name = "right"; + this.right.Size = new System.Drawing.Size(39, 22); + this.right.Text = "Right"; + this.right.Click += new System.EventHandler(this.right_Click); + // + // TriWrite + // + this.Controls.Add(this.txtcontents); + this.Controls.Add(this.toolStrip1); + this.Controls.Add(this.menuStrip2); + this.Name = "TriWrite"; + this.Size = new System.Drawing.Size(652, 414); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.menuStrip2.ResumeLayout(false); + this.menuStrip2.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem addContactToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; + private System.Windows.Forms.TreeView tvcontacts; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label txtbody; + private System.Windows.Forms.Label lbtitle; + private System.Windows.Forms.MenuStrip menuStrip2; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.RichTextBox txtcontents; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton bold; + private System.Windows.Forms.ToolStripButton italic; + private System.Windows.Forms.ToolStripButton underline; + private System.Windows.Forms.ToolStripButton strikethrough; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripComboBox fonts; + private System.Windows.Forms.ToolStripTextBox size; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripButton left; + private System.Windows.Forms.ToolStripButton center; + private System.Windows.Forms.ToolStripButton right; + } +} diff --git a/ShiftOS.WinForms/Applications/TriWrite.cs b/ShiftOS.WinForms/Applications/TriWrite.cs new file mode 100644 index 0000000..291aa30 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriWrite.cs @@ -0,0 +1,182 @@ +using ShiftOS.Objects.ShiftFS; +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; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("triwrite")] + [AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, "file_skimmer;textpad", "Office")] + [DefaultTitle("TriWrite")] + [Launcher("TriWrite", false, null, "Office")] + public partial class TriWrite : UserControl, IShiftOSWindow + { + + public TriWrite() + { + InitializeComponent(); //From the library of babel: "FIRST COMMIT FROM A MAC WOOOO TURIANS ARE COOL" + } + + private void newToolStripMenuItem_Click(object sender, EventArgs e) + { + txtcontents.Text = ""; + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + var txt = new List<string>(); + txt.Add(".rtf"); + + FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Open, (path) => LoadFile(path)); + } + + public void LoadFile(string file) + { + txtcontents.Rtf = Utils.ReadAllText(file); + } + + public void SaveFile(string file) + { + if (file.ToLower().EndsWith(".rtf")) + { + Utils.WriteAllText(file, txtcontents.Rtf); + } + else + { + Utils.WriteAllText(file, txtcontents.Text); + } + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + var txt = new List<string>(); + txt.Add(".rtf"); + txt.Add(".txt"); + FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Save, (path) => SaveFile(path)); + } + + public void OnLoad() + { + UpdateUI(); + } + + public void OnSkinLoad() + { + ResetFonts(); + } + + public void ResetFonts() + { + fonts.Items.Clear(); + foreach(var font in FontFamily.Families) + { + fonts.Items.Add(font.Name); + } + UpdateUI(); + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + } + + public void UpdateUI() + { + bold.Checked = txtcontents.SelectionFont.Bold; + italic.Checked = txtcontents.SelectionFont.Italic; + underline.Checked = txtcontents.SelectionFont.Underline; + strikethrough.Checked = txtcontents.SelectionFont.Strikeout; + fonts.Text = txtcontents.SelectionFont.Name; + size.Text = txtcontents.SelectionFont.Size.ToString(); + left.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Left; + center.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Center; + right.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Right; + + } + + private void txtcontents_SelectionChanged(object sender, EventArgs e) + { + UpdateUI(); + } + + public void SetFontStyle(bool bold, bool italic, bool underline, bool strikethrough) + { + FontStyle fs = FontStyle.Regular; + if (bold) + fs |= FontStyle.Bold; + if (italic) + fs |= FontStyle.Italic; + if (underline) + fs |= FontStyle.Underline; + if (strikethrough) + fs |= FontStyle.Strikeout; + txtcontents.SelectionFont = new Font(txtcontents.SelectionFont, fs); + UpdateUI(); + } + + private void bold_CheckedChanged(object sender, EventArgs e) + { + SetFontStyle(bold.Checked, italic.Checked, underline.Checked, strikethrough.Checked); + } + + public void SetFontFamily(string family, float emSize) + { + var style = txtcontents.SelectionFont.Style; + var size = emSize; + txtcontents.SelectionFont = new Font(family, size, style); + UpdateUI(); + } + + private void fonts_SelectedIndexChanged(object sender, EventArgs e) + { + SetFontFamily(fonts.Text, Convert.ToSingle(size.Text)); + } + + private void left_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Left; + UpdateUI(); + } + + private void center_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Center; + UpdateUI(); + + } + + private void right_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Right; + UpdateUI(); + + } + + private void size_Click(object sender, EventArgs e) + { + try + { + float s = Convert.ToSingle(size.Text); + if(s != txtcontents.SelectionFont.Size) + { + SetFontFamily(fonts.Text, s); + } + } + catch + { + UpdateUI(); + } + } + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs new file mode 100644 index 0000000..d30e2df --- /dev/null +++ b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs @@ -0,0 +1,128 @@ +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.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.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 new file mode 100644 index 0000000..1d93047 --- /dev/null +++ b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs @@ -0,0 +1,166 @@ +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.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.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/AudioManager.cs b/ShiftOS.WinForms/AudioManager.cs index 5c43ac4..ec12614 100644 --- a/ShiftOS.WinForms/AudioManager.cs +++ b/ShiftOS.WinForms/AudioManager.cs @@ -24,8 +24,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace ShiftOS.WinForms @@ -37,5 +39,78 @@ namespace ShiftOS.WinForms { } + + internal static byte[] GetRandomSong() + { + var r = new Random().Next(1, 10); + switch (r) + { + case 1: + return Properties.Resources.Ambient1; + case 2: + return Properties.Resources.Ambient2; + case 3: + return Properties.Resources.Ambient3; + case 4: + return Properties.Resources.Ambient4; + case 5: + return Properties.Resources.Ambient5; + case 6: + return Properties.Resources.Ambient6; + case 7: + return Properties.Resources.Ambient7; + case 8: + return Properties.Resources.Ambient8; + default: + return Properties.Resources.Ambient9; + + } + } + + internal static void StartAmbientLoop() + { + var athread = new Thread(() => + { + MemoryStream str = null; + NAudio.Wave.Mp3FileReader mp3 = null; + NAudio.Wave.WaveOut o = null; + bool shuttingDown = false; + + Engine.AppearanceManager.OnExit += () => + { + shuttingDown = true; + o?.Stop(); + o?.Dispose(); + mp3?.Close(); + mp3?.Dispose(); + str?.Close(); + str?.Dispose(); + }; + while (shuttingDown == false) + { + str = new MemoryStream(GetRandomSong()); + mp3 = new NAudio.Wave.Mp3FileReader(str); + o = new NAudio.Wave.WaveOut(); + o.Init(mp3); + bool c = false; + o.Play(); + o.PlaybackStopped += (s, a) => + { + c = true; + }; + while (!c) + { + try + { + o.Volume = (float)Engine.SaveSystem.CurrentSave.MusicVolume / 100; + } + catch { } + Thread.Sleep(10); + } + } + }); + athread.IsBackground = true; + athread.Start(); + } } } diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs new file mode 100644 index 0000000..ceaff02 --- /dev/null +++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs @@ -0,0 +1,202 @@ +/* + * 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; + +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 + { + get + { + return SkinEngine.LoadedSkin.ProgressBarStyle; + } + } + + public int BlockSize + { + get + { + return SkinEngine.LoadedSkin.ProgressBarBlockSize; + } + } + + public Color RealBackColor + { + get + { + return SkinEngine.LoadedSkin.ProgressBarBackgroundColor; + } + } + + public Image RealBackgroundImage + { + get + { + return SkinEngine.GetImage("progressbarbg"); + } + } + + public Image ProgressImage + { + get + { + return SkinEngine.GetImage("progress"); + } + } + + public Color ProgressColor + { + get + { + return SkinEngine.LoadedSkin.ProgressColor; + } + } + + protected override void OnPaint(PaintEventArgs pe) + { + pe.Graphics.Clear(this.RealBackColor); + if(RealBackgroundImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); + } + switch (Style) + { + case ProgressBarStyle.Continuous: + double width = linear(this.Value, 0, this.Maximum, 0, this.Width); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), 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); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); + + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + } + } + break; + case ProgressBarStyle.Marquee: + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), 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 new file mode 100644 index 0000000..e95d038 --- /dev/null +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -0,0 +1,261 @@ +/* + * 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.SuspendLayout(); + 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; + this.ResumeLayout(); + } + + 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) + { + this.SuspendLayout(); + 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; + this.ResumeLayout(); + } + + 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/DesktopWidgets/UpgradePercentage.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs index ca0d587..4867c8d 100644 --- a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs +++ b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs @@ -34,13 +34,11 @@ // // pgupgrades // - this.pgupgrades.BlockSize = 5; this.pgupgrades.Dock = System.Windows.Forms.DockStyle.Bottom; this.pgupgrades.Location = new System.Drawing.Point(0, 99); this.pgupgrades.Maximum = 100; this.pgupgrades.Name = "pgupgrades"; this.pgupgrades.Size = new System.Drawing.Size(227, 23); - this.pgupgrades.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgupgrades.TabIndex = 0; this.pgupgrades.Text = "shiftedProgressBar1"; this.pgupgrades.Value = 0; diff --git a/ShiftOS.WinForms/DownloadControl.Designer.cs b/ShiftOS.WinForms/DownloadControl.Designer.cs new file mode 100644 index 0000000..69c828d --- /dev/null +++ b/ShiftOS.WinForms/DownloadControl.Designer.cs @@ -0,0 +1,114 @@ +/* + * 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.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.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 new file mode 100644 index 0000000..9182b4b --- /dev/null +++ b/ShiftOS.WinForms/Oobe.cs @@ -0,0 +1,597 @@ +/* + * 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(); + lblhackwords.Font = new Font("Courier New", lblhackwords.Font.Size, FontStyle.Bold); + })); + + TextType("Hello, unsuspecting user."); + Thread.Sleep(2000); + Clear(); + TextType("Welcome to the Shifted Operating System."); + Thread.Sleep(2000); + Clear(); + TextType("Your computer has been taken over by ShiftOS, and is currently being wiped clean of all existing files and programs."); + Thread.Sleep(2000); + Clear(); + TextType("I will not share my identity or my intentions at this moment.I will just proceed with the installation.There�s nothing you can do to stop it."); + Thread.Sleep(2000); + Clear(); + TextType("All I will say, is I need your help.Once ShiftOS is installed, I will explain."); + + + 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 new file mode 100644 index 0000000..8f65265 --- /dev/null +++ b/ShiftOS.WinForms/Program.cs @@ -0,0 +1,279 @@ +/* + * 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 + SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor()); + SaveSystem.PreDigitalSocietyConnection += () => + { + Action completed = null; + completed = () => + { + SaveSystem.Ready = true; + Engine.AudioManager.PlayCompleted -= completed; + AudioManager.StartAmbientLoop(); + }; + Engine.AudioManager.PlayCompleted += completed; + Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02); + + }; + LoginManager.Init(new GUILoginFrontend()); + CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); + SkinEngine.SetIconProber(new ShiftOSIconProvider()); + ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider()); + Localization.RegisterProvider(new WFLanguageProvider()); + + 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 new file mode 100644 index 0000000..3e83c3f --- /dev/null +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -0,0 +1,1490 @@ +//------------------------------------------------------------------------------ +// <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.Byte[]. + /// </summary> + internal static byte[] Ambient1 { + get { + object obj = ResourceManager.GetObject("Ambient1", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient2 { + get { + object obj = ResourceManager.GetObject("Ambient2", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient3 { + get { + object obj = ResourceManager.GetObject("Ambient3", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient4 { + get { + object obj = ResourceManager.GetObject("Ambient4", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient5 { + get { + object obj = ResourceManager.GetObject("Ambient5", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient6 { + get { + object obj = ResourceManager.GetObject("Ambient6", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient7 { + get { + object obj = ResourceManager.GetObject("Ambient7", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient8 { + get { + object obj = ResourceManager.GetObject("Ambient8", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] Ambient9 { + get { + object obj = ResourceManager.GetObject("Ambient9", resourceCulture); + return ((byte[])(obj)); + } + } + + /// <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 notestate_connection_full { + get { + object obj = ResourceManager.GetObject("notestate_connection_full", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <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 [ + ///// 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.", + /// Dependencies: "desktop", + /// Category: "Enhancements", + /// }, + /// { + /// Name: "GUI Based Login Screen", + /// Cost: 500, + /// Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [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/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 688bcac..1db7a46 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -122,7 +122,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAkqMAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWajAAABAP7/AgD9/wMA/f8DAPz/BAD8/wQA/f8BAP//AAABAAAA//8C AP3/BAD9/wIAAAD//wIA//8BAAAAAAABAP//AQAAAAEAAAACAP7/AQABAAAAAQAAAAEAAAACAP7/AwD+ /wIAAAD//wIA/v8DAP7/AwD9/wMA//8AAAIA/f8DAAAA//8BAAAA/v8CAP////8CAPz/BAD8/wMA/f8A @@ -838,7 +838,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAATBgAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YSAYAAD/X5Vil2TRZUJmF2ZLZadjS2FqXt9aj1awUVtMc0b4PyQ57DFS KmUiSxoDEo4JEQGO+Bzwweee35zX9c+pyK7BGLsYtZqvlqoipneiW5/YnBCbFZq3mfOZEJvknD6fSqIg poaqcK/rtAq7i8FvyMrPgNdo347n7e9h+N8AXwnPERoaQSIlKrcx+zjmP0lGKUykUYJWs1pKXlJhpWMl @@ -964,7 +964,7 @@ <value>..\Resources\SweeperNormalFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="strings_en" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> + <value>..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1</value> </data> <data name="SweeperTile5" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\SweeperTile5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> @@ -974,7 +974,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA/AEeAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB AAIAgLsAAADuAgAEABAATElTVBQAAABJTkZPSUFSVAgAAABQaGlsaXAAAGRhdGG0AR4A//8CAAwA5v8a APT/8P8sAMf/OADX/xoA5v8bAPL/8/8aAOb/DQAOANb/KgDk/w4AAQDh/zwAt/9HAMj/GwACAPH/DgDy /w0AAQDy/xwA1f8sAO//5v84ALn/OQDk//7/AwD+/xAA4v8dANX/LADw//T/GgDl/w4AAADx/x4A4f8R @@ -33831,7 +33831,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA8FYAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YcRWAAAAAGQL6gtkDL8MEA3kDLUMaAwUDKULKwuYCvcJQAl4CJ0Hrwaw BaAEfgNQAg4Bwf9p/v/8mfsn+rD4OPe59T/0wPJH8dPvYu7+7JzrTeoG6dLnreaX5Z/kruPl4jHinOEk 4cTgh+Bl4GLgguDC4B7hpeFC4g3j7uP35B/mZufO6FXq9eu67ZHviPGT87L15/cr+oL84f5QAcMDPwa9 @@ -34456,7 +34456,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAjBYAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWAWAAAAAKYLIxdYIhQtQjexQFBJ81CUVwddTmFLZP9lXmZqZSRjl1/J WtFUu02mRao84jJzKHsdJRKPBub6TO/q4+XYZM6FxG67ObMCrOel8aA9ncuar5nimWybQZ5eoq+nKa6t tTC+hcec0U3cbefr8on+MQq6FfQgxSsFNo8/R0gRUMpWblzSYAFk2WVlZpxlfmMbYHJboVWsTrdG1D0l @@ -34573,4 +34573,34 @@ <data name="SuperDesk screenshot" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\SuperDesk screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="Ambient1" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient1.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient2" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient3" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient3.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient4" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient4.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient5" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient5.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient6" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient6.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient7" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient7.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient8" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient8.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="Ambient9" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name="notestate_connection_full" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Ambient1.mp3 b/ShiftOS.WinForms/Resources/Ambient1.mp3 Binary files differnew file mode 100644 index 0000000..d623b29 --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient1.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient2.mp3 b/ShiftOS.WinForms/Resources/Ambient2.mp3 Binary files differnew file mode 100644 index 0000000..b16e72f --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient2.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient3.mp3 b/ShiftOS.WinForms/Resources/Ambient3.mp3 Binary files differnew file mode 100644 index 0000000..cf06069 --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient3.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient4.mp3 b/ShiftOS.WinForms/Resources/Ambient4.mp3 Binary files differnew file mode 100644 index 0000000..7813b4f --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient4.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient5.mp3 b/ShiftOS.WinForms/Resources/Ambient5.mp3 Binary files differnew file mode 100644 index 0000000..521330e --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient5.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient6.mp3 b/ShiftOS.WinForms/Resources/Ambient6.mp3 Binary files differnew file mode 100644 index 0000000..86cb4a4 --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient6.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient7.mp3 b/ShiftOS.WinForms/Resources/Ambient7.mp3 Binary files differnew file mode 100644 index 0000000..9c5047a --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient7.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient8.mp3 b/ShiftOS.WinForms/Resources/Ambient8.mp3 Binary files differnew file mode 100644 index 0000000..ac908b6 --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient8.mp3 diff --git a/ShiftOS.WinForms/Resources/Ambient9.mp3 b/ShiftOS.WinForms/Resources/Ambient9.mp3 Binary files differnew file mode 100644 index 0000000..46cb670 --- /dev/null +++ b/ShiftOS.WinForms/Resources/Ambient9.mp3 diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index c3d27ae..4bd2e8d 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -8,6 +8,23 @@ Category: "Enhancements", }, { +<<<<<<< HEAD +======= + Name: "Shift Progress Bar", + Cost: 150, + Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground and background color of the progress bar, and many more things!.", + Dependencies: "shifter;shift_buttons", + Category: "Customization" + }, + { + Name: "Shift Buttons", + Cost: 150, + Description: "Want to customize the look of all ShiftOS buttons? This Shifter upgrade gives you a new \"Buttons\" category in the System category to do just that.", + Dependencies: "shifter", + Category: "Customization" + }, + { +>>>>>>> 9999324bd7751f536741c108322766421dae1a52 Name: "GUI Based Login Screen", Cost: 500, Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, why not use these tools to create a functioning and awesome-looking login screen?", diff --git a/ShiftOS.WinForms/Resources/notestate_connection_full.bmp b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp Binary files differnew file mode 100644 index 0000000..a4e15b3 --- /dev/null +++ b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 97cc3c9..b74003f 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -70,7 +70,21 @@ <Compile Include="Applications\About.Designer.cs"> <DependentUpon>About.cs</DependentUpon> </Compile> - <Compile Include="Applications\TriWrite.cs" /> + <Compile Include="Applications\TriPresent.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Applications\TriPresent.Designer.cs"> + <DependentUpon>TriPresent.cs</DependentUpon> + </Compile> + <Compile Include="Applications\TriSheet.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Applications\TriSheet.Designer.cs"> + <DependentUpon>TriSheet.cs</DependentUpon> + </Compile> + <Compile Include="Applications\TriWrite.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Include="Applications\TriWrite.Designer.cs"> <DependentUpon>TriWrite.cs</DependentUpon> </Compile> @@ -176,7 +190,9 @@ <Compile Include="Applications\Notifications.Designer.cs"> <DependentUpon>Notifications.cs</DependentUpon> </Compile> - <Compile Include="Applications\Pong.cs" /> + <Compile Include="Applications\Pong.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Include="Applications\Pong.Designer.cs"> <DependentUpon>Pong.cs</DependentUpon> </Compile> @@ -198,7 +214,9 @@ <Compile Include="Applications\Shiftnet.Designer.cs"> <DependentUpon>Shiftnet.cs</DependentUpon> </Compile> - <Compile Include="Applications\ShiftoriumFrontend.cs" /> + <Compile Include="Applications\ShiftoriumFrontend.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Include="Applications\ShiftoriumFrontend.Designer.cs"> <DependentUpon>ShiftoriumFrontend.cs</DependentUpon> </Compile> @@ -220,7 +238,9 @@ <Compile Include="Applications\ShopItemCreator.Designer.cs"> <DependentUpon>ShopItemCreator.cs</DependentUpon> </Compile> - <Compile Include="Applications\Skin Loader.cs" /> + <Compile Include="Applications\Skin Loader.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Include="Applications\Skin Loader.Designer.cs"> <DependentUpon>Skin Loader.cs</DependentUpon> </Compile> @@ -404,6 +424,12 @@ <EmbeddedResource Include="Applications\About.resx"> <DependentUpon>About.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="Applications\TriPresent.resx"> + <DependentUpon>TriPresent.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Applications\TriSheet.resx"> + <DependentUpon>TriSheet.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Applications\TriWrite.resx"> <DependentUpon>TriWrite.cs</DependentUpon> </EmbeddedResource> @@ -749,11 +775,21 @@ <None Include="Resources\ShiftnetServices.txt" /> <None Include="Resources\3beepvirus.wav" /> <None Include="Resources\dial-up-modem-02.wav" /> + <None Include="Resources\Ambient1.mp3" /> + <None Include="Resources\Ambient2.mp3" /> + <None Include="Resources\Ambient3.mp3" /> + <None Include="Resources\Ambient4.mp3" /> + <None Include="Resources\Ambient5.mp3" /> + <None Include="Resources\Ambient6.mp3" /> + <None Include="Resources\Ambient7.mp3" /> + <None Include="Resources\Ambient8.mp3" /> + <None Include="Resources\Ambient9.mp3" /> <Content Include="Resources\fileiconcf.bmp" /> <None Include="Resources\infobox.wav" /> <None Include="Resources\typesound.wav" /> <None Include="Resources\writesound.wav" /> <None Include="Resources\SuperDesk screenshot.png" /> + <None Include="Resources\notestate_connection_full.bmp" /> <Content Include="SystemIcons\iconArtpad.png" /> <Content Include="SystemIcons\iconAudioPlayer.png" /> <Content Include="SystemIcons\iconBitnoteDigger.png" /> diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs new file mode 100644 index 0000000..4f888ab --- /dev/null +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -0,0 +1,343 @@ +/* + * 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 + { + + } + + if(ctrl is Button) + { + Desktop.InvokeOnWorkerThread(() => + { + Button b = ctrl as Button; + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + b.FlatAppearance.BorderSize = SkinEngine.LoadedSkin.ButtonBorderWidth; + b.FlatAppearance.BorderColor = SkinEngine.LoadedSkin.ButtonForegroundColor; + b.ForeColor = SkinEngine.LoadedSkin.ButtonForegroundColor; + b.Font = SkinEngine.LoadedSkin.ButtonTextFont; + + b.MouseEnter += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonHoverColor; + b.BackgroundImage = SkinEngine.GetImage("buttonhover"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonhover"); + }; + b.MouseLeave += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + }; + b.MouseUp += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + }; + + b.MouseDown += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonPressedColor; + b.BackgroundImage = SkinEngine.GetImage("buttonpressed"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonpressed"); + + }; + }); + } + + 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 new file mode 100644 index 0000000..d042a40 --- /dev/null +++ b/ShiftOS.WinForms/Tools/DitheringEngine.cs @@ -0,0 +1,425 @@ +/* + * 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; +using System.IO; + +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 Image DitherColor(Color source, int width, int height) + { + 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); + return DitherImage(bmp); + + } + + 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 + + public static int GetClosestColor(int gray, bool eightBits, bool sixBits, bool fourBits, bool twoBits) + { + int newgray = gray; + if (!eightBits) + { + if (sixBits) + { + newgray = gray >> 2; + } + else + { + if (fourBits) + { + newgray = (int)linear(gray, 0, 255, 0, 15) * 4; + } + else + { + if (twoBits) + { + if (gray > 127 + 63) + { + newgray = 255; + } + else if (gray > 127) + newgray = 127 + 63; + else if (gray > 63) + { + newgray = 127; + } + else if (gray > 0) + newgray = 63; + else + newgray = 0; + } + else + { + if (gray > 127) + newgray = 255; + else + newgray = 0; + } + } + } + } + return newgray; + } + +#if FLOYDSTEINBERG + public static Image DitherImage(Image source) + { + 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"); + bool twentyfourbits = Shiftorium.UpgradeInstalled("color_depth_24_bits"); + if (twentyfourbits) + { + sourceArr.CopyTo(destArr, 0); + } + else + { + + if (!sixteenBits) + { + if (dithering == true) + { + if (false == true) + { + + } + else + { + int error = 0; + for (int i = 0; i < destArr.Length; i += 3) + { + byte r = sourceArr[i]; + byte g = sourceArr[i + 1]; + byte b = sourceArr[i + 2]; + + if (SkinEngine.LoadedSkin.SystemKey == Color.FromArgb(r, g, b)) + { + destArr[i] = r; + destArr[i + 1] = g; + destArr[i + 2] = b; + continue; + } + + + int gray = (((r + g + b) / 3) + error); + int newgray = gray; + newgray = GetClosestColor(gray, eightBits, sixBits, fourBits, twoBits); + if (newgray > 255) + newgray = 255; + if (newgray < 0) + newgray = 0; + error = gray - newgray; + destArr[i] = (byte)newgray; + destArr[i + 1] = (byte)newgray; + destArr[i + 2] = (byte)newgray; + + } + } + } + + else + { + for (int i = 0; i < sourceArr.Length; i += 3) + { + byte r = sourceArr[i]; + byte g = sourceArr[i + 1]; + byte b = sourceArr[i + 2]; + if (SkinEngine.LoadedSkin.SystemKey == Color.FromArgb(r, g, b)) + { + destArr[i] = r; + destArr[i + 1] = g; + destArr[i + 2] = b; + continue; + } + + int gray = (r + g + b) / 3; + int newgray = GetClosestColor(gray, eightBits, sixBits, fourBits, twoBits); + destArr[i] = (byte)newgray; + destArr[i + 1] = (byte)newgray; + destArr[i + 2] = (byte)newgray; + + + + } + } + } + } + + Marshal.Copy(destArr, 0, destPtr, destBytes); + + + bmp.UnlockBits(destLck); + + + + return bmp; + } +#endif + + private static int getIndexFromXY(int x, int y, int width) + { + return (width * y) + x; + } + } + + public class DitheringSkinPostProcessor : ISkinPostProcessor + { + public byte[] ProcessImage(byte[] original) + { + try + { + var img = SkinEngine.ImageFromBinary(original); + var dithered = DitheringEngine.DitherImage(img); + using (var mstr = new MemoryStream()) + { + dithered.Save(mstr, System.Drawing.Imaging.ImageFormat.Bmp); + return mstr.ToArray(); + } + } + catch + { + return original; + } + } + } +} diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs new file mode 100644 index 0000000..968a31c --- /dev/null +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -0,0 +1,388 @@ +/* + * 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.pnlnotifications = new System.Windows.Forms.Panel(); + this.flnotifications = new System.Windows.Forms.FlowLayoutPanel(); + 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.pnlssicon = new System.Windows.Forms.Panel(); + this.pnlwidgetlayer = new System.Windows.Forms.Panel(); + this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); + this.pnlnotificationbox = new System.Windows.Forms.Panel(); + this.lbnotemsg = new System.Windows.Forms.Label(); + this.lbnotetitle = new System.Windows.Forms.Label(); + 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.pnlnotifications.SuspendLayout(); + this.flnotifications.SuspendLayout(); + this.sysmenuholder.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.pnlscreensaver.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); + this.pnlnotificationbox.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.pnlnotifications); + 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); + // + // pnlnotifications + // + this.pnlnotifications.Controls.Add(this.flnotifications); + this.pnlnotifications.Controls.Add(this.lbtime); + this.pnlnotifications.Cursor = System.Windows.Forms.Cursors.Default; + this.pnlnotifications.Dock = System.Windows.Forms.DockStyle.Right; + this.pnlnotifications.Location = new System.Drawing.Point(1096, 0); + this.pnlnotifications.Name = "pnlnotifications"; + this.pnlnotifications.Size = new System.Drawing.Size(200, 24); + this.pnlnotifications.TabIndex = 3; + // + // flnotifications + // + this.flnotifications.AutoSize = true; + this.flnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flnotifications.Controls.Add(this.ntconnectionstatus); + this.flnotifications.Dock = System.Windows.Forms.DockStyle.Left; + this.flnotifications.Location = new System.Drawing.Point(0, 0); + this.flnotifications.Name = "flnotifications"; + this.flnotifications.Size = new System.Drawing.Size(22, 24); + this.flnotifications.TabIndex = 1; + // + // 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(139, 7); + 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; + // + // 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; + // + // 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; + // + // ntconnectionstatus + // + this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; + this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); + this.ntconnectionstatus.Name = "ntconnectionstatus"; + this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); + this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.ntconnectionstatus.TabIndex = 0; + this.ntconnectionstatus.TabStop = false; + this.ntconnectionstatus.Tag = "digitalsociety"; + // + // pnlnotificationbox + // + this.pnlnotificationbox.AutoSize = true; + this.pnlnotificationbox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.pnlnotificationbox.Controls.Add(this.lbnotemsg); + this.pnlnotificationbox.Controls.Add(this.lbnotetitle); + this.pnlnotificationbox.Location = new System.Drawing.Point(654, 111); + this.pnlnotificationbox.Name = "pnlnotificationbox"; + this.pnlnotificationbox.Size = new System.Drawing.Size(69, 68); + this.pnlnotificationbox.TabIndex = 0; + this.pnlnotificationbox.Visible = false; + // + // lbnotemsg + // + this.lbnotemsg.AutoSize = true; + this.lbnotemsg.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbnotemsg.Location = new System.Drawing.Point(0, 34); + this.lbnotemsg.MaximumSize = new System.Drawing.Size(350, 0); + this.lbnotemsg.Name = "lbnotemsg"; + this.lbnotemsg.Padding = new System.Windows.Forms.Padding(10); + this.lbnotemsg.Size = new System.Drawing.Size(69, 34); + this.lbnotemsg.TabIndex = 1; + this.lbnotemsg.Text = "label1"; + // + // lbnotetitle + // + this.lbnotetitle.AutoSize = true; + this.lbnotetitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbnotetitle.Location = new System.Drawing.Point(0, 0); + this.lbnotetitle.Margin = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Name = "lbnotetitle"; + this.lbnotetitle.Padding = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Size = new System.Drawing.Size(69, 34); + this.lbnotetitle.TabIndex = 0; + this.lbnotetitle.Tag = "header2"; + this.lbnotetitle.Text = "label1"; + // + // 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.pnlnotificationbox); + 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.pnlnotifications.ResumeLayout(false); + this.pnlnotifications.PerformLayout(); + this.flnotifications.ResumeLayout(false); + this.flnotifications.PerformLayout(); + this.sysmenuholder.ResumeLayout(false); + this.sysmenuholder.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.pnlscreensaver.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); + this.pnlnotificationbox.ResumeLayout(false); + this.pnlnotificationbox.PerformLayout(); + this.pnladvancedal.ResumeLayout(false); + this.pnlalsystemactions.ResumeLayout(false); + this.pnlalsystemactions.PerformLayout(); + this.pnlstatus.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #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.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; + private System.Windows.Forms.Panel pnlnotifications; + private System.Windows.Forms.FlowLayoutPanel flnotifications; + private System.Windows.Forms.Panel pnlnotificationbox; + private System.Windows.Forms.Label lbnotemsg; + private System.Windows.Forms.Label lbnotetitle; + private System.Windows.Forms.PictureBox ntconnectionstatus; + } + +} + diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs new file mode 100644 index 0000000..15ecb7a --- /dev/null +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -0,0 +1,1087 @@ +/* + * 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; + + public void PushNotification(string app, string title, string msg) + { + lbnotemsg.Text = msg; + lbnotetitle.Text = title; + + var ctl = flnotifications.Controls.ToList().FirstOrDefault(x => x.Tag.ToString() == app); + if (ctl == null) + pnlnotificationbox.Left = desktoppanel.Width - pnlnotificationbox.Width; + else + { + int left = ctl.PointToScreen(ctl.Location).X; + int realleft = left - pnlnotificationbox.Width; + realleft += ctl.Width; + pnlnotificationbox.Left = realleft; + } + + + if (LoadedSkin.DesktopPanelPosition == 0) + pnlnotificationbox.Top = desktoppanel.Height; + else + pnlnotificationbox.Top = this.Height - desktoppanel.Height - pnlnotificationbox.Height; + var notekiller = new System.Windows.Forms.Timer(); + notekiller.Interval = 10000; + notekiller.Tick += (o, a) => + { + pnlnotificationbox.Hide(); + }; + Engine.AudioManager.PlayStream(Properties.Resources.infobox); + pnlnotificationbox.Show(); + notekiller.Start(); + } + + /// <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; + + 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())); + }; + 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 = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; + lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; + + pnlnotifications.Width = flnotifications.Width + lbtime.Width + LoadedSkin.DesktopPanelClockFromRight.X; + } + } + + 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 { } + + + }; + 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"); + + ControlManager.SetupControls(pnlnotificationbox); + + //skinning + lbtime.BackColor = Color.Transparent; + pnlnotifications.BackgroundImage = GetImage("panelclockbg"); + pnlnotifications.BackgroundImageLayout = GetImageLayout("panelclockbg"); + pnlnotifications.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor; + + 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. + + this.BackgroundImage = SkinEngine.GetImage("desktopbackground"); + 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); + } + } + } + + public static class ControlCollectionExtensions + { + public static IList<Control> ToList(this Control.ControlCollection ctrls) + { + var lst = new List<Control>(); + foreach (var ctl in ctrls) + lst.Add(ctl as Control); + return lst; + } + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx index d5494e3..b77504b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.resx +++ b/ShiftOS.WinForms/WinformsDesktop.resx @@ -120,4 +120,7 @@ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root>
\ No newline at end of file |
