当前位置: 首页>>代码示例>>C#>>正文


C# HostSettings类代码示例

本文整理汇总了C#中HostSettings的典型用法代码示例。如果您正苦于以下问题:C# HostSettings类的具体用法?C# HostSettings怎么用?C# HostSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HostSettings类属于命名空间,在下文中一共展示了HostSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateServiceSettings

        private static LinuxServiceSettings CreateServiceSettings(HostSettings settings, string commandLine)
        {
            var currentAssembly = Assembly.GetEntryAssembly();

            if (currentAssembly == null)
            {
                throw new InstallException(Resources.ServiceMustBeExecutableFile);
            }

            var serviceName = settings.Name;

            if (!string.IsNullOrEmpty(settings.InstanceName))
            {
                serviceName += "@" + settings.InstanceName;
            }

            var result = new LinuxServiceSettings
            {
                ServiceName = serviceName,
                DisplayName = settings.DisplayName,
                Description = settings.Description,
                ServiceExe = currentAssembly.Location,
                ServiceArgs = commandLine
            };

            var installSettings = settings as InstallHostSettings;

            if (installSettings != null)
            {
                result.Username = installSettings.Credentials?.Username;
                result.Dependencies = installSettings.Dependencies;
            }

            return result;
        }
开发者ID:AlexMAS,项目名称:Topshelf.Unix,代码行数:35,代码来源:LinuxHostServiceInstallerImpl.cs

示例2: Run

        static void Run(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var statistics = new HostStatistics();

            var eye = new Beholder.Eyes.SharpDX11.Winforms.WinformsEye();
            var graphicsWindowHandle = eye.CreateNewWindow(200, 150, "Stream", true);
            var colorFormatInfo = eye.Adapters[0].GetSupportedWindowedDisplayFormats().First(x => x.ExplicitFormat == ExplicitFormat.R8G8B8A8_UNORM);
            #if DEBUG
            var deviceFlags = DeviceInitializationFlags.Debug;
            #else
            var deviceFlags = DeviceInitializationFlags.None;
            #endif
            eye.Initialize(eye.Adapters[0], graphicsWindowHandle, new SwapChainDescription(2, colorFormatInfo.ID, false, 0, Sampling.NoMultisampling, true), deviceFlags, new StraightforwardFileSystem());
            var device = eye.Device;

            var pclWorkarounds = new PclWorkarounds();
            var byteArrayPool = new ByteArrayPool();

            var logger = new FileLogger();
            var settings = new HostSettings();
            var globalEvents = new HostGlobalEvents();

            var broadcaster = settings.FromFile
                ? (IStreamBroadcaster)new FileStreamBroadcaster()
                : new TcpStreamBroadcaster(settings, globalEvents, logger);
            var broadcastingStage = new BroadcastStage(broadcaster);
            var cpuSideCodec = new CpuSideCodec(pclWorkarounds, byteArrayPool);
            var cpuCompressionStage = new CpuCompressionStage(statistics, cpuSideCodec);
            var gpuReadBackStage = new GpuReadBackStage(statistics, device, byteArrayPool, 1);
            var debugStage = new DebugStage(device);
            var gpuProcessingStage = new GpuProcessingStage(device);
            //var screenCaptor = new ScreenCaptor9(statistics, device);
            var screenCaptor = new ScreenCaptor11(statistics, device);
            var mainLoop = new MainLoop(statistics, globalEvents, device, screenCaptor);

            PipelineBuilder
                .BeginWith(mainLoop)
                .ContinueWith(gpuProcessingStage)
                //.ContinueWith(debugStage)
                .ContinueWith(gpuReadBackStage)
                .ContinueWith(cpuCompressionStage)
                .EndWith(broadcastingStage);

            broadcaster.Start();
            cpuCompressionStage.Start();

            eye.NewFrame += mainLoop.OnNewFrame;

            statistics.ShowForm();

            using (mainLoop)
            using (eye)
                eye.RunLoop(device.PrimarySwapChain.Window);

            cpuCompressionStage.Stop();
            broadcaster.Stop();
        }
开发者ID:Zulkir,项目名称:RAVC,代码行数:60,代码来源:Program.cs

示例3: GetBaseQueueName

        static string GetBaseQueueName(IConfigurationProvider configurationProvider, HostSettings hostSettings)
        {
            string baseQueueName;
            if (configurationProvider.TryGetSetting(QueueNameKey, out baseQueueName))
                return baseQueueName;

            return hostSettings.ServiceName.Replace(" ", "_");
        }
开发者ID:kinpro,项目名称:RapidTransit,代码行数:8,代码来源:HostServiceBusConfigurationSettings.cs

示例4: SpHostServiceInstaller

        public SpHostServiceInstaller(HostSettings settings, HostConfigurator configurator)
        {
            _hostConfigurator = configurator;

            _installer = CreateInstaller(settings);

            _transactedInstaller = CreateTransactedInstaller(_installer);
        }
开发者ID:r1pper,项目名称:Topshelf.StartParameters,代码行数:8,代码来源:SpHostServiceInstaller.cs

示例5: ServiceHandleProxy

        public ServiceHandleProxy(HostSettings settings, HostControl hostControl, ServiceBuilderFactory serviceBuilderFactory)
        {
            _settings = settings;
            _hostControl = new HostControlProxy(hostControl);
            _serviceBuilderFactory = serviceBuilderFactory;

            _service = CreateServiceInAppDomain();
        }
开发者ID:CharlieBP,项目名称:Topshelf,代码行数:8,代码来源:ServiceHandleProxy.cs

示例6: UninstallService

        public void UninstallService(HostSettings settings, Action beforeUninstall, Action afterUninstall)
        {
            var installer = new WindowsHostServiceInstallerImpl();

            Action<InstallEventArgs> tryBeforeUninstall = x => beforeUninstall?.Invoke();
            Action<InstallEventArgs> tryAfterUninstall = x => afterUninstall?.Invoke();

            installer.UninstallService(settings, _arguments, tryBeforeUninstall, tryAfterUninstall);
        }
开发者ID:AlexMAS,项目名称:Topshelf.Unix,代码行数:9,代码来源:WindowsHostEnvironmentImpl.cs

示例7: UninstallHost

 public UninstallHost(HostEnvironment environment, HostSettings settings, IEnumerable<Action> preActions,
     IEnumerable<Action> postActions,
     bool sudo)
 {
     _environment = environment;
     _settings = settings;
     _preActions = preActions;
     _postActions = postActions;
     _sudo = sudo;
 }
开发者ID:fivepmtechnology,项目名称:Topshelf,代码行数:10,代码来源:UninstallHost.cs

示例8: CreateSuperviseService

        SuperviseService CreateSuperviseService(HostSettings settings)
        {

            var service = new SuperviseService(settings, _serviceBuilderFactory);
            
            ServiceAvailability serviceAvailability = new DownFileServiceAvailability(service);
            service.AddServiceAvailability(serviceAvailability);

            return service;
        }
开发者ID:CharlieBP,项目名称:Topshelf,代码行数:10,代码来源:SuperviseServiceBuilder.cs

示例9: ConsoleRunHost

        public ConsoleRunHost(HostSettings settings, HostEnvironment environment, ServiceHandle serviceHandle)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");
            if (environment == null)
                throw new ArgumentNullException("environment");

            _settings = settings;
            _environment = environment;
            _serviceHandle = serviceHandle;
        }
开发者ID:fivepmtechnology,项目名称:Topshelf,代码行数:11,代码来源:ConsoleRunHost.cs

示例10: SuperviseService

        public SuperviseService(HostSettings settings, ServiceBuilderFactory serviceBuilderFactory)
        {
            _settings = settings;
            _serviceBuilderFactory = serviceBuilderFactory;
            _serviceAvailability = new List<ServiceAvailability>();

            _fiber = new PoolFiber();
            _scheduler = new TimerScheduler(new PoolFiber());

            _commandHandlers = CreateCommandHandlers();
        }
开发者ID:CharlieBP,项目名称:Topshelf,代码行数:11,代码来源:SuperviseService.cs

示例11: Create

        public void Create(ServiceBuilderFactory serviceBuilderFactory, HostSettings settings,
            HostLoggerConfigurator loggerConfigurator)
        {
            AppDomain.CurrentDomain.UnhandledException += CatchUnhandledException;

            HostLogger.UseLogger(loggerConfigurator);

            ServiceBuilder serviceBuilder = serviceBuilderFactory(settings);

            _serviceHandle = serviceBuilder.Build(settings);
        }
开发者ID:CharlieBP,项目名称:Topshelf,代码行数:11,代码来源:AppDomainServiceHandle.cs

示例12: WindowsServiceHost

        public WindowsServiceHost(HostEnvironment environment, HostSettings settings, ServiceHandle serviceHandle)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");
            if (serviceHandle == null)
                throw new ArgumentNullException("serviceHandle");

            _settings = settings;
            _serviceHandle = serviceHandle;
            _environment = environment;
        }
开发者ID:fivepmtechnology,项目名称:Topshelf,代码行数:11,代码来源:WindowsServiceHost.cs

示例13: CreateServiceHost

		public Host CreateServiceHost(HostSettings settings, ServiceHandle serviceHandle)
		{
			if (MonoHelper.RunningUnderMonoService)
			{
				return new WindowsServiceHost(this, settings, serviceHandle, configurator);
			}
			else
			{
				// TODO: Implement a service host which execs mono-service under the hood.
				throw new NotImplementedException();
			}
		}
开发者ID:Xamarui,项目名称:Topshelf.Linux,代码行数:12,代码来源:LinuxHostEnvironment.cs

示例14: BuildCommandLine

		private static string BuildCommandLine(HostSettings settings, IDictionary<string, object> arguments)
		{
			arguments = (arguments == null)
				? new Dictionary<string, object>()
				: new Dictionary<string, object>(arguments);

			arguments["instance"] = settings.InstanceName;
			arguments["displayname"] = settings.DisplayName;
			arguments["servicename"] = settings.Name;

			return TopshelfHelper.BuildCommandLine(arguments);
		}
开发者ID:geffzhang,项目名称:Topshelf.Unix,代码行数:12,代码来源:BaseHostServiceInstallerImpl.cs

示例15: CreateUninstaller

		protected override Installer CreateUninstaller(HostSettings settings, string commandLine)
		{
			var baseInstallers = new Installer[]
			{
				CreateServiceInstaller(settings, new string[] {}, HostStartMode.Automatic),
				CreateServiceProcessInstaller(ServiceAccount.LocalService, "", "")
			};

			var mainInstaller = new HostInstaller(settings, commandLine, baseInstallers);

			return CreateTransactedInstaller(mainInstaller);
		}
开发者ID:geffzhang,项目名称:Topshelf.Unix,代码行数:12,代码来源:WindowsHostServiceInstallerImpl.cs


注:本文中的HostSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。