From bbe37edb68f9e7535216bff80ba3e6b16cbca398 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 2 Feb 2017 09:47:23 -0500 Subject: Shiftnet, and audio fixes --- ShiftOS.Objects/Save.cs | 60 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'ShiftOS.Objects') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 787423d..c7fe43c 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Dynamic; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -23,15 +24,15 @@ namespace ShiftOS.Objects public string Password { get; set; } public string SystemName { get; set; } - public string DiscourseName { get; set; } - - /// - /// If the user has entered their Discourse account into ShiftOS, this is the password they gave. - /// - /// ANY developer caught abusing this property will have their dev status revoked and their account PERMANENTLY SUSPENDED. - Michael - /// - public string DiscoursePass { get; set; } + private dynamic _settings = new SettingsObject(); + public dynamic Settings + { + get + { + return _settings; + } + } public int CountUpgrades() { @@ -44,4 +45,47 @@ namespace ShiftOS.Objects return count; } } + + public class SettingsObject : DynamicObject + { + private Dictionary _settings = null; + + public SettingsObject() + { + _settings = new Dictionary(); + } + + public override IEnumerable GetDynamicMemberNames() + { + return _settings.Keys.ToArray(); + } + + public override bool TryGetMember(GetMemberBinder binder, out object result) + { + if (_settings.ContainsKey(binder.Name)) + { + result = _settings[binder.Name]; + return true; + } + else + { + result = null; + return false; + } + } + + public override bool TrySetMember(SetMemberBinder binder, object value) + { + if (_settings.ContainsKey(binder.Name)) + { + _settings[binder.Name] = value; + } + else + { + _settings.Add(binder.Name, value); + } + + return true; + } + } } -- cgit v1.2.3