aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/Artpad.cs12
-rw-r--r--ShiftOS.WinForms/Applications/Installer.cs10
-rw-r--r--ShiftOS.WinForms/Applications/NameChanger.cs11
-rw-r--r--ShiftOS.WinForms/Applications/Skin Loader.cs10
-rw-r--r--ShiftOS.WinForms/Applications/Terminal.cs41
-rw-r--r--ShiftOS.WinForms/Applications/TextPad.cs9
-rw-r--r--ShiftOS.WinForms/Applications/TriWrite.cs9
7 files changed, 94 insertions, 8 deletions
diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs
index e4d16bd..b584ac8 100644
--- a/ShiftOS.WinForms/Applications/Artpad.cs
+++ b/ShiftOS.WinForms/Applications/Artpad.cs
@@ -42,13 +42,17 @@ using System.Diagnostics;
namespace ShiftOS.WinForms.Applications
{
+ [FileHandler("Artpad Picture", ".pic", "fileiconpicture")]
+ [FileHandler("JPEG Picture", ".jpg", "fileiconpicture")]
+ [FileHandler("PNG Picture", ".png", "fileiconpicture")]
+ [FileHandler("Bitmap Picture", ".bmp", "fileiconpicture")]
[MultiplayerOnly]
[Launcher("{TIITLE_ARTPAD}", true, "al_artpad", "{AL_GRAPHICS}")]
[RequiresUpgrade("artpad")]
[WinOpen("{WO_ARTPAD}")]
[DefaultIcon("iconArtpad")]
[DefaultTitle("{TITLE_ARTPAD}")]
- public partial class Artpad : UserControl, IShiftOSWindow
+ public partial class Artpad : UserControl, IShiftOSWindow, IFileHandler
{
/// <summary>
/// artpad_'s GUI.
@@ -1589,6 +1593,12 @@ namespace ShiftOS.WinForms.Applications
setmagnification();
}
+
+ public void OpenFile(string file)
+ {
+ AppearanceManager.SetupWindow(this);
+ LoadPicture(file);
+ }
}
public class undo
diff --git a/ShiftOS.WinForms/Applications/Installer.cs b/ShiftOS.WinForms/Applications/Installer.cs
index 284ac2c..ec93735 100644
--- a/ShiftOS.WinForms/Applications/Installer.cs
+++ b/ShiftOS.WinForms/Applications/Installer.cs
@@ -19,7 +19,8 @@ namespace ShiftOS.WinForms.Applications
[MultiplayerOnly]
[DefaultTitle("{TITLE_INSTALLER}")]
[Launcher("{TITLE_INSTALLER}", true, "al_installer", "{AL_UTILITIES}")]
- public partial class Installer : UserControl, IShiftOSWindow
+ [FileHandler("Name Pack", ".names", "fileiconnames")]
+ public partial class Installer : UserControl, IShiftOSWindow, IFileHandler
{
public Installer()
{
@@ -27,6 +28,13 @@ namespace ShiftOS.WinForms.Applications
lbtitle.Text = "Select file";
}
+ public void OpenFile(string path)
+ {
+ var stpInstall = new StpInstallation(path);
+ AppearanceManager.SetupWindow(this);
+ InitiateInstall(stpInstall);
+ }
+
public void InitiateInstall(Installation install)
{
pnlselectfile.Hide();
diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs
index 4695c8a..67c64fd 100644
--- a/ShiftOS.WinForms/Applications/NameChanger.cs
+++ b/ShiftOS.WinForms/Applications/NameChanger.cs
@@ -37,20 +37,27 @@ using ShiftOS.Objects.ShiftFS;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications {
-
+ [FileHandler("Name Pack", ".nme", "fileiconnames")]
[MultiplayerOnly]
[Launcher("{TITLE_NAMECHANGER}", false, null, "{AL_CUSTOMIZATION}")]
[AppscapeEntry("name_changer", "{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
+ public partial class NameChanger : UserControl, IShiftOSWindow, IFileHandler
{
public NameChanger()
{
InitializeComponent();
}
+ public void OpenFile(string file)
+ {
+ AppearanceManager.SetupWindow(this);
+ names = JsonConvert.DeserializeObject<Dictionary<string, string>>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file));
+ SetupUI();
+ }
+
private Dictionary<string, string> names = new Dictionary<string, string>();
public void OnLoad()
diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs
index b70d3ea..de30360 100644
--- a/ShiftOS.WinForms/Applications/Skin Loader.cs
+++ b/ShiftOS.WinForms/Applications/Skin Loader.cs
@@ -37,12 +37,13 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
+ [FileHandler("ShiftOS Skin", ".skn", "fileiconskin")]
[Launcher("{TITLE_SKINLOADER}", true, "al_skin_loader", "{AL_CUSTOMIZATION}")]
[RequiresUpgrade("skinning")]
[WinOpen("skin_loader")]
[DefaultTitle("{TITLE_SKINLOADER}")]
[DefaultIcon("iconSkinLoader")]
- public partial class Skin_Loader : UserControl, IShiftOSWindow
+ public partial class Skin_Loader : UserControl, IShiftOSWindow, IFileHandler
{
public Skin_Loader()
{
@@ -54,6 +55,13 @@ namespace ShiftOS.WinForms.Applications
}
+ public void OpenFile(string file)
+ {
+ AppearanceManager.SetupWindow(this);
+ LoadedSkin = JsonConvert.DeserializeObject<Skin>(Objects.ShiftFS.Utils.ReadAllText(file));
+ SetupUI();
+ }
+
public void SetupControls(Control ctrl)
{
ctrl.Tag = "keepbg keepfg keepfont";
diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs
index 51ad42b..794edf7 100644
--- a/ShiftOS.WinForms/Applications/Terminal.cs
+++ b/ShiftOS.WinForms/Applications/Terminal.cs
@@ -47,12 +47,51 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
+ [FileHandler("Shell script", ".trm", "fileicontrm")]
[Launcher("{TITLE_TERMINAL}", false, null, "{AL_UTILITIES}")]
[WinOpen("{WO_TERMINAL}")]
[DefaultTitle("{TITLE_TERMINAL}")]
[DefaultIcon("iconTerminal")]
- public partial class Terminal : UserControl, IShiftOSWindow
+ public partial class Terminal : UserControl, IShiftOSWindow, IFileHandler
{
+ public void OpenFile(string file)
+ {
+ int lastline = 0;
+ string lastlinetext = "";
+
+ try
+ {
+ var lines = new List<string>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(file).Split(new[] { Environment.NewLine.ToString() }, StringSplitOptions.RemoveEmptyEntries));
+ AppearanceManager.SetupWindow(this);
+ var parser = CommandParser.GenerateSample();
+ foreach (var line in lines)
+ {
+ lastline = lines.IndexOf(line) + 1;
+ lastlinetext = line;
+ var command = parser.ParseCommand(line);
+ TerminalBackend.InvokeCommand(command.Key, command.Value);
+ }
+ }
+ catch(Exception ex)
+ {
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ ConsoleEx.Bold = true;
+ Console.WriteLine("Script exception");
+ ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
+ ConsoleEx.Bold = false;
+ ConsoleEx.Italic = true;
+#if DEBUG
+ Console.WriteLine(ex.Message);
+#endif
+ Console.WriteLine(ex.StackTrace);
+ if(lastline > 0)
+ {
+ Console.WriteLine(" at " + lastlinetext + " (line " + lastline + ") in " + file);
+ }
+ }
+ TerminalBackend.PrintPrompt();
+ }
+
public static Stack<string> ConsoleStack = new Stack<string>();
public static System.Windows.Forms.Timer ti = new System.Windows.Forms.Timer();
diff --git a/ShiftOS.WinForms/Applications/TextPad.cs b/ShiftOS.WinForms/Applications/TextPad.cs
index 403b4ef..0411e83 100644
--- a/ShiftOS.WinForms/Applications/TextPad.cs
+++ b/ShiftOS.WinForms/Applications/TextPad.cs
@@ -36,18 +36,25 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
+ [FileHandler("Text File", ".txt", "fileicontext")]
[Launcher("{TITLE_TEXTPAD}", true, "al_textpad", "{AL_ACCESSORIES}")]
[RequiresUpgrade("textpad")]
[WinOpen("{WO_TEXTPAD}")]
[DefaultTitle("{TITLE_TEXTPAD}")]
[DefaultIcon("iconTextPad")]
- public partial class TextPad : UserControl, IShiftOSWindow
+ public partial class TextPad : UserControl, IShiftOSWindow, IFileHandler
{
public TextPad()
{
InitializeComponent();
}
+ public void OpenFile(string file)
+ {
+ AppearanceManager.SetupWindow(this);
+ LoadFile(file);
+ }
+
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
txtcontents.Text = "";
diff --git a/ShiftOS.WinForms/Applications/TriWrite.cs b/ShiftOS.WinForms/Applications/TriWrite.cs
index f565328..293d30c 100644
--- a/ShiftOS.WinForms/Applications/TriWrite.cs
+++ b/ShiftOS.WinForms/Applications/TriWrite.cs
@@ -12,11 +12,12 @@ using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
{
+ [FileHandler("TriWrite Document", ".rtf", "fileicontext")]
[WinOpen("triwrite")]
[AppscapeEntry("triwrite", "TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, "file_skimmer;textpad", "Office")]
[DefaultTitle("TriWrite")]
[Launcher("TriWrite", false, null, "Office")]
- public partial class TriWrite : UserControl, IShiftOSWindow
+ public partial class TriWrite : UserControl, IShiftOSWindow, IFileHandler
{
public TriWrite()
@@ -24,6 +25,12 @@ namespace ShiftOS.WinForms.Applications
InitializeComponent(); //From the library of babel: "FIRST COMMIT FROM A MAC WOOOO TURIANS ARE COOL"
}
+ public void OpenFile(string file)
+ {
+ AppearanceManager.SetupWindow(this);
+ LoadFile(file);
+ }
+
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
txtcontents.Text = "";