public override bool Init(FtpServer server, IServerConfig config) { if (!base.Init(server, config)) { return(false); } var userSettingFile = config.Options.GetValue("userSetting"); if (string.IsNullOrEmpty(userSettingFile)) { server.Logger.Error("No user setting file defined!"); return(false); } List <FtpUser> users; try { users = XmlSerializerUtil.Deserialize <List <FtpUser> >(server.GetFilePath(userSettingFile)); } catch (Exception e) { AppServer.Logger.Error("Failed to deserialize FtpUser list file!", e); return(false); } m_UserDict = users.ToDictionary(u => u.UserName, u => u, StringComparer.OrdinalIgnoreCase); return(true); }
public override bool Init(FtpServer server, IServerConfig config) { if (!base.Init(server, config)) { return(false); } var userSettingFile = config.Options.GetValue("userSetting"); if (string.IsNullOrEmpty(userSettingFile)) { server.Logger.Error("No user setting file was not defined!"); return(false); } if (!Path.IsPathRooted(userSettingFile)) { userSettingFile = server.GetFilePath(userSettingFile); } if (!File.Exists(userSettingFile)) { AppServer.Logger.Error("The userSetting file cannot be found!"); return(false); } m_UserConfigFile = userSettingFile; ReadUserConfigFile(); m_UserConfigReadTimer = new Timer(OnUserConfigReadTimerCallback, null, Timeout.Infinite, Timeout.Infinite); return(true); }