Skip to content

Commit

Permalink
整理代码
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Sep 12, 2016
1 parent e6fcb14 commit 70012af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions DigitalPlatform.MessageServer/ServerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static void CreateCfgFile(string strCfgFileName,
dom.Save(strCfgFileName);
}

public static void Initial(InitialParam param)
public static void Initial(InitialParam param, bool bStartThread = true)
{
AutoTriggerUrl = param.AutoTriggerUrl;

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

BackThread.BeginThread();
if (bStartThread)
BackThread.BeginThread();
}

static string strMongoDbConnStr = "";
Expand Down Expand Up @@ -170,9 +171,9 @@ public static void CleanExpiredMessage()
// 删除 1 天以前失效的消息
MessageDatabase.DeleteExpired(DateTime.Now - new TimeSpan(1, 0, 0, 0)).Wait();
// 删除一年前发布的消息
MessageDatabase.DeleteByPublishTime(DateTime.Now - new TimeSpan(365,0,0,0)).Wait();
MessageDatabase.DeleteByPublishTime(DateTime.Now - new TimeSpan(365, 0, 0, 0)).Wait();
}
catch(Exception ex)
catch (Exception ex)
{
WriteErrorLog("清理失效消息时出现异常: " + ExceptionUtil.GetDebugText(ex));
}
Expand Down
Binary file added Ionic.Zip.dll
Binary file not shown.
Binary file added ZipUtil.exe
Binary file not shown.
10 changes: 6 additions & 4 deletions dp2MServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using System.ServiceProcess;
using System.Diagnostics;
using System.IO;

using Owin;
using Microsoft.Owin.Cors;
Expand All @@ -12,7 +13,6 @@

using DigitalPlatform.MessageServer;
using DigitalPlatform.ServiceProcess;
using System.IO;
using DigitalPlatform.IO;

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

ServerInfo.InitialMongoDb(true);

string strUserName = "supervisor";
string strPassword = "";

Expand Down Expand Up @@ -256,7 +258,7 @@ static void CreateSupervisor(string strUserName, string strPassword)
// return:
// true 初始化成功
// false 初始化失败
static bool Initial()
static bool Initial(bool bStartThread = true)
{
try
{
Expand All @@ -266,7 +268,7 @@ static bool Initial()
InitialParam param = new InitialParam();
param.DataDir = DataDir;
param.AutoTriggerUrl = AutoTriggerUrl;
ServerInfo.Initial(param);
ServerInfo.Initial(param, bStartThread);

return true;
}
Expand Down

0 comments on commit 70012af

Please sign in to comment.