diff options
| author | Michael <[email protected]> | 2017-02-04 11:14:39 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-04 11:14:39 -0500 |
| commit | 28a087d2d4961fd80d827df968de0f6f63da07eb (patch) | |
| tree | a58ef9c8fd9d462c77226d05222bcf81859e9652 /ShiftOS_TheReturn | |
| parent | 9aa2c1f03bc09435ba46c760383113ba4f1cabd0 (diff) | |
| download | shiftos_thereturn-28a087d2d4961fd80d827df968de0f6f63da07eb.tar.gz shiftos_thereturn-28a087d2d4961fd80d827df968de0f6f63da07eb.tar.bz2 shiftos_thereturn-28a087d2d4961fd80d827df968de0f6f63da07eb.zip | |
Add name changer backend
You can use the DefaultTitleAttribute on an IShiftOSWindow to specify a
default title for the window and name changer entry.
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/AppearanceManager.cs | 45 | ||||
| -rw-r--r-- | ShiftOS_TheReturn/Skinning.cs | 3 |
2 files changed, 48 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index dd205b2..112bca5 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -75,6 +76,39 @@ namespace ShiftOS.Engine } } + public static IEnumerable<Type> GetAllWindowTypes() + { + List<Type> types = new List<Type>(); + foreach(var file in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(file.EndsWith(".exe") || file.EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(file); + foreach(var type in asm.GetTypes()) + { + if (type.GetInterfaces().Contains(typeof(IShiftOSWindow))) + types.Add(type); + } + } + catch { } + } + } + return types; + } + + public static string GetDefaultTitle(Type winType) + { + foreach(var attrib in winType.GetCustomAttributes(false)) + { + if(attrib is DefaultTitleAttribute) + { + return (attrib as DefaultTitleAttribute).Title; + } + } + return winType.Name; + } public static string LastTerminalText { get; set; } public static int CurrentPosition { get; set; } @@ -205,4 +239,15 @@ namespace ShiftOS.Engine string Text { get; set; } IShiftOSWindow ParentWindow { get; set; } } + + public class DefaultTitleAttribute : Attribute + { + public DefaultTitleAttribute(string title) + { + Title = title; + } + + public string Title { get; private set; } + } + } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 80945b8..b3dddd3 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -137,6 +137,9 @@ namespace ShiftOS.Engine { return JsonConvert.SerializeObject(this, Formatting.Indented); } + [ShifterHidden] + public Dictionary<string, string> AppNames = new Dictionary<string, string>(); + [ShifterMeta("Windows")] [ShifterCategory("Titlebar")] [RequiresUpgrade("shift_title_text")] |
