private void loginButton_Click(object sender, EventArgs e)
 {
     if (isAllInputValid())
     {
         if (adminServerList.ContainsKey(adminServerName + ":" + adminPortNo))
         {
             MessageBox.Show(this, "The specified server have been added", "Alert");
         }
         else
         {
             Cursor.Current = Cursors.WaitCursor;
             adminServer    = new AdminServer();
             if (adminServer.connect(adminServerName, adminPortNo))
             {
                 if (adminServer.login(adminUserName, adminUserPassword))
                 {
                     this.DialogResult = DialogResult.OK;
                     Cursor.Current    = Cursors.Default;
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show(this, "Invalid admin. user or password", "Alert");
                 }
             }
             else
             {
                 MessageBox.Show(this, "Invalid admin. server name or port no.", "Alert");
             }
             Cursor.Current = Cursors.Default;
         }
     }
 }
示例#2
0
        internal void refreshRootNode()
        {
            splitContainer.SelectNextControl((Control)splitContainer, true, true, true, true);
            treeView.BeginUpdate();

            rootNode.Nodes.Clear();
            foreach (string key in adminServerManager.adminServerList.Keys)
            {
                AdminServer     adminServer     = adminServerManager.adminServerList[key];
                AdminServerNode adminServerNode = new AdminServerNode(adminServer, this);
                adminServerNode.init(uiObjFactory.getObj("adminServerNode"), key);
                foreach (string id in adminServerNode.toolStripItemList.Keys)
                {
                    ToolStripMenuItem tSI = adminServerNode.toolStripItemList[id].ToObject <ToolStripMenuItem>();
                    tSI.Click += (sender, e) => MessageBox.Show(adminServer.serverName + ":" + adminServer.portNo);
                    adminServerNode.ContextMenuStrip.Items.Add(tSI);
                }
                adminServerNode.ContextMenuStrip.ImageList = imageList;
                rootNode.Nodes.Add(adminServerNode);
                if (key == adminServerManager.lastServerKey)
                {
                    treeView.SelectedNode = adminServerNode;
                    adminServerNode.doSelect();
                    adminServerNode.Expand();
                }
            }
            treeView.EndUpdate();
        }
示例#3
0
        private void popupAddFTPServerDialog(string adminServerKey)
        {
            AdminServer adminServer = ftpAdminClient.adminServerList[adminServerKey];
            AddFtpForm  addFtpForm  = new AddFtpForm(adminServer);

            addFtpForm.ShowDialog();
            adminServer.addFtpServer(addFtpForm.ftpServerInfo);
        }
示例#4
0
        private void ftpServerHandler(string serverKey)
        {
            AdminServer adminServer = ftpAdminClient.adminServerList[serverKey];
            SortedDictionary <string, FtpServerInfo> ftpServerList = adminServer.getFTPServerList();

            if (ftpServerList.Count == 0)
            {
                Ui_Utility.initFTPServerList(settingList, serverKey);
            }
        }
示例#5
0
        private static ItemNode buildFtpServerListNode(AdminServer adminServer)
        {
            ItemNode ftpServerListNode = new ItemNode();

            ftpServerListNode.Text               = "FTP Server List";
            ftpServerListNode.Name               = "ftpServerList";
            ftpServerListNode.ImageIndex         = 3;
            ftpServerListNode.SelectedImageIndex = 3;
            ftpServerListNode.Description        = "All FTP server that under the remote server administration.";
            return(ftpServerListNode);
        }
示例#6
0
        internal static ItemNode buildAdminServerNode(AdminServer adminServer)
        {
            ItemNode adminServerNode = new ItemNode();
            string   key             = adminServer.serverName + ":" + adminServer.portNo;

            adminServerNode.Text               = key;
            adminServerNode.Name               = "adminServer";
            adminServerNode.ImageIndex         = 2;
            adminServerNode.SelectedImageIndex = 2;

            ContextMenuStrip adminTopMenu = new ContextMenuStrip();

            adminServerNode.Nodes.Add(buildAdministrationNode(adminServer));
            adminServerNode.Nodes.Add(buildFtpServerListNode(adminServer));
            adminServerNode.ContextMenuStrip = adminTopMenu;

            return(adminServerNode);
        }
示例#7
0
        private static ItemNode buildAdministrationNode(AdminServer adminServer)
        {
            ItemNode administrationNode = new ItemNode();

            administrationNode.Text               = "Administration";
            administrationNode.ImageIndex         = 7;
            administrationNode.SelectedImageIndex = 7;
            administrationNode.Name               = "administration";
            administrationNode.Description        = "Manage admin. server";

            ItemNode adminUserListNode = new ItemNode();

            adminUserListNode.Text               = "Admin. Users";
            adminUserListNode.ImageIndex         = 6;
            adminUserListNode.SelectedImageIndex = 6;
            adminUserListNode.Name               = "adminUser";
            adminUserListNode.Description        = "Manage admin. user";
            administrationNode.Nodes.Add(adminUserListNode);

            return(administrationNode);
        }
示例#8
0
        internal void refreshFtpServerListNode(AdminServer adminServer, FtpServerListNode ftpServerListNode)
        {
            SortedDictionary <string, FtpServerInfo> ftpServerList = adminServer.getFTPServerList();

            ftpServerListNode.Nodes.Clear();
            foreach (string serverId in ftpServerList.Keys)
            {
                FtpServerNode ftpServerNode = new FtpServerNode(adminServer, this, serverId);
                FtpServerInfo fI            = ftpServerList[serverId];
                ftpServerNode.init(uiObjFactory.getObj("ftpServerNode"));
                foreach (string key in ftpServerNode.toolStripItemList.Keys)
                {
                    ToolStripMenuItem tSI = ftpServerNode.toolStripItemList[key].ToObject <ToolStripMenuItem>();
                    tSI.Click += (sender, e) => MessageBox.Show(serverId);
                    ftpServerNode.ContextMenuStrip.Items.Add(tSI);
                }
                ftpServerNode.ContextMenuStrip.ImageList = imageList;
                ftpServerNode.Text = fI.description;
                ftpServerNode.Name = serverId;
                ftpServerListNode.Nodes.Add(ftpServerNode);
            }
        }
        public int addRemoteServer(string adminServerName, int adminPortNo, string adminUserName, string adminUserPassword)
        {
            int result = 0;

            try
            {
                if (adminServerList.ContainsKey(adminServerName + ":" + adminPortNo))
                {
                    result = 1;
                }
                else
                {
                    AdminServer adminServer = new AdminServer();
                    if (adminServer.connect(adminServerName, adminPortNo))
                    {
                        if (adminServer.login(adminUserName, adminUserPassword))
                        {
                            adminServerList.Add(adminServerName + ":" + adminPortNo, adminServer);
                            lastServerKey = adminServerName + ":" + adminPortNo;
                        }
                        else
                        {
                            result = 3;
                        }
                    }
                    else
                    {
                        result = 2;
                    }
                }
            }
            catch (Exception err)
            {
                throw new Exception("An error occurs when login to admin. server:" + err.Message);
            }
            return(result);
        }
示例#10
0
 public AdminServerNode(AdminServer adminServer, UIManager uiManager) : base(adminServer, uiManager)
 {
 }
示例#11
0
 public AddFtpForm(AdminServer adminServer)
 {
     InitializeComponent();
     this.adminServer = adminServer;
 }
示例#12
0
 public FtpServerNode(AdminServer adminServer, UIManager uiManager, string serverId) : base(adminServer, uiManager)
 {
     this.serverId = serverId;
 }
示例#13
0
 internal RootNode(AdminServer adminServer, UIManager uiManager) : base(adminServer, uiManager)
 {
 }
示例#14
0
        static void Main(string[] args)
        {
            //string portRange = "5000,1000,5100-5200,7744,4333";
            //string portRange = "5100,1234";

            /*string portRange = "5100-5200";
             * Console.Write(Utility.isValidPassiveModePortRange(portRange));*/
            AdminServer adminServer = new AdminServer();

            try
            {
                if (adminServer.connect("localhost", 4466))
                {
                    if (adminServer.login("admin", "password"))
                    {
                        FtpServerInfo ftpServerInfo = new FtpServerInfo();
                        ftpServerInfo.description          = "哈爾濱佛教大學";
                        ftpServerInfo.controlPort          = 21;
                        ftpServerInfo.passiveModeEnabled   = true;
                        ftpServerInfo.passiveModePortRange = "666,32767-40000,7809";
                        ftpServerInfo.bindingAddresses     = new List <string>(new string[] { "127.0.0.1", "10.53.11.32" });
                        adminServer.addFtpServer(ftpServerInfo);

                        /*
                         * Console.WriteLine("Wait 10 Second");
                         * System.Threading.Thread.Sleep(10000);
                         * SortedDictionary<string, FtpServerInfo> result = adminServer.getFTPServerList();
                         * Console.WriteLine(result.Count);
                         * FtpServerInfo ftpServerInfo = adminServer.getInitialFtpServerInfo();
                         * Console.WriteLine("FTP server Id:");
                         * Console.WriteLine(ftpServerInfo.serverId);
                         *
                         * Console.WriteLine("FTP server description:");
                         * Console.WriteLine(ftpServerInfo.description);
                         *
                         * Console.WriteLine("FTP server control port:");
                         * Console.WriteLine(ftpServerInfo.controlPort);
                         *
                         * Console.WriteLine("FTP server is passive mode enabled:");
                         * Console.WriteLine(ftpServerInfo.passiveModeEnabled);
                         *
                         * Console.WriteLine("FTP server passive mode port range:");
                         * Console.WriteLine(ftpServerInfo.passiveModePortRange);
                         *
                         * Console.WriteLine("User List:");
                         * FtpUserInfo ftpUserInfo;
                         * foreach (string key in ftpServerInfo.ftpUserInfoList.Keys)
                         * {
                         *  ftpUserInfo = ftpServerInfo.ftpUserInfoList[key];
                         *  Console.WriteLine("Id={0},Name={1},user Id={2}", key, ftpUserInfo.userName, ftpUserInfo.userId);
                         * }
                         * Console.WriteLine("Binding Address List:");
                         * foreach (BindingAddress ba in ftpServerInfo.bindingAddresses)
                         * {
                         *  Console.WriteLine("IP address={0},is bound={1}", ba.ipAddress, ba.bound);
                         * }*/
                        Console.WriteLine("Done");
                    }
                }
            }
            catch (Exception err)
            {
                logger.Error("An Exception occur:" + err.StackTrace);
            }
            finally
            {
                adminServer.disConnect();
            }
            Console.ReadLine();
        }
示例#15
0
 internal FtpServerListNode(AdminServer adminServer, UIManager uiManager) : base(adminServer, uiManager)
 {
 }
 internal AdminUserAdministrationNode(AdminServer adminServer, UIManager uiManager) : base(adminServer, uiManager)
 {
 }
 internal FtpServerNetworkPropertiesNode(AdminServer adminServer, UIManager uiManager, string serverId) : base(adminServer, uiManager)
 {
     this.serverId = serverId;
 }
 public ConnectToServerForm(SortedDictionary <string, AdminServer> adminServerList)
 {
     InitializeComponent();
     adminServer          = null;
     this.adminServerList = adminServerList;
 }
示例#19
0
 internal FtpUserGroupsListNode(AdminServer adminServer, UIManager uiManager, string serverId) : base(adminServer, uiManager)
 {
     this.serverId = serverId;
 }
示例#20
0
文件: Node.cs 项目: KNVB/TreeNodeTest
 internal Node(AdminServer adminServer, UIManager uiManager)
 {
     this.adminServer = adminServer;
     this.uiManager   = uiManager;
 }