示例#1
0
        /// <summary>
        /// Creates a new <see cref="FileSystemServer"/>.
        /// </summary>
        /// <param name="config">The configuration for the created <see cref="FileSystemServer"/>.</param>
        public FileSystemServer(FileSystemServerConfig config)
        {
            if (config.FsCreators == null)
            {
                throw new ArgumentException("FsCreators must not be null");
            }

            if (config.DeviceOperator == null)
            {
                throw new ArgumentException("DeviceOperator must not be null");
            }

            ExternalKeySet externalKeySet = config.ExternalKeySet ?? new ExternalKeySet();

            Timer = config.TimeSpanGenerator ?? new StopWatchTimeSpanGenerator();

            FsProxyCore = new FileSystemProxyCore(config.FsCreators, externalKeySet, config.DeviceOperator);
            var fsProxy = new FileSystemProxy(FsProxyCore, this);

            FsClient = new FileSystemClient(this, fsProxy, Timer);

            // NS usually takes care of this
            if (FsClient.IsSdCardInserted())
            {
                FsClient.SetSdCardAccessibility(true);
            }

            SaveDataIndexerManager = new SaveDataIndexerManager(FsClient, SaveIndexerId);

            fsProxy.CleanUpTemporaryStorage().IgnoreResult();
        }
示例#2
0
        /// <summary>
        /// Creates a new <see cref="FileSystemServer"/>.
        /// </summary>
        /// <param name="config">The configuration for the created <see cref="FileSystemServer"/>.</param>
        public FileSystemServer(FileSystemServerConfig config)
        {
            if (config.FsCreators == null)
            {
                throw new ArgumentException("FsCreators must not be null");
            }

            if (config.DeviceOperator == null)
            {
                throw new ArgumentException("DeviceOperator must not be null");
            }

            ExternalKeySet     externalKeySet = config.ExternalKeySet ?? new ExternalKeySet();
            ITimeSpanGenerator timer          = config.TimeSpanGenerator ?? new StopWatchTimeSpanGenerator();

            FsProxyCore = new FileSystemProxyCore(config.FsCreators, externalKeySet, config.DeviceOperator);
            FsClient    = new FileSystemClient(this, timer);
            Timer       = timer;

            SaveDataIndexerManager = new SaveDataIndexerManager(FsClient, SaveIndexerId);
        }