Most of TriWrite is implemented.

This commit is contained in:
Michael 2017-05-06 09:44:47 -04:00
parent ba585e7614
commit 57277a01d6
9 changed files with 617 additions and 80 deletions

View file

@ -30,6 +30,7 @@ using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
@ -90,46 +91,68 @@ namespace ShiftOS.WinForms.Applications
public void PopulateShiftorium()
{
try
var t = new Thread(() =>
{
lbnoupgrades.Hide();
lbupgrades.Items.Clear();
upgrades.Clear();
Timer();
foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId]))
try
{
String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
upgrades.Add(name, upg);
lbupgrades.Items.Add(name);
}
Desktop.InvokeOnWorkerThread(() =>
{
lbnoupgrades.Hide();
lbupgrades.Items.Clear();
upgrades.Clear();
Timer();
});
if (lbupgrades.Items.Count == 0)
foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId]))
{
string name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
upgrades.Add(name, upg);
Desktop.InvokeOnWorkerThread(() =>
{
lbupgrades.Items.Add(name);
});
}
if (lbupgrades.Items.Count == 0)
{
Desktop.InvokeOnWorkerThread(() =>
{
lbnoupgrades.Show();
lbnoupgrades.Location = new Point(
(lbupgrades.Width - lbnoupgrades.Width) / 2,
lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2
);
});
}
else
{
Desktop.InvokeOnWorkerThread(() =>
{
lbnoupgrades.Hide();
});
}
Desktop.InvokeOnWorkerThread(() =>
{
lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
btncat_back.Visible = (CategoryId > 0);
btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
});
}
catch
{
lbnoupgrades.Show();
lbnoupgrades.Location = new Point(
(lbupgrades.Width - lbnoupgrades.Width) / 2,
(lbupgrades.Height - lbnoupgrades.Height) / 2
);
Desktop.InvokeOnWorkerThread(() =>
{
lbnoupgrades.Show();
lbnoupgrades.Location = new Point(
(lbupgrades.Width - lbnoupgrades.Width) / 2,
lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2
);
});
}
else
{
lbnoupgrades.Hide();
}
lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
btncat_back.Visible = (CategoryId > 0);
btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
}
catch
{
lbnoupgrades.Show();
lbnoupgrades.Location = new Point(
(lbupgrades.Width - lbnoupgrades.Width) / 2,
(lbupgrades.Height - lbnoupgrades.Height) / 2
);
}
});
t.IsBackground = true;
t.Start();
}
public static bool UpgradeInstalled(string upg)
@ -200,7 +223,17 @@ namespace ShiftOS.WinForms.Applications
{
foreach(var upg in UpgradesToBuy)
{
backend.Buy(upg.Key, upg.Value);
SaveSystem.CurrentSave.Codepoints -= upg.Value;
if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key))
{
SaveSystem.CurrentSave.Upgrades[upg.Key] = true;
}
else
{
SaveSystem.CurrentSave.Upgrades.Add(upg.Key, true);
}
SaveSystem.SaveGame();
backend.InvokeUpgradeInstalled();
}
}
@ -224,7 +257,7 @@ namespace ShiftOS.WinForms.Applications
}
Timer cp_update = new System.Windows.Forms.Timer();
System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer();
public bool OnUnload()
{
@ -248,6 +281,7 @@ namespace ShiftOS.WinForms.Applications
{
timer100 = new System.Timers.Timer();
timer100.Interval = 2000;
//CLARIFICATION: What is this supposed to do? - Michael
//timer100.Elapsed += ???;
timer100.AutoReset = true;
timer100.Enabled = true;

View file

@ -65,8 +65,11 @@ namespace ShiftOS.WinForms.Applications
public void SetupUI()
{
SetupDesktop();
Setup();
if (LoadedSkin != null)
{
SetupDesktop();
Setup();
}
}
public void SetupDesktop()
@ -78,7 +81,7 @@ namespace ShiftOS.WinForms.Applications
//upgrades
if (SaveSystem.CurrentSave != null)
if (SaveSystem.CurrentSave != null && LoadedSkin != null)
{
desktoppanel.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop");
lbtime.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop_clock_widget");

View file

@ -36,15 +36,27 @@
this.panel1 = new System.Windows.Forms.Panel();
this.txtbody = new System.Windows.Forms.Label();
this.lbtitle = new System.Windows.Forms.Label();
this.txtcontents = new System.Windows.Forms.TextBox();
this.menuStrip2 = new System.Windows.Forms.MenuStrip();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip3 = new System.Windows.Forms.MenuStrip();
this.txtcontents = new System.Windows.Forms.RichTextBox();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.bold = new System.Windows.Forms.ToolStripButton();
this.italic = new System.Windows.Forms.ToolStripButton();
this.underline = new System.Windows.Forms.ToolStripButton();
this.strikethrough = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.fonts = new System.Windows.Forms.ToolStripComboBox();
this.size = new System.Windows.Forms.ToolStripTextBox();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.left = new System.Windows.Forms.ToolStripButton();
this.center = new System.Windows.Forms.ToolStripButton();
this.right = new System.Windows.Forms.ToolStripButton();
this.menuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.menuStrip2.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@ -61,16 +73,17 @@
// addContactToolStripMenuItem
//
this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem";
this.addContactToolStripMenuItem.Size = new System.Drawing.Size(32, 19);
this.addContactToolStripMenuItem.Size = new System.Drawing.Size(12, 20);
//
// removeToolStripMenuItem
//
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
this.removeToolStripMenuItem.Size = new System.Drawing.Size(32, 19);
this.removeToolStripMenuItem.Size = new System.Drawing.Size(12, 20);
//
// tvcontacts
//
this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left;
this.tvcontacts.LineColor = System.Drawing.Color.Empty;
this.tvcontacts.Location = new System.Drawing.Point(0, 24);
this.tvcontacts.Name = "tvcontacts";
this.tvcontacts.Size = new System.Drawing.Size(224, 551);
@ -107,16 +120,6 @@
this.lbtitle.Tag = "header1";
this.lbtitle.Text = "TriWrite";
//
// txtcontents
//
this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtcontents.Location = new System.Drawing.Point(0, 53);
this.txtcontents.Multiline = true;
this.txtcontents.Name = "txtcontents";
this.txtcontents.Size = new System.Drawing.Size(527, 460);
this.txtcontents.TabIndex = 1;
this.txtcontents.TabStop = false;
//
// menuStrip2
//
this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -125,7 +128,7 @@
this.saveToolStripMenuItem});
this.menuStrip2.Location = new System.Drawing.Point(0, 0);
this.menuStrip2.Name = "menuStrip2";
this.menuStrip2.Size = new System.Drawing.Size(527, 24);
this.menuStrip2.Size = new System.Drawing.Size(652, 24);
this.menuStrip2.TabIndex = 2;
this.menuStrip2.Text = "menuStrip2";
//
@ -134,40 +137,173 @@
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// menuStrip3
// txtcontents
//
this.menuStrip3.Location = new System.Drawing.Point(0, 30);
this.menuStrip3.Name = "menuStrip3";
this.menuStrip3.Size = new System.Drawing.Size(527, 24);
this.menuStrip3.TabIndex = 3;
this.menuStrip3.Text = "menuStrip3";
this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtcontents.Location = new System.Drawing.Point(0, 49);
this.txtcontents.Name = "txtcontents";
this.txtcontents.Size = new System.Drawing.Size(652, 365);
this.txtcontents.TabIndex = 4;
this.txtcontents.Text = "";
this.txtcontents.SelectionChanged += new System.EventHandler(this.txtcontents_SelectionChanged);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.bold,
this.italic,
this.underline,
this.strikethrough,
this.toolStripSeparator1,
this.fonts,
this.size,
this.toolStripSeparator2,
this.left,
this.center,
this.right});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(652, 25);
this.toolStrip1.TabIndex = 5;
this.toolStrip1.Text = "toolStrip1";
//
// bold
//
this.bold.CheckOnClick = true;
this.bold.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.bold.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.bold.Image = ((System.Drawing.Image)(resources.GetObject("bold.Image")));
this.bold.ImageTransparentColor = System.Drawing.Color.Magenta;
this.bold.Name = "bold";
this.bold.Size = new System.Drawing.Size(23, 22);
this.bold.Text = "B";
this.bold.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
//
// italic
//
this.italic.CheckOnClick = true;
this.italic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.italic.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Italic);
this.italic.Image = ((System.Drawing.Image)(resources.GetObject("italic.Image")));
this.italic.ImageTransparentColor = System.Drawing.Color.Magenta;
this.italic.Name = "italic";
this.italic.Size = new System.Drawing.Size(23, 22);
this.italic.Text = "I";
this.italic.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
//
// underline
//
this.underline.CheckOnClick = true;
this.underline.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.underline.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline);
this.underline.Image = ((System.Drawing.Image)(resources.GetObject("underline.Image")));
this.underline.ImageTransparentColor = System.Drawing.Color.Magenta;
this.underline.Name = "underline";
this.underline.Size = new System.Drawing.Size(23, 22);
this.underline.Text = "U";
this.underline.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
//
// strikethrough
//
this.strikethrough.CheckOnClick = true;
this.strikethrough.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.strikethrough.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.strikethrough.Image = ((System.Drawing.Image)(resources.GetObject("strikethrough.Image")));
this.strikethrough.ImageTransparentColor = System.Drawing.Color.Magenta;
this.strikethrough.Name = "strikethrough";
this.strikethrough.Size = new System.Drawing.Size(23, 22);
this.strikethrough.Text = "S";
this.strikethrough.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// fonts
//
this.fonts.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.fonts.Name = "fonts";
this.fonts.Size = new System.Drawing.Size(121, 25);
this.fonts.SelectedIndexChanged += new System.EventHandler(this.fonts_SelectedIndexChanged);
//
// size
//
this.size.AutoSize = false;
this.size.MaxLength = 3;
this.size.Name = "size";
this.size.Size = new System.Drawing.Size(40, 25);
this.size.TextChanged += new System.EventHandler(this.size_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// left
//
this.left.CheckOnClick = true;
this.left.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.left.Image = ((System.Drawing.Image)(resources.GetObject("left.Image")));
this.left.ImageTransparentColor = System.Drawing.Color.Magenta;
this.left.Name = "left";
this.left.Size = new System.Drawing.Size(31, 22);
this.left.Text = "Left";
this.left.Click += new System.EventHandler(this.left_Click);
//
// center
//
this.center.CheckOnClick = true;
this.center.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.center.Image = ((System.Drawing.Image)(resources.GetObject("center.Image")));
this.center.ImageTransparentColor = System.Drawing.Color.Magenta;
this.center.Name = "center";
this.center.Size = new System.Drawing.Size(46, 22);
this.center.Text = "Center";
this.center.Click += new System.EventHandler(this.center_Click);
//
// right
//
this.right.CheckOnClick = true;
this.right.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.right.Image = ((System.Drawing.Image)(resources.GetObject("right.Image")));
this.right.ImageTransparentColor = System.Drawing.Color.Magenta;
this.right.Name = "right";
this.right.Size = new System.Drawing.Size(39, 22);
this.right.Text = "Right";
this.right.Click += new System.EventHandler(this.right_Click);
//
// TriWrite
//
this.Controls.Add(this.txtcontents);
this.Controls.Add(this.menuStrip3);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip2);
this.Name = "TriWrite";
this.Size = new System.Drawing.Size(527, 513);
this.Size = new System.Drawing.Size(652, 414);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.menuStrip2.ResumeLayout(false);
this.menuStrip2.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -182,11 +318,22 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label txtbody;
private System.Windows.Forms.Label lbtitle;
private System.Windows.Forms.TextBox txtcontents;
private System.Windows.Forms.MenuStrip menuStrip2;
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.MenuStrip menuStrip3;
private System.Windows.Forms.RichTextBox txtcontents;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton bold;
private System.Windows.Forms.ToolStripButton italic;
private System.Windows.Forms.ToolStripButton underline;
private System.Windows.Forms.ToolStripButton strikethrough;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripComboBox fonts;
private System.Windows.Forms.ToolStripTextBox size;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripButton left;
private System.Windows.Forms.ToolStripButton center;
private System.Windows.Forms.ToolStripButton right;
}
}

View file

@ -13,7 +13,7 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
[WinOpen("triwrite")]
[AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, null, "Office")]
[AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, "file_skimmer;textpad", "Office")]
[DefaultTitle("TriWrite")]
[Launcher("TriWrite", false, null, "Office")]
public partial class TriWrite : UserControl, IShiftOSWindow
@ -32,35 +32,54 @@ namespace ShiftOS.WinForms.Applications
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
var txt = new List<string>();
txt.Add(".txt");
txt.Add(".rtf");
AppearanceManager.SetupDialog(new FileDialog(txt.ToArray(), FileOpenerStyle.Open, new Action<string>((file) => this.LoadFile(file))));
FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Open, (path) => LoadFile(path));
}
public void LoadFile(string file)
{
txtcontents.Text = Utils.ReadAllText(file);
txtcontents.Rtf = Utils.ReadAllText(file);
}
public void SaveFile(string file)
{
Utils.WriteAllText(file, txtcontents.Text);
if (file.ToLower().EndsWith(".rtf"))
{
Utils.WriteAllText(file, txtcontents.Rtf);
}
else
{
Utils.WriteAllText(file, txtcontents.Text);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
var txt = new List<string>();
txt.Add(".rtf");
txt.Add(".txt");
AppearanceManager.SetupDialog(new FileDialog(txt.ToArray(), FileOpenerStyle.Save, new Action<string>((file) => this.SaveFile(file))));
FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Save, (path) => SaveFile(path));
}
public void OnLoad()
{
UpdateUI();
}
public void OnSkinLoad()
{
ResetFonts();
}
public void ResetFonts()
{
fonts.Items.Clear();
foreach(var font in FontFamily.Families)
{
fonts.Items.Add(font.Name);
}
UpdateUI();
}
public bool OnUnload()
@ -72,5 +91,92 @@ namespace ShiftOS.WinForms.Applications
{
}
public void UpdateUI()
{
bold.Checked = txtcontents.SelectionFont.Bold;
italic.Checked = txtcontents.SelectionFont.Italic;
underline.Checked = txtcontents.SelectionFont.Underline;
strikethrough.Checked = txtcontents.SelectionFont.Strikeout;
fonts.Text = txtcontents.SelectionFont.Name;
size.Text = txtcontents.SelectionFont.Size.ToString();
left.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Left;
center.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Center;
right.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Right;
}
private void txtcontents_SelectionChanged(object sender, EventArgs e)
{
UpdateUI();
}
public void SetFontStyle(bool bold, bool italic, bool underline, bool strikethrough)
{
FontStyle fs = FontStyle.Regular;
if (bold)
fs |= FontStyle.Bold;
if (italic)
fs |= FontStyle.Italic;
if (underline)
fs |= FontStyle.Underline;
if (strikethrough)
fs |= FontStyle.Strikeout;
txtcontents.SelectionFont = new Font(txtcontents.SelectionFont, fs);
UpdateUI();
}
private void bold_CheckedChanged(object sender, EventArgs e)
{
SetFontStyle(bold.Checked, italic.Checked, underline.Checked, strikethrough.Checked);
}
public void SetFontFamily(string family, float emSize)
{
var style = txtcontents.SelectionFont.Style;
var size = emSize;
txtcontents.SelectionFont = new Font(family, size, style);
UpdateUI();
}
private void fonts_SelectedIndexChanged(object sender, EventArgs e)
{
SetFontFamily(fonts.Text, Convert.ToSingle(size.Text));
}
private void left_Click(object sender, EventArgs e)
{
txtcontents.SelectionAlignment = HorizontalAlignment.Left;
UpdateUI();
}
private void center_Click(object sender, EventArgs e)
{
txtcontents.SelectionAlignment = HorizontalAlignment.Center;
UpdateUI();
}
private void right_Click(object sender, EventArgs e)
{
txtcontents.SelectionAlignment = HorizontalAlignment.Right;
UpdateUI();
}
private void size_Click(object sender, EventArgs e)
{
try
{
float s = Convert.ToSingle(size.Text);
if(s != txtcontents.SelectionFont.Size)
{
SetFontFamily(fonts.Text, s);
}
}
catch
{
UpdateUI();
}
}
}
}

View file

@ -130,7 +130,113 @@ To add a contact, simply click "Add Contact", and to remove one, click "Remove".
<metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="menuStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>247, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="bold.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="italic.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="underline.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="strikethrough.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="left.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="center.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="right.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
</root>

View file

@ -86,6 +86,7 @@ namespace ShiftOS.WinForms.Controls
public void WriteLine(string text)
{
Engine.AudioManager.PlayStream(Properties.Resources.writesound);
this.HideSelection = true;
this.Select(this.TextLength, 0);
this.SelectionFont = ConstructFont();
@ -119,6 +120,135 @@ namespace ShiftOS.WinForms.Controls
base.OnMouseUp(mevent);
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (!TerminalBackend.InStory)
{
switch (e.KeyCode) {
case Keys.Add:
case Keys.Alt:
case Keys.Apps:
case Keys.Attn:
case Keys.BrowserBack:
case Keys.BrowserFavorites:
case Keys.BrowserForward:
case Keys.BrowserHome:
case Keys.BrowserRefresh:
case Keys.BrowserSearch:
case Keys.BrowserStop:
case Keys.Cancel:
case Keys.Capital:
case Keys.Clear:
case Keys.Control:
case Keys.ControlKey:
case Keys.Crsel:
case Keys.Decimal:
case Keys.Divide:
case Keys.Down:
case Keys.End:
case Keys.Enter:
case Keys.EraseEof:
case Keys.Escape:
case Keys.Execute:
case Keys.Exsel:
case Keys.F1:
case Keys.F10:
case Keys.F11:
case Keys.F12:
case Keys.F13:
case Keys.F14:
case Keys.F15:
case Keys.F16:
case Keys.F17:
case Keys.F18:
case Keys.F19:
case Keys.F2:
case Keys.F20:
case Keys.F21:
case Keys.F22:
case Keys.F23:
case Keys.F24:
case Keys.F3:
case Keys.F4:
case Keys.F5:
case Keys.F6:
case Keys.F7:
case Keys.F8:
case Keys.F9:
case Keys.FinalMode:
case Keys.HanguelMode:
case Keys.HanjaMode:
case Keys.Help:
case Keys.Home:
case Keys.IMEAccept:
case Keys.IMEConvert:
case Keys.IMEModeChange:
case Keys.IMENonconvert:
case Keys.Insert:
case Keys.JunjaMode:
case Keys.KeyCode:
case Keys.LaunchApplication1:
case Keys.LaunchApplication2:
case Keys.LaunchMail:
case Keys.LButton:
case Keys.LControlKey:
case Keys.Left:
case Keys.LineFeed:
case Keys.LMenu:
case Keys.LShiftKey:
case Keys.LWin:
case Keys.MButton:
case Keys.MediaNextTrack:
case Keys.MediaPlayPause:
case Keys.MediaPreviousTrack:
case Keys.MediaStop:
case Keys.Menu:
case Keys.Modifiers:
case Keys.Multiply:
case Keys.Next:
case Keys.NoName:
case Keys.None:
case Keys.NumLock:
case Keys.Pa1:
case Keys.Packet:
case Keys.PageUp:
case Keys.Pause:
case Keys.Play:
case Keys.Print:
case Keys.PrintScreen:
case Keys.ProcessKey:
case Keys.RButton:
case Keys.RControlKey:
case Keys.Right:
case Keys.RMenu:
case Keys.RShiftKey:
case Keys.RWin:
case Keys.Scroll:
case Keys.Select:
case Keys.SelectMedia:
case Keys.Separator:
case Keys.Shift:
case Keys.ShiftKey:
case Keys.Sleep:
case Keys.Subtract:
case Keys.Tab:
case Keys.Up:
case Keys.VolumeDown:
case Keys.VolumeMute:
case Keys.VolumeUp:
case Keys.XButton1:
case Keys.XButton2:
case Keys.Zoom:
break;
default:
Engine.AudioManager.PlayStream(Properties.Resources.typesound);
break;
}
}
}
public TerminalBox() : base()
{
this.Tag = "keepbg keepfg keepfont";

View file

@ -24,13 +24,13 @@ namespace ShiftOS.WinForms.DesktopWidgets
if(ts != ServerManager.DigitalSocietyPing)
{
ts = ServerManager.DigitalSocietyPing;
lbheartbeat.Text = "Server ping: " + ts.ToString();
lbheartbeat.Text = "Server ping: " + ts.ToString() + " MS";
}
};
}
//Fun fact. I misspelled this as "TimeSpam."
TimeSpan ts;
long ts = 0;
public void OnSkinLoad()
{

View file

@ -276,6 +276,17 @@ namespace ShiftOS.Engine
return true;
}
[Command("restart")]
public static bool Restart()
{
SaveSystem.CurrentSave.Upgrades = new Dictionary<string, bool>();
SaveSystem.CurrentSave.Codepoints = 0;
SaveSystem.CurrentSave.StoriesExperienced.Clear();
SaveSystem.CurrentSave.StoriesExperienced.Add("mud_fundamentals");
SaveSystem.SaveGame();
Shiftorium.InvokeUpgradeInstalled();
return true;
}
[Command("freecp")]
public static bool FreeCodepoints(Dictionary<string, object> args)
@ -283,8 +294,8 @@ namespace ShiftOS.Engine
if (args.ContainsKey("amount"))
try
{
Int64 codepointsToAdd = Convert.ToInt64(args["amount"].ToString());
SaveSystem.TransferCodepointsFrom("dev", codepointsToAdd);
long codepointsToAdd = Convert.ToInt64(args["amount"].ToString());
SaveSystem.CurrentSave.Codepoints += codepointsToAdd;
return true;
}
catch (Exception ex)
@ -293,7 +304,7 @@ namespace ShiftOS.Engine
return true;
}
SaveSystem.TransferCodepointsFrom("dev", 1000);
SaveSystem.CurrentSave.Codepoints += 1000;
return true;
}

View file

@ -55,7 +55,7 @@ namespace ShiftOS.Engine
private static NetObjectClient client { get; set; }
private static bool UserDisconnect = false;
public static TimeSpan DigitalSocietyPing
public static long DigitalSocietyPing
{
get;
private set;
@ -148,7 +148,7 @@ namespace ShiftOS.Engine
{
if (PingTimer.IsRunning)
{
DigitalSocietyPing = PingTimer.Elapsed;
DigitalSocietyPing = PingTimer.ElapsedMilliseconds;
PingTimer.Reset();
}
var msg = a.Data.Object as ServerMessage;