Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
pandolia committed Dec 4, 2019
1 parent 3103949 commit c3a472a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion outfiles/lastline.log
@@ -1 +1 @@
[2019-11-28 18:27:02] Stopped SampleWorker(c# version) [2019-12-04 17:04:53] Stopped SampleWorker(c# version)
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -45,7 +45,7 @@ WorkingDir: worker
# 输出目录,程序运行过程的输出将会写到这个目录下面,请确保该目录已存在 # 输出目录,程序运行过程的输出将会写到这个目录下面,请确保该目录已存在
OutFileDir: outfiles OutFileDir: outfiles
# 程序输出的编码,如果不确定,请设为空或 none # 程序输出的编码,如果不确定,请设为空
WorkerEncoding: utf8 WorkerEncoding: utf8
``` ```


Expand Down
9 changes: 5 additions & 4 deletions src/Main.cs
Expand Up @@ -323,7 +323,7 @@ private static string setPassword(string value)
private static string setDescription(string value) private static string setDescription(string value)
{ {
description = removeOuterQuote(value.Trim()); description = removeOuterQuote(value.Trim());
return null; return checkValid(description);
} }


private static string setDisplayName(string value) private static string setDisplayName(string value)
Expand Down Expand Up @@ -365,14 +365,14 @@ private static string readConfig()
private static void showConfig() private static void showConfig()
{ {
Print($"ServiceName: {serviceName}"); Print($"ServiceName: {serviceName}");
Print($"DisplayName: {displayName}");
Print($"Description: {description}");
Print($"Worker: {worker}"); Print($"Worker: {worker}");
Print($"Worker's fileName: {fileName}"); Print($"Worker's fileName: {fileName}");
Print($"Worker's arguments: {arguments}"); Print($"Worker's arguments: {arguments}");
Print($"WorkingDir: {workingDir}"); Print($"WorkingDir: {workingDir}");
Print($"OutFileDir: {outFileDir}"); Print($"OutFileDir: {outFileDir}");
Print($"WorkerEncoding: {workerEncoding}"); Print($"WorkerEncoding: {workerEncoding}");
Print($"Description: {description}");
Print($"DisplayName: {displayName}");
Print($"Domain: {domain}"); Print($"Domain: {domain}");
Print($"User: {user}"); Print($"User: {user}");
Print($"Password: {password}"); Print($"Password: {password}");
Expand Down Expand Up @@ -426,7 +426,8 @@ public static int Main(string[] args)
Print($"Service {name} is already installed!"); Print($"Service {name} is already installed!");
return 1; return 1;
} }
var _args = $"create {name} binPath= \"{BinPath}\" start= auto DisplayName= \"{displayName}\""; var _args = $"create {name} binPath= \"{BinPath}\" start= auto "
+ $"DisplayName= \"{displayName}\"";
if (user.Length > 0) if (user.Length > 0)
{ {
var obj = (domain.Length > 0) ? $"{domain}\\{user}" : user; var obj = (domain.Length > 0) ? $"{domain}\\{user}" : user;
Expand Down
17 changes: 7 additions & 10 deletions svc.conf
Expand Up @@ -4,26 +4,23 @@


# Manual: readme.md, readme.eng.md # Manual: readme.md, readme.eng.md


# required System service name, cannot be the same as an existing service in the system ServiceName: easy-service
ServiceName: An Easy Service
DisplayName: An Easy Service

Description: An example of EasyService


# required Executable program and command line parameters
Worker: sample-worker.exe Worker: sample-worker.exe


# required
WorkingDir: worker WorkingDir: worker
OutFileDir: outfiles


# optional OutFileDir: outfiles
Description: An Simple Description

# optional
DisplayName: An Simple DisplayName


# encoding of the worker, i.e utf8|cp936|... , leave empty to use system's default encoding # encoding of the worker, i.e utf8|cp936|... , leave empty to use system's default encoding
WorkerEncoding: utf8 WorkerEncoding: utf8


# user who you want to run this service, leave empty to use LOCAL-SYSTEM # user who you want to run this service, leave empty to use LOCAL-SYSTEM
# if using normal user, you must grant him the permission of running services at services management center
Domain: Domain:
User: User:
Password: Password:
Binary file modified svc.exe
Binary file not shown.

0 comments on commit c3a472a

Please sign in to comment.