From 0ca2fffe7a214fb5cc4c6482ca6fb8d1e4d2c4ea Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 May 2017 13:18:08 -0400 Subject: [PATCH] storydev.list command --- ShiftOS.WinForms/HackerCommands.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index f467eb2..316b7fc 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -2,12 +2,14 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using ShiftOS.Engine; using ShiftOS.Objects; +using ShiftOS.Objects.ShiftFS; using ShiftOS.WinForms.Applications; using static ShiftOS.Objects.ShiftFS.Utils; @@ -674,6 +676,34 @@ namespace ShiftOS.WinForms return true; } + [Command("list", description ="Lists all story IDs.")] + public static bool ListIds() + { + foreach(var exec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + { + foreach(var type in asm.GetTypes()) + { + foreach(var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + { + var attr = method.GetCustomAttributes(false).FirstOrDefault(x => x is StoryAttribute); + if (attr != null) + Console.WriteLine(" - " + (attr as StoryAttribute).StoryID); + } + } + } + } + catch { } + } + } + return true; + } + [Command("unexperience", description = "Marks a story plot as not-experienced yet.", usage ="id:string")] [RemoteLock] [RequiresArgument("id")]