/// <summary> /// Initializes a new instance of the <see cref="T:ChattelReader"/> class. /// If local storage is enabled, but no local storage instance was passed in, automatically sets up and uses the AssetStorageSimpleFolderTree for local storage. /// If purgeLocalStorage is set, purges all assets in the storage. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <param name="localStorage">Instance of the IChattelLocalStorage interface. If left null, then the default AssetStorageSimpleFolderTree will be instantiated.</param> /// <param name="purgeLocalStorage">Whether or not to attempt to purge local storage.</param> public ChattelReader(ChattelConfiguration config, IChattelLocalStorage localStorage, bool purgeLocalStorage) { _config = config ?? throw new ArgumentNullException(nameof(config)); if (_config.LocalStorageEnabled) { _localStorage = localStorage ?? new AssetStorageSimpleFolderTree(config); } if (purgeLocalStorage) { _localStorage?.PurgeAll(null); } }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelWriter"/> class. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <param name="localStorage">Instance of the IChattelLocalStorage interface. If left null, then the default AssetStorageSimpleFolderTree will be instantiated.</param> /// <param name="purgeLocalStorage">Whether or not to attempt to purge local storage.</param> /// <exception cref="!:ChattelConfigurationException">Thrown if the are pending assets to be sent upstream and there are no upstream servers configured.</exception> public ChattelWriter(ChattelConfiguration config, IChattelLocalStorage localStorage, bool purgeLocalStorage) { _config = config ?? throw new ArgumentNullException(nameof(config)); if (config.LocalStorageEnabled) { _localStorage = localStorage ?? new AssetStorageSimpleFolderTree(config); } if (purgeLocalStorage) { _localStorage?.PurgeAll(null); } if (config.LocalStorageEnabled && config.WriteCacheFile != null) { _writeCache = new WriteCache(config.WriteCacheFile, config.WriteCacheRecordCount, this, localStorage); } }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelReader"/> class. /// Automatically sets up and uses the AssetStorageSimpleFolderTree. /// </summary> /// <param name="config">Instance of the configuration class.</param> public ChattelReader(ChattelConfiguration config) : this(config, new AssetStorageSimpleFolderTree(config), false) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelReader"/> class. /// Automatically sets up and uses the AssetStorageSimpleFolderTree. /// If purgeLocalStorage is set, purges all assets in the storage for local storage. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <param name="purgeLocalStorage">Whether or not to attempt to purge local storage.</param> public ChattelReader(ChattelConfiguration config, bool purgeLocalStorage) : this(config, config?.LocalStorageEnabled ?? false ? new AssetStorageSimpleFolderTree(config) : null, purgeLocalStorage) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelReader"/> class. /// If local storage is enabled, but no local storage instance was passed in, automatically sets up and uses the AssetStorageSimpleFolderTree for local storage. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <param name="localStorage">Instance of the IChattelLocalStorage interface. If left null, then the default AssetStorageSimpleFolderTree will be instantiated.</param> public ChattelReader(ChattelConfiguration config, IChattelLocalStorage localStorage) : this(config, localStorage, false) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelWriter"/> class. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <exception cref="!:ChattelConfigurationException">Thrown if the are pending assets to be sent upstream and there are no upstream servers configured.</exception> public ChattelWriter(ChattelConfiguration config) : this(config, null, false) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelWriter"/> class. /// </summary> /// <param name="config">Instance of the configuration class.</param> /// <param name="purgeLocalStorage">Whether or not to attempt to purge local storage.</param> /// <exception cref="!:ChattelConfigurationException">Thrown if the are pending assets to be sent upstream and there are no upstream servers configured.</exception> public ChattelWriter(ChattelConfiguration config, bool purgeLocalStorage) : this(config, null, purgeLocalStorage) { }
/// <summary> /// Initializes a new instance of the <see cref="T:ChattelReader"/> class. /// </summary> /// <param name="config">Instance of the configuration class.</param> public AssetStorageSimpleFolderTree(ChattelConfiguration config) { _config = config ?? throw new ArgumentNullException(nameof(config)); }