/// <summary> /// Registers an instance. /// </summary> /// <param name="type"></param> /// <param name="title"></param> /// <param name="instance"></param> public bool RegisterInstance(string type, string title, object instance) { bool success = false; try { register.RegisterInstance(type, title, instance); success = true; } catch (ArgumentNullException e) { ExceptionHandler.LogException("Instance and/or type parameter are null.", e); } catch (ArgumentException e) { ExceptionHandler.LogException("Id may not be null.", e); } return(success); }
/// <summary> /// Creates a new client and saves it to the configuration. (No exception handling!) /// </summary> /// <param name="type">Type of the new client instance.</param> /// <param name="title">Unique title of the new client instance.</param> /// <param name="host">Address of the remote server for the client instance.</param> /// <param name="port">Port of the remote server for the client instance.</param> /// <param name="user">User on the remote server for the client instance.</param> /// <param name="password">Password of user on the remote server for the client instance.</param> /// <returns>True if client was created.</returns> public bool CreateClientInstance(InstanceType type, string title, string host, int port, string user, string password) { if (type != InstanceType.Unknown) { IProtocolManager manager; switch (type) { case InstanceType.FtpsClient: manager = new FtpsRemoteManager(host, port, user, password); break; default: return(false); } register.RegisterInstance(type, title, manager); return(true); } return(false); }