mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Lua app launcher items
This commit is contained in:
parent
3a41ba45e7
commit
44c1e66dd0
4 changed files with 32 additions and 2 deletions
|
@ -12,7 +12,7 @@ using ShiftOS.Objects.ShiftFS;
|
|||
|
||||
namespace ShiftOS.Modding.VirtualMachine
|
||||
{
|
||||
[Launcher("ShiftOS Virtual Machine", false)]
|
||||
[Launcher("ShiftOS Virtual Machine", false, null, "Programming")]
|
||||
public partial class Form1 : UserControl, IShiftOSWindow
|
||||
{
|
||||
private byte[] memory = null; //program binary
|
||||
|
|
|
@ -263,7 +263,16 @@ namespace ShiftOS.WinForms
|
|||
item.Text = kv.DisplayData.Name;
|
||||
item.Click += (o, a) =>
|
||||
{
|
||||
Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
|
||||
if (kv is LuaLauncherItem)
|
||||
{
|
||||
var interpreter = new Engine.Scripting.LuaInterpreter();
|
||||
interpreter.ExecuteFile((kv as LuaLauncherItem).LaunchPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Engine.AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
|
||||
}
|
||||
|
||||
};
|
||||
if (sortedItems.ContainsKey(kv.DisplayData.Category))
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using ShiftOS.Objects.ShiftFS;
|
||||
|
||||
namespace ShiftOS.Engine
|
||||
{
|
||||
|
@ -84,6 +85,15 @@ namespace ShiftOS.Engine
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var file in Utils.GetFiles(Paths.GetPath("applauncher")))
|
||||
{
|
||||
if (file.EndsWith(".al"))
|
||||
{
|
||||
var item = JsonConvert.DeserializeObject<LuaLauncherItem>(Utils.ReadAllText(file));
|
||||
win.Add(item);
|
||||
}
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
|
@ -95,4 +105,14 @@ namespace ShiftOS.Engine
|
|||
public Type LaunchType { get; internal set; }
|
||||
|
||||
}
|
||||
|
||||
public class LuaLauncherItem : LauncherItem
|
||||
{
|
||||
public LuaLauncherItem(string file)
|
||||
{
|
||||
LaunchPath = file;
|
||||
}
|
||||
|
||||
public string LaunchPath { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace ShiftOS.Engine
|
|||
AddPath("local", "deutsch.local");
|
||||
AddPath("local", "verbose.local");
|
||||
AddPath("system", "data");
|
||||
AddPath("system", "applauncher");
|
||||
AddPath("data", "save.json");
|
||||
AddPath("data", "user.dat");
|
||||
AddPath("data", "skin");
|
||||
|
|
Loading…
Reference in a new issue