public bool IsEqual(RemoteStorageAccount other) { return (_id == other._id && _plugin.GetUniqueID() == other._plugin.GetUniqueID() && _config.IsEqual(other._config)); }
private void AddComponent(DynamicSettingValue prop, IRemotePlugin plug, ref int row, Grid grid, FrameworkElement comp, bool addLabel = true, FrameworkElement secondElem = null) { grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); if (addLabel) { var label = new TextBlock { Text = prop.Description + ":" }; label.Margin = new Thickness(2); label.VerticalAlignment = VerticalAlignment.Center; Grid.SetRow(label, row); Grid.SetColumn(label, 0); grid.Children.Add(label); } comp.Margin = new Thickness(2); comp.VerticalAlignment = VerticalAlignment.Center; Grid.SetRow(comp, row); Grid.SetColumn(comp, 1); if (secondElem == null) { Grid.SetColumnSpan(comp, 2); } else { secondElem.Margin = new Thickness(2); Grid.SetRow(secondElem, row); Grid.SetColumn(secondElem, 2); grid.Children.Add(secondElem); } grid.Children.Add(comp); if (prop.HelpID != null) { var hlp = new PHelpBtn(); hlp.Margin = new Thickness(2, 0, 2, 0); hlp.VerticalAlignment = VerticalAlignment.Center; hlp.HelpProperty = plug.GetUniqueID().ToString("B") + "::" + prop.HelpID; Grid.SetRow(hlp, row); Grid.SetColumn(hlp, 3); grid.Children.Add(hlp); } row++; }
private void LoadPluginsFromAssembly(string path) { AssemblyName an = AssemblyName.GetAssemblyName(path); Assembly assembly = Assembly.Load(an); if (assembly == null) { throw new Exception("Could not load assembly '" + an.FullName + "'"); } Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.IsInterface || type.IsAbstract) { continue; } if (type.GetInterface(typeof(IRemotePlugin).FullName) != null) { IRemotePlugin instance = (IRemotePlugin)Activator.CreateInstance(type); instance.Init(App.Logger); if (!App.DebugMode) { if (instance.GetVersion().Revision != 0) { App.Logger.Warn("PluginManager", string.Format("Ignore plugin {0}, debug version {1} ({2})", instance.DisplayTitleShort, instance.GetVersion(), instance.GetUniqueID())); continue; } } if (_pluginIDs.Add(instance.GetUniqueID())) { App.Logger.Info("PluginManager", string.Format("Loaded plugin {0} in version {1} ({2})", instance.DisplayTitleShort, instance.GetVersion(), instance.GetUniqueID())); _provider.Add(instance); } else { App.Logger.Error("PluginManager", string.Format("Multiple plugins with the same ID ({0}) found", instance.GetUniqueID())); } } } }