public String Download([In, MarshalAs(UnmanagedType.BStr)] string srvRelLibFolder, [In, MarshalAs(UnmanagedType.BStr)] string clnFullPath, [In, MarshalAs(UnmanagedType.BStr)] string srvProcessor) { //upload.exe /ServerRelPath:"drawLibs" /LocalFullPath:“C:\SmartHomeDesign_x64\2.0\drawLibs\Config.ini” /ServerProcessor:“Raw Copy” String errMsg = ""; String[] args = new String[3]; args[0] = srvRelLibFolder; args[1] = clnFullPath; args[2] = srvProcessor; Dictionary <String, String> arguments = WebUtil.getArguments(args); WebRequestSession _reqSession = new WebRequestSession(); XmlConfig.getInstance().LoadConfig("ServerInfo.xml"); Boolean ssl = (Convert.ToInt32(XmlConfig.getInstance().GetParam("server", "ssl", "1")) > 0); String textBoxServerIP = XmlConfig.getInstance().GetParam("server", "host", "localhost"); // "localhost"; String textBoxPort = XmlConfig.getInstance().GetParam("server", "port", "9443"); //"9443"; String textBoxUser = XmlConfig.getInstance().GetParam("server", "user", "admin"); //"admin"; String textBoxPass = XmlConfig.getInstance().GetParam("server", "pass", ""); //""; if (!_reqSession.Login(ssl, textBoxServerIP, Convert.ToInt32(textBoxPort), textBoxUser, textBoxPass, String.Empty, "此处放机器ID")) { Login login = new Login(); if (login.ShowDialog() == DialogResult.OK) { ssl = (Convert.ToInt32(XmlConfig.getInstance().GetParam("server", "ssl", "1")) > 0); textBoxServerIP = XmlConfig.getInstance().GetParam("server", "host", "localhost"); // "localhost"; textBoxPort = XmlConfig.getInstance().GetParam("server", "port", "9443"); //"9443"; textBoxUser = XmlConfig.getInstance().GetParam("server", "user", "admin"); //"admin"; textBoxPass = XmlConfig.getInstance().GetParam("server", "pass", ""); //""; if (!_reqSession.Login(ssl, textBoxServerIP, Convert.ToInt32(textBoxPort), textBoxUser, textBoxPass, String.Empty, "此处放机器ID")) { errMsg = "客户端登录失败"; //MessageBox.Show("客户端登录失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(errMsg); } } else { errMsg = "客户端登录失败"; //MessageBox.Show("客户端登录失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(errMsg); } } String IsFolder = "1"; String ServerRelPath = ""; String LocalFullPath = ""; String ServerProcessor = ""; if (arguments.ContainsKey("ServerRelPath".ToLower())) { ServerRelPath = arguments["ServerRelPath".ToLower()].Trim(); } if (arguments.ContainsKey("LocalFullPath".ToLower())) { LocalFullPath = arguments["LocalFullPath".ToLower()].Trim(); } if (arguments.ContainsKey("ServerProcessor".ToLower())) { ServerProcessor = arguments["ServerProcessor".ToLower()].Trim(); } if (arguments.ContainsKey("IsFolder".ToLower())) { IsFolder = arguments["IsFolder".ToLower()].Trim(); } StringBuilder filePath = new StringBuilder(); Boolean result = RemoteCall.DownloadFiles(_reqSession, IsFolder, ServerRelPath, LocalFullPath, ServerProcessor); //String template = RemoteCall.GetTemplate(_reqSession); _reqSession.Logout(false); if (result)//!String.IsNullOrEmpty(template)) { //MessageBox.Show("下载成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); return(""); } errMsg = "下载失败"; //MessageBox.Show("下载失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(errMsg); }