diff options
| author | william341 <[email protected]> | 2017-06-18 19:11:45 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-06-18 19:11:45 -0700 |
| commit | d3496237b055639fcac12e1b4ea85a1cd68bacb7 (patch) | |
| tree | 3d79e760cfa65fe4c7bc1cd8e0b5186a5ec23faa /ShiftOS_TheReturn | |
| parent | d497555bda7ca99925b96ae0f47ca1bf49a475b3 (diff) | |
| parent | 45c587b3a656135fec9c91566fa5f817ddfc600e (diff) | |
| download | shiftos_thereturn-d3496237b055639fcac12e1b4ea85a1cd68bacb7.tar.gz shiftos_thereturn-d3496237b055639fcac12e1b4ea85a1cd68bacb7.tar.bz2 shiftos_thereturn-d3496237b055639fcac12e1b4ea85a1cd68bacb7.zip | |
Merge pull request #3 from shiftos-game/master
yes
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/AppLauncherDaemon.cs | 7 | ||||
| -rw-r--r-- | ShiftOS_TheReturn/CommandParser.cs | 78 | ||||
| -rw-r--r-- | ShiftOS_TheReturn/Desktop.cs | 2 | ||||
| -rw-r--r-- | ShiftOS_TheReturn/TerminalBackend.cs | 16 |
4 files changed, 24 insertions, 79 deletions
diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs index c259556..2d21a8c 100644 --- a/ShiftOS_TheReturn/AppLauncherDaemon.cs +++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs @@ -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); + } } } diff --git a/ShiftOS_TheReturn/CommandParser.cs b/ShiftOS_TheReturn/CommandParser.cs index da1073f..2f0d249 100644 --- a/ShiftOS_TheReturn/CommandParser.cs +++ b/ShiftOS_TheReturn/CommandParser.cs @@ -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; - } } } diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index a5e7f43..fac5e6b 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -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. diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index d60b675..c8c6ba9 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -448,19 +448,6 @@ namespace ShiftOS.Engine } /// <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> /// <param name="text">The command text.</param> @@ -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)) |
