/// <summary> /// 查询远程服务器上的应用程序信息 /// </summary> /// <param name="appName">app程序名称</param> /// <param name="type">类型</param> /// <param name="serAdress">远程服务器地址</param> /// <returns>应用程序信息</returns> public ActionResult QueryRemoteAppInfoByName(string appName, string type, string serAdress) { List <AppView> res = new List <AppView>(); switch (type.ToUpper()) { case "IIS": res = IISHelper.GetAllRemoteIISAppInfo(serAdress); break; case "EXE": res = ExeHelper.GetRemoteExeAppInfoByName(appName, serAdress); break; } return(new MyJsonResult { Data = res }); }
public static void Execute2() { When("the method is executed", () => { var result = 0; Act(() => { result = ExeHelper.Execute( ExeSimulatorPath.ExePath, $"WriteOutput=false ExitCode=0", string.Empty); }); Should("return success exit code", () => { Assert.That(result, Is.Zero); }); }); }
/// <summary> /// 读取程序列表 /// </summary> /// <param name="type">程序类型</param> /// <param name="appName">程序名称</param> /// <returns>程序列表</returns> public ActionResult QueryAllApp(string type, string appName) { List <AppView> res = new List <AppView>(); switch (type.ToUpper()) { case "IIS": // iis res = IISHelper.GetAllIISAppInfo(); break; case "EXE": // exe res = ExeHelper.GetAllExeAppInfo(); break; default: break; } return(new MyJsonResult { Data = res.Where(n => n.AppAlias.Contains(appName) || n.AppName.Contains(appName)) }); }
/// <summary> /// 获取所有EXE程序信息 /// </summary> /// <returns></returns> public string GetAllExeAppView() { return(ExeHelper.GetAllExeAppInfo().SerializeObject()); }
private void userButton1_Click(object sender, EventArgs e) { ExeHelper.AutoUpdateName = Assembly.GetExecutingAssembly().GetName().Version + @"\123.exe"; ExeHelper.AutoUpdate(); }
public static void Execute1() { When("the method is executed", () => { var extractOutput = false; ExeResult result = null; string exePath = null; Exception thrownException = null; Act(() => { try { result = ExeHelper.Execute( exePath, $"WriteOutput={extractOutput} ExitCode=1", extractOutput, string.Empty, 200); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) #pragma warning restore CA1031 // Do not catch general exception types { thrownException = e; } }); And("executable file name is specified", () => { exePath = ExeSimulatorPath.ExePath; And("output should be extracted", () => { extractOutput = true; Should("return result with extracted output", () => { Assert.That(result.ExitCode, Is.EqualTo(1)); Assert.That(result.Error, Contains.Substring("-error-")); Assert.That(result.Output, Contains.Substring("-output-")); }); }); And("output should not be extracted", () => { extractOutput = false; Should("return result without extracted output", () => { Assert.That(result.ExitCode, Is.EqualTo(1)); Assert.That(result.Error, Is.Null); Assert.That(result.Output, Is.Null); }); }); }); And("executable file name is not specified", () => { exePath = null; Should("throw the InvalidOperationException", () => { Assert.That(thrownException, Is.InstanceOf <InvalidOperationException>()); }); }); }); }
public void GetAllExeAppViewTest() { var res = ExeHelper.GetAllExeAppInfo(); Assert.Fail(); }
private void SearchTB_LostFocus(object sender, RoutedEventArgs e) { ExeHelper.KillExe("handinput"); }
private void SearchTB_GotFocus(object sender, RoutedEventArgs e) { ExeHelper.StartExe(AppHelper.AppStartupPath + @"\HandInput\1.1.0.282\handinput.exe"); }