private bool ingestIsDead(string deviceId, Ingest ingest) { var onPublishList = FastUsefulApis.GetOnPublishMonitorListByDeviceId(deviceId, out ResponseStruct rs); if (onPublishList == null || onPublishList.Count == 0) { return(true); } var client = onPublishList.FindLast(x => !string.IsNullOrEmpty(x.RtspUrl) && x.RtspUrl ! == ingest.Input !.Url !); if (client != null) { if (client.IsOnline == false) { return(true); } return(false); } return(true); }
private void doThing(string deviceId, string vhostDomain, Ingest ingest) { LogWriter.WriteLog("重启设备ID" + deviceId + "下的" + vhostDomain + "下的" + ingest.IngestName + " Ingest"); lock (SrsManageCommon.Common.LockDbObjForOnlineClient) { OrmService.Db.Delete <OnlineClient>().Where(x => x.RtspUrl == ingest.Input !.Url).ExecuteAffrows(); } var retInt = foundProcess(ingest); if (retInt > -1) { try { string cmd = "kill -9 " + retInt.ToString(); LinuxShell.Run(cmd, 1000); } catch (Exception ex) { LogWriter.WriteLog( "重启设备ID" + deviceId + "下的" + vhostDomain + "下的" + ingest.IngestName + " Ingest失败", ex.Message + "\r\n" + ex.StackTrace, ConsoleColor.Yellow); } } ResponseStruct rs = null !; VhostIngestApis.OnOrOffIngest(deviceId, vhostDomain, ingest.IngestName !, false, out rs); SystemApis.RefreshSrsObject(deviceId, out rs); Thread.Sleep(1000); VhostIngestApis.OnOrOffIngest(deviceId, vhostDomain, ingest.IngestName !, true, out rs); SystemApis.RefreshSrsObject(deviceId, out rs); }
public async void RetrieveIngestsTest() { List <Ingest> ingests = await twixel.RetrieveIngests(); Ingest newYork = ingests.FirstOrDefault((ingest) => ingest.name == "US East: New York, NY"); Assert.NotNull(newYork); }
void OnCollisionEnter(Collision other) { Ingest obj = new Ingest(); if (obj.shrink == false) { platform.material.color = Color.white; platform.material.SetColor("_EmissionColor", Color.white); } }
public PutPipelineResponse PutPipeline() { return(Ingest.PutPipeline("attachments", p => p.Description("Document attachment pipeline") .Processors(pr => pr .Attachment <ScientificPaperDocument>(a => a .Field(f => f.Content) .TargetField(f => f.Attachment) ) .Remove <ScientificPaperDocument>(r => r .Field(ff => ff .Field(f => f.Content)))))); }
public async void RetrieveIngestsTest() { List <Ingest> ingests = await twixel.RetrieveIngests(); Ingest newYork = null; foreach (Ingest ingest in ingests) { if (ingest.name == "US East: New York, NY") { newYork = ingest; break; } } Assert.NotNull(newYork); }
private int foundProcess(Ingest ingest) { string url = ingest.Input !.Url !.Replace("&", @"\&"); string cmd = "ps -aux |grep " + url + "|grep -v grep |awk '{print $2}'"; LinuxShell.Run(cmd, 1000, out string sdt, out string err); if (string.IsNullOrEmpty(sdt) && string.IsNullOrEmpty(err)) { return(-1); } if (int.TryParse(sdt, out int i)) { return(i); } if (int.TryParse(err, out int j)) { return(j); } return(-1); }
private static void write_Vhost_Ingest(Ingest o, out string output, int segmentLevel, List <Type> types = null !) { output = ""; string segmentSpace_head = paddingSegment(segmentLevel).Key; string segmentSpace = paddingSegment(segmentLevel).Value; output += segmentSpace_head + o.SectionsName?.ToLower().Trim() + " " + o.IngestName + " { \r\n"; foreach (PropertyInfo p in o.GetType().GetProperties()) { object?obj = p.GetValue(o); if (obj == null) { continue; } if (p.Name.ToLower().Trim() == "sectionsname" || p.Name.Trim().ToLower() == "instancename" || p.Name.ToLower().Trim() == "ingestname") { continue; } if ((p.PropertyType == typeof(string) || p.PropertyType == typeof(int?) || p.PropertyType == typeof(ushort?) || p.PropertyType == typeof(byte?) || p.PropertyType == typeof(float?) || p.PropertyType == typeof(bool?)) || ((types != null) && types.Contains(p.PropertyType))) { if (obj != null) { if (p.PropertyType == typeof(bool?)) { string s = ""; s = Common.GetBoolStr(p, o); string sTmp = segmentSpace + p.Name.Trim().ToLower() + "\t" + s + ";"; output += (sTmp + "\r\n"); } else { string sTmp = segmentSpace + p.Name.Trim().ToLower() + "\t" + obj + ";"; output += (sTmp + "\r\n"); } } } } foreach (PropertyInfo p in o.GetType().GetProperties()) //循环非基础类型数据,为了保证基础类型数据在顶上 { object?obj = p.GetValue(o); if (obj == null) { continue; } if (p.Name.ToLower().Trim() == "sectionsname" || p.Name.ToLower().Trim() == "instancename") { continue; } if (p.PropertyType == typeof(IngestInput)) { string s = ""; List <Type> types2 = new List <Type>(); types2.Add(typeof(IngestInputType?)); write_SubOnly(o.Input, out s, 3, types2); output += s; } if (p.PropertyType == typeof(List <IngestTranscodeEngine>)) { List <Type> types1 = new List <Type>(); types1.Add(typeof(IngestEngineIoformat?)); types1.Add(typeof(IngestEngineVprofile?)); types1.Add(typeof(IngestEngineVpreset?)); if (o.Engines != null) { foreach (IngestTranscodeEngine i in o.Engines) { string s = ""; write_Vhost_Ingest_Engine(i, out s, 3, types1); output += s; } } } } output += segmentSpace_head + "}\r\n"; }
static void Main(string[] args) { List <string> CSharpFiles = Ingest.GenerateFileStructure(args); List <string> contentList = new List <string>(); foreach (string file in CSharpFiles) { Console.Write("\n Processing file {0}\n", System.IO.Path.GetFileName(file)); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file)) { Console.Write("\n Can't open {0}\n\n", args[0]); return; } Console.Write("\n Type and Function Analysis"); Console.Write("\n ----------------------------"); BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); Parser parser = builder.build(); try { while (semi.getSemi()) { parser.parse(semi); } Console.Write("\n locations table contains:"); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } Repository rep = Repository.getInstance(); List <Elem> table = rep.locations; Console.Write( "\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", "category", "name", "bLine", "eLine", "bScop", "eScop", "size", "cmplx" ); Console.Write( "\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", "--------", "----", "-----", "-----", "-----", "-----", "----", "-----" ); List <string> functionList = new List <string>(); foreach (Elem e in table) { if (e.type == "class" || e.type == "struct" || e.type == "Comment") { Console.Write("\n"); } Console.Write("\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", e.type, e.name, e.beginLine, e.endLine, e.beginScopeCount, e.endScopeCount + 1, e.endLine - e.beginLine + 1, e.endScopeCount - e.beginScopeCount + 1 ); if (e.type == "function") { contentList = PostProcessor.getContentBetweenLines(file, e.beginLine, e.endLine); functionList.Add(e.name); } if (e.type == "class" || e.type == "namespace") { PostProcessor.addObjectToFile(e.name, file); } HTML_Builder.buildFileStructure(file, e.type, e.name, e.beginLine, e.endLine, contentList); } PostProcessor.addFileToFileList(functionList, file); Console.Write("\n"); semi.close(); } PostProcessor.buildDependencies(CSharpFiles); HTML_Builder.generateFileList(CSharpFiles); foreach (string file in CSharpFiles) { HTML_Builder.buildPageContent(file.Substring(file.LastIndexOf("\\") + 1), CSharpFiles); } Console.Write("\n\n"); }
public JsonResult SetVhostIngest(string deviceId, string vhostDomain, string ingestInstanceName, Ingest ingest) { ResponseStruct rss = CommonFunctions.CheckParams(new object[] { deviceId, vhostDomain, ingest, ingestInstanceName }); if (rss.Code != ErrorNumber.None) { return(Program.CommonFunctions.DelApisResult(null !, rss)); } var rt = VhostIngestApis.SetVhostIngest(deviceId, vhostDomain, ingestInstanceName, ingest, out ResponseStruct rs); return(Program.CommonFunctions.DelApisResult(rt, rs)); }