void Load(ConfigNode cfgNode) { if (cfgNode.HasNode("DefaultImageConfig")) { DefaultImageSettings = ImageSettings.Combine(ImageSettings.FromConfigNode(cfgNode.GetNode("DefaultImageConfig")), DefaultImageSettings); } if (cfgNode.HasNode("ActivityInterface")) { var uiNode = cfgNode.GetNode("ActivityInterface"); Current.UI_DelayBeforeShowingActivityUI = uiNode.GetValue("SecondsBeforeShowing", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeShowingActivityUI); Current.UI_DelayBeforeHidingActivityUI = uiNode.GetValue("SecondsBeforeHiding", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeHidingActivityUI); } UI_TryUseToolbarForDebugUI = cfgNode.GetValue("TryUseToolbarForDebugUI", text => bool.Parse(text), UI_TryUseToolbarForDebugUI); UI_DisplayDebugUI = cfgNode.GetValue("ShowDebugUI", text => bool.Parse(text), UI_DisplayDebugUI); Debug_DontLoadEditorCatalogThumbnailParts = cfgNode.GetValue("DontLoadEditorCatalogParts", text => bool.Parse(text), Debug_DontLoadEditorCatalogThumbnailParts); if (cfgNode.HasNode("Cache")) { var cache = cfgNode.GetNode("Cache"); foreach (ConfigNode node in cache.nodes) { var el = ImageConfigItem.FromConfigNode(node); Current.CachedDataPerResUrl[el.FileUrl] = el; if (el.CacheKey != null) { Current.CachedDataPerKey[el.CacheKey] = el; } } } }
ImageConfigItem addFileToCache(string key, UrlDir.UrlFile file) { var item = new ImageConfigItem(key, file); item.clearCache(GetCacheDirectory()); CachedDataPerKey.Add(key, item); CachedDataPerResUrl.Add(item.FileUrl, item); IsDirty = true; return(item); }
void Load(ConfigNode cfgNode) { if (cfgNode.HasNode("Thumbnail")) { var thumbNode = cfgNode.GetNode("Thumbnail"); Current.ThumbnailEnabled = thumbNode.GetValue("Enabled", s => bool.Parse(s), Current.ThumbnailEnabled); Current.ThumbnailWidth = thumbNode.GetValue("Width", s => int.Parse(s), Current.ThumbnailWidth); Current.ThumbnailHeight = thumbNode.GetValue("Height", s => int.Parse(s), Current.ThumbnailHeight); Current.ThumbnailFormat = thumbNode.GetValue("Format", s => { switch (s) { case "DXT5": return(TextureFormat.DXT5); case "ARGB32": default: return(TextureFormat.ARGB32); } }, Current.ThumbnailFormat); } if (cfgNode.HasNode("ActivityInterface")) { var uiNode = cfgNode.GetNode("ActivityInterface"); Current.UI_DelayBeforeShowingActivityUI = uiNode.GetValue("SecondsBeforeShowing", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeShowingActivityUI); Current.UI_DelayBeforeHidingActivityUI = uiNode.GetValue("SecondsBeforeHiding", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeHidingActivityUI); } UI_TryUseToolbarForDebugUI = cfgNode.GetValue("TryUseToolbarForDebugUI", text => bool.Parse(text), UI_TryUseToolbarForDebugUI); UI_DisplayDebugUI = cfgNode.GetValue("ShowDebugUI", text => bool.Parse(text), UI_DisplayDebugUI); Debug_DontLoadEditorCatalogThumbnailParts = cfgNode.GetValue("DontLoadEditorCatalogParts", text => bool.Parse(text), Debug_DontLoadEditorCatalogThumbnailParts); Current.CompressTextures = cfgNode.GetValue("CompressTextures", s => bool.Parse(s), Current.CompressTextures); if (cfgNode.HasNode("Cache")) { var cache = cfgNode.GetNode("Cache"); foreach (ConfigNode node in cache.nodes) { var el = ImageConfigItem.FromConfigNode(node); Current.CachedDataPerResUrl[el.FileUrl] = el; if (el.CacheKey != null) { Current.CachedDataPerKey[el.CacheKey] = el; } } } }