Ejemplo n.º 1
0
 public FileSystemProxyCore(FileSystemProxyConfiguration config, ExternalKeySet externalKeys, IDeviceOperator deviceOperator)
 {
     Config          = config;
     ProgramRegistry = new ProgramRegistryImpl(Config.ProgramRegistryServiceImpl);
     ExternalKeys    = externalKeys ?? new ExternalKeySet();
     DeviceOperator  = deviceOperator;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="FileSystemServer"/> and registers its services using the provided HOS client.
        /// </summary>
        /// <param name="horizonClient">The <see cref="HorizonClient"/> that will be used by this server.</param>
        /// <param name="config">The configuration for the created <see cref="FileSystemServer"/>.</param>
        public FileSystemServer(HorizonClient horizonClient, 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");
            }

            Hos = horizonClient;

            IsDebugMode = false;

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

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

            var fspConfig = new FileSystemProxyConfiguration
            {
                FsCreatorInterfaces        = config.FsCreators,
                ProgramRegistryServiceImpl = new ProgramRegistryServiceImpl(this)
            };

            FsProxyCore = new FileSystemProxyCore(fspConfig, externalKeySet, config.DeviceOperator);

            FsProxyCore.SetSaveDataIndexerManager(new SaveDataIndexerManager(Hos.Fs, SaveIndexerId,
                                                                             new ArrayPoolMemoryResource(), new SdHandleManager(), false));

            FileSystemProxy fsProxy = GetFileSystemProxyServiceObject();

            fsProxy.SetCurrentProcess(Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
            fsProxy.CleanUpTemporaryStorage().IgnoreResult();

            Hos.Sm.RegisterService(new FileSystemProxyService(this), "fsp-srv").IgnoreResult();
            Hos.Sm.RegisterService(new FileSystemProxyForLoaderService(this), "fsp-ldr").IgnoreResult();
            Hos.Sm.RegisterService(new ProgramRegistryService(this), "fsp-pr").IgnoreResult();

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