Beispiel #1
0
        /// <summary>
        /// 服务配置文件,设置服务器
        /// </summary>
        private void GetConfig()
        {
            try
            {
                string configFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.xml");
                object result     = TrackingHelper.LoadFromXml(configFile, typeof(Config));

                if (result != null)
                {
                    Config config = (Config)result;
                    TrackingHelper.mainTime     = config.TimeOut;
                    TrackingHelper.mainAGid     = config.AGid;
                    TrackingHelper.mainAGname   = config.AGname;
                    TrackingHelper.mainOverTime = config.OverTime;

                    for (int i = 1; i <= config.SynSign.Length; i++)
                    {
                        //TrackingHelper.mainSynSign += "'" + config.SynSign.Substring(i, 1) + "',";
                        TrackingHelper.mainSynSign += $"{config.SynSign.Substring(i, 1)},";
                    }
                    TrackingHelper.mainSynSign = TrackingHelper.mainSynSign.TrimEnd(',');
                    TrackingHelper.ProcessName = config.ProcessName;
                }
            }
            catch (Exception ex)
            {
                TrackingHelper.WriteError(ex.Message);
            }
        }
Beispiel #2
0
 protected override void OnStart(string[] args)
 {
     GetConfig();
     myTime = 0;
     IsOpen = TrackingHelper.GetServerStatus();
     if (IsOpen == "O")
     {
         Thread T = new Thread(TrackingHelper.DoSyncTrackStates);
         T.Start();
     }
     main_Timer.Start();
     Timer_open.Start();
 }
Beispiel #3
0
 /// <summary>
 /// 定时去读取服务器是否开启的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Timer_open_Elapsed(object sender, systimers.ElapsedEventArgs e)
 {
     IsOpen = TrackingHelper.GetServerStatus();
 }
Beispiel #4
0
 protected override void OnStop()
 {
     TrackingHelper.AllClear();
     main_Timer.Stop();
 }