public bool _IssueCommand(BLLPublishingPoint publishingPoint, PublishingPointCommand command) { bool tempresult = true; try { using (var serverManager = new ServerManager()) { Configuration appHost = serverManager.GetApplicationHostConfiguration(); ConfigurationSection liveStreamingConfig = appHost.GetSection(LIVESTREAMINGSECTION); if (liveStreamingConfig == null) { throw new Exception("Couldn't get to the live streaming section."); } ConfigurationMethodInstance instance = liveStreamingConfig.Methods[METHODGETPUBPOINTS].CreateInstance(); instance.Input[ATTR_SITENAME] = publishingPoint.SiteName; instance.Input[ATTR_VIRTUALPATH] = publishingPoint.Path; instance.Execute(); // Gets the PublishingPointCollection associated with the method output ConfigurationElement collection = instance.Output.GetCollection(); foreach (var item in collection.GetCollection()) { if (item.Attributes[ATTR_NAME].Value.ToString().Equals(publishingPoint.Name)) { var method = item.Methods[command.ToString()]; var methodInstance = method.CreateInstance(); methodInstance.Execute(); break; } } } } catch { tempresult = false; } return(tempresult); }
public bool _IssueCommand(BLLPublishingPoint publishingPoint, PublishingPointCommand command) { bool tempresult = true; try { using (var serverManager = new ServerManager()) { Configuration appHost = serverManager.GetApplicationHostConfiguration(); ConfigurationSection liveStreamingConfig = appHost.GetSection(LIVESTREAMINGSECTION); if (liveStreamingConfig == null) { throw new Exception("Couldn't get to the live streaming section."); } ConfigurationMethodInstance instance = liveStreamingConfig.Methods[METHODGETPUBPOINTS].CreateInstance(); instance.Input[ATTR_SITENAME] = publishingPoint.SiteName; instance.Input[ATTR_VIRTUALPATH] = publishingPoint.Path; instance.Execute(); // Gets the PublishingPointCollection associated with the method output ConfigurationElement collection = instance.Output.GetCollection(); foreach (var item in collection.GetCollection()) { if (item.Attributes[ATTR_NAME].Value.ToString().Equals(publishingPoint.Name)) { var method = item.Methods[command.ToString()]; var methodInstance = method.CreateInstance(); methodInstance.Execute(); break; } } } } catch { tempresult = false; } return tempresult; }