aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-17 14:45:42 -0400
committerMichael <[email protected]>2017-06-17 14:45:42 -0400
commite3f9a6028b3774f7376617502e7f6016dc50dd0e (patch)
tree195ad433cbb4519b433cf24156b761419f226fe5 /ShiftOS_TheReturn
parent0365b33993812361936e81104f793f58794fde8f (diff)
downloadshiftos_thereturn-e3f9a6028b3774f7376617502e7f6016dc50dd0e.tar.gz
shiftos_thereturn-e3f9a6028b3774f7376617502e7f6016dc50dd0e.tar.bz2
shiftos_thereturn-e3f9a6028b3774f7376617502e7f6016dc50dd0e.zip
Localize a LOT of the UI
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Commands.cs263
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs120
-rw-r--r--ShiftOS_TheReturn/UserManagementCommands.cs54
3 files changed, 155 insertions, 282 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index c2e414d..3a2b79a 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -38,118 +38,26 @@ using Newtonsoft.Json;
using System.IO.Compression;
using ShiftOS.Objects;
-using Discoursistency.Base.Models.Authentication;
using ShiftOS.Engine.Scripting;
using ShiftOS.Objects.ShiftFS;
namespace ShiftOS.Engine
{
- [RequiresUpgrade("desktop;wm_free_placement")]
- public static class InfoboxDebugCommands
- {
-
- [RequiresArgument("title")]
- [RequiresArgument("msg")]
- [Command("show")]
- public static bool ShowInfo(Dictionary<string, object> args)
- {
- Desktop.InvokeOnWorkerThread(new Action(() =>
- {
- Infobox.Show(args["title"].ToString(), args["msg"].ToString());
- }));
- return true;
- }
-
- [RequiresArgument("title")]
- [RequiresArgument("msg")]
- [Command("yesno")]
- public static bool ShowYesNo(Dictionary<string, object> args)
- {
- bool forwarding = TerminalBackend.IsForwardingConsoleWrites;
- var fGuid = TerminalBackend.ForwardGUID;
- Action<bool> callback = (result) =>
- {
- TerminalBackend.IsForwardingConsoleWrites = forwarding;
- TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null;
- string resultFriendly = (result == true) ? "yes" : "no";
- Console.WriteLine($"{SaveSystem.CurrentUser.Username} says {resultFriendly}.");
- TerminalBackend.IsForwardingConsoleWrites = false;
- };
- Desktop.InvokeOnWorkerThread(new Action(() =>
- {
- Infobox.PromptYesNo(args["title"].ToString(), args["msg"].ToString(), callback);
-
- }));
- return true;
- }
-
- [RequiresArgument("title")]
- [RequiresArgument("msg")]
- [Command("text")]
- public static bool ShowText(Dictionary<string, object> args)
- {
- bool forwarding = TerminalBackend.IsForwardingConsoleWrites;
- var fGuid = TerminalBackend.ForwardGUID;
- Action<string> callback = (result) =>
- {
- TerminalBackend.IsForwardingConsoleWrites = forwarding;
- TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null;
- Console.WriteLine($"{SaveSystem.CurrentUser.Username} says \"{result}\".");
- TerminalBackend.IsForwardingConsoleWrites = false;
- };
- Desktop.InvokeOnWorkerThread(new Action(() =>
- {
- Infobox.PromptText(args["title"].ToString(), args["msg"].ToString(), callback);
- }));
- return true;
- }
-
- }
-
- public static class AudioCommands
- {
- [Command("setvol", description = "Set the volume of the system audio to anywhere between 0 and 100.")]
- [RequiresArgument("value")]
- [RequiresUpgrade("audio_volume")]
- public static bool SetVolume(Dictionary<string,object> args)
- {
- int val = Convert.ToInt32(args["value"].ToString());
- float volume = (val / 100F);
- AudioManager.SetVolume(volume);
- return true;
- }
- [RequiresUpgrade("audio_volume")]
- [Command("mute", description = "Sets the volume of the system audio to 0")]
- public static bool MuteAudio()
- {
- AudioManager.SetVolume(0);
- return true;
- }
- }
-
[TutorialLock]
public static class TerminalCommands
{
- [Command("clear")]
+ [Command("clear", description = "{DESC_CLEAR}")]
public static bool Clear()
{
AppearanceManager.ConsoleOut.Clear();
return true;
}
-
- [Command("echo")]
- [RequiresArgument("text")]
- public static bool Echo(Dictionary<string, object> args)
- {
- Console.WriteLine(args["text"]);
- return true;
- }
}
public static class ShiftOSCommands
{
- [Command("setsfxenabled", description = "Set whether or not sound effects are enabled in the system.")]
+ [Command("setsfxenabled", description = "{DESC_SETSFXENABLED}")]
[RequiresArgument("value")]
public static bool SetSfxEnabled(Dictionary<string, object> args)
{
@@ -161,14 +69,14 @@ namespace ShiftOS.Engine
}
catch
{
- Console.WriteLine("Error: Value must be either true or false.");
+ Console.WriteLine("{ERR_BADBOOL}");
}
return true;
}
- [Command("setmusicenabled", description = "Set whether or not music is enabled in the system.")]
+ [Command("setmusicenabled", description = "{DESC_SETMUSICENABLED}")]
[RequiresArgument("value")]
public static bool SetMusicEnabled(Dictionary<string, object> args)
{
@@ -180,14 +88,14 @@ namespace ShiftOS.Engine
}
catch
{
- Console.WriteLine("Error: Value must be either true or false.");
+ Console.WriteLine("{ERR_BADBOOL}");
}
return true;
}
- [Command("setsfxvolume", description ="Set the system sound volume to a value between 1 and 100.")]
+ [Command("setvolume", description ="{DESC_SETVOLUME}")]
[RequiresArgument("value")]
public static bool SetSfxVolume(Dictionary<string, object> args)
{
@@ -199,13 +107,13 @@ namespace ShiftOS.Engine
}
else
{
- Console.WriteLine("Volume must be between 0 and 100!");
+ Console.WriteLine("{ERR_BADPERCENT}");
}
return true;
}
[RemoteLock]
- [Command("shutdown")]
+ [Command("shutdown", description = "{DESC_SHUTDOWN}")]
public static bool Shutdown()
{
TerminalBackend.InvokeCommand("sos.save");
@@ -213,7 +121,7 @@ namespace ShiftOS.Engine
return true;
}
- [Command("lang", "{COMMAND_SOS_LANG_USAGE}", "{COMMAND_SOS_LANG_DESCRIPTION}")]
+ [Command("lang", description = "{DESC_LANG}")]
[RequiresArgument("language")]
public static bool SetLanguage(Dictionary<string, object> userArgs)
{
@@ -221,20 +129,17 @@ namespace ShiftOS.Engine
{
string lang = "";
- if (userArgs.ContainsKey("language"))
- lang = (string)userArgs["language"];
- else
- throw new Exception("You must specify a valid 'language' value.");
-
+ lang = (string)userArgs["language"];
+
if (Localization.GetAllLanguages().Contains(lang))
{
SaveSystem.CurrentSave.Language = lang;
SaveSystem.SaveGame();
- Console.WriteLine("{LANGUAGE_CHANGED}");
+ Console.WriteLine("{RES_LANGUAGE_CHANGED}");
return true;
}
- throw new Exception($"Couldn't find language with ID: {lang}");
+ throw new Exception("{ERR_NOLANG}");
}
catch
{
@@ -242,11 +147,11 @@ namespace ShiftOS.Engine
}
}
- [Command("commands", "", "{COMMAND_COMMANDS_DESCRIPTION}")]
+ [Command("commands", "", "{DESC_COMMANDS}")]
public static bool Commands()
{
var sb = new StringBuilder();
- sb.AppendLine("Commands");
+ sb.AppendLine("{GEN_COMMANDS}");
sb.AppendLine("=================");
sb.AppendLine();
//print all unique namespaces.
@@ -254,7 +159,7 @@ namespace ShiftOS.Engine
{
sb.Append(n.CommandInfo.name);
if (!string.IsNullOrWhiteSpace(n.CommandInfo.description))
- if (Shiftorium.UpgradeInstalled("help_descriptions"))
+ if (Shiftorium.UpgradeInstalled("help_description"))
sb.Append(" - " + n.CommandInfo.description);
sb.AppendLine();
}
@@ -264,7 +169,7 @@ namespace ShiftOS.Engine
return true;
}
- [Command("help", description = "Type this command to list all the things you can do in ShiftOS.")]
+ [Command("help", description = "{DESC_HELP}")]
public static bool Help()
{
Commands();
@@ -274,7 +179,7 @@ namespace ShiftOS.Engine
[MultiplayerOnly]
- [Command("save")]
+ [Command("save", description = "{DESC_SAVE}")]
public static bool Save()
{
SaveSystem.SaveGame();
@@ -282,19 +187,23 @@ namespace ShiftOS.Engine
}
[MultiplayerOnly]
- [Command("status")]
+ [Command("status", description = "{DESC_STATUS}")]
public static bool Status()
{
- string status = $@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()}
+ string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
-Codepoints: {SaveSystem.CurrentSave.Codepoints}
-Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
- {Shiftorium.GetAvailable().Length} available
+ string cp = SaveSystem.CurrentSave.Codepoints.ToString();
+ string installed = SaveSystem.CurrentSave.CountUpgrades().ToString();
+ string available = Shiftorium.GetAvailable().Length.ToString();
-";
-
- Console.WriteLine(status);
- Console.WriteLine("Objectives:");
+ Console.WriteLine(Localization.Parse("{COM_STATUS}", new Dictionary<string, string>
+ {
+ ["%cp"] = cp,
+ ["%version"] = version,
+ ["%installed"] = installed,
+ ["%available"] = available
+ }));
+ Console.WriteLine("{GEN_OBJECTIVES}");
try
{
if (Story.CurrentObjectives.Count > 0)
@@ -309,12 +218,12 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
}
else
{
- Console.WriteLine(" - No objectives are running. Check back later!");
+ Console.WriteLine("{RES_NOOBJECTIVES}");
}
}
catch
{
- Console.WriteLine(" - No objectives are running. Check back later!");
+ Console.WriteLine("{RES_NOOBJECTIVES}");
}
return true;
}
@@ -323,7 +232,7 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
[MultiplayerOnly]
public static class ShiftoriumCommands
{
- [Command("buy")]
+ [Command("buy", description = "{DESC_BUY}")]
[RequiresArgument("upgrade")]
public static bool BuyUpgrade(Dictionary<string, object> userArgs)
{
@@ -331,30 +240,31 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
{
string upgrade = "";
- if (userArgs.ContainsKey("upgrade"))
- upgrade = (string)userArgs["upgrade"];
- else
- throw new Exception("You must specify a valid 'upgrade' value.");
+ upgrade = (string)userArgs["upgrade"];
- foreach (var upg in Shiftorium.GetAvailable())
+ var upg = Shiftorium.GetAvailable().FirstOrDefault(x => x.ID == upgrade);
+ if(upg != null)
{
- if (upg.ID == upgrade)
- {
- Shiftorium.Buy(upgrade, upg.Cost);
- return true;
- }
+ if (Shiftorium.Buy(upg.ID, upg.Cost) == true)
+ Console.WriteLine("{RES_UPGRADEINSTALLED}");
+ else
+ Console.WriteLine("{ERR_NOTENOUGHCODEPOINTS}");
+ }
+ else
+ {
+ Console.WriteLine("{ERR_NOUPGRADE}");
}
- throw new Exception($"Couldn't find upgrade with ID: {upgrade}");
}
catch
{
- return false;
+ Console.WriteLine("{ERR_GENERAL}");
}
+ return true;
}
[RequiresUpgrade("shiftorium_bulk_buy")]
- [Command("bulkbuy")]
+ [Command("bulkbuy", description = "{DESC_BULKBUY}")]
[RequiresArgument("upgrades")]
public static bool BuyBulk(Dictionary<string, object> args)
{
@@ -368,15 +278,11 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
BuyUpgrade(dict);
}
}
- else
- {
- throw new Exception("Please specify a list of upgrades in the 'upgrades' argument. Each upgrade is separated by a comma.");
- }
return true;
}
- [Command("upgradeinfo", description ="Shows information about a specific upgrade.")]
+ [Command("upgradeinfo", description ="{DESC_UPGRADEINFO}")]
[RequiresArgument("upgrade")]
public static bool ViewInfo(Dictionary<string, object> userArgs)
{
@@ -384,29 +290,26 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
{
string upgrade = "";
- if (userArgs.ContainsKey("upgrade"))
- upgrade = (string)userArgs["upgrade"];
- else
- throw new Exception("You must specify a valid 'upgrade' value.");
+ upgrade = (string)userArgs["upgrade"];
foreach (var upg in Shiftorium.GetDefaults())
{
if (upg.ID == upgrade)
{
- Console.WriteLine($@"Information for {upgrade}:
-
-{upg.Category}: {upg.Name} - {upg.Cost} Codepoints
-------------------------------------------------------
+ Console.WriteLine(Localization.Parse("{COM_UPGRADEINFO}", new Dictionary<string, string>
+ {
+ ["%id"] = upg.ID,
+ ["%category"] = upg.Category,
+ ["%name"] = upg.Name,
+ ["%cost"] = upg.Cost.ToString(),
+ ["%description"] = upg.Description
+ }));
-{upg.Description}
-
-To buy this upgrade, run:
-shiftorium.buy{{upgrade:""{upg.ID}""}}");
return true;
}
}
- throw new Exception($"Couldn't find upgrade with ID: {upgrade}");
+ throw new Exception("{ERR_NOUPGRADE}");
}
catch
{
@@ -414,17 +317,21 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
}
}
- [Command("upgradecategories", description = "Shows all available Shiftorium upgrade categories, and how many upgrades are available in them.")]
+ [Command("upgradecategories", description = "{DESC_UPGRADECATEGORIES}")]
public static bool ListCategories()
{
foreach(var cat in Shiftorium.GetCategories())
{
- Console.WriteLine($"{cat} - {Shiftorium.GetAvailable().Where(x=>x.Category==cat).Count()} upgrades");
+ Console.WriteLine(Localization.Parse("{SHFM_CATEGORY}", new Dictionary<string, string>
+ {
+ ["%name"] = cat,
+ ["%available"] = Shiftorium.GetAvailable().Where(x=>x.Category==cat).Count().ToString()
+ }));
}
return true;
}
- [Command("upgrades", description ="Lists all available Shiftorium upgrades.")]
+ [Command("upgrades", description ="{DESC_UPGRADES}")]
public static bool ListAll(Dictionary<string, object> args)
{
try
@@ -449,11 +356,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
{
ConsoleEx.Bold = true;
ConsoleEx.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Shiftorium Query Error");
+ Console.WriteLine("{SHFM_QUERYERROR}");
Console.WriteLine();
ConsoleEx.Bold = false;
ConsoleEx.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine("Either there are no upgrades in the category \"" + cat + "\" or the category was not found.");
+ Console.WriteLine("{ERR_EMPTYCATEGORY}");
return true;
}
upglist = Shiftorium.GetAvailable().Where(x => x.Category == cat);
@@ -464,11 +371,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
{
ConsoleEx.Bold = true;
ConsoleEx.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("No upgrades available!");
+ Console.WriteLine("{SHFM_NOUPGRADES}");
Console.WriteLine();
ConsoleEx.Bold = false;
ConsoleEx.ForegroundColor = ConsoleColor.Gray;
- Console.WriteLine("You have installed all available upgrades for your system. Please check back later for more.");
+ Console.WriteLine("{ERR_NOMOREUPGRADES}");
return true;
}
@@ -482,11 +389,13 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
upgrades.Add(upg.ID, upg.Cost);
}
- Console.WriteLine("ID".PadRight((maxLength + 5) - 2) + "Cost (Codepoints)");
-
foreach (var upg in upgrades)
{
- Console.WriteLine(upg.Key.PadRight((maxLength + 5) - upg.Key.Length) + " " + upg.Value.ToString());
+ Console.WriteLine(Localization.Parse("{SHFM_UPGRADE}", new Dictionary<string, string>
+ {
+ ["%id"] = upg.Key,
+ ["%cost"] = upg.Value.ToString()
+ }));
}
return true;
}
@@ -500,14 +409,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
public static class WindowCommands
{
-
-
-
[RemoteLock]
- [Command("processes", description = "Shows all running applications.")]
+ [Command("processes", description = "{DESC_PROCESSES}")]
public static bool List()
{
- Console.WriteLine("Window ID\tName");
+ Console.WriteLine("{GEN_CURRENTPROCESSES}");
foreach (var app in AppearanceManager.OpenForms)
{
//Windows are displayed the order in which they were opened.
@@ -516,17 +422,17 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
return true;
}
- [Command("programs", description = "Lists all the programs installed in ShiftOS.")]
+ [Command("programs", description = "{DESC_PROGRAMS}")]
public static bool Programs()
{
- Console.WriteLine("Programs:");
+ Console.WriteLine("{GEN_PROGRAMS}");
Console.WriteLine("===============");
Console.WriteLine();
foreach(var cmd in TerminalBackend.Commands.Where(x=>x is TerminalBackend.WinOpenCommand && Shiftorium.UpgradeInstalled(x.Dependencies)).OrderBy(x => x.CommandInfo.name))
{
Console.Write(" - " + cmd.CommandInfo.name);
if (!string.IsNullOrWhiteSpace(cmd.CommandInfo.description))
- if (Shiftorium.UpgradeInstalled("help_descriptions"))
+ if (Shiftorium.UpgradeInstalled("help_description"))
Console.Write(": " + cmd.CommandInfo.description);
Console.WriteLine();
}
@@ -534,7 +440,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
}
[RemoteLock]
- [Command("close", usage = "{win:integer32}", description ="Closes the specified window.")]
+ [Command("close", usage = "{win:integer32}", description ="{DESC_CLOSE}")]
[RequiresArgument("win")]
[RequiresUpgrade("close_command")]
public static bool CloseWindow(Dictionary<string, object> args)
@@ -545,11 +451,14 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
string err = null;
if (winNum < 0 || winNum >= AppearanceManager.OpenForms.Count)
- err = "The window number must be between 0 and " + (AppearanceManager.OpenForms.Count - 1).ToString() + ".";
+ err = Localization.Parse("{ERR_BADWINID}", new Dictionary<string, string>
+ {
+ ["%max"] = (AppearanceManager.OpenForms.Count - 1).ToString()
+ });
if (string.IsNullOrEmpty(err))
{
- Console.WriteLine($"Closing {AppearanceManager.OpenForms[winNum].Text}...");
+ Console.WriteLine("{RES_WINDOWCLOSED}");
AppearanceManager.Close(AppearanceManager.OpenForms[winNum].ParentWindow);
}
else
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 97cc26e..306a49b 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -126,9 +126,9 @@ namespace ShiftOS.Engine
}
Thread.Sleep(350);
- Console.WriteLine("ShiftKernel v0.4.2");
+ Console.WriteLine("{MISC_KERNELVERSION}");
Thread.Sleep(50);
- Console.WriteLine("(MIT) DevX 2017, Very Little Rights Reserved");
+ Console.WriteLine("Copyright (c) 2018 DevX. Licensed under MIT.");
Console.WriteLine("");
Console.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR");
Console.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
@@ -139,39 +139,20 @@ namespace ShiftOS.Engine
Console.WriteLine("SOFTWARE.");
Console.WriteLine("");
Thread.Sleep(250);
- Console.WriteLine("[init] Kernel boot complete.");
- Console.WriteLine("[sfs] Loading SFS driver v3");
+ Console.WriteLine("{MISC_KERNELBOOTED}");
+ Console.WriteLine("{MISC_SHIFTFSDRV}");
Thread.Sleep(350);
- Console.WriteLine("[sfs] 4096 blocks read.");
- if (loadingJoke1 == 0)
- Console.WriteLine("[sos] Getting good and ready...");
- if (loadingJoke1 == 1)
- Console.WriteLine("[sos] Shifting the OS...");
- if (loadingJoke1 == 2)
- Console.WriteLine("[sos] Placing things everywhere...");
- if (loadingJoke1 == 3)
- Console.WriteLine("[sos] Making an an errors...");
- if (loadingJoke1 == 4)
- Console.WriteLine("[sos] Testing to see if this OS is indeed on...");
- if (loadingJoke1 == 5)
- Console.WriteLine("[sos] Calming user...");
- if (loadingJoke1 == 6)
- Console.WriteLine("[sos] Cleaning room...");
- if (loadingJoke1 == 7)
- Console.WriteLine("[sos] Checking for piracy...");
- if (loadingJoke1 == 8)
- Console.WriteLine("[sos] Getting Jim that important office memo...");
- if (loadingJoke1 == 9)
- Console.WriteLine("[sos] Using imagination...");
+ Console.WriteLine("{MISC_SHIFTFSBLOCKSREAD}");
+ Console.WriteLine("{MISC_LOADINGMSG1_" + loadingJoke1 + "}");
Thread.Sleep(500);
- Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)");
+ Console.WriteLine("{MISC_LOADINGCONFIG}");
Thread.Sleep(30);
- Console.WriteLine("[termdb] Building command database from filesystem...");
+ Console.WriteLine("{MISC_BUILDINGCMDS}");
TerminalBackend.PopulateTerminalCommands();
if (IsSandbox == false)
{
- Console.WriteLine("[inetd] Connecting to network...");
+ Console.WriteLine("{MISC_CONNECTINGTONETWORK}");
Ready = false;
@@ -192,28 +173,9 @@ namespace ShiftOS.Engine
{
//Connection successful! Stop waiting!
guidReceived = true;
- Console.WriteLine("[inetd] Connection successful.");
+ Console.WriteLine("{INIT_CONNECTIONSUCCESSFUL}");
Thread.Sleep(100);
- if (loadingJoke2 == 0)
- Console.WriteLine("[sos] Running final checks (gotta be sure!)...");
- if (loadingJoke2 == 1)
- Console.WriteLine("[sos] Fixing the time because we think we got it wrong...");
- if (loadingJoke2 == 2)
- Console.WriteLine("[sos] Fun Fact: there is a 12% chance you will read this...");
- if (loadingJoke2 == 3)
- Console.WriteLine("[sos] Fixing sloppy code...");
- if (loadingJoke2 == 4)
- Console.WriteLine("[sos] Welcoming new users...");
- if (loadingJoke2 == 5)
- Console.WriteLine("[sos] Taking inspiration from GMod...");
- if (loadingJoke2 == 6)
- Console.WriteLine("[sos] Getting help...");
- if (loadingJoke2 == 7)
- Console.WriteLine("[sos] I'm very clevery guy...");
- if (loadingJoke2 == 8)
- Console.WriteLine("[sos] Waiting a bit...");
- if (loadingJoke2 == 9)
- Console.WriteLine("[sos] Do a digital dancing...");
+ Console.WriteLine("{MISC_LOADINGMSG2_" + loadingJoke2 + "}");
Thread.Sleep(500);
};
@@ -227,12 +189,12 @@ namespace ShiftOS.Engine
{
Thread.Sleep(10);
}
- Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
+ Console.WriteLine("{MISC_DHCPHANDSHAKEFINISHED}");
FinishBootstrap();
}
else
{
- Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection.");
+ Console.WriteLine("{MISC_NONETWORK}");
FinishBootstrap();
}
}
@@ -259,7 +221,7 @@ namespace ShiftOS.Engine
}
else
{
- Console.WriteLine("[inetd] Sandbox mode initiating...");
+ Console.WriteLine("{MISC_SANDBOXMODE}");
CurrentSave = new Save
{
IsSandbox = true,
@@ -328,8 +290,6 @@ namespace ShiftOS.Engine
/// </summary>
private static void FinishBootstrap()
{
- KernelWatchdog.Log("mud_handshake", "handshake successful: kernel watchdog access code is \"" + ServerManager.thisGuid.ToString() + "\"");
-
ServerMessageReceived savehandshake = null;
savehandshake = (msg) =>
@@ -343,7 +303,7 @@ namespace ShiftOS.Engine
}
catch
{
- Console.WriteLine("[system] [SEVERE] Cannot parse configuration file.");
+ Console.WriteLine("{ENGINE_CANNOTLOADSAVE}");
oobe.PromptForLogin();
}
}
@@ -373,7 +333,7 @@ namespace ShiftOS.Engine
Thread.Sleep(75);
Thread.Sleep(50);
- Console.WriteLine("[usr-man] Accepting logins on local tty 1.");
+ Console.WriteLine("{MISC_ACCEPTINGLOGINS}");
Sysname:
bool waitingForNewSysName = false;
@@ -381,16 +341,16 @@ namespace ShiftOS.Engine
if (string.IsNullOrWhiteSpace(CurrentSave.SystemName))
{
- Infobox.PromptText("Enter a system name", "Your system does not have a name. All systems within the digital society must have a name. Please enter one.", (name) =>
+ Infobox.PromptText("{TITLE_ENTERSYSNAME}", "{PROMPT_ENTERSYSNAME}", (name) =>
{
if (string.IsNullOrWhiteSpace(name))
- Infobox.Show("Invalid name", "Please enter a valid name.", () =>
+ Infobox.Show("{TITLE_INVALIDNAME}", "{PROMPT_INVALIDNAME}.", () =>
{
gobacktosysname = true;
waitingForNewSysName = false;
});
else if (name.Length < 5)
- Infobox.Show("Value too small.", "Your system name must have at least 5 characters in it.", () =>
+ Infobox.Show("{TITLE_VALUESMALL}", "{PROMPT_SMALLSYSNAME}", () =>
{
gobacktosysname = true;
waitingForNewSysName = false;
@@ -398,11 +358,6 @@ namespace ShiftOS.Engine
else
{
CurrentSave.SystemName = name;
- if (!string.IsNullOrWhiteSpace(CurrentSave.UniteAuthToken))
- {
- var unite = new Unite.UniteClient("http://getshiftos.ml", CurrentSave.UniteAuthToken);
- unite.SetSysName(name);
- }
SaveSystem.SaveGame();
gobacktosysname = false;
waitingForNewSysName = false;
@@ -429,18 +384,18 @@ namespace ShiftOS.Engine
`-:/++++::.`
.+ydNMMMMMNNMMMMMNhs/.
/yNMMmy+:-` `````.-/ohNMMms-
- `oNMMh/.`:oydmNMMMMNmhs+- .+dMMm+` Welcome to ShiftOS.
+ `oNMMh/.`:oydmNMMMMNmhs+- .+dMMm+` {{GEN_WELCOME}}
`oMMmo``+dMMMMMMMMMMMMMMMMMNh/`.sNMN+
- :NMN+ -yMMMMMMMNdhyssyyhdmNMMMMNs``sMMd. SYSTEM STATUS:
+ :NMN+ -yMMMMMMMNdhyssyyhdmNMMMMNs``sMMd. {{GEN_SYSTEMSTATUS}}
oMMd.`sMMMMMMd+. `/MMMMN+ -mMN: ----------------------
oMMh .mMMMMMM/ `-::::-.` :MMMMMMh`.mMM:
- :MMd .NMMMMMMs .dMMMMMMMMMNddMMMMMMMd`.NMN. Codepoints: {SaveSystem.CurrentSave.Codepoints}
- mMM. dMMMMMMMo -mMMMMMMMMMMMMMMMMMMMMs /MMy Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed
- :MMh :MMMMMMMMm` .+shmMMMMMMMMMMMMMMMN` NMN` {Shiftorium.GetAvailable().Count()} available
- oMM+ sMMMMMMMMMN+` `-/smMMMMMMMMMMM: hMM: Filesystems: {Utils.Mounts.Count} filesystems mounted in memory.
+ :MMd .NMMMMMMs .dMMMMMMMMMNddMMMMMMMd`.NMN. {{GEN_CODEPOINTS}}: {SaveSystem.CurrentSave.Codepoints}
+ mMM. dMMMMMMMo -mMMMMMMMMMMMMMMMMMMMMs /MMy
+ :MMh :MMMMMMMMm` .+shmMMMMMMMMMMMMMMMN` NMN`
+ oMM+ sMMMMMMMMMN+` `-/smMMMMMMMMMMM: hMM:
sMM+ sMMMMMMMMMMMMds/-` .sMMMMMMMMM/ yMM/
- +MMs +MMMMMMMMMMMMMMMMMmhs:` +MMMMMMMM- dMM- System name: {CurrentSave.SystemName.ToUpper()}
- .MMm `NMMMMMMMMMMMMMMMMMMMMMo `NMMMMMMd .MMN Users: {Users.Count()} found.
+ +MMs +MMMMMMMMMMMMMMMMMmhs:` +MMMMMMMM- dMM- {{GEN_SYSTEMNAME}}: {CurrentSave.SystemName.ToUpper()}
+ .MMm `NMMMMMMMMMMMMMMMMMMMMMo `NMMMMMMd .MMN {{GEN_USERS}}: {Users.Count()}.
hMM+ +MMMMMMmsdNMMMMMMMMMMN/ -MMMMMMN- yMM+
`NMN- oMMMMMd `-/+osso+- .mMMMMMN: +MMd
-NMN: /NMMMm` :yMMMMMMm- oMMd`
@@ -460,7 +415,7 @@ namespace ShiftOS.Engine
Password = "",
Permissions = UserPermissions.Root
});
- Console.WriteLine("[usr-man] WARN: No users found. Creating new user with username \"root\", with no password.");
+ Console.WriteLine("{MISC_NOUSERS}");
}
TerminalBackend.InStory = false;
@@ -492,18 +447,21 @@ namespace ShiftOS.Engine
int progress = 0;
bool goback = false;
TextSentEventHandler ev = null;
+ string loginstr = Localization.Parse("{GEN_LPROMPT}", new Dictionary<string, string>
+ {
+ ["%sysname"] = CurrentSave.SystemName
+ });
ev = (text) =>
{
if (progress == 0)
{
- string loginstr = CurrentSave.SystemName + " login: ";
string getuser = text.Remove(0, loginstr.Length);
if (!string.IsNullOrWhiteSpace(getuser))
{
if (CurrentSave.Users.FirstOrDefault(x => x.Username == getuser) == null)
{
Console.WriteLine();
- Console.WriteLine("User not found.");
+ Console.WriteLine("{ERR_NOUSER}");
goback = true;
progress++;
TerminalBackend.TextSent -= ev;
@@ -515,7 +473,7 @@ namespace ShiftOS.Engine
else
{
Console.WriteLine();
- Console.WriteLine("Username not provided.");
+ Console.WriteLine("{ERR_NOUSER}");
TerminalBackend.TextSent -= ev;
goback = true;
progress++;
@@ -523,20 +481,20 @@ namespace ShiftOS.Engine
}
else if (progress == 1)
{
- string passwordstr = "password: ";
+ string passwordstr = Localization.Parse("{GEN_PASSWORD}: ");
string getpass = text.Remove(0, passwordstr.Length);
var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username);
if (user.Password == getpass)
{
Console.WriteLine();
- Console.WriteLine("Welcome to ShiftOS.");
+ Console.WriteLine("{GEN_WELCOME}");
CurrentUser = user;
progress++;
}
else
{
Console.WriteLine();
- Console.WriteLine("Access denied.");
+ Console.WriteLine("{RES_DENIED}");
goback = true;
progress++;
}
@@ -545,7 +503,7 @@ namespace ShiftOS.Engine
};
TerminalBackend.TextSent += ev;
Console.WriteLine();
- Console.Write(CurrentSave.SystemName + " login: ");
+ Console.Write(loginstr);
ConsoleEx.Flush();
while (progress == 0)
{
@@ -554,7 +512,7 @@ namespace ShiftOS.Engine
if (goback)
goto Login;
Console.WriteLine();
- Console.Write("password: ");
+ Console.Write("{GEN_PASSWORD}: ");
ConsoleEx.Flush();
while (progress == 1)
Thread.Sleep(10);
diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs
index cac535b..7936820 100644
--- a/ShiftOS_TheReturn/UserManagementCommands.cs
+++ b/ShiftOS_TheReturn/UserManagementCommands.cs
@@ -19,14 +19,14 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("add", description = "Add a user to the system.", usage ="name:")]
+ [Command("adduser", description = "{DESC_ADDUSER}")]
[RequiresArgument("name")]
public static bool AddUser(Dictionary<string, object> args)
{
string name = args["name"].ToString();
- if(SaveSystem.CurrentSave.Users.FirstOrDefault(x=>x.Username==name) != null)
+ if (SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name) != null)
{
- Console.WriteLine("Error: User already exists.");
+ Console.WriteLine("{ERR_USERFOUND}");
return true;
}
@@ -37,7 +37,10 @@ namespace ShiftOS.Engine
Permissions = UserPermissions.User
};
SaveSystem.CurrentSave.Users.Add(user);
- Console.WriteLine($"Creating new user \"{name}\" with no password and User permissions.");
+ Console.WriteLine(Localization.Parse("{RES_CREATINGUSER}", new Dictionary<string, string>
+ {
+ { "%name", name }
+ }));
SaveSystem.SaveGame();
return true;
}
@@ -48,25 +51,28 @@ namespace ShiftOS.Engine
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("remove", description = "Remove a user from the system.", usage = "name:")]
+ [Command("removeuser", description = "{DESC_REMOVEUSER}")]
[RequiresArgument("name")]
public static bool RemoveUser(Dictionary<string, object> args)
{
string name = args["name"].ToString();
if (SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name) == null)
{
- Console.WriteLine("Error: User doesn't exist.");
+ Console.WriteLine("{ERR_NOUSER}");
return true;
}
var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name);
- if(user.Username != SaveSystem.CurrentUser.Username)
+ if (user.Username != SaveSystem.CurrentUser.Username)
{
- Console.WriteLine("Error: Cannot remove yourself.");
+ Console.WriteLine("{ERR_REMOVEYOU}");
return true;
}
SaveSystem.CurrentSave.Users.Remove(user);
- Console.WriteLine($"Removing user \"{name}\" from system...");
+ Console.WriteLine(Localization.Parse("{RES_REMOVINGUSER}", new Dictionary<string, string>
+ {
+ ["%name"] = name
+ }));
SaveSystem.SaveGame();
return true;
}
@@ -79,7 +85,7 @@ namespace ShiftOS.Engine
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("set_acl")]
+ [Command("setuserpermissions", description = "{DESC_SETUSERPERMISSIONS}")]
[RequiresArgument("user")]
[RequiresArgument("val")]
public static bool SetUserPermission(Dictionary<string, object> args)
@@ -92,13 +98,13 @@ namespace ShiftOS.Engine
}
catch
{
- Console.WriteLine("Error: Permission value must be an integer.");
+ Console.WriteLine("{ERR_BADACL}");
return true;
}
if(SaveSystem.CurrentSave.Users.FirstOrDefault(x=>x.Username==username) == null)
{
- Console.WriteLine("Error: User not found.");
+ Console.WriteLine("{ERR_NOUSER}");
return true;
}
@@ -119,26 +125,26 @@ namespace ShiftOS.Engine
uperm = UserPermissions.Root;
break;
default:
- Console.WriteLine("Permission value must be between 0 and 4.");
+ Console.WriteLine("{ERR_BADACL}");
return true;
}
//Permissions are backwards... oops...
if(uperm < SaveSystem.CurrentUser.Permissions)
{
- Console.WriteLine("Error: Cannot set user permissions to values greater than your own!");
+ Console.WriteLine("{ERR_ACLHIGHERVALUE}");
return true;
}
var oldperm = SaveSystem.Users.FirstOrDefault(x => x.Username == username).Permissions;
if (SaveSystem.CurrentUser.Permissions > oldperm)
{
- Console.WriteLine("Error: Can't set the permission of this user. They have more rights than you.");
+ Console.WriteLine("{ERR_HIGHERPERMS}");
return true;
}
SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == username).Permissions = uperm;
- Console.WriteLine("User permissions updated.");
+ Console.WriteLine("{RES_ACLUPDATED}");
return true;
}
@@ -148,7 +154,7 @@ namespace ShiftOS.Engine
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("users", description = "Get a list of all users on the system.")]
+ [Command("users", description = "{DESC_USERS}")]
public static bool GetUsers()
{
foreach (var u in SaveSystem.CurrentSave.Users)
@@ -180,7 +186,7 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("login", description = "Log in as another user.")]
+ [Command("su", description = "{DESC_SU}")]
[RequiresArgument("user")]
[RequiresArgument("pass")]
public static bool Login(Dictionary<string, object> args)
@@ -191,18 +197,18 @@ namespace ShiftOS.Engine
var usr = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == user);
if(usr==null)
{
- Console.WriteLine("Error: No such user.");
+ Console.WriteLine("{ERR_NOUSER}");
return true;
}
if (usr.Password != pass)
{
- Console.WriteLine("Access denied.");
+ Console.WriteLine("{RES_DENIED}");
return true;
}
SaveSystem.CurrentUser = usr;
- Console.WriteLine("Access granted.");
+ Console.WriteLine("{RES_GRANTED}");
return true;
}
@@ -211,7 +217,7 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="args">Command arguments.</param>
/// <returns>Command result.</returns>
- [Command("setpass", description ="Allows you to set your password to a new value.", usage ="old:,new:")]
+ [Command("passwd", description ="{DESC_PASSWD}", usage ="old:,new:")]
[RequiresArgument("old")]
[RequiresArgument("new")]
public static bool SetPassword(Dictionary<string, object> args)
@@ -223,12 +229,12 @@ namespace ShiftOS.Engine
{
SaveSystem.CurrentUser.Password = newpass;
SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == SaveSystem.CurrentUser.Username).Password = newpass;
- Console.WriteLine("Password set successfully.");
+ Console.WriteLine("{RES_PASSWD_SET}");
SaveSystem.SaveGame();
}
else
{
- Console.WriteLine("Passwords do not match.");
+ Console.WriteLine("{ERR_PASSWD_MISMATCH}");
}
return true;
}