Skip to content

Commit 70012af

Browse files
author
DigitalPlatform
committed
整理代码
1 parent e6fcb14 commit 70012af

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

DigitalPlatform.MessageServer/ServerInfo.cs

+5-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static void CreateCfgFile(string strCfgFileName,
7979
dom.Save(strCfgFileName);
8080
}
8181

82-
public static void Initial(InitialParam param)
82+
public static void Initial(InitialParam param, bool bStartThread = true)
8383
{
8484
AutoTriggerUrl = param.AutoTriggerUrl;
8585

@@ -117,7 +117,8 @@ public static void Initial(InitialParam param)
117117
WriteErrorLog("装载配置文件 '" + strCfgFileName + "' 时出现异常: " + ExceptionUtil.GetExceptionText(ex));
118118
}
119119

120-
BackThread.BeginThread();
120+
if (bStartThread)
121+
BackThread.BeginThread();
121122
}
122123

123124
static string strMongoDbConnStr = "";
@@ -170,9 +171,9 @@ public static void CleanExpiredMessage()
170171
// 删除 1 天以前失效的消息
171172
MessageDatabase.DeleteExpired(DateTime.Now - new TimeSpan(1, 0, 0, 0)).Wait();
172173
// 删除一年前发布的消息
173-
MessageDatabase.DeleteByPublishTime(DateTime.Now - new TimeSpan(365,0,0,0)).Wait();
174+
MessageDatabase.DeleteByPublishTime(DateTime.Now - new TimeSpan(365, 0, 0, 0)).Wait();
174175
}
175-
catch(Exception ex)
176+
catch (Exception ex)
176177
{
177178
WriteErrorLog("清理失效消息时出现异常: " + ExceptionUtil.GetDebugText(ex));
178179
}

Ionic.Zip.dll

452 KB
Binary file not shown.

ZipUtil.exe

8.5 KB
Binary file not shown.

dp2MServer/Program.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Threading.Tasks;
44
using System.ServiceProcess;
55
using System.Diagnostics;
6+
using System.IO;
67

78
using Owin;
89
using Microsoft.Owin.Cors;
@@ -12,7 +13,6 @@
1213

1314
using DigitalPlatform.MessageServer;
1415
using DigitalPlatform.ServiceProcess;
15-
using System.IO;
1616
using DigitalPlatform.IO;
1717

1818
namespace dp2MServer
@@ -148,9 +148,11 @@ static void Main(string[] args)
148148
// 创建超级用户账户
149149
if (args.Length == 1 && args[0].Equals("createuser"))
150150
{
151-
if (Initial() == false)
151+
if (Initial(false) == false)
152152
return;
153153

154+
ServerInfo.InitialMongoDb(true);
155+
154156
string strUserName = "supervisor";
155157
string strPassword = "";
156158

@@ -256,7 +258,7 @@ static void CreateSupervisor(string strUserName, string strPassword)
256258
// return:
257259
// true 初始化成功
258260
// false 初始化失败
259-
static bool Initial()
261+
static bool Initial(bool bStartThread = true)
260262
{
261263
try
262264
{
@@ -266,7 +268,7 @@ static bool Initial()
266268
InitialParam param = new InitialParam();
267269
param.DataDir = DataDir;
268270
param.AutoTriggerUrl = AutoTriggerUrl;
269-
ServerInfo.Initial(param);
271+
ServerInfo.Initial(param, bStartThread);
270272

271273
return true;
272274
}

0 commit comments

Comments
 (0)