示例#1
0
		/// <summary>
		/// 提交命令
		/// </summary>
		/// <param name="data">shellstruct数据</param>
		/// <param name="funcNameXpath">xpath表示的方法名(/cmder/readfile)</param>
		/// <param name="param"></param>
		public static byte[] SubmitCommand(Shell data, string funcNameXpath, string[] param)
		{
			var shellType = CustomShellTypeProvider.GetShellType(data.ShellType);
			var customCommandCode = new CustomCommandCode(shellType, data.ShellPwd);
			var commandCode = customCommandCode.GetCode(funcNameXpath, param);

			var httpClient = new HttpClient(GetHttpHeader(data));
			return httpClient.SubmitCommandByPost(data.ShellUrl, commandCode);
		}
示例#2
0
		public static byte[] SubmitCommand(Shell data,
								string funcNameXpath, string[] param,
								bool isBindUploadProgressChangedEvent,
								bool isBindDownloadProgressChangedEvent)
		{
			CustomShellType shellType = CustomShellTypeProvider.GetShellType(data.ShellType);
			CustomCommandCode customCommandCode = new CustomCommandCode(shellType, data.ShellPwd);
			Dictionary<string, string> commandCode = customCommandCode.GetCode(funcNameXpath, param);
			HttpClient httpClient = new HttpClient();
			//if (isBindUploadProgressChangedEvent)
			//    httpClient.UploadFileProgressChangedToDo += httpClient_UploadFileProgressChangedToDo;
			//if (isBindDownloadProgressChangedEvent)
			//    httpClient.DownloadFileProgressChangedToDo += httpClient_DownloadFileProgressChangedToDo;
			return httpClient.SubmitCommandByPost(data.ShellUrl, commandCode);
		}