Merge pull request #2 from MichaelTheShifter/shiftui_integration

Shifter UI rewrite, fix shiftnet and spkg paths.
This commit is contained in:
carverh 2016-07-22 10:01:24 -07:00 committed by GitHub
commit e25a0a7066
6 changed files with 1478 additions and 6416 deletions

View file

@ -6,6 +6,7 @@
using ShiftUI.Theming.Default; using ShiftUI.Theming.Default;
using System.Drawing; using System.Drawing;
using ShiftUI.ShiftOS; using ShiftUI.ShiftOS;
using System.Drawing.Drawing2D;
namespace ShiftUI.Theming namespace ShiftUI.Theming
{ {
@ -23,10 +24,202 @@ public override ButtonPainter ButtonPainter
return new Memphis.ButtonPainter(); return new Memphis.ButtonPainter();
} }
} }
public override CheckBoxPainter CheckBoxPainter
{
get
{
return new Memphis.CheckBoxPainter();
}
}
} }
namespace Memphis namespace Memphis
{ {
internal class CheckBoxPainter : Default.CheckBoxPainter
{
#region Standard
public override void DrawNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height;
int x_pos = Math.Max(0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2);
int y_pos = Math.Max(0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2);
Rectangle rect = new Rectangle(x_pos, y_pos, check_box_visible_size, check_box_visible_size);
g.FillRectangle(new SolidBrush(Application.CurrentSkin.CheckBoxBackgroundColor), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
Pen pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1);
g.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2);
g.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y);
pen = new Pen(Application.CurrentSkin.Border3DBottomRight, 1);
g.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3);
g.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1);
pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1);
g.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
g.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
// oh boy, matching ms is like fighting against windmills
using (Pen h_pen = new Pen(Application.CurrentSkin.CheckBoxCheckColor))
{
g.DrawLine(h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
g.DrawLine(h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2);
}
if (state == CheckState.Checked)
DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor);
else if (state == CheckState.Indeterminate)
DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor);
}
public override void DrawHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawNormalCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height;
int x_pos = Math.Max(0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2);
int y_pos = Math.Max(0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2);
Rectangle rect = new Rectangle(x_pos, y_pos, check_box_visible_size, check_box_visible_size);
g.FillRectangle(new SolidBrush(Application.CurrentSkin.CheckBoxCheckColor), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
Pen pen = new Pen(Application.CurrentSkin.Border3DBottomRightInner, 1);
g.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2);
g.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y);
pen = new Pen(Application.CurrentSkin.Border3DBottomRight, 1);
g.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3);
g.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1);
pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1);
g.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
g.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
// oh boy, matching ms is like fighting against windmills
using (Pen h_pen = new Pen(Application.CurrentSkin.CheckBoxCheckColor))
{
g.DrawLine(h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
g.DrawLine(h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2);
}
if (state == CheckState.Checked)
DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor);
else if (state == CheckState.Indeterminate)
DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor);
}
public override void DrawDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawPressedCheckBox(g, bounds, backColor, foreColor, CheckState.Unchecked);
if (state == CheckState.Checked || state == CheckState.Indeterminate)
DrawCheck(g, bounds, SystemColors.ControlDark);
}
#endregion
#region FlatStyle
public override void DrawFlatNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawNormalCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawFlatHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawFlatPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawPressedCheckBox(g, bounds, backColor, foreColor, state);
}
/* public override void DrawFlatDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
Rectangle checkbox_rectangle;
checkbox_rectangle = new Rectangle(bounds.X, bounds.Y, Math.Max(bounds.Width - 2, 0), Math.Max(bounds.Height - 2, 0));
WidgetPaint.DrawBorder(g, checkbox_rectangle, foreColor, ButtonBorderStyle.Solid);
bounds.Offset(-1, 0);
if (state == CheckState.Checked || state == CheckState.Indeterminate)
DrawCheck(g, bounds, SystemColors.ControlDarkDark);
}*/
#endregion
#region Popup
public override void DrawPopupNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawPopupHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawPopupPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
DrawFlatPressedCheckBox(g, bounds, backColor, foreColor, state);
}
public override void DrawPopupDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state)
{
}
#endregion
#region Check
public override void DrawCheck(Graphics g, Rectangle bounds, Color checkColor)
{
int check_size = (bounds.Height > bounds.Width) ? bounds.Width / 2 : bounds.Height / 2;
Pen check_pen = ResPool.GetPen(checkColor);
if (check_size < 7)
{
int lineWidth = Math.Max(3, check_size / 3);
int Scale = Math.Max(1, check_size / 9);
Rectangle rect = new Rectangle(bounds.X + (bounds.Width / 2) - (check_size / 2) - 1, bounds.Y + (bounds.Height / 2) - (check_size / 2) - 1,
check_size, check_size);
for (int i = 0; i < lineWidth; i++)
{
g.DrawLine(check_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i);
g.DrawLine(check_pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i);
}
}
else
{
int lineWidth = Math.Max(3, check_size / 3) + 1;
int x_half = bounds.Width / 2;
int y_half = bounds.Height / 2;
Rectangle rect = new Rectangle(bounds.X + x_half - (check_size / 2) - 1, bounds.Y + y_half - (check_size / 2),
check_size, check_size);
int gradient_left = check_size / 3;
int gradient_right = check_size - gradient_left - 1;
for (int i = 0; i < lineWidth; i++)
{
g.DrawLine(check_pen, rect.X, rect.Bottom - 1 - gradient_left - i, rect.X + gradient_left, rect.Bottom - 1 - i);
g.DrawLine(check_pen, rect.X + gradient_left, rect.Bottom - 1 - i, rect.Right - 1, rect.Bottom - i - 1 - gradient_right);
}
}
}
#endregion
}
internal class ButtonPainter : Default.ButtonPainter internal class ButtonPainter : Default.ButtonPainter
{ {

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,7 @@ public Shifter()
InitializeComponent(); InitializeComponent();
} }
/*
public Skinning.Skin CustomizingSkin = null; public Skinning.Skin CustomizingSkin = null;
public Skinning.Images CustomizingImages = null; public Skinning.Images CustomizingImages = null;
private bool EarnCP = false; private bool EarnCP = false;
@ -1442,7 +1443,7 @@ private void btnmenus_Click(object sender, EventArgs e)
HideAll(); HideAll();
pnlmenuoptions.Show(); pnlmenuoptions.Show();
pnlmenuoptions.BringToFront(); pnlmenuoptions.BringToFront();
SetPreviewSkin(true);*/ SetPreviewSkin(true);
} }
private void Button2_Click(object sender, EventArgs e) private void Button2_Click(object sender, EventArgs e)
@ -3088,6 +3089,6 @@ public void SetupLuaForm(Dictionary<string, object> d)
}; };
} }
} }*/
} }
} }

View file

@ -75,7 +75,7 @@ public static string VisitSite(string url)
{ {
try try
{ {
string content = wc.DownloadString(url.Replace("shiftnet://", "http://www.playshiftos.ml/shiftnet/www/")); string content = wc.DownloadString(url.Replace("shiftnet://", "http://releases.playshiftos.ml/shiftnet/www/"));
if (content.StartsWith("<!STML>")) if (content.StartsWith("<!STML>"))
{ {
LastUrl = url; LastUrl = url;

View file

@ -14,6 +14,8 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using ShiftUI; using ShiftUI;
using ShiftOS.FinalMission;
using ShiftOS;
namespace ShiftOS namespace ShiftOS
{ {
@ -1383,12 +1385,37 @@ public string GetParent(string path)
public void DoCommand() public void DoCommand()
{ {
API.LastRanCommand = command; //Grab the type of this class using Reflection.
string[] args = command.ToLower().Split(' '); var terminal = this.GetType();
switch (args[0]) string[] cmdargs = command.Split(' ');
var method_info = terminal.GetMethod("cmd_" + cmdargs[0].ToLower());
if(method_info != null)
{
method_info.Invoke(this, new object[] { cmdargs });
}
else
{
terminal.GetMethod("cmd_default").Invoke(this, new object[] { cmdargs });
}
}
#region Terminal command methods
/*
* Adding terminal commands has been changed.
*
* It's now done in a way that doesn't require hardcoding.
*
* Simply add a new method here with a prefix 'cmd_', for example 'cmd_05tray', and
* one argument of type 'string[]'. Then, put all the stuff you want your command to
* do in that method, and try running your command (without the 'cmd_' prefix) in the
* Terminal and it should work just fine.
*
* Thanks to @carverh for inspiring this by making all commands their own function.
*/
public void cmd_dir(String[] args)
{ {
case "ls":
case "dir":
if (API.Upgrades["fileskimmer"]) if (API.Upgrades["fileskimmer"])
{ {
foreach (var d in Directory.GetDirectories(current_dir)) foreach (var d in Directory.GetDirectories(current_dir))
@ -1404,8 +1431,12 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "cd":
public void cmd_cd(String[] args)
{
try
{
if (API.Upgrades["fileskimmer"]) if (API.Upgrades["fileskimmer"])
{ {
if (args[1] == "..") if (args[1] == "..")
@ -1432,8 +1463,16 @@ public void DoCommand()
SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> ");
} }
} }
break; }
case "upg": catch (Exception e)
{
WriteLine("cd: " + e);
}
}
public void cmd_upg(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -1454,8 +1493,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "endgame_test":
public void cmd_endgame_test(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -1483,11 +1524,15 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "htutorial":
public void cmd_htutorial(String[] args)
{
ShiftOS.Hacking.StartBattleTutorial(); ShiftOS.Hacking.StartBattleTutorial();
break; }
case "fake_buy":
public void cmd_fake_buy(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
try try
@ -1514,8 +1559,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "connections":
public void cmd_connections(String[] args)
{
try try
{ {
switch (args[1]) switch (args[1])
@ -1552,7 +1599,8 @@ public void DoCommand()
c.Connect(host, port); c.Connect(host, port);
WriteLine("Re-established connection with host."); WriteLine("Re-established connection with host.");
} }
else { else
{
WriteLine("This host has been connected to already."); WriteLine("This host has been connected to already.");
} }
} }
@ -1563,8 +1611,10 @@ public void DoCommand()
{ {
WriteLine("connections: Missing arguments."); WriteLine("connections: Missing arguments.");
} }
break; }
case "story":
public void cmd_story(String[] args)
{
if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) if (API.DeveloperMode == true && API.Upgrades["shiftnet"])
{ {
try try
@ -1594,8 +1644,10 @@ public void DoCommand()
} }
} }
else { wrongcommand(); } else { wrongcommand(); }
break; }
case "make":
public void cmd_make(String[] args)
{
try try
{ {
string path = command.Replace("make ", ""); string path = command.Replace("make ", "");
@ -1614,8 +1666,10 @@ public void DoCommand()
{ {
WriteLine("make: Invalid arguments."); WriteLine("make: Invalid arguments.");
} }
break; }
case "linux":
public void cmd_devupg(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
WriteLine("Upgrading your system..."); WriteLine("Upgrading your system...");
@ -1631,12 +1685,16 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "netgen":
public void cmd_netgen(String[] args)
{
WriteLine("Starting netgen..."); WriteLine("Starting netgen...");
API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal"));
break; }
case "lua":
public void cmd_lua(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
try try
@ -1678,8 +1736,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "hack":
public void cmd_hack(String[] args)
{
if (API.Upgrades["hacking"] == true) if (API.Upgrades["hacking"] == true)
{ {
StartHackingSession("random"); StartHackingSession("random");
@ -1688,9 +1748,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "virusscanner":
case "vscan": public void cmd_vscan(String[] args)
{
if (API.Upgrades["virusscanner"] == true) if (API.Upgrades["virusscanner"] == true)
{ {
WriteLine("Scanning for infected files..."); WriteLine("Scanning for infected files...");
@ -1705,7 +1766,8 @@ public void DoCommand()
{ {
goodList[file] += ", " + kv.Key; goodList[file] += ", " + kv.Key;
} }
else { else
{
goodList.Add(file, kv.Key); goodList.Add(file, kv.Key);
} }
} }
@ -1716,7 +1778,8 @@ public void DoCommand()
{ {
goodList[kv.Value] += ", " + kv.Key; goodList[kv.Value] += ", " + kv.Key;
} }
else { else
{
goodList.Add(kv.Value, kv.Key); goodList.Add(kv.Value, kv.Key);
} }
} }
@ -1736,8 +1799,10 @@ public void DoCommand()
WriteLine("No infections found. You are safe."); WriteLine("No infections found. You are safe.");
} }
} }
break; }
case "infections":
public void cmd_infections(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
foreach (KeyValuePair<string, string> kv in Viruses.Infections) foreach (KeyValuePair<string, string> kv in Viruses.Infections)
@ -1749,19 +1814,24 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "binarywater":
public void cmd_binarywater(String[] args)
{
if (API.DeveloperMode) if (API.DeveloperMode)
{ {
ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0));
WriteLine("Philip Adams is now in the list of hirable hackers."); WriteLine("Philip Adams is now in the list of hirable hackers.");
WriteLine("\" I Don't Think This is Canon \" -Carver");
} }
else else
{ {
WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg.");
} }
break; }
case "color":
public void cmd_color(String[] args)
{
try try
{ {
if (API.Upgrades["setterminalcolors"] == true) if (API.Upgrades["setterminalcolors"] == true)
@ -1778,8 +1848,10 @@ public void DoCommand()
{ {
WriteLine("color: Missing arguments."); WriteLine("color: Missing arguments.");
} }
break; }
case "encrypt":
public void cmd_encrypt(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
string messageToEncrypt = command.Replace("encrypt ", ""); string messageToEncrypt = command.Replace("encrypt ", "");
@ -1790,8 +1862,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "font":
public void cmd_font(String[] args)
{
if (API.Upgrades["setterminalfont"] == true) if (API.Upgrades["setterminalfont"] == true)
{ {
var fname = command.Replace("font ", ""); var fname = command.Replace("font ", "");
@ -1808,8 +1882,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "colorlist":
public void cmd_colorlist(String[] args)
{
if (API.Upgrades["setterminalcolors"] == true) if (API.Upgrades["setterminalcolors"] == true)
{ {
foreach (string itm in GetColorList()) foreach (string itm in GetColorList())
@ -1821,8 +1897,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "spkg":
public void cmd_spkg(String[] args)
{
if (!API.LimitedMode) if (!API.LimitedMode)
{ {
if (API.Upgrades["shiftnet"] == true) if (API.Upgrades["shiftnet"] == true)
@ -1897,9 +1975,7 @@ public void DoCommand()
WriteLine("Beginning installation."); WriteLine("Beginning installation.");
Thread.Sleep(1000); Thread.Sleep(1000);
WriteLine(@" == GOD MODE == WriteLine(@" == GOD MODE ==
God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want. God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want.
Installing core applications..."); Installing core applications...");
Thread.Sleep(250); Thread.Sleep(250);
WriteLine("Installing subpackage 'json_edit'..."); WriteLine("Installing subpackage 'json_edit'...");
@ -1909,7 +1985,6 @@ public void DoCommand()
WriteLine("Installing subpackage 'hijacker'..."); WriteLine("Installing subpackage 'hijacker'...");
Thread.Sleep(500); Thread.Sleep(500);
WriteLine(@" == HIJACKER by DevX == WriteLine(@" == HIJACKER by DevX ==
HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle."); HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle.");
Thread.Sleep(100); Thread.Sleep(100);
WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft..."); WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft...");
@ -1937,8 +2012,14 @@ public void DoCommand()
WriteLine("spkg: Missing arguments."); WriteLine("spkg: Missing arguments.");
} }
} }
break; }
case "alias":
/// <summary>
/// Command Functions, to Be Used For ShiftBatch
/// </summary>
/// <param name="args">String[] args</param>
public void cmd_alias(String[] args)
{
try try
{ {
switch (args[1]) switch (args[1])
@ -1994,8 +2075,10 @@ public void DoCommand()
{ {
WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command.");
} }
break; }
case "username":
public void cmd_username(String[] args)
{
if (API.Upgrades["customusername"] == true) if (API.Upgrades["customusername"] == true)
{ {
try try
@ -2011,8 +2094,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "osname":
public void cmd_osname(String[] args)
{
if (API.Upgrades["customusername"] == true) if (API.Upgrades["customusername"] == true)
{ {
try try
@ -2028,32 +2113,40 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "unity": public void cmd_unity(String[] args)
{
if (API.Upgrades["unitymode"] == true) if (API.Upgrades["unitymode"] == true)
{ {
API.CurrentSession.SetUnityMode(); API.CurrentSession.SetUnityMode();
API.CurrentSession.SetupDesktop(); API.CurrentSession.SetupDesktop();
txtterm.Focus(); txtterm.Focus();
} else }
else
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "time":
public void cmd_time(String[] args)
{
if (API.Upgrades["pmandam"] == false) if (API.Upgrades["pmandam"] == false)
{ {
if (API.Upgrades["hourssincemidnight"] == false) if (API.Upgrades["hourssincemidnight"] == false)
{ {
if (API.Upgrades["minutessincemidnight"] == false) if (API.Upgrades["minutessincemidnight"] == false)
{ {
if (API.Upgrades["secondssincemidnight"] == true) { if (API.Upgrades["secondssincemidnight"] == true)
{
WriteLine("Since midnight, " + API.GetTime() + " seconds have passed."); WriteLine("Since midnight, " + API.GetTime() + " seconds have passed.");
} else { }
else
{
wrongcommand(); wrongcommand();
} }
} else }
else
{ {
WriteLine("Since midnight, " + API.GetTime() + " minutes have passed."); WriteLine("Since midnight, " + API.GetTime() + " minutes have passed.");
} }
@ -2062,13 +2155,17 @@ public void DoCommand()
{ {
WriteLine("Since Midnight, " + API.GetTime() + " hours have passed."); WriteLine("Since Midnight, " + API.GetTime() + " hours have passed.");
} }
} else }
else
{ {
WriteLine("Current time: " + API.GetTime()); WriteLine("Current time: " + API.GetTime());
} }
break; }
case "saa":
if (API.Upgrades["shiftnet"]) { public void cmd_saa(String[] args)
{
if (API.Upgrades["shiftnet"])
{
var f = command.Replace("saa ", ""); var f = command.Replace("saa ", "");
if (f.StartsWith("/")) if (f.StartsWith("/"))
{ {
@ -2101,8 +2198,10 @@ public void DoCommand()
{ {
wrongcommand(); wrongcommand();
} }
break; }
case "help":
public void cmd_help(String[] args)
{
try try
{ {
showhelp(args[1]); showhelp(args[1]);
@ -2111,18 +2210,25 @@ public void DoCommand()
{ {
showhelp(); showhelp();
} }
break; }
case "codepoints":
case "cp": public void cmd_cp(String[] args)
{
WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); WriteLine("You have " + API.Codepoints.ToString() + " Codepoints.");
break; }
case "shutdown":
public void cmd_shutdown(String[] args)
{
API.ShutDownShiftOS(); API.ShutDownShiftOS();
break; }
case "clear":
public void cmd_clear(String[] args)
{
txtterm.Text = ""; txtterm.Text = "";
break; }
case "close":
public void cmd_close(String[] args)
{
if (command.Contains("close ")) if (command.Contains("close "))
{ {
var pid = command.Replace("close ", ""); var pid = command.Replace("close ", "");
@ -2139,19 +2245,23 @@ public void DoCommand()
{ {
WriteLine("Insufficient arguments."); WriteLine("Insufficient arguments.");
} }
break; }
case "05tray":
public void cmd_05tray(String[] args)
{
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
API.AddCodepoints(500); API.AddCodepoints(500);
WriteLine("You've been granted 500 Codepoints."); WriteLine("You've been granted 500 Codepoints.");
} else }
else
{ {
wrongcommand(); wrongcommand();
} }
}
break; public void cmd_debug(String[] args)
case "debug": {
if (API.DeveloperMode == true) if (API.DeveloperMode == true)
{ {
try try
@ -2176,7 +2286,9 @@ public void DoCommand()
{ {
WriteLine("debug: " + ex.Message); WriteLine("debug: " + ex.Message);
} }
} else { }
else
{
try try
{ {
switch (args[1].ToLower()) switch (args[1].ToLower())
@ -2186,16 +2298,19 @@ public void DoCommand()
API.DeveloperMode = true; API.DeveloperMode = true;
break; break;
default: default:
wrongcommand(); WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work"
break; break;
} }
} catch }
catch
{ {
wrongcommand(); //Debug command pretends to be an invalid command if an exception is thrown. WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work"
} }
} }
break; }
case "echo":
public void cmd_echo(String[] args)
{
if (command.Contains("echo ")) if (command.Contains("echo "))
{ {
WriteLine(command.Replace("echo ", "")); WriteLine(command.Replace("echo ", ""));
@ -2204,12 +2319,10 @@ public void DoCommand()
{ {
WriteLine("echo: Insufficient Parameters."); WriteLine("echo: Insufficient Parameters.");
} }
break; }
case "syncsave":
WriteLine("Command removed.");
break;
default: public void cmd_default(String[] args)
{
if (API.OpenProgram(args[0]) == false) if (API.OpenProgram(args[0]) == false)
{ {
if (API.Upgrades["trmfiles"] == false) if (API.Upgrades["trmfiles"] == false)
@ -2267,10 +2380,30 @@ public void DoCommand()
} }
} }
} }
break;
} }
/// <summary>
/// About Box, Created By Carver Harrison
/// </summary>
/// <param name="args">String[] args</param>
public void cmd_about(String[] args)
{
API.CreateInfoboxSession("About ShiftOS", "ShiftOS Version " + ProductVersion + "\n Copyright 2014-2016 ShiftOS Dev Team \n Type 'credits' in Terminal to Show Credits", infobox.InfoboxMode.Info);
} }
// HISTACOM REFERENCES, DO NOT REMOVE, CRUCIAL FOR SECRET STORY ARC
public void cmd_histacom_year(String[] args)
{
WriteLine("Year: 2002");
}
public void cmd_histacom_timedistorter(String[] args)
{
WriteLine("Install 'timedistorter' by going to shiftnet://12padams");
}
#endregion
private void StartChoice1EndStory() private void StartChoice1EndStory()
{ {
var t = new ShiftUI.Timer(); var t = new ShiftUI.Timer();

View file

@ -188,7 +188,7 @@ public static bool GetPackage(string pkgname)
Directory.CreateDirectory(downloadpath); Directory.CreateDirectory(downloadpath);
} }
WebClient wc = new WebClient(); WebClient wc = new WebClient();
wc.DownloadFile("http://playshiftos.ml/shiftnet/packages/" + pkgname + ".pkg", downloadpath + pkgname + ".pkg"); wc.DownloadFile("http://releases.playshiftos.ml/shiftnet/packages/" + pkgname + ".pkg", downloadpath + pkgname + ".pkg");
LastPackage_DownloadPath = downloadpath + pkgname + ".pkg"; LastPackage_DownloadPath = downloadpath + pkgname + ".pkg";
} }
catch catch