diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-06-11 23:38:13 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-06-11 23:38:13 +0200 |
commit | 2fa4a0e50ebfc97059c8b84dbd17e79f9afc8a8d (patch) | |
tree | c3b34ccb2737e347a73768536895cbbaab13cc01 /DSACore/Commands/Help.cs | |
parent | ec991104f56e90d7bb2878da2fe6ed4e585dfc46 (diff) | |
parent | af74efccf8d21e6151022b71f3cacd3fa83024ee (diff) |
Merge branch 'rework-backend'
Diffstat (limited to 'DSACore/Commands/Help.cs')
-rw-r--r-- | DSACore/Commands/Help.cs | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/DSACore/Commands/Help.cs b/DSACore/Commands/Help.cs deleted file mode 100644 index 1575b36..0000000 --- a/DSACore/Commands/Help.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Linq; -using System.Threading.Tasks; -using DSACore.Auxiliary; - -namespace DSACore.Commands -{ - public class Help - { - static Help() - { - /*TextReader stream = new StreamReader(@"..\..\Help.json"); // Load command-description file - var reader = new JsonTextReader(stream); // create stream reader - - reader.Read(); // step into structure, until the array starts - reader.Read(); - reader.Read(); - - try - { - var test = new JsonSerializer().Deserialize<List<CommandInfo>>(reader); // Deserialize Data and create CommandInfo Struct - - Commands.AddRange(test); // Add new CommandInfos to List - } - catch (Exception e) - { - // ignored - }*/ - } - - //public static List<CommandInfo> Commands { get; } = new List<CommandInfo>(); - - - public static string Get_Specific_Help(string command) - { - // return command specific help - var com = DSACore.DSA_Game.Save.Properties.CommandInfos.OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command - return com.GetDescription(); - } - - public static string Get_Generic_Help() - { - string res = ""; - foreach (var com in DSACore.DSA_Game.Save.Properties.CommandInfos) - { - int first_column_width = 8; - res += ("!" + com.Name + ": ").AddSpaces(first_column_width) + com.Brief; - - if (com.Description.Length > 1) - { - res += "\n" + "".AddSpaces(first_column_width) + "(\"!man " + com.Name + "\" gibt genauere Informationen)"; - } - - res += "\n\n"; - } - return res; - } - - public static string ShowHelp(params string[] commandList) - { - var command = ""; - if (commandList.Length > 0) { - command = commandList.Aggregate((s, c) => s + " " + c); - } - - if (command.Equals(string.Empty)) // return generic Help - { - string res = Get_Generic_Help(); - - return res; - } - - - return Get_Specific_Help(command); - } - } -} |