public static bool _StopLiveSource_PublishingPoint(string aPublishingpoint) { BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingpoint); bool tempresult = false; if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Started) { if (PP._IssueCommand(tempPP, PublishingPointCommand.Stop) == true) { tempresult = true; } //esta apagado already } } return(tempresult); }
public bool _StartPublishingPoint(string aPublishingpoint) { BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingpoint); bool tempresult = false; if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Started) { //esta encendido already tempresult = true; } else { //compruebo que la operacion se realizo if (PP._IssueCommand(tempPP, PublishingPointCommand.Start) == true) { tempresult = true; } else { //hubo problemas al realizar la operacion tempresult = false; } } } return(tempresult); }
public bool CreatePublishingPoint(BLLPublishingPoint publishingPoint, string title, string duration, LiveSourceType type) { bool retVal = false; using (var manager = new ServerManager()) { Site site = manager.Sites[publishingPoint.SiteName]; Application application = site.Applications[publishingPoint.Path]; string template = string.Format("TEMPLATE.xml", title, type, duration ?? string.Empty); try { string path = string.Format(@"{0}\{1}", application.VirtualDirectories[0].PhysicalPath, publishingPoint.Name); File.WriteAllText(path, template); retVal = true; } catch (Exception ex) { Debug.Print(ex.Message); } } return(retVal); }
public static BLLPublishingPoint _GetPublishingPointByName(string PublishingPointName) { List <BLLPublishingPoint> templist = GetPublishingPoints(); BLLPublishingPoint tempresult = new BLLPublishingPoint(); // Recojo solo el nombre del Publishing point de la ruta completa (Ej. solo extraigo canales.isml de http://38.100.207.193/channels/canales.isml) string ParsedPublishingPointName = ParsePublishingPointName(PublishingPointName); foreach (BLLPublishingPoint tempPP in templist) { if (tempPP.Name == ParsedPublishingPointName) { tempresult = tempPP; break; } } if (tempresult.Name != null) { return(tempresult); } else { return(null); } }
public static bool DeletePPoint(string PPointid) { var ppoint = PpointRepository.GetPPoint(PPointid); PpointRepository.DeletePPoint(PPointid); return(BLLPublishingPoint.DeletePublishingPointPTM(ppoint.IIS_NAME)); }
public static bool _RestartPublishingPoint(string aPublishingPoint) { bool tempResult = false; bool operationresult; BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingPoint); if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Idle) { //esta apagado already } else { //compruebo que la operacion se realizo if (PP._IssueCommand(tempPP, PublishingPointCommand.Shutdown) == true) { } else { //hubo problemas al realizar la operacion tempResult = false; } } //inicio el publishing point if (PP._IssueCommand(tempPP, PublishingPointCommand.Start) == true) { } else { //hubo problemas al realizar la operacion tempResult = false; } //encuesto de nuevo el publishing point para asegurarme que esta en estado correcto para recibir transmisiones BLLPublishingPoint tempComprobarPP = _GetPublishingPointByName(aPublishingPoint); if (tempComprobarPP.PubState == PublishingPointState.Starting) { //se reinicio satisfactoriamente tempResult = true; } } 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); }
public static bool CreatePPoint(tppoint post) { PpointRepository.CreatePPoint(post); return(BLLPublishingPoint.CreatePublishingPointPTM(post.IIS_NAME, post.AMS_URL, true)); }
public bool _StartPublishingPoint(string aPublishingpoint) { BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingpoint); bool tempresult = false; if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Started) { //esta encendido already tempresult = true; } else { //compruebo que la operacion se realizo if (PP._IssueCommand(tempPP, PublishingPointCommand.Start) == true) { tempresult = true; } else { //hubo problemas al realizar la operacion 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; }
public bool CreatePublishingPoint(BLLPublishingPoint publishingPoint, string title, string duration, LiveSourceType type) { bool retVal = false; using (var manager = new ServerManager()) { Site site = manager.Sites[publishingPoint.SiteName]; Application application = site.Applications[publishingPoint.Path]; string template = string.Format("TEMPLATE.xml", title, type, duration ?? string.Empty); try { string path = string.Format(@"{0}\{1}", application.VirtualDirectories[0].PhysicalPath, publishingPoint.Name); File.WriteAllText(path, template); retVal = true; } catch (Exception ex) { Debug.Print(ex.Message); } } return retVal; }
public static bool _StopLiveSource_PublishingPoint(string aPublishingpoint) { BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingpoint); bool tempresult = false; if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Started) { if (PP._IssueCommand(tempPP, PublishingPointCommand.Stop) == true) { tempresult = true; } //esta apagado already } } return tempresult; }
public static bool _RestartPublishingPoint(string aPublishingPoint) { bool tempResult = false; bool operationresult; BLLPublishingPoint tempPP = _GetPublishingPointByName(aPublishingPoint); if (tempPP == null) { // Devuelvo falso, el publishing point que busco no existe } else { BLLPublishingPoint PP = new BLLPublishingPoint(); //paro el publishing point if (tempPP.PubState == PublishingPointState.Idle) { //esta apagado already } else { //compruebo que la operacion se realizo if (PP._IssueCommand(tempPP, PublishingPointCommand.Shutdown) == true) { } else { //hubo problemas al realizar la operacion tempResult = false; } } //inicio el publishing point if (PP._IssueCommand(tempPP, PublishingPointCommand.Start) == true) { } else { //hubo problemas al realizar la operacion tempResult = false; } //encuesto de nuevo el publishing point para asegurarme que esta en estado correcto para recibir transmisiones BLLPublishingPoint tempComprobarPP = _GetPublishingPointByName(aPublishingPoint); if (tempComprobarPP.PubState == PublishingPointState.Starting) { //se reinicio satisfactoriamente tempResult = true; } } return tempResult; }
public static BLLPublishingPoint _GetPublishingPointByName(string PublishingPointName) { List<BLLPublishingPoint> templist = GetPublishingPoints(); BLLPublishingPoint tempresult = new BLLPublishingPoint(); // Recojo solo el nombre del Publishing point de la ruta completa (Ej. solo extraigo canales.isml de http://38.100.207.193/channels/canales.isml) string ParsedPublishingPointName = ParsePublishingPointName(PublishingPointName); foreach (BLLPublishingPoint tempPP in templist) { if (tempPP.Name == ParsedPublishingPointName) { tempresult = tempPP; break; } } if (tempresult.Name != null) { return tempresult; } else { return null; } }