diff options
| author | Michael <[email protected]> | 2017-05-31 09:03:19 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-31 09:03:19 -0400 |
| commit | c63117276194d18890f14c75b8864749fbd33a0e (patch) | |
| tree | eaef3c68269988a163a1b9ac9fed2f3989bf0aa5 /ShiftOS_TheReturn/NotificationDaemon.cs | |
| parent | 3dd402277bba874f24fab11865d257133c6f782c (diff) | |
| download | shiftos_thereturn-c63117276194d18890f14c75b8864749fbd33a0e.tar.gz shiftos_thereturn-c63117276194d18890f14c75b8864749fbd33a0e.tar.bz2 shiftos_thereturn-c63117276194d18890f14c75b8864749fbd33a0e.zip | |
modular notifications
Diffstat (limited to 'ShiftOS_TheReturn/NotificationDaemon.cs')
| -rw-r--r-- | ShiftOS_TheReturn/NotificationDaemon.cs | 30 |
1 files changed, 30 insertions, 0 deletions
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 { + /// <summary> + /// Gets a list of all <see cref="IStatusIcon"/> objects that meet their Shiftorium dependencies. + /// </summary> + /// <returns>An array of <see cref="Type"/>s containing the found objects.</returns> + public static Type[] GetAllStatusIcons() + { + List<Type> lst = new List<Type>(); + 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() { |
