/// <summary> /// Gets the DataDownloader /// </summary> /// <param name="factory">ObjectsFactory instance</param> /// <returns>a DataDownloader instance.</returns> internal static DataDownloader GetDownloader(this ObjectsFactory factory) { if (factory.FactoryVersion < new Version(LocalDataStore.Factory_Supported_Version)) { throw new NotSupportedException("factory doesn't support this version"); } return(new DataDownloader()); }
/// <summary> /// Gets FtpRemoteClient. /// </summary> /// <param name="factory">ObjectsFactory instance</param> /// <param name="remoteAddress">remote FTP address instance</param> /// <returns>a FtpRemoteClient instance</returns> internal static FtpRemoteClient GetFtpRemoteClient(this ObjectsFactory factory, RemoteAddress remoteAddress) { if (factory.FactoryVersion < new Version(HttpRemoteClient.Factory_Supported_Version)) { throw new NotSupportedException("factory doesn't support this version"); } if (remoteAddress.Protocol.ToLower() == "ftp") { return(new FtpRemoteClient(remoteAddress)); } else { throw new NotSupportedException("Protocol Not Supported!"); } }
/// <summary> /// Gets FtpRemoteClient. /// </summary> /// <param name="factory">ObjectsFactory instance</param> /// <param name="remoteAddress">remote HTTP/HTTPS address</param> /// <returns>a HttpRemoteClient instance</returns> internal static HttpRemoteClient GetHttpRemoteClient(this ObjectsFactory factory, string remoteAddress) { if (factory.FactoryVersion < new Version(HttpRemoteClient.Factory_Supported_Version)) { throw new NotSupportedException("factory doesn't support this version"); } RemoteAddress address = new RemoteAddress(remoteAddress); if (address.Protocol.ToLower() == "http" || address.Protocol.ToLower() == "https") { return(new HttpRemoteClient(address)); } else { throw new NotSupportedException("Protocol Not Supported!"); } }
/// <summary> /// Gets LocalDataStore. /// </summary> /// <param name="factory">ObjectsFactory instance</param> /// <param name="location">local storage location</param> /// <returns></returns> internal static LocalDataStore GetLocalDataStore(this ObjectsFactory factory, string location) { if (factory.FactoryVersion < new Version(LocalDataStore.Factory_Supported_Version)) { throw new NotSupportedException("factory doesn't support this version"); } Match match = Regex.Match(location, @"(?<drive>[a-z][:][\\])", RegexOptions.IgnoreCase); if (match.Success) { return(new LocalDataStore(location)); } else { throw new NotSupportedException("location not supported"); } }
static ObjectsFactory() { Factory = new ObjectsFactory(); }