public ExtensionTreeNode(ExtensionContainer extensionContainer) { if (extensionContainer == null) { throw new ArgumentNullException(nameof(extensionContainer)); } ExtensionContainer = extensionContainer; Text = $"Extension: {extensionContainer.Extension.Name} (version {extensionContainer.Extension.Version})"; }
private void LoadConfiguration() { if (File.Exists(configFile) == false) { return; } XDocument doc; try { doc = XDocument.Load(configFile); } catch { return; } foreach (XElement module in doc.Elements("modules").Elements("module")) { Module existingModule = null; try { string moduleFileName = (string)module.Attribute("filename"); string moduleAssemblyName = (string)module.Attribute("assembly"); existingModule = Modules.FirstOrDefault(m => Path.GetFileName(m.ModuleFilename) == moduleFileName && m.Assembly.FullName == moduleAssemblyName); } catch { } if (existingModule == null) { continue; } foreach (XElement ext in module.Elements("extension")) { try { var extType = (string)ext.Attribute("type"); var extName = (string)ext.Attribute("name"); var extVersion = (int)ext.Attribute("version"); ExtensionContainer existingExtension = existingModule.Extensions.FirstOrDefault(x => x.Extension.GetType().FullName == extType && x.Extension.Name == extName && x.Extension.Version == extVersion); if (existingExtension == null) { continue; } var buttons = (int)ext.Attribute("buttons"); existingExtension.ButtonsMask = (Buttons)buttons; } catch { } } } }