Пример #1
0
        public static void AddPlatformSpecificServices(IServiceManager services)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                services
                .AddService(new WindowsFileSystem())
                .AddService(new WindowsProcessServices())
                .AddService(new RegistryImpl())
                .AddService <IRInstallationService, WindowsRInstallation>()
                .AddService(new WindowsPlatformServices());
            }
            else
            {
                var fs = new UnixFileSystem();
                services
                .AddService(new UnixFileSystem());

                if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    services
                    .AddService(new MacProcessServices())
                    .AddService(new MacPlatformServices())
                    .AddService(new RMacInstallation(fs));
                }
                else
                {
                    services
                    .AddService(new LinuxProcessServices())
                    .AddService(new LinuxPlatformServices())
                    .AddService(new RLinuxInstallation(fs));
                }
            }
        }
Пример #2
0
        public override void ConfigureServices(IServiceCollection services) {
            base.ConfigureServices(services);

            var fs = new UnixFileSystem();
            services.AddSingleton<IFileSystem>(fs)
                .AddSingleton<IAuthenticationService, LinuxAuthenticationService>()
                .AddSingleton<IRHostProcessService, LinuxRHostProcessService>()
                .AddSingleton<IRInstallationService, RInstallation>()
                .AddSingleton<ISystemInfoService>(new LinuxSystemInfoService(fs));
        }