public static void StartPushGraphs() { try { StreamSources streamSources = StreamSources.LoadFromFile(false); StartSources startSources = StartSources.LoadFromFile(false); if ((streamSources != null) && (startSources != null)) { foreach (StartSource startSource in startSources.Items) { StreamSourceInfo streamSourceInfo = streamSources.FindSource(startSource.SourceName); if (streamSourceInfo != null) { AppLogger.Message(String.Format("Starting source {0}", streamSourceInfo.SourceName)); if (streamSourceInfo.DeviceAddress != null) { AppLogger.Message(String.Format("Starting Channel={0} Input={1}", streamSourceInfo.DeviceAddress.Channel, streamSourceInfo.DeviceAddress.Input)); } OpenGraphRequest openGraphRequest = new OpenGraphRequest(); openGraphRequest.Id = Guid.NewGuid(); openGraphRequest.SourceName = streamSourceInfo.SourceName; openGraphRequest.UserName = "******"; BaseGraph graph = BaseGraph.CreateInstance(streamSourceInfo, openGraphRequest); graph.Run(); if (graph != null) { _graphMap.Add(streamSourceInfo.SourceName, graph); } } } } } catch (Exception e) { AppLogger.Dump(e); } }
public static void StartGraph(string sourceName) { if (_graphMap.ContainsKey(sourceName) == false) { StreamSources streamSources = StreamSources.LoadFromFile(false); if (streamSources != null) { StreamSourceInfo streamSourceInfo = streamSources.FindSource(sourceName); if (streamSourceInfo != null) { OpenGraphRequest openGraphRequest = new OpenGraphRequest(); openGraphRequest.Id = Guid.NewGuid(); openGraphRequest.SourceName = streamSourceInfo.SourceName; openGraphRequest.UserName = "******"; BaseGraph graph = BaseGraph.CreateInstance(streamSourceInfo, openGraphRequest); graph.Run(); if (graph != null) { _graphMap.Add(streamSourceInfo.SourceName, graph); } } } } }