示例#1
0
        public ServerResponse addFtpServer(FtpServerInfo ftpServerInfo)
        {
            Request        request  = new Request();
            ServerResponse response = null;

            request.action = "AddFtpServer";
            List <string> bindingAddresses = new List <string>();

            foreach (string address in ftpServerInfo.bindingAddresses)
            {
                if (address.Equals("*(All IP address)"))
                {
                    bindingAddresses.Add("*");
                }
                else
                {
                    bindingAddresses.Add(address);
                }
            }
            ftpServerInfo.bindingAddresses     = bindingAddresses;
            request.ObjectMap["ftpServerInfo"] = ftpServerInfo;
            _websocket.Send(messageCoder.aesEncode(jss.Serialize(request)));
            _messageReceivedEvent.WaitOne();
            if (String.IsNullOrEmpty(errorMessage))
            {
                response = jss.Deserialize <ServerResponse>(jss.Serialize(serverResponse));
            }
            else
            {
                disConnect();
                websocketException = new Exception("An exception occurs when adding a FTP Server.");
                throw websocketException;
            }
            return(response);
        }
示例#2
0
        public AdminServer()
        {
            jss          = new JavaScriptSerializer();
            messageCoder = new MessageCoder();
            string log4netConfigFilePath = AppDomain.CurrentDomain.BaseDirectory + "log4net.config";

            XmlConfigurator.Configure(new FileInfo(log4netConfigFilePath));

            FtpServerInfo ftpServerInfo = new FtpServerInfo();

            ftpServerInfo.serverId    = "QQKK";
            ftpServerInfo.description = "陳大文";
            ftpServerList.Add(ftpServerInfo.serverId, ftpServerInfo);

            ftpServerInfo             = new FtpServerInfo();
            ftpServerInfo.serverId    = "4466";
            ftpServerInfo.description = "張三_李四";
            ftpServerList.Add(ftpServerInfo.serverId, ftpServerInfo);
        }
示例#3
0
        public FtpServerInfo getInitialFtpServerInfo()
        {
            FtpServerInfo result  = null;
            Request       request = new Request();

            request.action = "GetInitialFtpServerInfo";
            _websocket.Send(messageCoder.aesEncode(jss.Serialize(request)));
            _messageReceivedEvent.WaitOne();
            if (String.IsNullOrEmpty(errorMessage))
            {
                result = jss.Deserialize <FtpServerInfo>(jss.Serialize(serverResponse.returnObjects["ftpServerInfo"]));
            }
            else
            {
                disConnect();
                websocketException = new Exception("An exception occurs when getting the Initial FtpServer Info.");
                throw websocketException;
            }
            return(result);
        }