public SourceDiscoveryPlugin GetPlugin(FutureConcepts.Media.SourceDiscoveryDefinition sourceDiscovery) { SourceDiscoveryPlugin result = null; if (_plugins.ContainsKey(sourceDiscovery.Name) == false) { switch (sourceDiscovery.Type) { case "MasterSourceDiscovery": result = new MasterSourceDiscoveryPlugin(sourceDiscovery); break; case "WowzaSourceDiscovery": result = new WowzaSourceDiscoveryPlugin(sourceDiscovery); break; case "LocalSourceDiscovery": result = new LocalSourceDiscoveryPlugin(sourceDiscovery); break; case "NetMgrSourceDiscovery": result = new NetMgrSourceDiscoveryPlugin(sourceDiscovery); break; default: throw new NotImplementedException(sourceDiscovery.Type); } _plugins[sourceDiscovery.Name] = result; } else { result = _plugins[sourceDiscovery.Name]; } return(result); }
/// <summary> /// Adds a new <see cref="T:StreamSourceInfo"/> item to the collection. /// </summary> /// <param name="item">item to add</param> public void Add(SourceDiscoveryDefinition item) { if (_items == null) { _items = new List <SourceDiscoveryDefinition>(); } _items.Add(item); }
private void CreateTestConfig() { FileStream file = null; DataContractSerializer serializer = new DataContractSerializer(typeof(SourceDiscoveryConfiguration), new List <Type> { typeof(SourceDiscoveryDefinition) }); String fileName = @"C:\Temp\test.xml"; file = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite); SourceDiscoveryDefinition testdef = new SourceDiscoveryDefinition(); testdef.Name = "Dave"; testdef.Type = "roogy"; testdef.URL = "floor"; testdef.PollInterval = 30000; SourceDiscoveryConfiguration testconfig = new SourceDiscoveryConfiguration(); testconfig.Items = new List <SourceDiscoveryDefinition>(); testconfig.Items.Add(testdef); serializer.WriteObject(file, testconfig); file.Close(); }