本文整理汇总了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;
}
示例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();
}
示例3: GetBaseQueueName
static string GetBaseQueueName(IConfigurationProvider configurationProvider, HostSettings hostSettings)
{
string baseQueueName;
if (configurationProvider.TryGetSetting(QueueNameKey, out baseQueueName))
return baseQueueName;
return hostSettings.ServiceName.Replace(" ", "_");
}
示例4: SpHostServiceInstaller
public SpHostServiceInstaller(HostSettings settings, HostConfigurator configurator)
{
_hostConfigurator = configurator;
_installer = CreateInstaller(settings);
_transactedInstaller = CreateTransactedInstaller(_installer);
}
示例5: ServiceHandleProxy
public ServiceHandleProxy(HostSettings settings, HostControl hostControl, ServiceBuilderFactory serviceBuilderFactory)
{
_settings = settings;
_hostControl = new HostControlProxy(hostControl);
_serviceBuilderFactory = serviceBuilderFactory;
_service = CreateServiceInAppDomain();
}
示例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);
}
示例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;
}
示例8: CreateSuperviseService
SuperviseService CreateSuperviseService(HostSettings settings)
{
var service = new SuperviseService(settings, _serviceBuilderFactory);
ServiceAvailability serviceAvailability = new DownFileServiceAvailability(service);
service.AddServiceAvailability(serviceAvailability);
return service;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
}
示例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);
}
示例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);
}