ConfigurationManager.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. global using static Terminal.Gui.ConfigurationManager;
  2. global using CM = Terminal.Gui.ConfigurationManager;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Reflection;
  10. using System.Text;
  11. using System.Text.Json;
  12. using System.Text.Json.Serialization;
  13. using static Terminal.Gui.SpinnerStyle;
  14. #nullable enable
  15. namespace Terminal.Gui;
  16. /// <summary>
  17. /// Provides settings and configuration management for Terminal.Gui applications.
  18. /// <para>
  19. /// Users can set Terminal.Gui settings on a global or per-application basis by providing JSON formatted configuration files.
  20. /// The configuration files can be placed in at <c>.tui</c> folder in the user's home directory (e.g. <c>C:/Users/username/.tui</c>,
  21. /// or <c>/usr/username/.tui</c>),
  22. /// the folder where the Terminal.Gui application was launched from (e.g. <c>./.tui</c>), or as a resource
  23. /// within the Terminal.Gui application's main assembly.
  24. /// </para>
  25. /// <para>
  26. /// Settings are defined in JSON format, according to this schema:
  27. /// https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json
  28. /// </para>
  29. /// <para>
  30. /// Settings that will apply to all applications (global settings) reside in files named <c>config.json</c>. Settings
  31. /// that will apply to a specific Terminal.Gui application reside in files named <c>appname.config.json</c>,
  32. /// where <c>appname</c> is the assembly name of the application (e.g. <c>UICatalog.config.json</c>).
  33. /// </para>
  34. /// Settings are applied using the following precedence (higher precedence settings
  35. /// overwrite lower precedence settings):
  36. /// <para>
  37. /// 1. Application configuration found in the users's home directory (<c>~/.tui/appname.config.json</c>) -- Highest precedence
  38. /// </para>
  39. /// <para>
  40. /// 2. Application configuration found in the directory the app was launched from (<c>./.tui/appname.config.json</c>).
  41. /// </para>
  42. /// <para>
  43. /// 3. Application configuration found in the applications's resources (<c>Resources/config.json</c>).
  44. /// </para>
  45. /// <para>
  46. /// 4. Global configuration found in the user's home directory (<c>~/.tui/config.json</c>).
  47. /// </para>
  48. /// <para>
  49. /// 5. Global configuration found in the directory the app was launched from (<c>./.tui/config.json</c>).
  50. /// </para>
  51. /// <para>
  52. /// 6. Global configuration in <c>Terminal.Gui.dll</c>'s resources (<c>Terminal.Gui.Resources.config.json</c>) -- Lowest Precidence.
  53. /// </para>
  54. /// </summary>
  55. public static partial class ConfigurationManager {
  56. private static readonly string _configFilename = "config.json";
  57. internal static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions {
  58. ReadCommentHandling = JsonCommentHandling.Skip,
  59. PropertyNameCaseInsensitive = true,
  60. DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
  61. WriteIndented = true,
  62. Converters = {
  63. // We override the standard Rune converter to support specifying Glyphs in
  64. // a flexible way
  65. new RuneJsonConverter(),
  66. },
  67. };
  68. /// <summary>
  69. /// A dictionary of all properties in the Terminal.Gui project that are decorated with the <see cref="SerializableConfigurationProperty"/> attribute.
  70. /// The keys are the property names pre-pended with the class that implements the property (e.g. <c>Application.UseSystemConsole</c>).
  71. /// The values are instances of <see cref="ConfigProperty"/> which hold the property's value and the
  72. /// <see cref="PropertyInfo"/> that allows <see cref="ConfigurationManager"/> to get and set the property's value.
  73. /// </summary>
  74. /// <remarks>
  75. /// Is <see langword="null"/> until <see cref="Initialize"/> is called.
  76. /// </remarks>
  77. internal static Dictionary<string, ConfigProperty>? _allConfigProperties;
  78. /// <summary>
  79. /// The backing property for <see cref="Settings"/>.
  80. /// </summary>
  81. /// <remarks>
  82. /// Is <see langword="null"/> until <see cref="Reset"/> is called. Gets set to a new instance by
  83. /// deserialization (see <see cref="Load"/>).
  84. /// </remarks>
  85. private static SettingsScope? _settings;
  86. /// <summary>
  87. /// The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties with the <see cref="SettingsScope"/>
  88. /// attribute value.
  89. /// </summary>
  90. public static SettingsScope? Settings {
  91. get {
  92. if (_settings == null) {
  93. throw new InvalidOperationException ("ConfigurationManager has not been initialized. Call ConfigurationManager.Reset() before accessing the Settings property.");
  94. }
  95. return _settings;
  96. }
  97. set {
  98. _settings = value!;
  99. }
  100. }
  101. /// <summary>
  102. /// The root object of Terminal.Gui themes manager. Contains only properties with the <see cref="ThemeScope"/>
  103. /// attribute value.
  104. /// </summary>
  105. public static ThemeManager? Themes => ThemeManager.Instance;
  106. /// <summary>
  107. /// Application-specific configuration settings scope.
  108. /// </summary>
  109. [SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true), JsonPropertyName ("AppSettings")]
  110. public static AppScope? AppSettings { get; set; }
  111. /// <summary>
  112. /// The set of glyphs used to draw checkboxes, lines, borders, etc...See also <seealso cref="Terminal.Gui.GlyphDefinitions"/>.
  113. /// </summary>
  114. [SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true),
  115. JsonPropertyName ("Glyphs")]
  116. public static GlyphDefinitions Glyphs { get; set; } = new GlyphDefinitions ();
  117. /// <summary>
  118. /// Initializes the internal state of ConfigurationManager. Nominally called once as part of application
  119. /// startup to initialize global state. Also called from some Unit Tests to ensure correctness (e.g. Reset()).
  120. /// </summary>
  121. internal static void Initialize ()
  122. {
  123. _allConfigProperties = new Dictionary<string, ConfigProperty> ();
  124. _settings = null;
  125. Dictionary<string, Type> classesWithConfigProps = new Dictionary<string, Type> (StringComparer.InvariantCultureIgnoreCase);
  126. // Get Terminal.Gui.dll classes
  127. var types = from assembly in AppDomain.CurrentDomain.GetAssemblies ()
  128. from type in assembly.GetTypes ()
  129. where type.GetProperties ().Any (prop => prop.GetCustomAttribute (typeof (SerializableConfigurationProperty)) != null)
  130. select type;
  131. foreach (var classWithConfig in types) {
  132. classesWithConfigProps.Add (classWithConfig.Name, classWithConfig);
  133. }
  134. Debug.WriteLine ($"ConfigManager.getConfigProperties found {classesWithConfigProps.Count} classes:");
  135. classesWithConfigProps.ToList ().ForEach (x => Debug.WriteLine ($" Class: {x.Key}"));
  136. foreach (var p in from c in classesWithConfigProps
  137. let props = c.Value.GetProperties (BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public).Where (prop =>
  138. prop.GetCustomAttribute (typeof (SerializableConfigurationProperty)) is SerializableConfigurationProperty)
  139. let enumerable = props
  140. from p in enumerable
  141. select p) {
  142. if (p.GetCustomAttribute (typeof (SerializableConfigurationProperty)) is SerializableConfigurationProperty scp) {
  143. if (p.GetGetMethod (true)!.IsStatic) {
  144. // If the class name is omitted, JsonPropertyName is allowed.
  145. _allConfigProperties!.Add (scp.OmitClassName ? ConfigProperty.GetJsonPropertyName (p) : $"{p.DeclaringType?.Name}.{p.Name}", new ConfigProperty {
  146. PropertyInfo = p,
  147. PropertyValue = null
  148. });
  149. } else {
  150. throw new Exception ($"Property {p.Name} in class {p.DeclaringType?.Name} is not static. All SerializableConfigurationProperty properties must be static.");
  151. }
  152. }
  153. }
  154. _allConfigProperties = _allConfigProperties!.OrderBy (x => x.Key).ToDictionary (x => x.Key, x => x.Value, StringComparer.InvariantCultureIgnoreCase);
  155. Debug.WriteLine ($"ConfigManager.Initialize found {_allConfigProperties.Count} properties:");
  156. //_allConfigProperties.ToList ().ForEach (x => Debug.WriteLine ($" Property: {x.Key}"));
  157. AppSettings = new AppScope ();
  158. }
  159. /// <summary>
  160. /// Creates a JSON document with the configuration specified.
  161. /// </summary>
  162. /// <returns></returns>
  163. internal static string ToJson ()
  164. {
  165. Debug.WriteLine ($"ConfigurationManager.ToJson()");
  166. return JsonSerializer.Serialize<SettingsScope> (Settings!, _serializerOptions);
  167. }
  168. internal static Stream ToStream ()
  169. {
  170. var json = JsonSerializer.Serialize<SettingsScope> (Settings!, _serializerOptions);
  171. // turn it into a stream
  172. var stream = new MemoryStream ();
  173. var writer = new StreamWriter (stream);
  174. writer.Write (json);
  175. writer.Flush ();
  176. stream.Position = 0;
  177. return stream;
  178. }
  179. /// <summary>
  180. /// Gets or sets whether the <see cref="ConfigurationManager"/> should throw an exception if it encounters
  181. /// an error on deserialization. If <see langword="false"/> (the default), the error is logged and printed to the
  182. /// console when <see cref="Application.Shutdown"/> is called.
  183. /// </summary>
  184. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))]
  185. public static bool? ThrowOnJsonErrors { get; set; } = false;
  186. internal static StringBuilder jsonErrors = new StringBuilder ();
  187. internal static void AddJsonError (string error)
  188. {
  189. Debug.WriteLine ($"ConfigurationManager: {error}");
  190. jsonErrors.AppendLine (error);
  191. }
  192. /// <summary>
  193. /// Prints any Json deserialization errors that occurred during deserialization to the console.
  194. /// </summary>
  195. public static void PrintJsonErrors ()
  196. {
  197. if (jsonErrors.Length > 0) {
  198. Console.WriteLine ($"Terminal.Gui ConfigurationManager encountered the following errors while deserializing configuration files:");
  199. Console.WriteLine (jsonErrors.ToString ());
  200. }
  201. }
  202. private static void ClearJsonErrors ()
  203. {
  204. jsonErrors.Clear ();
  205. }
  206. /// <summary>
  207. /// Called when the configuration has been updated from a configuration file. Invokes the <see cref="Updated"/>
  208. /// event.
  209. /// </summary>
  210. public static void OnUpdated ()
  211. {
  212. Debug.WriteLine ($"ConfigurationManager.OnApplied()");
  213. Updated?.Invoke (null, new ConfigurationManagerEventArgs ());
  214. }
  215. /// <summary>
  216. /// Event fired when the configuration has been updated from a configuration source.
  217. /// application.
  218. /// </summary>
  219. public static event EventHandler<ConfigurationManagerEventArgs>? Updated;
  220. /// <summary>
  221. /// Resets the state of <see cref="ConfigurationManager"/>. Should be called whenever a new app session
  222. /// (e.g. in <see cref="Application.Init(ConsoleDriver)"/> starts. Called by <see cref="Load"/>
  223. /// if the <c>reset</c> parameter is <see langword="true"/>.
  224. /// </summary>
  225. /// <remarks>
  226. ///
  227. /// </remarks>
  228. public static void Reset ()
  229. {
  230. Debug.WriteLine ($"ConfigurationManager.Reset()");
  231. if (_allConfigProperties == null) {
  232. ConfigurationManager.Initialize ();
  233. }
  234. ClearJsonErrors ();
  235. Settings = new SettingsScope ();
  236. ThemeManager.Reset ();
  237. AppSettings = new AppScope ();
  238. // To enable some unit tests, we only load from resources if the flag is set
  239. if (Locations.HasFlag (ConfigLocations.DefaultOnly)) {
  240. Settings.UpdateFromResource (typeof (ConfigurationManager).Assembly, $"Terminal.Gui.Resources.{_configFilename}");
  241. }
  242. Apply ();
  243. ThemeManager.Themes? [ThemeManager.SelectedTheme]?.Apply ();
  244. AppSettings?.Apply ();
  245. }
  246. /// <summary>
  247. /// Retrieves the hard coded default settings from the Terminal.Gui library implementation. Used in development of
  248. /// the library to generate the default configuration file. Before calling Application.Init, make sure
  249. /// <see cref="Locations"/> is set to <see cref="ConfigLocations.None"/>.
  250. /// </summary>
  251. /// <remarks>
  252. /// <para>
  253. /// This method is only really useful when using ConfigurationManagerTests
  254. /// to generate the JSON doc that is embedded into Terminal.Gui (during development).
  255. /// </para>
  256. /// <para>
  257. /// WARNING: The <c>Terminal.Gui.Resources.config.json</c> resource has setting definitions (Themes)
  258. /// that are NOT generated by this function. If you use this function to regenerate <c>Terminal.Gui.Resources.config.json</c>,
  259. /// make sure you copy the Theme definitions from the existing <c>Terminal.Gui.Resources.config.json</c> file.
  260. /// </para>
  261. /// </remarks>
  262. internal static void GetHardCodedDefaults ()
  263. {
  264. if (_allConfigProperties == null) {
  265. throw new InvalidOperationException ("Initialize must be called first.");
  266. }
  267. Settings = new SettingsScope ();
  268. ThemeManager.GetHardCodedDefaults ();
  269. AppSettings?.RetrieveValues ();
  270. foreach (var p in Settings!.Where (cp => cp.Value.PropertyInfo != null)) {
  271. Settings! [p.Key].PropertyValue = p.Value.PropertyInfo?.GetValue (null);
  272. }
  273. }
  274. /// <summary>
  275. /// Applies the configuration settings to the running <see cref="Application"/> instance.
  276. /// </summary>
  277. public static void Apply ()
  278. {
  279. var settings = false;
  280. var themes = false;
  281. var appSettings = false;
  282. try {
  283. settings = Settings?.Apply () ?? false;
  284. themes = !string.IsNullOrEmpty (ThemeManager.SelectedTheme) && (ThemeManager.Themes? [ThemeManager.SelectedTheme]?.Apply () ?? false);
  285. appSettings = AppSettings?.Apply () ?? false;
  286. } catch (JsonException e) {
  287. if (ThrowOnJsonErrors ?? false) {
  288. throw;
  289. } else {
  290. AddJsonError ($"Error applying Configuration Change: {e.Message}");
  291. }
  292. } finally {
  293. if (settings || themes || appSettings) {
  294. OnApplied ();
  295. }
  296. }
  297. }
  298. /// <summary>
  299. /// Called when an updated configuration has been applied to the
  300. /// application. Fires the <see cref="Applied"/> event.
  301. /// </summary>
  302. public static void OnApplied ()
  303. {
  304. Debug.WriteLine ($"ConfigurationManager.OnApplied()");
  305. Applied?.Invoke (null, new ConfigurationManagerEventArgs ());
  306. // TODO: Refactor ConfigurationManager to not use an event handler for this.
  307. // Instead, have it call a method on any class appropriately attributed
  308. // to update the cached values. See Issue #2871
  309. }
  310. /// <summary>
  311. /// Event fired when an updated configuration has been applied to the
  312. /// application.
  313. /// </summary>
  314. public static event EventHandler<ConfigurationManagerEventArgs>? Applied;
  315. /// <summary>
  316. /// Name of the running application. By default this property is set to the application's assembly name.
  317. /// </summary>
  318. public static string AppName { get; set; } = Assembly.GetEntryAssembly ()?.FullName?.Split (',') [0]?.Trim ()!;
  319. /// <summary>
  320. /// Describes the location of the configuration files. The constants can be
  321. /// combined (bitwise) to specify multiple locations.
  322. /// </summary>
  323. [Flags]
  324. public enum ConfigLocations {
  325. /// <summary>
  326. /// No configuration will be loaded.
  327. /// </summary>
  328. /// <remarks>
  329. /// Used for development and testing only. For Terminal,Gui to function properly, at least
  330. /// <see cref="DefaultOnly"/> should be set.
  331. /// </remarks>
  332. None = 0,
  333. /// <summary>
  334. /// Global configuration in <c>Terminal.Gui.dll</c>'s resources (<c>Terminal.Gui.Resources.config.json</c>) -- Lowest Precidence.
  335. /// </summary>
  336. DefaultOnly,
  337. /// <summary>
  338. /// This constant is a combination of all locations
  339. /// </summary>
  340. All = -1
  341. }
  342. /// <summary>
  343. /// Gets and sets the locations where <see cref="ConfigurationManager"/> will look for config files.
  344. /// The value is <see cref="ConfigLocations.All"/>.
  345. /// </summary>
  346. public static ConfigLocations Locations { get; set; } = ConfigLocations.All;
  347. /// <summary>
  348. /// Loads all settings found in the various configuration storage locations to
  349. /// the <see cref="ConfigurationManager"/>. Optionally,
  350. /// resets all settings attributed with <see cref="SerializableConfigurationProperty"/> to the defaults.
  351. /// </summary>
  352. /// <remarks>
  353. /// Use <see cref="Apply"/> to cause the loaded settings to be applied to the running application.
  354. /// </remarks>
  355. /// <param name="reset">If <see langword="true"/> the state of <see cref="ConfigurationManager"/> will
  356. /// be reset to the defaults.</param>
  357. public static void Load (bool reset = false)
  358. {
  359. Debug.WriteLine ($"ConfigurationManager.Load()");
  360. if (reset) Reset ();
  361. // LibraryResources is always loaded by Reset
  362. if (Locations == ConfigLocations.All) {
  363. var embeddedStylesResourceName = Assembly.GetEntryAssembly ()?
  364. .GetManifestResourceNames ().FirstOrDefault (x => x.EndsWith (_configFilename));
  365. if (string.IsNullOrEmpty (embeddedStylesResourceName)) {
  366. embeddedStylesResourceName = _configFilename;
  367. }
  368. Settings = Settings?
  369. // Global current directory
  370. .Update ($"./.tui/{_configFilename}")?
  371. // Global home directory
  372. .Update ($"~/.tui/{_configFilename}")?
  373. // App resources
  374. .UpdateFromResource (Assembly.GetEntryAssembly ()!, embeddedStylesResourceName!)?
  375. // App current directory
  376. .Update ($"./.tui/{AppName}.{_configFilename}")?
  377. // App home directory
  378. .Update ($"~/.tui/{AppName}.{_configFilename}");
  379. }
  380. }
  381. /// <summary>
  382. /// Returns an empty Json document with just the $schema tag.
  383. /// </summary>
  384. /// <returns></returns>
  385. public static string GetEmptyJson ()
  386. {
  387. var emptyScope = new SettingsScope ();
  388. emptyScope.Clear ();
  389. return JsonSerializer.Serialize<SettingsScope> (emptyScope, _serializerOptions);
  390. }
  391. /// <summary>
  392. /// System.Text.Json does not support copying a deserialized object to an existing instance.
  393. /// To work around this, we implement a 'deep, memberwise copy' method.
  394. /// </summary>
  395. /// <remarks>
  396. /// TOOD: When System.Text.Json implements `PopulateObject` revisit
  397. /// https://github.com/dotnet/corefx/issues/37627
  398. /// </remarks>
  399. /// <param name="source"></param>
  400. /// <param name="destination"></param>
  401. /// <returns><paramref name="destination"/> updated from <paramref name="source"/></returns>
  402. internal static object? DeepMemberwiseCopy (object? source, object? destination)
  403. {
  404. if (destination == null) {
  405. throw new ArgumentNullException (nameof (destination));
  406. }
  407. if (source == null) {
  408. return null!;
  409. }
  410. if (source.GetType () == typeof (SettingsScope)) {
  411. return ((SettingsScope)destination).Update ((SettingsScope)source);
  412. }
  413. if (source.GetType () == typeof (ThemeScope)) {
  414. return ((ThemeScope)destination).Update ((ThemeScope)source);
  415. }
  416. if (source.GetType () == typeof (AppScope)) {
  417. return ((AppScope)destination).Update ((AppScope)source);
  418. }
  419. // If value type, just use copy constructor.
  420. if (source.GetType ().IsValueType || source.GetType () == typeof (string)) {
  421. return source;
  422. }
  423. // Dictionary
  424. if (source.GetType ().IsGenericType && source.GetType ().GetGenericTypeDefinition ().IsAssignableFrom (typeof (Dictionary<,>))) {
  425. foreach (var srcKey in ((IDictionary)source).Keys) {
  426. if (srcKey is string) {
  427. }
  428. if (((IDictionary)destination).Contains (srcKey))
  429. ((IDictionary)destination) [srcKey] = DeepMemberwiseCopy (((IDictionary)source) [srcKey], ((IDictionary)destination) [srcKey]);
  430. else {
  431. ((IDictionary)destination).Add (srcKey, ((IDictionary)source) [srcKey]);
  432. }
  433. }
  434. return destination;
  435. }
  436. // ALl other object types
  437. var sourceProps = source?.GetType ().GetProperties ().Where (x => x.CanRead).ToList ();
  438. var destProps = destination?.GetType ().GetProperties ().Where (x => x.CanWrite).ToList ()!;
  439. foreach (var (sourceProp, destProp) in
  440. from sourceProp in sourceProps
  441. where destProps.Any (x => x.Name == sourceProp.Name)
  442. let destProp = destProps.First (x => x.Name == sourceProp.Name)
  443. where destProp.CanWrite
  444. select (sourceProp, destProp)) {
  445. var sourceVal = sourceProp.GetValue (source);
  446. var destVal = destProp.GetValue (destination);
  447. if (sourceVal != null) {
  448. if (destVal != null) {
  449. // Recurse
  450. destProp.SetValue (destination, DeepMemberwiseCopy (sourceVal, destVal));
  451. } else {
  452. destProp.SetValue (destination, sourceVal);
  453. }
  454. }
  455. }
  456. return destination!;
  457. }
  458. //public class ConfiguraitonLocation
  459. //{
  460. // public string Name { get; set; } = string.Empty;
  461. // public string? Path { get; set; }
  462. // public async Task<SettingsScope> UpdateAsync (Stream stream)
  463. // {
  464. // var scope = await JsonSerializer.DeserializeAsync<SettingsScope> (stream, serializerOptions);
  465. // if (scope != null) {
  466. // ConfigurationManager.Settings?.UpdateFrom (scope);
  467. // return scope;
  468. // }
  469. // return new SettingsScope ();
  470. // }
  471. //}
  472. //public class StreamConfiguration {
  473. // private bool _reset;
  474. // public StreamConfiguration (bool reset)
  475. // {
  476. // _reset = reset;
  477. // }
  478. // public StreamConfiguration UpdateAppResources ()
  479. // {
  480. // if (Locations.HasFlag (ConfigLocations.AppResources)) LoadAppResources ();
  481. // return this;
  482. // }
  483. // public StreamConfiguration UpdateAppDirectory ()
  484. // {
  485. // if (Locations.HasFlag (ConfigLocations.AppDirectory)) LoadAppDirectory ();
  486. // return this;
  487. // }
  488. // // Additional update methods for each location here
  489. // private void LoadAppResources ()
  490. // {
  491. // // Load AppResources logic here
  492. // }
  493. // private void LoadAppDirectory ()
  494. // {
  495. // // Load AppDirectory logic here
  496. // }
  497. //}
  498. }