storydev.list command

This commit is contained in:
Michael 2017-05-30 13:18:08 -04:00
parent c6e3d0e905
commit 0ca2fffe7a

View file

@ -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")]