Localize a lot of the window titles

This commit is contained in:
Michael 2017-06-18 20:31:19 -04:00
parent 12acff8742
commit 5fd343195b
47 changed files with 405 additions and 4094 deletions

View file

@ -36,9 +36,9 @@ using System.Reflection;
namespace ShiftOS.WinForms.Applications
{
[WinOpen("about")]
[Launcher("About", false, null, "Accessories")]
[DefaultTitle("About ShiftOS")]
[WinOpen("{WO_ABOUT}")]
[Launcher("{TITLE_ABOUT}", false, null, "{AL_ACCESSORIES}")]
[DefaultTitle("{TITLE_ABOUT}")]
public partial class About : UserControl, IShiftOSWindow
{
public About()

View file

@ -13,10 +13,10 @@ using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
[WinOpen("address_book")]
[AppscapeEntry("Address Book", "Add and edit your contacts within the digital society in an easy-to-use application.", 1024, 750, null, "Office")]
[DefaultTitle("Address Book")]
[Launcher("Address Book", false, null, "Office")]
[WinOpen("{WO_ADDRESSBOOK}")]
[AppscapeEntry("{TITLE_ADDRESSBOOK}", "{DESC_ADDRESSBOOK}", 1024, 750, null, "{AL_OFFICE}")]
[DefaultTitle("{TITLE_ADDRESSBOOK}")]
[Launcher("{TITLE_ADDRESSBOOK}", false, null, "{AL_OFFICE}")]
public partial class AddressBook : UserControl, IShiftOSWindow
{
public AddressBook()

View file

@ -43,10 +43,11 @@ using System.Diagnostics;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[Launcher("Artpad", true, "al_artpad", "Graphics")]
[Launcher("{TIITLE_ARTPAD}", true, "al_artpad", "{AL_GRAPHICS}")]
[RequiresUpgrade("artpad")]
[WinOpen("artpad")]
[WinOpen("{WO_ARTPAD}")]
[DefaultIcon("iconArtpad")]
[DefaultTitle("{TITLE_ARTPAD}")]
public partial class Artpad : UserControl, IShiftOSWindow
{
/// <summary>

View file

@ -37,10 +37,10 @@ using System.Threading;
namespace ShiftOS.WinForms.Applications
{
[AppscapeEntry("Audio Player", "Play music and other sounds on your computer.", 3047, 1000, "file_skimmer", "Entertainment")]
[Launcher("Audio Player", false, null, "Entertainment")]
[WinOpen("audio_player")]
[DefaultTitle("Audio Player")]
[AppscapeEntry("{TITLE_AUDIOPLAYER}", "{DESC_AUDIOPLAYER}", 3047, 1000, "file_skimmer", "{AL_ENTERTAINMENT}")]
[Launcher("{TITLE_AUDIOPLAYER}", false, null, "{AL_ENTERTAINMENT}")]
[WinOpen("{WO_AUDIOPLAYER}")]
[DefaultTitle("{TITLE_AUDIOPLAYER}")]
public partial class AudioPlayer : UserControl, IShiftOSWindow
{
public AudioPlayer()

View file

@ -35,10 +35,11 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
[Launcher("Calculator", true, "al_calculator", "Accessories")]
[Launcher("{TITLE_CALCULATOR}", true, "al_calculator", "{AL_ACCESSORIES}")]
[RequiresUpgrade("calculator")]
[WinOpen("calculator")]
[WinOpen("{WO_CALCULATOR}")]
[DefaultIcon("iconCalculator")]
[DefaultTitle("{TITLE_CALCULATOR}")]
public partial class Calculator : UserControl, IShiftOSWindow
{
public bool justopened = false;

View file

@ -38,10 +38,10 @@ using System.Threading;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[WinOpen("simplesrc")]
[Launcher("SimpleSRC Client", false, null, "Networking")]
[DefaultTitle("SimpleSRC Client")]
[AppscapeEntry("SimpleSRC", "A simple ShiftOS Relay Chat client that allows you to talk with other ShiftOS users from all over the world.", 300, 145, "file_skimmer", "Networking")]
[WinOpen("{WO_SIMPLESRC}")]
[Launcher("{TITLE_SIMPLESRC}", false, null, "{AL_NETWORKING}")]
[DefaultTitle("{TITLE_SIMPLESRC}")]
[AppscapeEntry("{TITLE_SIMPLESRC}", "{DESC_SIMPLESRC}", 300, 145, "file_skimmer", "{AL_NETWORKING}")]
public partial class Chat : UserControl, IShiftOSWindow
{
public Chat()

View file

@ -37,7 +37,7 @@ using API = ShiftOS.WinForms.Tools.ColorPickerDataBackend;
namespace ShiftOS.WinForms.Applications
{
[DefaultTitle("Choose color")] [DefaultIcon("iconColourPicker")]
[DefaultTitle("{TITLE_COLORPICKER}")] [DefaultIcon("iconColourPicker")]
public partial class ColorPicker : UserControl, IShiftOSWindow
{
public ColorPicker(Color oldcol, string ctc, Action<Color> callback)

View file

@ -53,16 +53,16 @@ namespace ShiftOS.WinForms.Applications
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.pbicon = new System.Windows.Forms.PictureBox();
this.btnok = new System.Windows.Forms.Button();
this.flyesno = new System.Windows.Forms.FlowLayoutPanel();
this.btnno = new System.Windows.Forms.Button();
this.btnyes = new System.Windows.Forms.Button();
this.lbmessage = new System.Windows.Forms.Label();
this.txtinput = new System.Windows.Forms.TextBox();
this.lbmessage = new System.Windows.Forms.Label();
this.flyesno = new System.Windows.Forms.FlowLayoutPanel();
this.btnyes = new System.Windows.Forms.Button();
this.btnno = new System.Windows.Forms.Button();
this.btnok = new System.Windows.Forms.Button();
this.pbicon = new System.Windows.Forms.PictureBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbicon)).BeginInit();
this.flyesno.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbicon)).BeginInit();
this.SuspendLayout();
//
// panel1
@ -78,66 +78,14 @@ namespace ShiftOS.WinForms.Applications
this.panel1.Size = new System.Drawing.Size(341, 177);
this.panel1.TabIndex = 0;
//
// pbicon
// txtinput
//
this.pbicon.Location = new System.Drawing.Point(14, 19);
this.pbicon.Name = "pbicon";
this.pbicon.Size = new System.Drawing.Size(64, 64);
this.pbicon.TabIndex = 0;
this.pbicon.TabStop = false;
//
// btnok
//
this.btnok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
this.txtinput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnok.AutoSize = true;
this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnok.Location = new System.Drawing.Point(149, 140);
this.btnok.Name = "btnok";
this.btnok.Size = new System.Drawing.Size(32, 23);
this.btnok.TabIndex = 1;
this.btnok.Text = "OK";
this.btnok.UseVisualStyleBackColor = true;
//
// flyesno
//
this.flyesno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flyesno.AutoSize = true;
this.flyesno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flyesno.Controls.Add(this.btnyes);
this.flyesno.Controls.Add(this.btnno);
this.flyesno.Location = new System.Drawing.Point(129, 134);
this.flyesno.Name = "flyesno";
this.flyesno.Size = new System.Drawing.Size(78, 29);
this.flyesno.TabIndex = 2;
this.flyesno.WrapContents = false;
//
// btnno
//
this.btnno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnno.AutoSize = true;
this.btnno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnno.Location = new System.Drawing.Point(44, 3);
this.btnno.Name = "btnno";
this.btnno.Size = new System.Drawing.Size(31, 23);
this.btnno.TabIndex = 3;
this.btnno.Text = "No";
this.btnno.UseVisualStyleBackColor = true;
//
// btnyes
//
this.btnyes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnyes.AutoSize = true;
this.btnyes.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnyes.Location = new System.Drawing.Point(3, 3);
this.btnyes.Name = "btnyes";
this.btnyes.Size = new System.Drawing.Size(35, 23);
this.btnyes.TabIndex = 4;
this.btnyes.Text = "Yes";
this.btnyes.UseVisualStyleBackColor = true;
this.txtinput.Location = new System.Drawing.Point(88, 116);
this.txtinput.Name = "txtinput";
this.txtinput.Size = new System.Drawing.Size(250, 20);
this.txtinput.TabIndex = 4;
//
// lbmessage
//
@ -151,14 +99,66 @@ namespace ShiftOS.WinForms.Applications
this.lbmessage.Text = "label1";
this.lbmessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtinput
// flyesno
//
this.txtinput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
this.flyesno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtinput.Location = new System.Drawing.Point(88, 116);
this.txtinput.Name = "txtinput";
this.txtinput.Size = new System.Drawing.Size(250, 20);
this.txtinput.TabIndex = 4;
this.flyesno.AutoSize = true;
this.flyesno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flyesno.Controls.Add(this.btnyes);
this.flyesno.Controls.Add(this.btnno);
this.flyesno.Location = new System.Drawing.Point(129, 134);
this.flyesno.Name = "flyesno";
this.flyesno.Size = new System.Drawing.Size(157, 29);
this.flyesno.TabIndex = 2;
this.flyesno.WrapContents = false;
//
// btnyes
//
this.btnyes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnyes.AutoSize = true;
this.btnyes.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnyes.Location = new System.Drawing.Point(3, 3);
this.btnyes.Name = "btnyes";
this.btnyes.Size = new System.Drawing.Size(75, 23);
this.btnyes.TabIndex = 4;
this.btnyes.Text = "{GEN_YES}";
this.btnyes.UseVisualStyleBackColor = true;
//
// btnno
//
this.btnno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnno.AutoSize = true;
this.btnno.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnno.Location = new System.Drawing.Point(84, 3);
this.btnno.Name = "btnno";
this.btnno.Size = new System.Drawing.Size(70, 23);
this.btnno.TabIndex = 3;
this.btnno.Text = "{GEN_NO}";
this.btnno.UseVisualStyleBackColor = true;
//
// btnok
//
this.btnok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnok.AutoSize = true;
this.btnok.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnok.Location = new System.Drawing.Point(149, 140);
this.btnok.Name = "btnok";
this.btnok.Size = new System.Drawing.Size(69, 23);
this.btnok.TabIndex = 1;
this.btnok.Text = "{GEN_OK}";
this.btnok.UseVisualStyleBackColor = true;
//
// pbicon
//
this.pbicon.Location = new System.Drawing.Point(14, 19);
this.pbicon.Name = "pbicon";
this.pbicon.Size = new System.Drawing.Size(64, 64);
this.pbicon.TabIndex = 0;
this.pbicon.TabStop = false;
//
// Dialog
//
@ -169,9 +169,9 @@ namespace ShiftOS.WinForms.Applications
this.Size = new System.Drawing.Size(341, 177);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbicon)).EndInit();
this.flyesno.ResumeLayout(false);
this.flyesno.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbicon)).EndInit();
this.ResumeLayout(false);
}

View file

@ -35,10 +35,11 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic.Devices;
using ShiftOS.Engine;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[DefaultTitle("Information")]
[DefaultTitle("{TITLE_INFOBOX}")]
[DefaultIcon("iconInfoBox")]
public partial class Dialog : UserControl, IShiftOSWindow, IInfobox
{
@ -51,13 +52,21 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
AppearanceManager.SetWindowTitle(this, this.Title);
if(!string.IsNullOrWhiteSpace(Title))
AppearanceManager.SetWindowTitle(this, this.Title);
ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.infobox);
}
public void OnSkinLoad()
{
AppearanceManager.SetWindowTitle(this, this.Title);
if(!string.IsNullOrWhiteSpace(Title))
AppearanceManager.SetWindowTitle(this, this.Title);
int top = btnok.Top;
btnok.CenterParent();
btnyes.Parent.CenterParent();
btnok.Top = top;
btnyes.Parent.Top = top;
}
public bool OnUnload()

View file

@ -42,10 +42,10 @@ using System.IO.Compression;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[Launcher("Downloader", true, "al_downloader", "Networking")]
[Launcher("{TITLE_DOWNLOADER}", true, "al_downloader", "{AL_NETWORKING}")]
[DefaultIcon("iconDownloader")]
[WinOpen("downloader")]
[DefaultTitle("Downloader")]
[WinOpen("{WO_DOWNLOADER}")]
[DefaultTitle("{TITLE_DOWNLOADER}")]
[RequiresUpgrade("downloader")]
public partial class Downloader : UserControl, IShiftOSWindow
{

View file

@ -41,7 +41,7 @@ namespace ShiftOS.WinForms.Applications
/// <summary>
///
/// </summary>
[DefaultTitle("Choose file")]
[DefaultTitle("{TITLE_FILEDIALOG}")]
[DefaultIcon("iconFileSkimmer")]
public partial class FileDialog : UserControl, IShiftOSWindow
{
@ -103,7 +103,7 @@ namespace ShiftOS.WinForms.Applications
}
else
{
Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}");
Infobox.Show("{TITLE_FILENOTFOUND}", "{PROMPT_FILENOTFOUND}");
}
}

View file

@ -39,10 +39,10 @@ using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
[Launcher("File Skimmer", true, "al_file_skimmer", "Utilities")]
[Launcher("{TITLE_FILESKIMMER}", true, "al_file_skimmer", "{AL_UTILITIES}")]
[RequiresUpgrade("file_skimmer")]
[WinOpen("file_skimmer")]
[DefaultTitle("File Skimmer")]
[WinOpen("{WO_FILESKIMMER}")]
[DefaultTitle("{TITLE_FILESKIMMER}")]
[DefaultIcon("iconFileSkimmer")]
public partial class FileSkimmer : UserControl, IShiftOSWindow
{

View file

@ -57,13 +57,16 @@ namespace ShiftOS.WinForms.Applications
this.btnAddOptionalText = new System.Windows.Forms.Button();
this.btnAddRegexText = new System.Windows.Forms.Button();
this.btnAddCommand = new System.Windows.Forms.Button();
this.lblExampleCommand = new System.Windows.Forms.Label();
this.btnAddColor = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.btnTest = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.btnLoad = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.txtentersyntax = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnloaddefault = new System.Windows.Forms.Button();
this.panelEditor.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// panelEditor
@ -71,6 +74,8 @@ namespace ShiftOS.WinForms.Applications
this.panelEditor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelEditor.AutoScroll = true;
this.panelEditor.Controls.Add(this.label1);
this.panelEditor.Controls.Add(this.txtentersyntax);
this.panelEditor.Location = new System.Drawing.Point(4, 4);
this.panelEditor.Name = "panelEditor";
this.panelEditor.Size = new System.Drawing.Size(589, 46);
@ -84,7 +89,6 @@ namespace ShiftOS.WinForms.Applications
this.btnAddText.TabIndex = 2;
this.btnAddText.Text = "Add Text";
this.btnAddText.UseVisualStyleBackColor = true;
this.btnAddText.Click += new System.EventHandler(this.btnAddText_Click);
//
// btnAddOptionalText
//
@ -94,7 +98,6 @@ namespace ShiftOS.WinForms.Applications
this.btnAddOptionalText.TabIndex = 3;
this.btnAddOptionalText.Text = "Add Optional Text";
this.btnAddOptionalText.UseVisualStyleBackColor = true;
this.btnAddOptionalText.Click += new System.EventHandler(this.btnAddOptionalText_Click);
//
// btnAddRegexText
//
@ -104,7 +107,6 @@ namespace ShiftOS.WinForms.Applications
this.btnAddRegexText.TabIndex = 4;
this.btnAddRegexText.Text = "Add Regex Text";
this.btnAddRegexText.UseVisualStyleBackColor = true;
this.btnAddRegexText.Click += new System.EventHandler(this.btnAddRegexText_Click);
//
// btnAddCommand
//
@ -114,16 +116,6 @@ namespace ShiftOS.WinForms.Applications
this.btnAddCommand.TabIndex = 5;
this.btnAddCommand.Text = "+ Namespace";
this.btnAddCommand.UseVisualStyleBackColor = true;
this.btnAddCommand.Click += new System.EventHandler(this.btnAddCommand_Click);
//
// lblExampleCommand
//
this.lblExampleCommand.AutoSize = true;
this.lblExampleCommand.Location = new System.Drawing.Point(4, 115);
this.lblExampleCommand.Name = "lblExampleCommand";
this.lblExampleCommand.Size = new System.Drawing.Size(290, 13);
this.lblExampleCommand.TabIndex = 8;
this.lblExampleCommand.Text = "Create a command and an example usage will show up here";
//
// btnAddColor
//
@ -133,76 +125,104 @@ namespace ShiftOS.WinForms.Applications
this.btnAddColor.TabIndex = 9;
this.btnAddColor.Text = "Add Color";
this.btnAddColor.UseVisualStyleBackColor = true;
this.btnAddColor.Click += new System.EventHandler(this.btnAddColor_Click);
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(7, 132);
this.richTextBox1.Multiline = false;
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(476, 23);
this.richTextBox1.TabIndex = 10;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// btnTest
//
this.btnTest.Location = new System.Drawing.Point(490, 132);
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(47, 23);
this.btnTest.TabIndex = 11;
this.btnTest.Text = "Test";
this.btnTest.UseVisualStyleBackColor = true;
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(7, 161);
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSave.AutoSize = true;
this.btnSave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnSave.Location = new System.Drawing.Point(3, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(47, 23);
this.btnSave.Size = new System.Drawing.Size(82, 23);
this.btnSave.TabIndex = 13;
this.btnSave.Text = "Save";
this.btnSave.Text = "{GEN_SAVE}";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnLoad
//
this.btnLoad.Location = new System.Drawing.Point(60, 161);
this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnLoad.AutoSize = true;
this.btnLoad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnLoad.Location = new System.Drawing.Point(91, 3);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(47, 23);
this.btnLoad.Size = new System.Drawing.Size(83, 23);
this.btnLoad.TabIndex = 14;
this.btnLoad.Text = "Load";
this.btnLoad.Text = "{GEN_LOAD}";
this.btnLoad.UseVisualStyleBackColor = true;
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
//
// btnApply
//
this.btnApply.Location = new System.Drawing.Point(113, 161);
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnApply.AutoSize = true;
this.btnApply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnApply.Location = new System.Drawing.Point(318, 3);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(47, 23);
this.btnApply.Size = new System.Drawing.Size(88, 23);
this.btnApply.TabIndex = 15;
this.btnApply.Text = "Apply";
this.btnApply.Text = "{GEN_APPLY}";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// txtentersyntax
//
this.txtentersyntax.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtentersyntax.Location = new System.Drawing.Point(3, 23);
this.txtentersyntax.Name = "txtentersyntax";
this.txtentersyntax.Size = new System.Drawing.Size(583, 20);
this.txtentersyntax.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(187, 13);
this.label1.TabIndex = 1;
this.label1.Text = "{FORMATEDITOR_ENTERSYNTAX}";
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel1.Controls.Add(this.btnSave);
this.flowLayoutPanel1.Controls.Add(this.btnLoad);
this.flowLayoutPanel1.Controls.Add(this.btnloaddefault);
this.flowLayoutPanel1.Controls.Add(this.btnApply);
this.flowLayoutPanel1.Location = new System.Drawing.Point(11, 123);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(409, 29);
this.flowLayoutPanel1.TabIndex = 16;
//
// btnloaddefault
//
this.btnloaddefault.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnloaddefault.AutoSize = true;
this.btnloaddefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnloaddefault.Location = new System.Drawing.Point(180, 3);
this.btnloaddefault.Name = "btnloaddefault";
this.btnloaddefault.Size = new System.Drawing.Size(132, 23);
this.btnloaddefault.TabIndex = 16;
this.btnloaddefault.Text = "{GEN_LOADDEFAULT}";
this.btnloaddefault.UseVisualStyleBackColor = true;
//
// FormatEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.btnTest);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.btnAddColor);
this.Controls.Add(this.lblExampleCommand);
this.Controls.Add(this.btnAddText);
this.Controls.Add(this.btnAddOptionalText);
this.Controls.Add(this.btnAddRegexText);
this.Controls.Add(this.btnAddCommand);
this.Controls.Add(this.panelEditor);
this.Name = "FormatEditor";
this.Size = new System.Drawing.Size(596, 426);
this.Size = new System.Drawing.Size(596, 164);
this.panelEditor.ResumeLayout(false);
this.panelEditor.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -214,12 +234,13 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.Button btnAddOptionalText;
private System.Windows.Forms.Button btnAddRegexText;
private System.Windows.Forms.Button btnAddCommand;
private System.Windows.Forms.Label lblExampleCommand;
private System.Windows.Forms.Button btnAddColor;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button btnTest;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnLoad;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtentersyntax;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnloaddefault;
}
}

View file

@ -33,154 +33,64 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications {
[MultiplayerOnly]
[Launcher("Format Editor", true, "al_format_editor", "Customization")]
[AppscapeEntry("Format Editor", "Edit the syntax of your Terminal to be however you like.", 740, 750, "file_skimmer", "Customization")]
[WinOpen("formateditor")]
[DefaultTitle("Format Editor")]
[DefaultIcon("iconFormatEditor")]
public partial class FormatEditor : UserControl, IShiftOSWindow {
namespace ShiftOS.WinForms.Applications
{
public partial class FormatEditor : UserControl, IShiftOSWindow
{
IList<CommandFormat> parts = new List<CommandFormat>();
CommandParser parser = new CommandParser();
IList<Panel> editorBoxes = new List<Panel>();
private CommandParser EditingParser = null;
string commandMode = "namespace";
int avcount = 0;
public FormatEditor() {
public FormatEditor()
{
InitializeComponent();
}
public void OnLoad() {
public void OnLoad()
{
EditingParser = CommandParser.Load(SkinEngine.LoadedSkin.CurrentParser.Save());
SetupUI();
OnUpgrade();
}
public void SetupUI()
{
txtentersyntax.Text = "";
foreach(var part in EditingParser.parts)
{
if(part is CommandFormatCommand)
{
txtentersyntax.Text += Localization.Parse("{FORMATEDITOR_COMMAND_LOWER}");
}
else if(part is CommandFormatText)
{
txtentersyntax.Text += (part as CommandFormatText).str;
}
else if (part is CommandFormatOptionalText)
{
txtentersyntax.Text += "[" + (part as CommandFormatOptionalText).str + "]";
}
else if(part is CommandFormatArgument)
{
txtentersyntax.Text += Localization.Parse("{FORMATEDITOR_ARGUMENT_LOWER}");
}
else if(part is CommandFormatValue)
{
txtentersyntax.Text += Localization.Parse("{FORMATEDITOR_VALUE_LOWER}");
}
}
}
public void OnSkinLoad() { }
public bool OnUnload() { return true; }
public void OnUpgrade() {
public void OnUpgrade()
{
btnAddOptionalText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_optional_text");
btnAddRegexText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_regex");
btnAddColor.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_syntax_highlighting");
}
private void addPart(CommandFormat part) {
parser.AddPart(part);
addPart(part.Draw());
}
private void addPart(Control part) {
Panel container = new Panel();
Control drawnPart = part;
container.Size = drawnPart.Size;
container.Controls.Add(drawnPart);
int woffset = 0;
if (editorBoxes.Count > 0) {
woffset = editorBoxes.Last().Width + editorBoxes.Last().Location.X;
} else {
woffset = 0;
}
container.Location = new Point(woffset, 0);
editorBoxes.Add(container);
panelEditor.Controls.Add(container);
}
private void btnAddText_Click(object sender, EventArgs e) {
addPart(new CommandFormatText());
}
private void btnAddOptionalText_Click(object sender, EventArgs e) {
addPart(new CommandFormatOptionalText());
}
private void btnAddRegexText_Click(object sender, EventArgs e) {
}
private void btnAddColor_Click(object sender, EventArgs e) {
}
private void btnAddCommand_Click(object sender, EventArgs e) {
switch (commandMode) {
case "namespace":
addPart(new CommandFormatNamespace());
commandMode = "command";
btnAddCommand.Text = "+ Command";
break;
case "command":
addPart(new CommandFormatCommand());
commandMode = "argument";
btnAddCommand.Text = "+ Argument";
break;
case "argument":
addPart(new CommandFormatArgument());
commandMode = "value";
btnAddCommand.Text = "+ \"Value\"";
break;
case "value":
addPart(new CommandFormatValue());
avcount++;
if (avcount >= 2) {
commandMode = "";
btnAddCommand.Text = "";
btnAddCommand.Enabled = false;
}else {
commandMode = "argument";
btnAddCommand.Text = "+ Argument";
}
break;
}
}
private void richTextBox1_TextChanged(object sender, EventArgs e) {
var result = parser.ParseCommand(richTextBox1.Text);
if (result.Equals(default(KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>))) {
lblExampleCommand.Text = "Syntax Error";
} else {
string argvs = "{";
foreach (KeyValuePair<string, string> entry in result.Value) {
argvs += entry.Key + "=\"" + entry.Value + "\", ";
}
argvs += "}";
lblExampleCommand.Text = result.Key + argvs;
}
}
private void btnTest_Click(object sender, EventArgs e) {
}
private void btnSave_Click(object sender, EventArgs e) {
CurrentCommandParser.parser = parser;
FileSkimmerBackend.GetFile(new string[] { ".cf" }, FileOpenerStyle.Save, new Action<string>((result) => {
Objects.ShiftFS.Utils.WriteAllText(result, parser.Save());
}));
}
private void btnLoad_Click(object sender, EventArgs e) {
FileSkimmerBackend.GetFile(new string[] { ".cf" }, FileOpenerStyle.Open, new Action<string>((result) => {
parser = CommandParser.Load(Objects.ShiftFS.Utils.ReadAllText(result));
foreach(CommandFormat part in parser.parts) {
addPart(part.Draw());
}
}));
}
private void btnApply_Click(object sender, EventArgs e) {
CurrentCommandParser.parser = parser;
}
}
}

View file

@ -38,7 +38,7 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[DefaultTitle("Choose graphic")] [DefaultIcon("icongraphicpicker")]
[DefaultTitle("{TITLE_CHOOSEGRAPHIC}")] [DefaultIcon("icongraphicpicker")]
public partial class GraphicPicker : UserControl, IShiftOSWindow
{
public GraphicPicker(Image old, string name, ImageLayout layout, Action<byte[], Image, ImageLayout> cb)

View file

@ -15,8 +15,8 @@ using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
[RequiresUpgrade("icon_manager")]
[Launcher("Icon Manager", true, "al_icon_manager", "Customization")]
[DefaultTitle("Icon Manager")]
[Launcher("{TITLE_ICONMANAGER}", true, "al_icon_manager", "{AL_CUSTOMIZATION}")]
[DefaultTitle("{TITLE_ICONMANAGER}")]
[DefaultIcon("iconIconManager")]
public partial class IconManager : UserControl, IShiftOSWindow
{

View file

@ -14,11 +14,11 @@ using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
[WinOpen("installer")]
[WinOpen("{WO_INSTALLER}")]
[RequiresUpgrade("installer")]
[MultiplayerOnly]
[DefaultTitle("Installer")]
[Launcher("Installer", true, "al_installer", "Utilities")]
[DefaultTitle("{TITLE_INSTALLER}")]
[Launcher("{TITLE_INSTALLER}", true, "al_installer", "{AL_UTILITIES}")]
public partial class Installer : UserControl, IShiftOSWindow
{
public Installer()

File diff suppressed because it is too large Load diff

View file

@ -1,958 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
using Newtonsoft.Json;
using ShiftOS.Objects;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[RequiresUpgrade("mud_control_centre")]
[Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")]
[WinOpen("mud_control_centre")]
[DefaultIcon("iconSysinfo")]
[DefaultTitle("MUD Control Centre")]
public partial class MUDControlCentre : UserControl, IShiftOSWindow
{
public MUDControlCentre()
{
if (SaveSystem.CurrentSave.CurrentLegions == null)
SaveSystem.CurrentSave.CurrentLegions = new List<string>();
InitializeComponent();
ServerManager.MessageReceived += (msg) =>
{
try
{
this.Invoke(new Action(() =>
{
if (msg.Name == "user_not_found_in_legion")
{
ShowLegionInfo(new Legion
{
Name = "No legion",
ShortName = "NONE",
Description = "You are not currently in any legions! You can go to 'Join Legion' and look for a legion to join, however, or create your own.",
Publicity = LegionPublicity.UnlistedInviteOnly,
BannerColor = ConsoleColor.DarkRed
});
}
else if (msg.Name == "legion_create_ok")
{
SaveSystem.CurrentSave.CurrentLegions.Clear();
SaveSystem.CurrentSave.CurrentLegions.Add(editingLegion.ShortName);
SaveSystem.SaveGame();
this.Invoke(new Action(() =>
{
myLegionToolStripMenuItem_Click(this, EventArgs.Empty);
}));
}
else if(msg.Name == "chat_all")
{
this.Invoke(new Action(() =>
{
this.ListAllChats(JsonConvert.DeserializeObject<Channel[]>(msg.Contents));
}));
}
else if (msg.Name == "user_shop_check_result")
{
if (msg.Contents == "0")
{
ShowCreateShop();
}
else
{
Infobox.PromptYesNo("Close Shop", "You already own a MUD shop. Would you like to close it and create a new one?", new Action<bool>((result) =>
{
if (result == true)
{
ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new
{
username = SaveSystem.CurrentUser.Username
}));
ShowCreateShop();
}
}));
}
}
else if (msg.Name == "legion_alreadyexists")
{
this.Invoke(new Action(() =>
{
Infobox.Show("Legion already exists", "A legion with the short name you provided already exists. Please choose another.");
}));
}
else if (msg.Name == "legion_users_found")
{
lvusers.Items.Clear();
foreach (var usr in JsonConvert.DeserializeObject<string[]>(msg.Contents))
{
lvusers.Items.Add(usr);
}
}
else if (msg.Name == "user_legion")
{
ShowLegionInfo(JsonConvert.DeserializeObject<Legion>(msg.Contents));
}
else if (msg.Name == "shop_taken")
{
this.Invoke(new Action(() =>
{
Infobox.Show("Shop name taken.", "A shop with the same name already exists.");
}));
}
else if (msg.Name == "shop_added")
{
ServerManager.SendMessage("shop_getall", "");
}
else if (msg.Name == "legion_all")
{
PopulateJoinLegion(JsonConvert.DeserializeObject<List<Legion>>(msg.Contents));
}
else if(msg.Name == "user_shop")
{
this.Invoke(new Action(() =>
{
ShowShop(JsonConvert.DeserializeObject<Shop>(msg.Contents));
}));
}
else if(msg.Name == "shop_additem")
{
var contents = JsonConvert.DeserializeObject<Dictionary<string, string>>(msg.Contents);
if((string)contents["shop"] == CurrentShop.Name)
{
CurrentShop.Items.Add(JsonConvert.DeserializeObject<ShopItem>(DownloadManager.Decompress(DownloadManager.Decompress(contents["itemdata"] as string))));
this.Invoke(new Action(PopulateShopView));
}
}
else if(msg.Name == "user_noshop")
{
this.Invoke(new Action(() =>
{
Infobox.Show("No shop.", "You do not currently own any shops. You must open one to use this screen.");
}));
}
else if (msg.Name == "shop_all")
{
this.Invoke(new Action(() =>
{
PopulateShopList(JsonConvert.DeserializeObject<Shop[]>(msg.Contents));
}));
}
}));
}
catch { }
};
}
internal void ShowClasses()
{
var descriptions = new Dictionary<UserClass, string> {
{ UserClass.Skinner, "Skinners, otherwise known as \"Shifters\" due to their excessive use of the Shifter application, like to customize ShiftOS to look like other operating systems or even have an entirely different UI. They gain heaps of codepoints from it, and like to sell their skins for even more Codepoints." },
{ UserClass.Hacker, "Hackers are notorious for taking down large groups and individuals of which have many useful documents and Codepoints on their system. Hackers enjoy the rush of typing malicious commands into their terminals and seeing how they affect their target." },
{ UserClass.Investigator, "Much like hackers, investigators are skilled with a terminal and breaching systems, but they don't do it directly for monetary gain. They will search a target's system for any files and clues that may lead to them being guilty of a crime within the digital society. Unlike Hackers, Investigators mostly have higher reputations in society, and go after those with lower reputations."},
{ UserClass.Explorer, "Explorers like to venture the vast regions of the multi-user domain and Shiftnet looking for secrets, hidden tools and software, and finding the hidden truths behind their screen. Explorers don't always know how to hack, but if it involves finding a secret about ShiftOS, they will do it. They typically do not have malicious intent."},
{ UserClass.SafetyActivist, "Safety Activists are skilled with exploitation and hacking, but they only go after the worst there is in the multi-user domain. Crime rings, large hacker groups, you name it. Their primary goal is keeping the multi-user domain safe." },
{ UserClass.PenetrationTester, "Penetration testers go hand-in-hand with Safety Activists. They go after the good guys, but rather than attacking them, they alert them that an exploit was found in their service and that this exploit should be fixed. They are a gray subject though - you never know if you are dealing with a genuine pen-tester or a hacker skilled with social engineering. Be careful." },
{ UserClass.Collector, "Collectors go well with Explorers - however, Collectors are the ones who open shops. They like to find rare objects and sell them for Codepoints." },
{UserClass.Programmer, "Programmers are the ones who write applications and services for ShiftOS and the multi-user domain. Depending on the code that they write, they can be seen as either morally wrong sentiences or morally correct sentiences, it's up to their decisions." },
};
lbclasses.Items.Clear();
lbclasses.SelectedIndexChanged += (o, a) =>
{
newClass = (UserClass)Enum.Parse(typeof(UserClass), lbclasses.SelectedItem.ToString());
lbclassdesc.Text = descriptions[newClass];
lbclasstitle.Text = newClass.ToString();
};
foreach (var kv in descriptions)
{
lbclasses.Items.Add(kv.Key.ToString());
}
menuStrip1.Hide();
pnlclasses.Show();
pnlclasses.BringToFront();
}
UserClass newClass = UserClass.None;
public void ListAllChats(Channel[] channels)
{
shop_all.BringToFront();
flshoplist.Controls.Clear();
lblistname.Text = "Chat";
lblistdesc.Text = "Want to talk with other Shifters on the multi-user domain? Simply select a chatroom below and click 'Join' to join in!";
foreach (var shop in channels)
{
var bnr = new Panel();
bnr.Height = 100;
bnr.Tag = "keepbg";
bnr.Width = flshoplist.Width;
var lTitle = new Label();
lTitle.AutoSize = true;
lTitle.Tag = "keepbg header2";
lTitle.Text = shop.Name;
lTitle.Location = new Point(18, 17);
bnr.Controls.Add(lTitle);
lTitle.Show();
var desc = new Label();
desc.Text = shop.Topic;
bnr.Controls.Add(desc);
desc.Show();
var flButtons = new FlowLayoutPanel();
flButtons.AutoSize = true;
flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flButtons.Tag = "keepbg";
flButtons.FlowDirection = FlowDirection.RightToLeft;
flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right;
flButtons.Top = 2;
flButtons.Left = bnr.Width - flButtons.Width - 2;
bnr.Controls.Add(flButtons);
flButtons.Show();
var btn = new Button();
btn.Text = "Join";
btn.Click += (o, a) =>
{
OpenChat(shop.ID);
};
flButtons.Controls.Add(btn);
btn.Show();
flshoplist.Controls.Add(bnr);
bnr.Show();
ControlManager.SetupControls(bnr);
desc.Left = lTitle.Left;
desc.Width = (bnr.Width - desc.Left - desc.Left);
desc.Top = lTitle.Top + lTitle.Height;
desc.Height = (bnr.Height - lTitle.Top);
}
}
[Obsolete("MUD control center is dying! KILL IT!")]
public void OpenChat(string id)
{
// AppearanceManager.SetupWindow(new Chat(id));
}
private Shop editingShop = null;
public void ShowCreateShop()
{
this.Invoke(new Action(() =>
{
editingShop = new Shop();
creatingShop = true;
editingShop.Name = "My shop";
editingShop.Description = "My shop has lots of awesome items. You should buy from my shop.";
editingShop.Owner = SaveSystem.CurrentUser.Username;
editingShop.Items = new List<ShopItem>();
shop_editor.BringToFront();
PopulateShopEditor();
}));
}
public void PopulateShopEditor()
{
txtshopdescription.Text = editingShop.Description;
txtshopname.Text = editingShop.Name;
lbeditingshopitems.Items.Clear();
foreach(var item in editingShop.Items)
{
lbeditingshopitems.Items.Add(item.Name);
}
}
public void PopulateShopList(Shop[] shops)
{
shop_all.BringToFront();
flshoplist.Controls.Clear();
lblistname.Text = "Shops";
lblistdesc.Text = "The multi-user domain is full of various shops ran by other users. They can contain anything from skins to applications to full system modifications. Just select a shop below to browse its contents!";
foreach (var shop in shops)
{
var bnr = new Panel();
bnr.Height = 100;
bnr.Tag = "keepbg";
bnr.Width = flshoplist.Width;
var lTitle = new Label();
lTitle.AutoSize = true;
lTitle.Tag = "keepbg header2";
lTitle.Text = shop.Name;
lTitle.Location = new Point(18, 17);
bnr.Controls.Add(lTitle);
lTitle.Show();
var desc = new Label();
desc.Text = shop.Description;
bnr.Controls.Add(desc);
desc.Show();
var flButtons = new FlowLayoutPanel();
flButtons.AutoSize = true;
flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flButtons.Tag = "keepbg";
flButtons.FlowDirection = FlowDirection.RightToLeft;
flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right;
flButtons.Top = 2;
flButtons.Left = bnr.Width - flButtons.Width - 2;
bnr.Controls.Add(flButtons);
flButtons.Show();
var btn = new Button();
btn.Text = "Browse";
btn.Click += (o, a) =>
{
ShowShop(shop);
};
flButtons.Controls.Add(btn);
btn.Show();
flshoplist.Controls.Add(bnr);
bnr.Show();
ControlManager.SetupControls(bnr);
desc.Left = lTitle.Left;
desc.Width = (bnr.Width - desc.Left - desc.Left);
desc.Top = lTitle.Top + lTitle.Height;
desc.Height = (bnr.Height - lTitle.Top);
}
}
public void PopulateShopView()
{
lbupgrades.Items.Clear();
shopItems = CurrentShop.Items;
foreach (var item in CurrentShop.Items)
{
lbupgrades.Items.Add(item.Name);
}
}
public void ShowShop(Shop shop)
{
shop_view.BringToFront();
CurrentShop = shop;
lbshopname.Text = shop.Name;
lbupgradetitle.Text = $"Welcome to {shop.Name}.";
lbupgradedesc.Text = shop.Description;
lbprice.Text = "Select an item from the list on the left.";
btnbuy.Hide();
ServerManager.SendMessage("shop_getitems", JsonConvert.SerializeObject(new
{
shopname = CurrentShop.Name
}));
lbupgrades.SelectedIndexChanged += (o, a) =>
{
item = shopItems[lbupgrades.SelectedIndex];
lbupgradetitle.Text = item.Name;
lbupgradedesc.Text = item.Description;
lbprice.Text = $"Cost: {item.Cost} CP";
btnbuy.Show();
};
if(shop.Owner == SaveSystem.CurrentUser.Username)
{
btneditshop.Show();
}
else
{
btneditshop.Hide();
}
}
private ShopItem item = null;
private List<ShopItem> shopItems = null;
public void PopulateJoinLegion(List<Legion> legions)
{
lgn_join.BringToFront();
fllegionlist.Controls.Clear();
foreach(var lgn in legions)
{
var bnr = new Panel();
bnr.Height = 100;
bnr.Tag = "keepbg";
bnr.BackColor = GetColor(lgn.BannerColor);
bnr.Width = fllegionlist.Width;
var lTitle = new Label();
lTitle.AutoSize = true;
lTitle.Tag = "keepbg header2";
lTitle.Text = $"[{lgn.ShortName}] {lgn.Name}";
lTitle.Location = new Point(18, 17);
bnr.Controls.Add(lTitle);
lTitle.Show();
var flButtons = new FlowLayoutPanel();
flButtons.AutoSize = true;
flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flButtons.Tag = "keepbg";
flButtons.FlowDirection = FlowDirection.RightToLeft;
flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right;
flButtons.Top = 2;
flButtons.Left = bnr.Width - flButtons.Width - 2;
bnr.Controls.Add(flButtons);
flButtons.Show();
var btn = new Button();
btn.Text = "More info";
btn.Click += (o, a) =>
{
ShowLegionInfo(lgn);
};
flButtons.Controls.Add(btn);
btn.Show();
fllegionlist.Controls.Add(bnr);
bnr.Show();
ControlManager.SetupControls(bnr);
}
}
public Color GetColor(ConsoleColor color)
{
switch (color)
{
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 void OnLoad()
{
ServerManager.MessageReceived += (msg) =>
{
if(msg.Name == "mud_usermemos")
{
try
{
foreach (var memo in JsonConvert.DeserializeObject<MUDMemo[]>(msg.Contents))
{
this.Invoke(new Action(() =>
{
var lbtitle = new Label();
lbtitle.Text = memo.Subject;
lbtitle.Tag = "header3";
ControlManager.SetupControls(lbtitle);
flmemos.Controls.Add(lbtitle);
var lbsubject = new Label();
lbsubject.Text = "From " + memo.UserFrom;
flmemos.Controls.Add(lbsubject);
var lbbody = new Label();
lbbody.Margin = new Padding(0, 15, 0, 15);
lbbody.Text = memo.Body;
flmemos.Controls.Add(lbbody);
lbtitle.Show();
lbsubject.Show();
lbbody.Show();
}));
}
}
catch { }
}
};
SetupSystemStatus();
}
public void SetupSystemStatus()
{
int scripts = 0;
string legionname = "";
foreach(var lgn in SaveSystem.CurrentSave.CurrentLegions)
{
legionname += Environment.NewLine + " - " + lgn;
}
you_systemstatus.BringToFront();
lblsysstatus.Text = $@"Username: {SaveSystem.CurrentUser.Username}
System name: {SaveSystem.CurrentSave.SystemName}
Codepoints: {SaveSystem.CurrentSave.Codepoints}
Upgrades: {SaveSystem.CurrentSave.CountUpgrades()}/{Shiftorium.GetDefaults().Count}
System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.MinorVersion}.{SaveSystem.CurrentSave.Revision}
Shared scripts: {scripts}
Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})
Current legions: {legionname}";
}
public void OnSkinLoad()
{
}
public bool OnUnload()
{
return true;
}
public void OnUpgrade()
{
}
private void tsMemos_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("get_memos_for_user", $@"{{
username: ""{SaveSystem.CurrentUser.Username}""
}}");
you_memos.BringToFront();
}
private void profileToolStripMenuItem_Click(object sender, EventArgs e)
{
SetupSystemStatus();
}
private void disconnectFromMuDToolStripMenuItem_Click(object sender, EventArgs e)
{
}
public void ShowLegionInfo(Legion lgn)
{
lgn_view.BringToFront();
lblegiontitle.Text = $"[{lgn.ShortName}] {lgn.Name}";
lbdescription.Text = lgn.Description;
if(lgn.Publicity == LegionPublicity.PublicInviteOnly || lgn.Publicity == LegionPublicity.UnlistedInviteOnly)
{
btnjoinlegion.Hide();
}
banner.BackColor = GetColor(lgn.BannerColor);
ServerManager.SendMessage("legion_get_users", JsonConvert.SerializeObject(lgn));
btnleavelegion.Hide();
if(SaveSystem.CurrentSave.CurrentLegions.Contains(lgn.ShortName))
{
btnjoinlegion.Hide();
btnleavelegion.Show();
}
}
private void myLegionToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
}
private void joinLegionToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("legion_get_all", "");
}
public void ShowLegionSelector()
{
ServerManager.SendMessage("legion_get_all", "");
}
private void btnjoinlegion_Click(object sender, EventArgs e)
{
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
SaveSystem.CurrentSave.CurrentLegions.Add(shortname);
SaveSystem.SaveGame();
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
LegionChanged?.Invoke();
}
public event Action LegionChanged;
private void btnleavelegion_Click(object sender, EventArgs e)
{
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
SaveSystem.CurrentSave.CurrentLegions.Remove(shortname);
SaveSystem.SaveGame();
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
}
Legion newLegion = null;
private void createLegionToolStripMenuItem_Click(object sender, EventArgs e)
{
newLegion = new Legion();
SetupLegionEditor(newLegion);
}
public void SetupLegionEditor(Legion l)
{
editingLegion = l;
cbcolorchooser.Items.Clear();
foreach(var name in Enum.GetNames(typeof(ConsoleColor)))
{
cbcolorchooser.Items.Add(name);
}
cbcolorchooser.Text = l.BannerColor.ToString();
cbcolorchooser.SelectedIndexChanged += (o, a) =>
{
panel4.BackColor = GetColor((ConsoleColor)Enum.Parse(typeof(ConsoleColor), cbcolorchooser.Text));
editingLegion.BannerColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), cbcolorchooser.Text);
};
cbpublicity.Items.Clear();
cbpublicity.SelectedIndexChanged += (o, a) =>
{
var pb = (LegionPublicity)Enum.Parse(typeof(LegionPublicity), cbpublicity.Text);
editingLegion.Publicity = pb;
};
foreach(var pb in Enum.GetNames(typeof(LegionPublicity)))
{
cbpublicity.Items.Add(pb);
}
cbpublicity.Text = editingLegion.Publicity.ToString();
if (editingLegion.ShortName == null)
editingLegion.ShortName = "NAME";
if (editingLegion.Name == null)
editingLegion.Name = "Legion name";
if (editingLegion.Description == null)
editingLegion.Description = "This is your legion description.";
txtnewlegionshortname.Text = editingLegion.ShortName;
txtnewlegiondescription.Text = editingLegion.Description;
txtnewlegiontitle.Text = editingLegion.Name;
panel4.BackColor = GetColor(editingLegion.BannerColor);
lgn_create.BringToFront();
}
Legion editingLegion;
private void txtnewlegionshortname_TextChanged(object sender, EventArgs e)
{
var g = txtnewlegionshortname.CreateGraphics();
SizeF sf = g.MeasureString(txtnewlegionshortname.Text, txtnewlegionshortname.Font);
editingLegion.ShortName = txtnewlegionshortname.Text;
txtnewlegionshortname.Size = new Size((int)sf.Width, (int)sf.Height);
}
private Shop CurrentShop = null;
private void txtnewlegiontitle_TextChanged(object sender, EventArgs e)
{
var g = txtnewlegiontitle.CreateGraphics();
SizeF sf = g.MeasureString(txtnewlegiontitle.Text, txtnewlegiontitle.Font);
editingLegion.Name = txtnewlegiontitle.Text;
txtnewlegiontitle.Size = new Size((int)sf.Width, (int)sf.Height);
}
private void flowLayoutPanel3_Paint(object sender, PaintEventArgs e)
{
}
private void cbcolorchooser_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void btncreate_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("legion_createnew", JsonConvert.SerializeObject(editingLegion));
}
private void txtnewlegiondescription_TextChanged(object sender, EventArgs e)
{
editingLegion.Description = txtnewlegiondescription.Text;
}
private void currentTaskToolStripMenuItem_Click(object sender, EventArgs e)
{
this.job_current.BringToFront();
}
private void browseToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("shop_getall", "");
}
private void btnbuy_Click(object sender, EventArgs e)
{
if (SaveSystem.CurrentSave.Codepoints >= item.Cost)
{
//Send the Codepoints to the shop owner. If they're online, the MUD will tell them to update their Codepoints.
ServerManager.SendMessage("usr_givecp", JsonConvert.SerializeObject(new
{
username = this.CurrentShop.Owner,
amount = item.Cost
}));
string fileExt = FileSkimmerBackend.GetFileExtension((FileType)item.FileType);
FileSkimmerBackend.GetFile(new[] { fileExt }, FileOpenerStyle.Save, new Action<string>((dest) =>
{
var d = new Download
{
ShiftnetUrl = $"{CurrentShop.Name}: {item.Name}",
Destination = dest,
Bytes = item.MUDFile
};
DownloadManager.StartDownload(d);
}));
}
else
{
Infobox.Show("Not enough Codepoints", "You cannot afford this item. You need at least " + item.Cost.ToString() + ".");
}
}
private void openAShopToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new
{
username = SaveSystem.CurrentUser.Username
}));
}
private void txtshopname_TextChanged(object sender, EventArgs e)
{
try
{
editingShop.Name = txtshopname.Text;
}
catch { }
}
private void txtshopdescription_TextChanged(object sender, EventArgs e)
{
try
{
editingShop.Description = txtshopdescription.Text;
}
catch { }
}
bool creatingShop = false;
private void btnsaveshop_Click(object sender, EventArgs e)
{
if(creatingShop == true)
{
ServerManager.SendMessage("create_shop", JsonConvert.SerializeObject(editingShop));
}
else
{
ServerManager.SendMessage("update_shop_by_user", JsonConvert.SerializeObject(new
{
username = editingShop.Owner,
shop = editingShop
}));
}
}
private void btnaddshopitem_Click(object sender, EventArgs e)
{
AppearanceManager.SetupWindow(new ShopItemCreator(new ShopItem(), new Action<ShopItem>((item) =>
{
editingShop.Items.Add(item);
PopulateShopEditor();
})));
}
private void btnremoveitem_Click(object sender, EventArgs e)
{
try
{
int i = lbeditingshopitems.SelectedIndex;
editingShop.Items.RemoveAt(i);
PopulateShopEditor();
}
catch
{
}
}
private void btnedititem_Click(object sender, EventArgs e)
{
try
{
int i = lbeditingshopitems.SelectedIndex;
AppearanceManager.SetupWindow(new ShopItemCreator(editingShop.Items[i], new Action<ShopItem>((item) =>
{
editingShop.Items[i] = item;
})));
PopulateShopEditor();
}
catch
{
}
}
private void myShopToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentUser.Username);
}
private void btneditshop_Click(object sender, EventArgs e)
{
editingShop = CurrentShop;
creatingShop = false;
shop_editor.BringToFront();
PopulateShopEditor();
}
private void joinAChatToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("chat_getallchannels", "");
}
private void btndeletesave_Click(object sender, EventArgs e)
{
Infobox.PromptYesNo("Delete your system", "Are you SURE you want to delete your system? If you do, you will lose ALL of your Codepoints and file system.", (firstres) =>
{
if(firstres == true)
{
Infobox.PromptYesNo("Last chance.", "What you are about to do is IRREVERSABLE. You will lose access to any legions or shops you are a part of. Continue anyway?", (second) =>
{
if(second == true)
{
ServerManager.SendMessage("delete_save", JsonConvert.SerializeObject(new ClientSave
{
Username = SaveSystem.CurrentUser.Username,
Password = SaveSystem.CurrentSave.Password
}));
SaveSystem.CurrentSave = null;
ShiftOS.Objects.ShiftFS.Utils.Delete(Paths.GetPath("user.dat"));
TerminalBackend.InvokeCommand("sos.shutdown");
MessageBox.Show("Thank you for playing ShiftOS. Your save data has been deleted successfully. You can come back at anytime, but you will have to restart your game.");
System.IO.File.Delete(Paths.SaveFile);
}
});
}
});
}
public event Action ClassChanged;
private void btnchooseclass_Click(object sender, EventArgs e)
{
if(newClass != UserClass.None)
{
SaveSystem.CurrentSave.Class = newClass;
SaveSystem.SaveGame();
ClassChanged?.Invoke();
menuStrip1.Show();
pnlclasses.SendToBack();
this.SetupSystemStatus();
return;
}
}
}
}

View file

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="lblistdesc.Text" xml:space="preserve">
<value>The multi-user domain has many unique shops selling many items such as applications, skins and other things. Just choose a shop, browse for an item you'd like, then pay Codepoints and the download will begin.</value>
</data>
<data name="label10.Text" xml:space="preserve">
<value>On this screen you can customize your legion profile. This is how users will see your legion inside the Join Legion screen.
You can set up a banner color, short and long name, and a description on this screen. The shortname is used to identify your legion. The long name is a more descriptive name for your legion.
The description will be what explains your legion - what does it do? Why should the user join it? Stuff like that.</value>
</data>
</root>

View file

@ -13,8 +13,8 @@ using System.Threading;
namespace ShiftOS.WinForms.Applications
{
[WinOpen("mindblow")]
[Launcher("MindBlow", false, null, "Utilities")]
[WinOpen("{WO_MINDBLOW}")]
[Launcher("{TITLE_MINDBLOW}", false, null, "{AL_PROGRAMMING}")]
[RequiresUpgrade("mindblow")]
public partial class MindBlow : UserControl, IShiftOSWindow, IBFListener
{

View file

@ -39,10 +39,10 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications {
[MultiplayerOnly]
[Launcher("Name Changer", false, null, "Customization")]
[AppscapeEntry("Name Changer", "Want to change the names of applications within ShiftOS? This application lets you do just that.", 342, 500, "skinning;file_skimmer;wm_titlebar", "Customization")]
[WinOpen("name_changer")]
[DefaultTitle("Name Changer")]
[Launcher("{TITLE_NAMECHANGER}", false, null, "{AL_CUSTOMIZATION}")]
[AppscapeEntry("{TITLE_NAMECHANGER}", "{DESC_NAMECHANGER}", 342, 500, "skinning;file_skimmer;wm_titlebar", "{AL_CUSTOMIZATION}")]
[WinOpen("{WO_NAMECHANGER}")]
[DefaultTitle("{TITLE_NAMECHANGER}")]
[DefaultIcon("iconNameChanger")]
public partial class NameChanger : UserControl, IShiftOSWindow
{
@ -62,37 +62,41 @@ namespace ShiftOS.WinForms.Applications {
public void SetupUI()
{
flnames.Controls.Clear();
foreach(var name in names)
foreach(var type in ReflectMan.Types.Where(x => Shiftorium.UpgradeAttributesUnlocked(x) && x.GetInterfaces().Contains(typeof(IShiftOSWindow))))
{
var pnl = new Panel();
var lbl = new Label();
var txt = new TextBox();
pnl.Controls.Add(lbl);
lbl.Show();
pnl.Controls.Add(txt);
txt.Show();
ControlManager.SetupControls(pnl);
pnl.Width = flnames.Width - 10;
pnl.Height = 50;
lbl.Left = 10;
lbl.Width = (pnl.Width / 4) - 10;
lbl.Text = name.Key;
lbl.Top = (pnl.Height - lbl.Height) / 2;
lbl.TextAlign = ContentAlignment.MiddleLeft;
txt.Text = name.Value;
txt.TextChanged += (o, a) =>
var title = type.GetCustomAttributes(false).FirstOrDefault(x => x is DefaultTitleAttribute) as DefaultTitleAttribute;
if(title != null)
{
names[name.Key] = txt.Text;
};
txt.Width = pnl.Width - (pnl.Width / 4) - 20;
txt.Left = lbl.Width + 20;
txt.Top = (pnl.Height - txt.Height) / 2;
flnames.Controls.Add(pnl);
pnl.Show();
var lbl = new Label();
lbl.AutoSize = true;
lbl.Text = Localization.Parse(title.Title);
lbl.Tag = "header3";
ControlManager.SetupControl(lbl);
flnames.Controls.Add(lbl);
lbl.Show();
flnames.SetFlowBreak(lbl, true);
var txt = new TextBox();
ControlManager.SetupControl(txt);
if (!names.ContainsKey(type.Name))
names.Add(type.Name, title.Title);
txt.Text = Localization.Parse(names[type.Name]);
txt.TextChanged += (o, a) =>
{
if(txt.Text == Localization.Parse(title.Title))
{
names[type.Name] = title.Title;
}
else
{
names[type.Name] = txt.Text;
}
};
flnames.Controls.Add(txt);
txt.Show();
txt.Width = flnames.Width - 10;
flnames.SetFlowBreak(txt, true);
}
}
}
@ -121,7 +125,7 @@ namespace ShiftOS.WinForms.Applications {
private void btnloaddefault_Click(object sender, EventArgs e)
{
names = NameChangerBackend.GetDefault();
names = new Dictionary<string, string>();
SetupUI();
}
@ -153,15 +157,7 @@ namespace ShiftOS.WinForms.Applications {
{
public static Dictionary<string, string> GetDefault()
{
var dict = new Dictionary<string, string>();
foreach(var winType in AppearanceManager.GetAllWindowTypes())
{
if (dict.ContainsKey(winType.Name))
dict[winType.Name] = AppearanceManager.GetDefaultTitle(winType);
else
dict.Add(winType.Name, AppearanceManager.GetDefaultTitle(winType));
}
return dict;
return new Dictionary<string, string>();
}
public static Dictionary<string,string> GetCurrent()
@ -172,12 +168,6 @@ namespace ShiftOS.WinForms.Applications {
if (SkinEngine.LoadedSkin.AppNames == null)
SkinEngine.LoadedSkin.AppNames = GetDefault();
foreach(var def in GetDefault())
{
if (!SkinEngine.LoadedSkin.AppNames.ContainsKey(def.Key))
SkinEngine.LoadedSkin.AppNames.Add(def.Key, def.Value);
}
return SkinEngine.LoadedSkin.AppNames;
}
@ -195,7 +185,7 @@ namespace ShiftOS.WinForms.Applications {
SkinEngine.LoadedSkin.AppNames = GetDefault();
if (!SkinEngine.LoadedSkin.AppNames.ContainsKey(type.Name))
SkinEngine.LoadedSkin.AppNames.Add(type.Name, AppearanceManager.GetDefaultTitle(type));
return Localization.Parse(AppearanceManager.GetDefaultTitle(type));
return SkinEngine.LoadedSkin.AppNames[type.Name];
}

View file

@ -1,114 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace ShiftOS.WinForms.Applications
{
partial class Notifications
{
/// <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.lblnotifications = new System.Windows.Forms.Label();
this.fllist = new System.Windows.Forms.FlowLayoutPanel();
this.btnmarkallread = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblnotifications
//
this.lblnotifications.AutoSize = true;
this.lblnotifications.Dock = System.Windows.Forms.DockStyle.Top;
this.lblnotifications.Location = new System.Drawing.Point(0, 0);
this.lblnotifications.Name = "lblnotifications";
this.lblnotifications.Padding = new System.Windows.Forms.Padding(10);
this.lblnotifications.Size = new System.Drawing.Size(85, 33);
this.lblnotifications.TabIndex = 0;
this.lblnotifications.Tag = "header1";
this.lblnotifications.Text = "Notifications";
//
// fllist
//
this.fllist.Dock = System.Windows.Forms.DockStyle.Fill;
this.fllist.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.fllist.Location = new System.Drawing.Point(0, 33);
this.fllist.Name = "fllist";
this.fllist.Size = new System.Drawing.Size(437, 487);
this.fllist.TabIndex = 1;
//
// btnmarkallread
//
this.btnmarkallread.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnmarkallread.AutoSize = true;
this.btnmarkallread.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnmarkallread.Location = new System.Drawing.Point(356, 4);
this.btnmarkallread.Name = "btnmarkallread";
this.btnmarkallread.Size = new System.Drawing.Size(78, 23);
this.btnmarkallread.TabIndex = 2;
this.btnmarkallread.Text = "Mark all read";
this.btnmarkallread.UseVisualStyleBackColor = true;
this.btnmarkallread.Click += new System.EventHandler(this.btnmarkallread_Click);
//
// Notifications
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnmarkallread);
this.Controls.Add(this.fllist);
this.Controls.Add(this.lblnotifications);
this.Name = "Notifications";
this.Size = new System.Drawing.Size(437, 520);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblnotifications;
private System.Windows.Forms.FlowLayoutPanel fllist;
private System.Windows.Forms.Button btnmarkallread;
}
}

View file

@ -1,275 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[DefaultTitle("Notifications")]
[Launcher("Notifications", true, "al_notifications", "Utilities")]
public partial class Notifications : UserControl, IShiftOSWindow
{
public Notifications()
{
InitializeComponent();
onMade = (note) =>
{
SetupUI();
};
}
Action<Notification> onMade = null;
public void SetupUI()
{
fllist.Controls.Clear();
bool showNoNotes = true;
foreach (var note in new List<Notification>(NotificationDaemon.GetAllFromFile()).OrderByDescending(n => n.Timestamp))
{
if (note.Read == false)
{
try
{
showNoNotes = false;
var headerLabel = new Label();
headerLabel.Tag = "header2";
ControlManager.SetupControl(headerLabel);
headerLabel.Text = ParseNotification(note);
headerLabel.Width = fllist.Width - 4;
fllist.Controls.Add(headerLabel);
headerLabel.Show();
var markButton = new Button();
ControlManager.SetupControl(markButton);
markButton.Text = "Mark as read";
markButton.AutoSize = true;
markButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
markButton.Click += (o, a) =>
{
NotificationDaemon.MarkRead(new List<Notification>(NotificationDaemon.GetAllFromFile()).IndexOf(note));
SetupUI();
};
fllist.Controls.Add(markButton);
markButton.Show();
var dataLabel = new Label();
dataLabel.Text = ParseNotificationData(note);
dataLabel.MaximumSize = new Size(fllist.Width - 4, 0);
dataLabel.AutoSize = true;
fllist.Controls.Add(dataLabel);
dataLabel.Show();
}
catch
{
}
}
}
if(showNoNotes == true)
{
var lbl = new Label();
lbl.Tag = "header3";
ControlManager.SetupControl(lbl);
lbl.AutoSize = true;
lbl.Text = "You have no notifications.";
fllist.Controls.Add(lbl);
lbl.Show();
}
}
public string ParseNotificationData(Notification note)
{
string data = "";
data = note.Timestamp.ToString();
data += Environment.NewLine + Environment.NewLine;
switch (note.Type)
{
case NotificationType.ChatBan:
data += "You have been banned from " + note.Data.ToString() + ".";
break;
case NotificationType.CodepointsReceived:
data += "You have received " + note.Data.ToString() + " Codepoints.";
break;
case NotificationType.CodepointsSent:
data += "You have lost " + note.Data.ToString() + " Codepoints.";
break;
case NotificationType.CriticalBugwatch:
data += "ShiftOS is in a critical bugwatch state. If you see any bugs, report them to us immediately.";
break;
case NotificationType.DownloadComplete:
data += "Download of file " + note.Data.ToString() + " complete.";
break;
case NotificationType.DownloadStarted:
data += "Download started. Destination: " + note.Data.ToString() + ".";
break;
case NotificationType.Generic:
data += note.Data.ToString();
break;
case NotificationType.LegionBan:
data += "You have been banned from " + note.Data.ToString();
break;
case NotificationType.LegionInvite:
data += "You have been invited to a legion. Invite code: " + note.Data.ToString();
break;
case NotificationType.LegionKick:
data += "You have been kicked out of " + note.Data.ToString() + ".";
break;
case NotificationType.MemoReceived:
data += "New memo received from " + note.Data.ToString() + "!";
break;
case NotificationType.MemoSent:
data += "Memo successfully sent to " + note.Data.ToString() + ".";
break;
case NotificationType.MUDAnnouncement:
data += note.Data.ToString();
break;
case NotificationType.MUDMaintenance:
data += "The MUD will be going down for a little while at " + note.Data.ToString() + ". Please beware.";
break;
case NotificationType.NewAppveyor:
data += "A new AppVeyor build of ShiftOS has been released.";
break;
case NotificationType.NewDeveloper:
data += "A new developer, " + note.Data.ToString() + " has been added to the team!";
break;
case NotificationType.NewShiftOSStable:
data += "The latest ShiftOS stable, " + note.Data.ToString() + " has been released!";
break;
case NotificationType.NewShiftOSStream:
data += "We're going to be live at http://youtube.com/ShiftOS/live at " + note.Data.ToString() + " (Eastern Standard Time).";
break;
case NotificationType.NewShiftOSUnstable:
data += "A new unstable version of ShiftOS has been released: " + note.Data.ToString() + ".";
break;
case NotificationType.NewShiftOSVideo:
data += "A new ShiftOS video has been released! Get to it before Victor Tran!";
break;
case NotificationType.SavePurge:
data += "A purge has occurred inside the multi-user domain. If you have lost your save, it is because it has gone rogue and has been purged.";
break;
case NotificationType.ShopPurchase:
data += "You have successfully purchased " + note.Data.ToString() + ".";
break;
default:
data += "Corrupt notification data.";
break;
}
return data;
}
public string ParseNotification(Notification note)
{
switch (note.Type)
{
case NotificationType.ChatBan:
return "Banned from chat";
case NotificationType.CodepointsReceived:
return "Codepoints received.";
case NotificationType.CodepointsSent:
return "Codepoints sent.";
case NotificationType.CriticalBugwatch:
return "Critical Bugwatch in progress";
case NotificationType.DownloadComplete:
return "Download complete.";
case NotificationType.DownloadStarted:
return "Download started.";
case NotificationType.Generic:
return "System update";
case NotificationType.LegionBan:
return "Banned from legion";
case NotificationType.LegionInvite:
return "Legion invite received.";
case NotificationType.LegionKick:
return "Kicked from legion";
case NotificationType.MemoReceived:
return "New memo";
case NotificationType.MemoSent:
return "Memo sent.";
case NotificationType.MUDAnnouncement:
return "MUD Announcement";
case NotificationType.MUDMaintenance:
return "MUD maintenance warning!";
case NotificationType.NewAppveyor:
return "New AppVeyor build of ShiftOS";
case NotificationType.NewDeveloper:
return "Please welcome our newest developer...";
case NotificationType.NewShiftOSStable:
return "The newest ShiftOS stable is out!";
case NotificationType.NewShiftOSStream:
return "We're going live soon!";
case NotificationType.NewShiftOSUnstable:
return "The latest ShiftOS unstable is out!";
case NotificationType.NewShiftOSVideo:
return "New ShiftOS video is out!";
case NotificationType.SavePurge:
return "MUD save purge";
case NotificationType.ShopPurchase:
return "Item purchased from shop.";
default:
return "Unknown";
}
}
public void OnLoad()
{
SetupUI();
NotificationDaemon.NotificationMade += onMade;
}
public void OnSkinLoad()
{
}
public bool OnUnload()
{
NotificationDaemon.NotificationMade -= onMade;
return true;
}
public void OnUpgrade()
{
}
private void btnmarkallread_Click(object sender, EventArgs e)
{
NotificationDaemon.MarkAllRead();
}
}
}

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -12,9 +12,9 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[Launcher("Pong", true, "al_pong", "Games")]
[WinOpen("pong")]
[DefaultTitle("Pong")]
[Launcher("{TITLE_PONG}", true, "al_pong", "{AL_GAMES}")]
[WinOpen("{WO_PONG}")]
[DefaultTitle("{TITLE_PONG}")]
[DefaultIcon("iconPong")]
public partial class Pong : UserControl, IShiftOSWindow
{

View file

@ -37,9 +37,9 @@ using System.Windows.Forms;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[Launcher("ShiftLetters", false, null, "Games")]
[AppscapeEntry("ShiftLetters", "Let's see how much you know about ShiftOS by playing this tiny little Hangman game! Shiftorium Upgrades exist to allow you to buy different word sets!", 300, 150, null, "Games")]
[WinOpen("shiftletters")]
[Launcher("{TITLE_SHIFTLETTERS}", false, null, "{AL_GAMES}")]
[AppscapeEntry("{TITLE_SHIFTLETTERS}", "{DESC_SHIFTLETTERS}", 300, 150, null, "{AL_GAMES}")]
[WinOpen("{WO_SHIFTLETTERS}")]
[DefaultIcon("iconShiftLetters")]
public partial class ShiftLetters : UserControl, IShiftOSWindow
{

View file

@ -34,11 +34,11 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
[Launcher("ShiftLotto", true, "al_shiftlotto", "Games")]
[Launcher("{TITLE_SHIFTLOTTO}", true, "al_shiftlotto", "{AL_GAMES}")]
[MultiplayerOnly]
[DefaultIcon("iconShiftLotto")]
[RequiresUpgrade("shiftlotto")]
[WinOpen("shiftlotto")]
[WinOpen("{WO_SHIFTLOTTO}")]
public partial class ShiftLotto : UserControl, IShiftOSWindow
{
public ShiftLotto()

View file

@ -34,10 +34,10 @@ using System.Windows.Forms;
using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications {
[Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")]
[AppscapeEntry("ShiftSweeper", "A simple Minesweeper game built for ShiftOS! Careful, it's a hard one.", 1600, 800, "shiftletters", "Games")]
[Launcher("{TITLE_SHIFTSWEEPER}", true, "al_shiftsweeper", "{AL_GAMES}")]
[AppscapeEntry("{TITLE_SHIFTSWEEPER}", "{DESC_SHIFTSWEEPER}", 1600, 800, "shiftletters", "{AL_GAMES}")]
[MultiplayerOnly]
[WinOpen("shiftsweeper")]
[WinOpen("{WO_SHIFTSWEEPER}")]
[DefaultIcon("iconShiftSweeper")]
public partial class ShiftSweeper : UserControl, IShiftOSWindow {
int[,] game;

View file

@ -37,9 +37,10 @@ using System.Threading;
namespace ShiftOS.WinForms.Applications
{
[MultiplayerOnly]
[Launcher("Shifter", true, "al_shifter", "Customization")]
[Launcher("{TITLE_SHIFTER}", true, "al_shifter", "{AL_CUSTOMIZATION}")]
[RequiresUpgrade("shifter")]
[WinOpen("shifter")]
[WinOpen("{WO_SHIFTER}")]
[DefaultTitle("{TITLE_SHIFTER}")]
[DefaultIcon("iconShifter")]
public partial class Shifter : UserControl, IShiftOSWindow
{

View file

@ -46,10 +46,10 @@ namespace ShiftOS.WinForms.Applications
//
//READ THE DAMN SHIFTOS CODING GUIDELINES.
[Launcher("Shiftnet", true, "al_shiftnet", "Networking")]
[Launcher("{TITLE_SHIFTNET}", true, "al_shiftnet", "{AL_NETWORKING}")]
[MultiplayerOnly]
[DefaultTitle("Shiftnet")]
[WinOpen("shiftnet")]
[DefaultTitle("{TITLE_SHIFTNET}")]
[WinOpen("{WO_SHIFTNET}")]
[RequiresUpgrade("victortran_shiftnet")]
[DefaultIcon("iconShiftnet")]
public partial class Shiftnet : UserControl, IShiftOSWindow, IShiftnetClient

View file

@ -38,11 +38,11 @@ using static ShiftOS.Engine.SkinEngine;
using backend = ShiftOS.Engine.Shiftorium;
namespace ShiftOS.WinForms.Applications
{
[Launcher("Shiftorium", true, "al_shiftorium", "Utilities")]
[Launcher("{TITLE_SHIFTORIUM}", true, "al_shiftorium", "{AL_UTILITIES}")]
[RequiresUpgrade("shiftorium_gui")]
[MultiplayerOnly]
[WinOpen("shiftorium")]
[DefaultTitle("Shiftorium")]
[WinOpen("{WO_SHIFTORIUM}")]
[DefaultTitle("{TITLE_SHIFTORIUM}")]
[DefaultIcon("iconShiftorium")]
public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow
{

View file

@ -1,197 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace ShiftOS.WinForms.Applications
{
partial class ShopItemCreator
{
/// <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.txtitemname = new System.Windows.Forms.TextBox();
this.txtfilename = new System.Windows.Forms.TextBox();
this.btnbrowse = new System.Windows.Forms.Button();
this.btndone = new System.Windows.Forms.Button();
this.txtdescription = new System.Windows.Forms.TextBox();
this.txtcost = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// txtitemname
//
this.txtitemname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtitemname.Location = new System.Drawing.Point(91, 21);
this.txtitemname.Name = "txtitemname";
this.txtitemname.Size = new System.Drawing.Size(421, 20);
this.txtitemname.TabIndex = 0;
//
// txtfilename
//
this.txtfilename.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtfilename.Location = new System.Drawing.Point(91, 47);
this.txtfilename.Name = "txtfilename";
this.txtfilename.ReadOnly = true;
this.txtfilename.Size = new System.Drawing.Size(334, 20);
this.txtfilename.TabIndex = 1;
//
// btnbrowse
//
this.btnbrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnbrowse.Location = new System.Drawing.Point(431, 47);
this.btnbrowse.Name = "btnbrowse";
this.btnbrowse.Size = new System.Drawing.Size(75, 23);
this.btnbrowse.TabIndex = 2;
this.btnbrowse.Text = "Browse";
this.btnbrowse.UseVisualStyleBackColor = true;
this.btnbrowse.Click += new System.EventHandler(this.btnbrowse_Click);
//
// btndone
//
this.btndone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btndone.Location = new System.Drawing.Point(453, 324);
this.btndone.Name = "btndone";
this.btndone.Size = new System.Drawing.Size(75, 23);
this.btndone.TabIndex = 3;
this.btndone.Text = "Done";
this.btndone.UseVisualStyleBackColor = true;
this.btndone.Click += new System.EventHandler(this.btndone_Click);
//
// txtdescription
//
this.txtdescription.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.txtdescription.Location = new System.Drawing.Point(91, 86);
this.txtdescription.Multiline = true;
this.txtdescription.Name = "txtdescription";
this.txtdescription.Size = new System.Drawing.Size(421, 143);
this.txtdescription.TabIndex = 4;
//
// txtcost
//
this.txtcost.Location = new System.Drawing.Point(91, 255);
this.txtcost.Name = "txtcost";
this.txtcost.Size = new System.Drawing.Size(100, 20);
this.txtcost.TabIndex = 5;
this.txtcost.TextChanged += new System.EventHandler(this.txtcost_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 13);
this.label1.TabIndex = 6;
this.label1.Text = "Item name:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(14, 50);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(26, 13);
this.label2.TabIndex = 7;
this.label2.Text = "File:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(14, 89);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(63, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Description:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(14, 258);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(54, 13);
this.label4.TabIndex = 9;
this.label4.Text = "Cost (CP):";
//
// ShopItemCreator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtcost);
this.Controls.Add(this.txtdescription);
this.Controls.Add(this.btndone);
this.Controls.Add(this.btnbrowse);
this.Controls.Add(this.txtfilename);
this.Controls.Add(this.txtitemname);
this.Name = "ShopItemCreator";
this.Size = new System.Drawing.Size(531, 350);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtitemname;
private System.Windows.Forms.TextBox txtfilename;
private System.Windows.Forms.Button btnbrowse;
private System.Windows.Forms.Button btndone;
private System.Windows.Forms.TextBox txtdescription;
private System.Windows.Forms.TextBox txtcost;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}

View file

@ -1,112 +0,0 @@
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
using ShiftOS.Objects;
using ShiftOS.Objects.ShiftFS;
namespace ShiftOS.WinForms.Applications
{
[DefaultTitle("Shop item editor")]
[MultiplayerOnly]
[DefaultIcon("iconSysInfo")]
public partial class ShopItemCreator : UserControl, IShiftOSWindow
{
public ShopItemCreator(ShopItem item, Action<ShopItem> callback)
{
InitializeComponent();
Callback = callback;
Item = item;
txtitemname.Text = Item.Name;
txtdescription.Text = Item.Description;
txtcost.Text = Item.Cost.ToString();
txtfilename.Text = "Unselected";
}
private Action<ShopItem> Callback { get; set; }
public ShopItem Item { get; private set; }
private void btnbrowse_Click(object sender, EventArgs e)
{
FileSkimmerBackend.GetFile(new[] { "" }, FileOpenerStyle.Open, new Action<string>((result) =>
{
txtfilename.Text = result;
Item.MUDFile = Utils.ReadAllBytes(result);
Item.FileType = (int)FileSkimmerBackend.GetFileType(result);
}));
}
private void btndone_Click(object sender, EventArgs e)
{
if(Item.MUDFile == null)
{
Infobox.Show("No file chosen.", "Please select a file to sell.");
return;
}
Item.Cost = Convert.ToUInt64(txtcost.Text);
Item.Description = txtdescription.Text;
Item.Name = txtitemname.Text;
Callback?.Invoke(Item);
AppearanceManager.Close(this);
}
public void OnLoad()
{
}
public void OnSkinLoad()
{
}
public bool OnUnload()
{
return true;
}
public void OnUpgrade()
{
}
private void txtcost_TextChanged(object sender, EventArgs e)
{
try
{
Item.Cost = Convert.ToUInt64(txtcost.Text);
}
catch
{
txtcost.Text = Item.Cost.ToString();
}
}
}
}

View file

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -153,30 +153,30 @@ namespace ShiftOS.WinForms.Applications
// item1ToolStripMenuItem
//
this.item1ToolStripMenuItem.Name = "item1ToolStripMenuItem";
this.item1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.item1ToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.item1ToolStripMenuItem.Text = "Item 1";
//
// item2ToolStripMenuItem
//
this.item2ToolStripMenuItem.Name = "item2ToolStripMenuItem";
this.item2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.item2ToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.item2ToolStripMenuItem.Text = "Item 2";
//
// item3ToolStripMenuItem
//
this.item3ToolStripMenuItem.Name = "item3ToolStripMenuItem";
this.item3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.item3ToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.item3ToolStripMenuItem.Text = "Item 3";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(104, 6);
//
// item4ToolStripMenuItem
//
this.item4ToolStripMenuItem.Name = "item4ToolStripMenuItem";
this.item4ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.item4ToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.item4ToolStripMenuItem.Text = "Item 4";
//
// lbtime
@ -363,9 +363,9 @@ namespace ShiftOS.WinForms.Applications
this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnclose.Location = new System.Drawing.Point(3, 3);
this.btnclose.Name = "btnclose";
this.btnclose.Size = new System.Drawing.Size(60, 23);
this.btnclose.Size = new System.Drawing.Size(89, 23);
this.btnclose.TabIndex = 0;
this.btnclose.Text = "{CLOSE}";
this.btnclose.Text = "{GEN_CLOSE}";
this.btnclose.UseVisualStyleBackColor = true;
this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
//
@ -374,11 +374,11 @@ namespace ShiftOS.WinForms.Applications
this.btnloaddefault.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.btnloaddefault.AutoSize = true;
this.btnloaddefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnloaddefault.Location = new System.Drawing.Point(69, 3);
this.btnloaddefault.Location = new System.Drawing.Point(98, 3);
this.btnloaddefault.Name = "btnloaddefault";
this.btnloaddefault.Size = new System.Drawing.Size(109, 23);
this.btnloaddefault.Size = new System.Drawing.Size(132, 23);
this.btnloaddefault.TabIndex = 1;
this.btnloaddefault.Text = "{LOAD_DEFAULT}";
this.btnloaddefault.Text = "{GEN_LOADDEFAULT}";
this.btnloaddefault.UseVisualStyleBackColor = true;
this.btnloaddefault.Click += new System.EventHandler(this.btnloaddefault_Click);
//
@ -386,11 +386,11 @@ namespace ShiftOS.WinForms.Applications
//
this.btnexport.AutoSize = true;
this.btnexport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnexport.Location = new System.Drawing.Point(184, 3);
this.btnexport.Location = new System.Drawing.Point(236, 3);
this.btnexport.Name = "btnexport";
this.btnexport.Size = new System.Drawing.Size(69, 23);
this.btnexport.Size = new System.Drawing.Size(82, 23);
this.btnexport.TabIndex = 2;
this.btnexport.Text = "{EXPORT}";
this.btnexport.Text = "{GEN_SAVE}";
this.btnexport.UseVisualStyleBackColor = true;
this.btnexport.Click += new System.EventHandler(this.btnexport_Click);
//
@ -398,11 +398,11 @@ namespace ShiftOS.WinForms.Applications
//
this.btnimport.AutoSize = true;
this.btnimport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnimport.Location = new System.Drawing.Point(259, 3);
this.btnimport.Location = new System.Drawing.Point(324, 3);
this.btnimport.Name = "btnimport";
this.btnimport.Size = new System.Drawing.Size(67, 23);
this.btnimport.Size = new System.Drawing.Size(83, 23);
this.btnimport.TabIndex = 3;
this.btnimport.Text = "{IMPORT}";
this.btnimport.Text = "{GEN_LOAD}";
this.btnimport.UseVisualStyleBackColor = true;
this.btnimport.Click += new System.EventHandler(this.btnimport_Click);
//
@ -410,11 +410,11 @@ namespace ShiftOS.WinForms.Applications
//
this.btnapply.AutoSize = true;
this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnapply.Location = new System.Drawing.Point(332, 3);
this.btnapply.Location = new System.Drawing.Point(413, 3);
this.btnapply.Name = "btnapply";
this.btnapply.Size = new System.Drawing.Size(59, 23);
this.btnapply.Size = new System.Drawing.Size(88, 23);
this.btnapply.TabIndex = 4;
this.btnapply.Text = "{APPLY}";
this.btnapply.Text = "{GEN_APPLY}";
this.btnapply.UseVisualStyleBackColor = true;
this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
//

View file

@ -37,10 +37,10 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[Launcher("Skin Loader", true, "al_skin_loader", "Customization")]
[Launcher("{TITLE_SKINLOADER}", true, "al_skin_loader", "{AL_CUSTOMIZATION}")]
[RequiresUpgrade("skinning")]
[WinOpen("skin_loader")]
[DefaultTitle("Skin Loader")]
[DefaultTitle("{TITLE_SKINLOADER}")]
[DefaultIcon("iconSkinLoader")]
public partial class Skin_Loader : UserControl, IShiftOSWindow
{

View file

@ -47,8 +47,9 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
[Launcher("Terminal", false, null, "Utilities")]
[WinOpen("terminal")]
[Launcher("{TITLE_TERMINAL}", false, null, "{AL_UTILITIES}")]
[WinOpen("{WO_TERMINAL}")]
[DefaultTitle("{TITLE_TERMINAL}")]
[DefaultIcon("iconTerminal")]
public partial class Terminal : UserControl, IShiftOSWindow
{

View file

@ -36,9 +36,10 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
[Launcher("TextPad", true, "al_textpad", "Accessories")]
[Launcher("{TITLE_TEXTPAD}", true, "al_textpad", "{AL_ACCESSORIES}")]
[RequiresUpgrade("textpad")]
[WinOpen("textpad")]
[WinOpen("{WO_TEXTPAD}")]
[DefaultTitle("{TITLE_TEXTPAD}")]
[DefaultIcon("iconTextPad")]
public partial class TextPad : UserControl, IShiftOSWindow
{

View file

@ -20,6 +20,10 @@
"{GEN_CODEPOINTS}": "Codepoints",
"{GEN_LOADING}": "Loading...",
"{GEN_SAVE}": "Save",
"{GEN_LOAD}": "Load",
"{GEN_APPLY}": "Apply",
"{GEN_RESET}": "Reset",
"{GEN_LOADDEFAULT}": "Load default",
"{GEN_CANCEL}": "Cancel",
"{GEN_CONTINUE}": "Continue",
"{GEN_BACK}": "Back",
@ -29,6 +33,7 @@
"{GEN_SETTINGS}": "Settings",
"{GEN_ABOUT}": "About",
"{GEN_EXIT}": "Exit",
"{GEN_CLOSE}": "Close",
//General errors
//Syntax errors, command errors, you name it..
@ -48,6 +53,7 @@
"{ERR_ACLHIGHERVALUE}": "You can't set a user's permissions to a value higher than your own.",
"{ERR_HIGHERPERMS}": "That user has more rights than you!",
"{ERR_PASSWD_MISMATCH}": "Passwords don't match!",
"{ERR_SYNTAXERROR}": "Syntax error.",
//Command results
"{RES_ACLUPDATED}": "User permissions updated.",
@ -97,16 +103,56 @@
"{DESC_USERS}": "Lists all users on your computer.",
"{DESC_SU}": "Change your identity to another user's.",
"{DESC_PASSWD}": "Change your user account password.",
"{DESC_NAMECHANGER}": "Change the name of virtually any program within ShiftOS!",
"{DESC_FILENOTFOUND}": "The file you requested could not be found.",
//Window titles.
"{TITLE_FILENOTFOUND}": "File not found.",
"{TITLE_PONG_YOULOSE}": "You lose",
"{TITLE_CODEPOINTSTRANSFERRED}": "Codepoints transferred.",
"{TITLE_INVALIDPORT}": "Invalid port number.",
"{TITLE_ENTERSYSNAME}": "Enter system name",
"{TITLE_INVALIDNAME}": "Invalid name",
"{TITLE_VALUETOOSMALL}": "Value too small.",
"{TITLE_TEMPLATE}": "Template",
"{TITLE_SKINLOADER}": "Skin loader",
"{TITLE_NAMECHANGER}": "Name Changer",
"{TITLE_ADDRESSBOOK}": "Address Book",
"{TITLE_ARTPAD}": "ArtPad",
"{TITLE_SIMPLESRC}": "SimpleSRC Client",
"{TITLE_INFOBOX}": "Information",
"{TITLE_COLORPICKER}": "Choose color",
"{TITLE_AUDIOPLAYER}": "Audio Player",
"{TITLE_CALCULATOR}": "Calculator",
"{TITLE_DOWNLOADER}": "Downloader",
"{TITLE_ABOUT}": "About ShiftOS",
"{TITLE_FILESKIMMER}": "File Skimmer",
"{TITLE_CHOOSEGRAPHIC}": "Choose graphic",
"{TITLE_ICONMANAGER}": "Icon Manager",
"{TITLE_INSTALLER}": "Installer",
"{TITLE_MINDBLOW}": "MindBlow",
"{TITLE_PONG}": "Pong",
"{TITLE_SHIFTER}": "Shifter",
"{TITLE_SHIFTLETTERS}": "ShiftLetters",
"{TITLE_SHIFTLOTTO}": "ShiftLotto",
"{TITLE_SHIFTNET}": "Shiftnet",
"{TITLE_SHIFTORIUM}": "Shiftorium",
"{TITLE_SHIFTSWEEPER}": "ShiftSweeper",
"{TITLE_TERMINAL}": "Terminal",
"{TITLE_TEXTPAD}": "TextPad",
//App Launcher categories
"{AL_PROGRAMMING}": "Programming",
"{AL_CUSTOMIZATION}": "Customization",
"{AL_NETWORKING}": "Networking",
"{AL_UTILITIES}": "Utilities",
"{AL_GRAPHICS}": "Graphics",
"{AL_ACCESSORIES}": "Accessories",
"{AL_ENTERTAINMENT}": "Entertainment",
"{AL_OFFICE}": "Office",
"{AL_GAMES}": "Games",
//Infobox prompt messages
"{PROMPT_PONGLOST}": "You lost this game of Pong. Guess you should've cashed out...",
"{PROMPT_CODEPOINTSTRANSFERRED}": "%transferrer has transferred %amount Codepoints to your system.",
@ -190,4 +236,9 @@
"{LOADINGMSG2_8}": "[systemd] Can I at least have a muffin?",
"{LOADINGMSG2_9}": "[systemd] System initiated, but I still want a cake.",
//Format editor
"{FORMATEDITOR_COMMAND_LOWER}": "command",
"{FORMATEDITOR_ARGUMENT_LOWER}": "argument",
"{FORMATEDITOR_VALUE_LOWER}": "value",
"{FORMATEDITOR_ENTERSYNTAX}": "Enter syntax here",
}

View file

@ -185,24 +185,12 @@
<Compile Include="Applications\ShiftLetters.Designer.cs">
<DependentUpon>ShiftLetters.cs</DependentUpon>
</Compile>
<Compile Include="Applications\MUDControlCentre.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\MUDControlCentre.Designer.cs">
<DependentUpon>MUDControlCentre.cs</DependentUpon>
</Compile>
<Compile Include="Applications\NameChanger.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\NameChanger.Designer.cs">
<DependentUpon>NameChanger.cs</DependentUpon>
</Compile>
<Compile Include="Applications\Notifications.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\Notifications.Designer.cs">
<DependentUpon>Notifications.cs</DependentUpon>
</Compile>
<Compile Include="Applications\Shifter.cs">
<SubType>UserControl</SubType>
</Compile>
@ -239,12 +227,6 @@
<Compile Include="Applications\ShiftSweeper.Designer.cs">
<DependentUpon>ShiftSweeper.cs</DependentUpon>
</Compile>
<Compile Include="Applications\ShopItemCreator.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Applications\ShopItemCreator.Designer.cs">
<DependentUpon>ShopItemCreator.cs</DependentUpon>
</Compile>
<Compile Include="Applications\Skin Loader.cs">
<SubType>UserControl</SubType>
</Compile>
@ -550,15 +532,9 @@
<EmbeddedResource Include="Applications\ShiftLetters.resx">
<DependentUpon>ShiftLetters.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\MUDControlCentre.resx">
<DependentUpon>MUDControlCentre.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\NameChanger.resx">
<DependentUpon>NameChanger.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\Notifications.resx">
<DependentUpon>Notifications.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\Shifter.resx">
<DependentUpon>Shifter.cs</DependentUpon>
</EmbeddedResource>
@ -577,9 +553,6 @@
<EmbeddedResource Include="Applications\ShiftSweeper.resx">
<DependentUpon>ShiftSweeper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\ShopItemCreator.resx">
<DependentUpon>ShopItemCreator.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Applications\Skin Loader.resx">
<DependentUpon>Skin Loader.cs</DependentUpon>
</EmbeddedResource>

View file

@ -182,154 +182,6 @@ namespace ShiftOS.WinForms.Stories
//What a way to create unbuyable, engine-managed Shiftorium Upgrades... :P
}
[Story("devx_legions")]
public static void DevXLegionStory()
{
CharacterName = "DevX";
SysName = "mud";
bool waiting = false;
//Used for DevX dialogue.
//Used for legion selection.
var mud = new Applications.MUDControlCentre();
//For installing the MCC
var installer = new Applications.Installer();
installer.InstallCompleted += () =>
{
Desktop.InvokeOnWorkerThread(() =>
{
AppearanceManager.Close(installer);
});
waiting = false;
};
if (!terminalOpen())
{
var term = new Applications.Terminal();
AppearanceManager.SetupWindow(term);
}
var t = new Thread(() =>
{
WriteLine("DevX@mud - user connecting to your system.", false);
Thread.Sleep(2000);
WriteLine($"Hello, {SaveSystem.CurrentUser.Username}. It's been a while.");
WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades.");
WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it.");
WriteLine("Well, now it's time to introduce your next task.");
WriteLine("In the multi-user domain, each user has a reputation value associated with them.");
WriteLine("Right now, you have a reputation of 0, Neutral.");
WriteLine("This means that nobody has an opinion on you, yet.");
WriteLine("What a good time to make your presence known?");
WriteLine("I have an application for you to try, that will help you out in the multi-user domain, and help you make yourself famous.");
WriteLine("In the digital society, you can't survive long as a lone sentience. You must kongregate with a group, and these groups are called \"legions\".");
WriteLine("This application will assist you in finding one. A legion is a group of sentiences who carry out actions together. They're like... a pack of wolves, or a family, if you will.");
WriteLine("They share Codepoints, documents, applications, and other things with each other.");
WriteLine("And they all have their own goals.");
WriteLine("Up until now, you've been blindly following my directions, with the goal of upgrading ShiftOS. Now, it's time for you to join a legion, and fulfill their goals, to become known within the digital society.");
WriteLine("You'll do all of this through the MUD Control Centre.");
WriteLine("I'll set it up on your system now.");
//Set up an Installer.
waiting = true;
Desktop.InvokeOnWorkerThread(() =>
{
AppearanceManager.SetupWindow(installer);
installer.InitiateInstall(new MCCInstallation());
});
while (waiting == true)
Thread.Sleep(25);
WriteLine("There, it's all installed, so let's get you set up with a legion, shall we?");
Desktop.InvokeOnWorkerThread(() =>
{
AppearanceManager.SetupWindow(mud);
mud.ShowClasses();
mud.ClassChanged += () =>
{
waiting = false;
};
});
WriteLine("First, select a class. A class will help define your personality within the multi-user domain. It'll determine the best legions for you.");
waiting = true;
while (waiting == true)
Thread.Sleep(25);
WriteLine($"Your class has been selected. You are a(n) {SaveSystem.CurrentSave.Class}.");
WriteLine("On this screen, you can see a detailed view of your status within the digital society.");
WriteLine("You'll see this screen everytime you start the MUD Control Centre.");
WriteLine("Like the sos.status command, it shows your Codepoints, the upgrades you've bought and the upgrades available, but it also shows your reputation, legion, shops, and various other details.");
WriteLine("Right now, you are not in any legions. This is about to change.");
WriteLine("I will open the Legion Selector for you. The best legions will be shown at the top of the list.");
WriteLine("Pay attention to their Perdominent Class and their Collective Reputation values. These values will indicate how morally correct the legion is, and may affect your personal reputation.");
Desktop.InvokeOnWorkerThread(() =>
{
mud.ShowLegionSelector();
mud.LegionChanged += () =>
{
waiting = false;
};
});
waiting = true;
while (waiting == true)
Thread.Sleep(25);
WriteLine($"So, you've joined the [{SaveSystem.CurrentSave.CurrentLegions[0]}] legion.");
WriteLine("Now you can see a more detailed view of the legion - who's inside, how many Codepoints the legion has, and you can also join their private chat.");
WriteLine("It's up to you what you do next. Get acquianted with your new team. I've gotta go work on something.");
WriteLine("I will contact you as you become more well-known.");
WriteLine("OH, one more thing.");
WriteLine("You're probably wondering about your reputation. Well, right now you have a Neutral reputation.");
WriteLine("This means, of course, that people don't have an opinion on you. They don't really know you exist.");
WriteLine("As you start performing large-scale operations within the digital society, your reputation will raise or lower gradually depending on how morally correct that action was.");
WriteLine("For example, if you start performing criminal actions, your reputation will start to drop, and people will start to distrust you.");
WriteLine("And if your rep drops too far, the MUD Safety Task Force, and other safety activists may start going after you and trying to take you off the MUD.");
WriteLine("However, if you perform morally-correct actions, your reputation will rise, and more people will trust you with more sensitive data and operations.");
WriteLine("Be careful though, if you have too high of a reputation, lower-rep groups will try to attack you.");
WriteLine("And, I'd be careful of Investigators. If they suspect anything bad about you, they'll do whatever they can to prove you guilty and dramatically decrease your reputation.");
WriteLine("Anyways, I've got some other sentiences I need to... have a little...word...with. Keep on shifting.");
WriteLine("--user has disconnected from your system.--", false);
TerminalBackend.PrefixEnabled = true;
TerminalBackend.PrintPrompt();
});
t.IsBackground = true;
t.Start();
TerminalBackend.PrefixEnabled = false;
}
public class MCCInstallation : Applications.Installation
{
protected override void Run()
{
SetStatus("Beginning installation...");
Thread.Sleep(1270);
SetProgress(10);
SetStatus("Installing base application...");
for(int i = 0; i < 45; i++)
{
Thread.Sleep(25);
SetProgress(10 + i);
}
SetStatus("Configuring system...");
//First, we initialize the user's legion value.
SaveSystem.CurrentSave.CurrentLegions = new List<string>();
Thread.Sleep(250);
SetProgress(65);
//Now we initialize their shop value.
SaveSystem.CurrentSave.MyShop = null;
Thread.Sleep(200);
SetProgress(75);
//Now for their reputation...
SaveSystem.CurrentSave.RawReputation = 0.000;
Thread.Sleep(250);
SetProgress(90);
//Now their class.
SaveSystem.CurrentSave.Class = Objects.UserClass.None;
Thread.Sleep(200);
Story.Start("mud_control_centre");
SaveSystem.SaveGame();
SetProgress(100);
}
}
/// <summary>
/// Stub: Used for story-driven Shiftorium dependency "installer".
/// </summary>

View file

@ -1035,11 +1035,6 @@ namespace ShiftOS.WinForms
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;

View file

@ -71,7 +71,12 @@ namespace ShiftOS.Engine
{
var launch = attr as LauncherAttribute;
if (launch.UpgradeInstalled)
win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
{
var data = new LauncherItem { DisplayData = launch, LaunchType = type };
data.DisplayData.Category = Localization.Parse(data.DisplayData.Category);
data.DisplayData.Name = Localization.Parse(data.DisplayData.Name);
win.Add(data);
}
}
}

View file

@ -258,11 +258,7 @@ namespace ShiftOS.Engine
}
else if (format is CommandFormatMarker)
{
if (format is CommandFormatNamespace)
{
type = "namespace";
}
else if (format is CommandFormatCommand)
if (format is CommandFormatCommand)
{
type = "command";
}
@ -287,8 +283,6 @@ namespace ShiftOS.Engine
return new CommandFormatOptionalText(text);
case "regexText":
return new CommandFormatRegex(text);
case "namespace":
return new CommandFormatNamespace();
case "command":
return new CommandFormatCommand();
case "argument":
@ -303,10 +297,16 @@ namespace ShiftOS.Engine
}
public interface CommandFormat
public class CommandFormat
{
string CheckValidity(string check);
Control Draw();
public virtual string CheckValidity(string check)
{
return check;
}
//winforms use in engine - coding standard violation.
//Control Draw();
}
public class CommandFormatText : CommandFormat
{
@ -323,21 +323,11 @@ namespace ShiftOS.Engine
this.str = str;
}
public virtual string CheckValidity(string check)
public override string CheckValidity(string check)
{
return check.StartsWith(str) ? str : "+FALSE+";
}
public Control Draw()
{
textBox = new TextBox();
textBox.TextChanged += new EventHandler(TextChanged);
textBox.Location = new Point(0, 0);
textBox.Text = str;
return textBox;
}
void TextChanged(object sender, EventArgs e)
{
str = textBox.Text;
@ -384,11 +374,11 @@ namespace ShiftOS.Engine
{
}
public virtual string CheckValidity(string check)
public override string CheckValidity(string check)
{
string res = string.Empty;
string alphanumeric = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm"; // not using regex for performance reasons
string alphanumeric = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm-_0123456789"; // not using regex for performance reasons
//You said "alphanumeric" for that variable name... but it only had the alphabet in it. Rectified. - Michael
foreach (char c in check)
{
if (alphanumeric.IndexOf(c) > -1)
@ -403,45 +393,16 @@ namespace ShiftOS.Engine
return res;
}
public virtual Control Draw()
{
button = new Button();
button.Location = new Point(0, 0);
button.Text = "Marker";
return button;
}
}
public class CommandFormatCommand : CommandFormatMarker
{
public override Control Draw()
{
Button draw = (Button)base.Draw();
draw.Text = "Command";
return draw;
}
}
public class CommandFormatNamespace : CommandFormatMarker
{
public override Control Draw()
{
Button draw = (Button)base.Draw();
draw.Text = "Namespace";
return draw;
}
//stub
}
public class CommandFormatArgument : CommandFormatMarker
{
public override Control Draw()
{
Button draw = (Button)base.Draw();
draw.Text = "Argument";
return draw;
}
//stub
}
public class CommandFormatValue : CommandFormatMarker
@ -477,12 +438,5 @@ namespace ShiftOS.Engine
}
return done ? res : "+FALSE+";
}
public override Control Draw()
{
Button draw = (Button)base.Draw();
draw.Text = "\"Value\"";
return draw;
}
}
}

View file

@ -76,7 +76,7 @@ namespace ShiftOS.Engine
/// <summary>
/// Gets or sets this item's category.
/// </summary>
public string Category { get; private set; }
public string Category { get; internal set; }
/// <summary>
/// Gets whether or not the required upgrade is installed.

View file

@ -447,19 +447,6 @@ namespace ShiftOS.Engine
return true;
}
/// <summary>
/// Runs a command on the client-side.
/// </summary>
/// <param name="ns">The command's namespace.</param>
/// <param name="cmd">The command name.</param>
/// <param name="args">The command's arguments.</param>
/// <param name="isRemote">Whether the command should be ran through RTS.</param>
/// <returns>Whether the command ran successfully.</returns>
public static bool RunClient(string ns, string cmd, Dictionary<string, string> args, bool isRemote = false)
{
return RunClient(ns + "." + cmd, args, isRemote);
}
/// <summary>
/// Runs a command on the client.
/// </summary>
@ -491,8 +478,7 @@ namespace ShiftOS.Engine
//Console.WriteLine(text + " " + "{" + string.Join(",", args.Select(kv => kv.Key + "=" + kv.Value).ToArray()) + "}" + " " + isRemote);
string[] split = text.Split('.');
var cmd = Commands.FirstOrDefault(x => x.CommandInfo.name == text);
var cmd = Commands.FirstOrDefault(x => Localization.Parse(x.CommandInfo.name) == text);
if (cmd == null)
return false;
if (!Shiftorium.UpgradeInstalled(cmd.Dependencies))