Topshelf.Runtime.Linux.LinuxHostServiceInstallerImpl.CreateServiceSettings C# (CSharp) Method

CreateServiceSettings() private static method

private static CreateServiceSettings ( HostSettings settings, string commandLine ) : System.ServiceProcess.Linux.LinuxServiceSettings
settings HostSettings
commandLine string
return System.ServiceProcess.Linux.LinuxServiceSettings
        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;
        }