Esempio n. 1
0
        /// <summary>
        /// 提交命令
        /// </summary>
        /// <param name="data">shellstruct数据</param>
        /// <param name="funcNameXpath">xpath表示的方法名(/cmder/readfile)</param>
        /// <param name="param"></param>
        /// <returns></returns>
        private byte[] SubmitCommand(ShellStruct data, string funcNameXpath, string[] param)
        {
            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();

            return(httpClient.SubmitCommandByPost(data.ShellUrl, commandCode));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        /// <summary>
        /// 提交命令
        /// </summary>
        /// <param name="data">shellstruct数据</param>
        /// <param name="funcNameXpath">xpath表示的方法名(/cmder/readfile)</param>
        /// <param name="param"></param>
        public byte[] SubmitCommand(Shell data, string funcNameXpath, string[] param)
        {
            CustomShellType             shellType         = CustomShellTypeProvider.GetShellType(data.ShellType);
            CustomCommandCode           customCommandCode = new CustomCommandCode(shellType, data.ShellPwd);
            Dictionary <string, string> commandCode       = customCommandCode.GetCode(funcNameXpath, param);

            ShellExtra shellExtra = new ShellExtra(data.ShellExtraString);
            HttpClient httpClient = new HttpClient(shellExtra.HttpHeader);

            return(httpClient.SubmitCommandByPost(data.ShellUrl, commandCode));
        }
Esempio n. 4
0
        private byte[] SubmitCommand(ShellStruct 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));
        }