Esempio n. 1
0
        /// <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);
            }
        }
Esempio n. 2
0
        /// <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);
            }
        }
Esempio n. 3
0
 /// <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)
 {
 }
Esempio n. 4
0
 /// <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)
 {
 }
Esempio n. 5
0
 /// <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)
 {
 }
Esempio n. 6
0
 /// <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)
 {
 }
Esempio n. 7
0
 /// <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)
 {
 }
Esempio n. 8
0
 /// <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));
 }