void Init() { _serverConfig = FTPServerConfigManager.Get(); skinWaterTextBox1.Text = _serverConfig.IP.ToString(); skinWaterTextBox2.Text = _serverConfig.Port.ToString(); if (_serverConfig.Users == null) { _serverConfig.Users = new ConcurrentDictionary <string, FTPUser>(); } if (!_serverConfig.Users.Any()) { _serverConfig.Users.TryAdd("anonymous", new FTPUser("anonymous", "*****@*****.**", "c:\\")); FTPServerConfigManager.Save(); } _ftpServerUsers = SerializeHelper.Deserialize <List <FtpServerUser> >(SerializeHelper.Serialize(_serverConfig.Users.Values)); dataGridView1.DataSource = null; dataGridView1.DataSource = _ftpServerUsers; dataGridView1.AllowUserToAddRows = true; }
public FTPServer(string ip, ushort port = 21, int bufferSize = 10240) { _serverConfig = FTPServerConfigManager.Get(); _serverConfig.Port = port; _serverConfig.BufferSize = bufferSize; FTPServerConfigManager.Save(); _cmdSocket = new ServerSocket(_serverConfig); _cmdSocket.OnReceived += _serverSocket_OnReceived; }