aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/AppLauncherDaemon.cs
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-05-28 12:37:00 -0700
committerGitHub <[email protected]>2017-05-28 12:37:00 -0700
commit771c20cfb3a703e0f1550fdcf9eb07b78298c944 (patch)
tree59cb532e15ebff313fdba2be264d78ec0033f407 /ShiftOS_TheReturn/AppLauncherDaemon.cs
parent496b0cbf8659c99203f48210fd39c572400ae623 (diff)
parentc7ba7d733c756d196f98dd4533289a1ef4db715f (diff)
downloadshiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.gz
shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.bz2
shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.zip
Merge pull request #1 from shiftos-game/master
welp, no longer a dev.
Diffstat (limited to 'ShiftOS_TheReturn/AppLauncherDaemon.cs')
-rw-r--r--ShiftOS_TheReturn/AppLauncherDaemon.cs55
1 files changed, 51 insertions, 4 deletions
diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs
index 7ef34c1..716a6a3 100644
--- a/ShiftOS_TheReturn/AppLauncherDaemon.cs
+++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs
@@ -34,8 +34,17 @@ using ShiftOS.Objects.ShiftFS;
namespace ShiftOS.Engine
{
+ /// <summary>
+ /// Provides functionality for pulling data about the App Launcher.
+ /// </summary>
public static class AppLauncherDaemon
{
+ /// <summary>
+ /// Extension method that allows you to determine if a list of <see cref="AssemblyName"/>s contains a given name.
+ /// </summary>
+ /// <param name="asms">The list of assembly names</param>
+ /// <param name="name">The name to look for.</param>
+ /// <returns>Whether or not the name was found in the list.</returns>
public static bool Contains(this AssemblyName[] asms, string name)
{
foreach(var asm in asms)
@@ -46,6 +55,10 @@ namespace ShiftOS.Engine
return false;
}
+ /// <summary>
+ /// Pulls a list of all available App Launcher items.
+ /// </summary>
+ /// <returns>A <see cref="List{LauncherItem}"/> containing all available App Launcher items.</returns>
public static List<LauncherItem> Available()
{
List<LauncherItem> win = new List<LauncherItem>();
@@ -64,14 +77,29 @@ namespace ShiftOS.Engine
{
if (type.GetInterfaces().Contains(typeof(IShiftOSWindow)))
{
+ bool isAllowed = true;
foreach (var attr in type.GetCustomAttributes(false))
{
- if (attr is LauncherAttribute)
+ if(attr is MultiplayerOnlyAttribute)
{
- var launch = attr as LauncherAttribute;
- if (launch.UpgradeInstalled)
+ if(KernelWatchdog.MudConnected == false)
{
- win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ isAllowed = false;
+
+ }
+ }
+ if (isAllowed == true)
+ {
+ if (attr is LauncherAttribute)
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(type))
+ {
+ var launch = attr as LauncherAttribute;
+ if (launch.UpgradeInstalled)
+ {
+ win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ }
+ }
}
}
}
@@ -99,20 +127,39 @@ namespace ShiftOS.Engine
}
+ /// <summary>
+ /// Provides a data object for app launcher items
+ /// </summary>
public class LauncherItem
{
+ /// <summary>
+ /// Display data including icons, names, and the category of the item.
+ /// </summary>
public LauncherAttribute DisplayData { get; internal set; }
+ /// <summary>
+ /// A .NET <see cref="Type"/> that is associated with this item.
+ /// </summary>
public Type LaunchType { get; internal set; }
}
+ /// <summary>
+ /// Provides the ability to run Lua scripts from the App Launcher.
+ /// </summary>
public class LuaLauncherItem : LauncherItem
{
+ /// <summary>
+ /// Creates a new instance of the <see cref="LuaLauncherItem"/>.
+ /// </summary>
+ /// <param name="file">A script file to run when the item is activated.</param>
public LuaLauncherItem(string file)
{
LaunchPath = file;
}
+ /// <summary>
+ /// Gets or sets the launch path of this App Launcher item.
+ /// </summary>
public string LaunchPath { get; private set; }
}
}