C#自动更新服务(本地服务安装)
代码说明:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Common.WinService;using Common.Log;using System.Threading;using Common.Net;using System.Text.RegularExpressions;namespace Collection.AutoRunner{ //获取学生信息 public class Service_Update_Data : IWindowsService { private ILogWriter _logWriter = null; private const string logCategory = "Services.Info"; private string logInfoSource = "Update_Data"; private const string logErrorCategory = "Services.Error"; private const string logErrorSource = "Update_Data_Error"; private bool BeStop = true; private System.Timers.Timer timer = null; public void Start(Common.Log.ILogWriter logWriter, string gameCode) { gameCode = gameCode.ToUpper(); logInfoSource = gameCode; _logWriter = logWriter; BeStop = false; StartRequestData(); } int stata = 0; private void StartRequestData() { try { #region 配置 //时间频率 var UpdateStudentSpan = ServiceHelper.GetInterval("UpdateData"); //更新学生开始时间 var studentbegintime = ServiceHelper.GetInterval("StudentBeginTime"); //更新学生结束时间 var studentendtime = ServiceHelper.GetInterval("StudentEndTime"); //是否更新学生基本信息:true为更新 false为不更新 var IsUpdateStudnet =Convert.ToBoolean(ServiceHelper.GetSystemConfig("IsUpdateStudnet")); #endregion timer = ServiceHelper.ExcuteByTimer(UpdateStudentSpan, () => { int timeHour = DateTime.Now.Hour; if (timeHour == 3) stata = 0; #region 更新学生基本信息 if (studentbegintime
下载说明:请别用迅雷下载,失败请重下,重下不扣分!