From c63117276194d18890f14c75b8864749fbd33a0e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 09:03:19 -0400 Subject: modular notifications --- ShiftOS_TheReturn/IStatusIcon.cs | 14 ++++++++++++++ ShiftOS_TheReturn/NotificationDaemon.cs | 30 ++++++++++++++++++++++++++++++ ShiftOS_TheReturn/ShiftOS.Engine.csproj | 1 + 3 files changed, 45 insertions(+) create mode 100644 ShiftOS_TheReturn/IStatusIcon.cs (limited to 'ShiftOS_TheReturn') diff --git a/ShiftOS_TheReturn/IStatusIcon.cs b/ShiftOS_TheReturn/IStatusIcon.cs new file mode 100644 index 0000000..f32d1c1 --- /dev/null +++ b/ShiftOS_TheReturn/IStatusIcon.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Engine +{ + public interface IStatusIcon + { + void Setup(); + + } +} diff --git a/ShiftOS_TheReturn/NotificationDaemon.cs b/ShiftOS_TheReturn/NotificationDaemon.cs index a90510a..0725782 100644 --- a/ShiftOS_TheReturn/NotificationDaemon.cs +++ b/ShiftOS_TheReturn/NotificationDaemon.cs @@ -25,6 +25,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; @@ -34,6 +35,35 @@ namespace ShiftOS.Engine { public static class NotificationDaemon { + /// + /// Gets a list of all objects that meet their Shiftorium dependencies. + /// + /// An array of s containing the found objects. + public static Type[] GetAllStatusIcons() + { + List lst = new List(); + 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().Where(x => x.GetInterfaces().Contains(typeof(IStatusIcon)))) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + lst.Add(type); + } + } + } + catch { } + } + } + return lst.ToArray(); + } + + //if the notifications file already exists then get them public static Notification[] GetAllFromFile() { diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj index 4cbce72..f70c41e 100644 --- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj +++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj @@ -109,6 +109,7 @@ + -- cgit v1.2.3