windows服务,配置程序随系统启动
高胜
2023-03-23 ae55a952b05bfe9f5dd81ca6738fe329e20f6a7a
线上版本
1 文件已复制
42个文件已添加
24个文件已修改
5 文件已重命名
109740 ■■■■■ 已修改文件
RestartService/.vs/RestartService/v14/.suo 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Alarm/AlarmHp.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Alarm/HttpHp.cs 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Alarm/LogHp.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/App.config 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Entity/ResponseData.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Monitor/EmqxClientMonitor.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Monitor/EmqxPushMonitor.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Monitor/Packet.cs 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Monitor/ServerMonitor.cs 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Monitor/UDPServer.cs 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/Program.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/ProjectInstaller.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/ProjectInstaller.resx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/RestartService.Designer.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/RestartService.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/RestartService.csproj 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/RestartService.resx 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/Newtonsoft.Json.xml 11363 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/RestartService.exe 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/RestartService.exe.config 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/RestartService.pdb 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Debug/RestartService.vshost.exe.config 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/Newtonsoft.Json.xml 11363 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.exe 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.exe.config 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.pdb 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.vshost.exe 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.vshost.exe.config 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/bin/Release/RestartService.vshost.exe.manifest 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/DesignTimeResolveAssemblyReferences.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.RestartService.resources 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.csproj.FileListAbsolute.txt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.csprojResolveAssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.exe 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Debug/RestartService.pdb 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.RestartService.resources 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.csproj.FileListAbsolute.txt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.csprojResolveAssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.exe 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/RestartService.pdb 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/RestartService/packages.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/.signature.p7s 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/LICENSE.md 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/Newtonsoft.Json.13.0.3.nupkg 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/README.md 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net20/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net20/Newtonsoft.Json.xml 10393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net35/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net35/Newtonsoft.Json.xml 9541 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net40/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net40/Newtonsoft.Json.xml 9741 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.xml 11363 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net6.0/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net6.0/Newtonsoft.Json.xml 11325 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.0/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.0/Newtonsoft.Json.xml 11051 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.3/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.3/Newtonsoft.Json.xml 11173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard2.0/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard2.0/Newtonsoft.Json.xml 11338 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/packages/Newtonsoft.Json.13.0.3/packageIcon.png 补丁 | 查看 | 原始文档 | blame | 历史
RestartService/.vs/RestartService/v14/.suo
Binary files differ
RestartService/RestartService/Alarm/AlarmHp.cs
New file
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestartService.Alarm
{
    public class AlarmHp
    {
        /// <summary>
        /// 发送业务异常报警
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="alarmType"></param>
        /// <param name="content"></param>
        /// <param name="ip"></param>
        public static void ApplicationAlarm(string serviceName, string alarmType, string content, string ip, string title)
        {
            //var dto = new
            //{
            //    alarmType = alarmType,
            //    content = content,
            //    serviceIp = ip,
            //    serviceName = serviceName
            //};
            //var data = HttpHp.GetSignRequestJson(dto);
            //var result = HttpHp.Post<ResponseData<object>>(ConfigurationManager.AppSettings["ApplicationAlarm"].ToString(), data);
            //if (result != null && result.code == 0)
            {
                WechatAlarm(serviceName, "CUSTOM_ALARM", content, ip, "HIGH", title);
            }
        }
        public static void ServiceAlarm(string serviceName, string content, string ip, string title)
        {
            //var dto = new
            //{
            //    alarmType = "SPRING_BOOT_ADMIN",
            //    content = content,
            //    server = ip,
            //    application = serviceName,
            //    subType = "OFFLINE"
            //};
            //var data = HttpHp.GetSignRequestJson(dto);
            //var result = HttpHp.Post<ResponseData<object>>(ConfigurationManager.AppSettings["ServiceAlarm"].ToString(), data);
            //if (result != null && result.code == 0)
            {
                WechatAlarm(serviceName, "SPRING_BOOT_ADMIN", content, ip, "HIGH", title);
            }
        }
        public static void WechatAlarm(string serviceName, string alarmType, string content, string ip, string alarmLevel, string subType)
        {
            var wechatDto = new
            {
                alarmType = alarmType,
                alarmLevel = alarmLevel,
                server = ip,
                application = serviceName,
                subType = subType,
                time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                trace = Guid.NewGuid().ToString().Replace("-", string.Empty),
                content = content
            };
            var wechatResult = HttpHp.Post<ResponseData<object>>(ConfigurationManager.AppSettings["WechatAlarm"], Newtonsoft.Json.JsonConvert.SerializeObject(wechatDto));
            if (wechatResult != null && wechatResult.code == 0)
            {
                //发送成功
            }
        }
    }
}
RestartService/RestartService/Alarm/HttpHp.cs
New file
@@ -0,0 +1,178 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace RestartService.Alarm
{
    public class HttpHp
    {
        /// <summary>
        /// 发送POST请求
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="reqDataStr"></param>
        /// <returns></returns>
        public static T Post<T>(string url, string reqDataStr) where T : class
        {
            return HttpRequet<T>(url, reqDataStr, "POST", "application/json;charset=UTF-8");
        }
        /// <summary>
        /// 发送GET请求
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="reqDataStr"></param>
        /// <returns></returns>
        public static T Get<T>(string url) where T : class
        {
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";
            request.Headers.Add(HttpRequestHeader.Authorization, ConfigurationManager.AppSettings["EmqAuthToken"]);
            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return JsonConvert.DeserializeObject<T>(responseString);
        }
        /// <summary>
        /// 发送HTTP请求
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="reqDataStr"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public static T HttpRequet<T>(string url, string reqDataStr, string Method, string contentType) where T : class
        {
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = Method;
            request.ContentType = contentType;
            request.ContentLength = 0;
            if (reqDataStr != null)
            {
                var reqData = Encoding.UTF8.GetBytes(reqDataStr);
                request.ContentLength = reqData.Length;
                using (var stream = request.GetRequestStream())
                {
                    stream.Write(reqData, 0, reqData.Length);
                }
            }
            var response = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            return JsonConvert.DeserializeObject<T>(responseString);
        }
        /// <summary>
        /// 2020-11-02
        /// 基础服务的接口都要校验sign
        /// 计算sign签名
        /// </summary>
        /// <returns></returns>
        public static string GetSignRequestJson(object requestObj, Dictionary<string, object> paramDictionary = null)
        {
            try
            {
                //1. 将model实体转为Dictionary<string, object>
                if (paramDictionary == null)
                {
                    paramDictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(JsonConvert.SerializeObject(requestObj));
                }
                //2. 计算sign
                if (paramDictionary != null)
                {
                    paramDictionary.Add("appKey", ConfigurationManager.AppSettings["AppKey"].ToString());
                    paramDictionary.Add("timestamp", GetTimestamp());
                    //2.1 字典升序
                    paramDictionary = paramDictionary.OrderBy(o => o.Key).ToDictionary(o => o.Key, p => p.Value);
                    //2.2 拼接按URL键值对
                    string str = string.Empty;
                    foreach (KeyValuePair<string, object> item in paramDictionary)
                    {
                        //Value为null不参加校验
                        if (item.Value != null)
                        {
                            //Value.ToString()为null或者""也不参加校验
                            //if (!string.IsNullOrEmpty(item.Value.ToString()) && (item.Value is string || item.Value.GetType().IsValueType))
                            //{
                            //检测当前参数是否需要参与校验
                            if (IfValueNeedSign(item.Value.ToString()))
                            {
                                //如果是bool类型,要转小写
                                if (item.Value is bool)
                                {
                                    str += item.Key + "=" + item.Value.ToString().ToLower() + "&";
                                }
                                else
                                {
                                    str += item.Key + "=" + item.Value.ToString() + "&";
                                }
                            }
                        }
                    }
                    //2.3 拼接SECRET_KEY
                    str = str.Substring(0, str.Length - 1) + ConfigurationManager.AppSettings["SecretKey"].ToString();
                    //2.4 MD5转换+转小写
                    var signstr = SignMD5Encrypt(str);
                    paramDictionary.Add("sign", signstr);
                    var signResult = JsonConvert.SerializeObject(paramDictionary);
                    return signResult;
                }
                else
                {
                    return "";
                }
            }
            catch
            {
                return "";
            }
        }
        /// <summary>
        /// 判断当前值是否需要参与签名,保持跟云端一致
        /// 空字符串不参与
        /// 数组,集合,对象不参与
        /// </summary>
        /// <param name="valueStr"></param>
        /// <returns></returns>
        static bool IfValueNeedSign(string valueStr)
        {
            if (string.IsNullOrEmpty(valueStr) || valueStr.StartsWith("{") || valueStr.StartsWith("["))
            {
                return false;
            }
            return true;
        }
        static long GetTimestamp()
        {
            return (long)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds;
        }
        static string SignMD5Encrypt(string str)
        {
            byte[] result = Encoding.UTF8.GetBytes(str.Trim());    //tbPass为输入密码的文本框
            var md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            string passwordMD5 = BitConverter.ToString(output).Replace("-", string.Empty);  //tbMd5pass为输出加密文本的文本框
            return passwordMD5.Trim().ToLower();
        }
    }
}
RestartService/RestartService/Alarm/LogHp.cs
New file
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestartService.Alarm
{
    public class LogHp
    {
        public static void WriteLog(string name, string content)
        {
            File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + $"Logs//{name} {DateTime.Now.ToString("yyyy-MM-dd")}.txt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n" + content + "\r\n\r\n===============================================\r\n\r\n");
        }
    }
}
RestartService/RestartService/App.config
@@ -2,12 +2,24 @@
<configuration>
  <appSettings>
    <add key="RunAfter" value="MSMQ"/>
    <add key="Servers" value="Server,FtpServer,陈贵军特殊服务器,PushServer,清理工具"/>
    <add key="Server" value="D:\Servers\GateWayServer\Server.exe"/>
    <add key="陈贵军特殊服务器" value="D:\Servers\特殊应用\陈贵军\陈贵军特殊服务器.exe"/>
    <add key="FtpServer" value="D:\Servers\FtpServer\FtpServer.exe"/>
    <add key="PushServer" value="D:\Servers\PushServer\PushServer.exe"/>
    <add key="清理工具" value="D:\FTP\清理工具\清理工具.exe"/>
    <add key="Servers" value="Server,MQTTPush,MQTTPenetrate"/>
    <add key="Server" value="D:\Server(New)\Server.exe"/>
    <add key="MQTTPush" value="D:\MQTTPush\MQTTPush.exe"/>
    <add key="MQTTPenetrate" value="D:\MQTTPenetrate\MQTTPenetrate.exe"/>
    <add key="ServerIp" value="118.31.3.103"/>
    <add key="ApplicationAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/applicationWarn"/>
    <add key="WechatAlarm" value="http://iot.hdlcontrol.com:8888/hdl-support-monitor/api/alarm/alarmPush"/>
    <add key="ServiceAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/supportMonitor"/>
    <add key="AppKey" value="HDL-HOME-APP-TEST"/>
    <add key="SecretKey" value="WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"/>
    <add key="EmqClientUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService"/>
    <add key="EmqPushUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService1"/>
    <add key="EmqAuthToken" value="Basic MmY1ZjEyZmVkYzFlOk16QTVPREE1TURrM056a3pNemt3TWpnMk9EZ3dORGt4TnpJeU1EWTBOVEkzTXpH"/>
  </appSettings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
RestartService/RestartService/Entity/ResponseData.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestartService
{
    public class ResponseData<T> where T : class
    {
        public int code { get; set; }
        public bool isSuccess { get; set; }
        public string requestId { get; set; }
        public string timestamp { get; set; }
        public T data { get; set; }
    }
}
RestartService/RestartService/Monitor/EmqxClientMonitor.cs
New file
@@ -0,0 +1,64 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RestartService.Alarm;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RestartService.Monitor
{
    public class EmqxClientMonitor
    {
        private static int DeviceCacheExCount = 0;
        public static void monitor()
        {
            new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    try
                    {
                        var result = HttpHp.Get<ResponseData<List<JObject>>>(ConfigurationManager.AppSettings["EmqClientUrl"]);
                        if (result.code != 0)
                        {
                            throw new Exception("响应数据异常");
                        }
                        if (result.data.Count == 0)
                        {
                            throw new Exception("响应数据异常");
                        }
                        DeviceCacheExCount = 0;
                    }
                    catch (Exception exc)
                    {
                        DeviceCacheExCount++;
                        if (DeviceCacheExCount > 2 && DeviceCacheExCount % 3 == 0)
                        {
                            try
                            {
                                AlarmHp.ApplicationAlarm("SupportCtrlOldUdpGate", "warn-system", exc.StackTrace, "157.175.231.123", "国外-透传服务" + exc.Message);
                            }
                            catch (Exception ex)
                            {
                                LogHp.WriteLog("透传服务异常", JsonConvert.SerializeObject(ex));
                            }
                        }
                    }
                    Thread.Sleep(1000 * 10);
                }
            }))
            { IsBackground = true }.Start();
        }
    }
}
RestartService/RestartService/Monitor/EmqxPushMonitor.cs
New file
@@ -0,0 +1,64 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RestartService.Alarm;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RestartService.Monitor
{
    public class EmqxPushMonitor
    {
        private static int DeviceCacheExCount = 0;
        public static void monitor()
        {
            new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    try
                    {
                        var result = HttpHp.Get<ResponseData<List<JObject>>>(ConfigurationManager.AppSettings["EmqPushUrl"]);
                        if (result.code != 0)
                        {
                            throw new Exception("响应数据异常");
                        }
                        if (result.data.Count == 0)
                        {
                            throw new Exception("响应数据异常");
                        }
                        DeviceCacheExCount = 0;
                    }
                    catch (Exception exc)
                    {
                        DeviceCacheExCount++;
                        if (DeviceCacheExCount > 2 && DeviceCacheExCount % 3 == 0)
                        {
                            try
                            {
                                AlarmHp.ApplicationAlarm("PushService_MessageQueue", "warn-system", exc.StackTrace, "157.175.231.123", "国外-消息推送服务" + exc.Message);
                            }
                            catch (Exception ex)
                            {
                                LogHp.WriteLog("消息推送服务异常", JsonConvert.SerializeObject(ex));
                            }
                        }
                    }
                    Thread.Sleep(1000 * 10);
                }
            }))
            { IsBackground = true }.Start();
        }
    }
}
RestartService/RestartService/Monitor/Packet.cs
New file
@@ -0,0 +1,218 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RestartService.Monitor
{
    public class Packet
    {
        /// <summary>
        /// 缓冲区
        /// </summary>
        public byte[] Bytes = new byte[1300];
        /// <summary>
        /// 网络套接字
        /// </summary>
        public System.Net.EndPoint RemoteEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
        public void Manager()
        {
            try
            {
                if (!"HDLMIRACLE".Equals(System.Text.Encoding.ASCII.GetString(Bytes, 4, 10)))
                {
                    return;
                }
                #region
                byte subnetID = this.Bytes[17]; //源子网号
                byte deviceID = this.Bytes[18]; //源设备号
                //源设备类型
                int deviceType = this.Bytes[19] * 256 + this.Bytes[20];
                int command = Bytes[21] * 256 + Bytes[22]; //操作码控制命令
                byte targetSubnetID = this.Bytes[23];
                byte targetDeviceID = this.Bytes[24];
                var usefulBytes = new byte[] { };
                if (Bytes[16] == 0xFF)
                {
                    usefulBytes = new byte[this.Bytes.Length - 25 - 2];
                    Array.Copy(Bytes, 25 + 2, usefulBytes, 0, usefulBytes.Length);
                }
                else
                {
                    //有用的附加数据
                    usefulBytes = new byte[this.Bytes[16] - 11];
                    Array.Copy(Bytes, 25, usefulBytes, 0, usefulBytes.Length);
                }
                switch (command)//记录成功返回的数据
                {
                    case 0x3012:
                        if (ServerMonitor.ServerSendCount > 6)
                        {
                            var minuite = (ServerMonitor.ServerSendCount * 10) / 60;
                            //日志埋点
                            //PointLogUtil.LogsUtil.WriteLog("数据转发服务已恢复正常,不可用状态持续" + minuite + "分钟!");
                        }
                        System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + $"UDPStart.txt", "数据转发服务!\r\n\r\n");
                        //收到数据清零
                        ServerMonitor.ServerSendCount = 0;
                        if ((DateTime.Now - ServerMonitor.sendTime).TotalSeconds >= 3)//超过3000毫秒,肯定有问题
                        {
                            ServerMonitor.InternetDeleyCount++;//记录延迟数据
                            if (ServerMonitor.InternetDeleyCount == 5)
                            {
                                //日志埋点
                                //PointLogUtil.LogsUtil.WriteLog("数据转发服务已连续超过5次响应数据延迟超过3秒,请检查服务状态和数据!");
                            }
                        }
                        else //正常
                        {
                            ServerMonitor.InternetDeleyCount = 0;
                        }
                        break;
                    default:
                        break;
                }
                #endregion
            }
            catch { }
        }
        public static byte[] SendBytes(byte[] addData, int Command, byte SubnetID, byte DeviceID)
        {
            try
            {
                var bytes = new byte[16 + 11 + addData.Length];
                bytes[0] = 192;
                bytes[1] = 168;
                bytes[2] = 10;
                bytes[3] = 1;
                bytes[4] = 72;//H
                bytes[5] = 68;//D
                bytes[6] = 76;//L
                bytes[7] = 77;//M
                bytes[8] = 73;//I
                bytes[9] = 82;//R
                bytes[10] = 65;//A
                bytes[11] = 67;//C
                bytes[12] = 76;//L
                bytes[13] = 69;//E
                bytes[14] = 0xAA;//引导码2位,0xAAAA固定
                bytes[15] = 0xAA;
                bytes[16] = (byte)(11 + addData.Length);//数据包长度
                bytes[17] = SubnetID; //源子网地址 0-254
                bytes[18] = DeviceID;//源设备地址 0-254
                                     //源设备类型2位
                bytes[19] = (byte)(0xFFFC / 256);
                bytes[20] = (byte)(0xFFFC % 256);
                //操作码
                bytes[21] = (byte)(Command / 256);
                bytes[22] = (byte)(Command % 256);
                //目标子网地址 0-254
                bytes[23] = 255;
                //目标设备地址 0-254
                bytes[24] = 255;
                Array.Copy(addData, 0, bytes, 25, addData.Length);
                //CRC校验位
                bytes[bytes.Length - 2] = 0;
                bytes[bytes.Length - 1] = 0;
                ConCRC(ref bytes, 16, bytes.Length - 2);
                return bytes;
            }
            catch
            {
                return null;
            }
        }
        /// <summary>
        /// 添加CRC校验字
        /// </summary>
        /// <param name="bufin">信息串</param>
        /// <param name="n">不包括校验字的串总长度</param>
        public static void ConCRC(ref byte[] bufin, byte start, int n)
        {
            ushort crc16 = 0;
            byte i;
            //n个数据的CRC校验
            for (i = start; i < n; i++)
            {
                crc16 = xcrc(crc16, bufin[i]);
            }
            bufin[i] = (byte)(crc16 >> 8);
            bufin[i + 1] = (byte)(crc16 & 0xff);
        }
        /// <summary>
        /// CRC校验公式
        /// </summary>
        /// <param name="crc">CRC</param>
        /// <param name="cp">发送的数据序列</param>
        /// <returns>新CRC</returns>
        private static ushort xcrc(ushort crc, byte cp)
        {
            ushort t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0;
            t1 = (ushort)(crc >> 8);
            t2 = (ushort)(t1 & 0xff);
            t3 = (ushort)(cp & 0xff);
            t4 = (ushort)(crc << 8);
            t5 = (ushort)(t2 ^ t3);
            t6 = (ushort)(crctab[t5] ^ t4);
            return t6;
        }
        #region crctab
        private static ushort[] crctab = new ushort[256]
        {
            0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
            0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
            0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
            0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
            0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
            0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
            0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
            0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
            0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
            0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
            0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
            0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
            0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
            0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
            0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
            0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
            0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
            0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
            0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
            0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
            0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
            0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
            0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
            0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
            0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
            0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
            0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
            0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
            0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
            0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
            0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
            0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
        };
        #endregion
    }
}
RestartService/RestartService/Monitor/ServerMonitor.cs
New file
@@ -0,0 +1,69 @@
using RestartService.Alarm;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RestartService.Monitor
{
    public class ServerMonitor
    {
        /// <summary>
        /// 发送时间
        /// </summary>
        public static DateTime sendTime;
        /// <summary>
        /// 发送了多少次
        /// </summary>
        public static int ServerSendCount;
        /// <summary>
        /// 网络延迟次数
        /// </summary>
        public static int InternetDeleyCount;
        /// <summary>
        /// 监控数据转发服务
        /// </summary>
        public static void monitorServer()
        {
            new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    try
                    {
                        var sendBytes = new byte[29];
                        var groupNameBytes = Encoding.Default.GetBytes("HDL");
                        Array.Copy(groupNameBytes, 0, sendBytes, 9, groupNameBytes.Length);
                        sendBytes = Packet.SendBytes(sendBytes, 0x3011, 42, 0);
                        UDPServer.AsyncBeginSend(new Packet
                        {
                            Bytes = sendBytes,
                            RemoteEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ConfigurationManager.AppSettings["ServerIp"]), 9999)
                        });
                        sendTime = DateTime.Now;
                        ServerSendCount++;
                        //超过6次有问题
                        if (ServerSendCount > 5 && ServerSendCount % 6 == 0)
                        {
                            AlarmHp.ServiceAlarm("Server", "服务已经6次没有响应,请尽快检查!","157.175.231.123," + ConfigurationManager.AppSettings["ServerIp"], "国外-旧服务器数据转发服务");
                        }
                    }
                    catch (Exception ex)
                    {
                        LogHp.WriteLog("UDP服务异常", Newtonsoft.Json.JsonConvert.SerializeObject(ex));
                    }
                    Thread.Sleep(1000 * 10);
                }
            }))
            { IsBackground = true }.Start();
        }
    }
}
RestartService/RestartService/Monitor/UDPServer.cs
New file
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace RestartService.Monitor
{
    public class UDPServer
    {
        private static Socket udpSocket;
        /// <summary>
        /// 启动Socket接收和发送功能
        /// </summary>
        /// <param name="port"></param>
        public static void Start()
        {
            if (IsRunning)
            {
                return;
            }
            udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            udpSocket.Bind(new IPEndPoint(IPAddress.Any, 0));
            asyncBeginReceive();
        }
        public static void Close()
        {
            if (!IsRunning)
            {
                return;
            }
            udpSocket.Close();
            udpSocket = null;
            System.Threading.Thread.Sleep(100);
        }
        private static bool IsRunning
        {
            get
            {
                return null == udpSocket ? false : true;
            }
        }
        private static void asyncBeginReceive()
        {
            if (!IsRunning)
            {
                return;
            }
            try
            {
                var tempPacket = new Packet { };
                udpSocket.BeginReceiveFrom(tempPacket.Bytes, 0, tempPacket.Bytes.Length, SocketFlags.None, ref tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndReceive), tempPacket);
            }
            catch
            {
                System.Threading.Thread.Sleep(1);
                asyncBeginReceive();
            }
        }
        private static void asyncEndReceive(IAsyncResult iar)
        {
            if (!IsRunning)
            {
                return;
            }
            try
            {
                var tempPacket = (Packet)iar.AsyncState;
                var len = udpSocket.EndReceiveFrom(iar, ref tempPacket.RemoteEndPoint);
                var bytes = new byte[len];
                System.Array.Copy(tempPacket.Bytes, 0, bytes, 0, bytes.Length);
                tempPacket.Bytes = bytes;
                asyncBeginReceive();
                tempPacket.Manager();
            }
            catch
            {
                asyncBeginReceive();
            }
        }
        public static void AsyncBeginSend(Packet tempPacket)
        {
            try
            {
                udpSocket.BeginSendTo(tempPacket.Bytes, 0, tempPacket.Bytes.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket);
            }
            catch { }
        }
        private static void asyncEndSend(IAsyncResult iar)
        {
            try
            {
                int bytesSent = udpSocket.EndSendTo(iar);
            }
            catch { }
        }
    }
}
RestartService/RestartService/Program.cs
@@ -17,7 +17,7 @@
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Service1()
                new RestartService()
            };
            ServiceBase.Run(ServicesToRun);
        }
RestartService/RestartService/ProjectInstaller.Designer.cs
@@ -39,7 +39,7 @@
            // 
            // serviceInstaller1
            // 
            this.serviceInstaller1.ServiceName = "Service1";
            this.serviceInstaller1.ServiceName = "RestartService";
            this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
            // 
            // c
RestartService/RestartService/ProjectInstaller.resx
@@ -118,7 +118,7 @@
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
    <value>17, 55</value>
  </metadata>
  <metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>208, 17</value>
RestartService/RestartService/RestartService.Designer.cs
File was renamed from RestartService/RestartService/Service1.Designer.cs
@@ -1,6 +1,6 @@
namespace RestartService
{
    partial class Service1
    partial class RestartService
    {
        /// <summary> 
        /// 必需的设计器变量。
@@ -29,9 +29,9 @@
        private void InitializeComponent()
        {
            // 
            // Service1
            // RestartService
            // 
            this.ServiceName = "Service1";
            this.ServiceName = "RestartService";
        }
RestartService/RestartService/RestartService.cs
File was renamed from RestartService/RestartService/Service1.cs
@@ -9,18 +9,28 @@
using System.Threading.Tasks;
using System.Timers;
using System.Configuration;
using RestartService.Monitor;
namespace RestartService
{
    public partial class Service1 : ServiceBase
    public partial class RestartService : ServiceBase
    {
        public Service1()
        public RestartService()
        {
            InitializeComponent();
        }
        protected override void OnStart(string[] args)
        {
            UDPServer.Start();
            EmqxClientMonitor.monitor();
            ServerMonitor.monitorServer();
            EmqxPushMonitor.monitor();
            Start();
        }
        void Start()
        {
            var t = new Timer(1000 * 10);//实例化Timer类,设置间隔时间为10秒;
            t.Elapsed += (object source, System.Timers.ElapsedEventArgs e) =>
            {
RestartService/RestartService/RestartService.csproj
@@ -34,6 +34,10 @@
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Configuration.Install" />
@@ -49,17 +53,26 @@
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Alarm\AlarmHp.cs" />
    <Compile Include="Alarm\HttpHp.cs" />
    <Compile Include="Alarm\LogHp.cs" />
    <Compile Include="Entity\ResponseData.cs" />
    <Compile Include="Monitor\EmqxPushMonitor.cs" />
    <Compile Include="Monitor\EmqxClientMonitor.cs" />
    <Compile Include="Monitor\Packet.cs" />
    <Compile Include="Monitor\ServerMonitor.cs" />
    <Compile Include="Monitor\UDPServer.cs" />
    <Compile Include="ProjectInstaller.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="ProjectInstaller.Designer.cs">
      <DependentUpon>ProjectInstaller.cs</DependentUpon>
    </Compile>
    <Compile Include="Service1.cs">
    <Compile Include="RestartService.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Service1.Designer.cs">
      <DependentUpon>Service1.cs</DependentUpon>
    <Compile Include="RestartService.Designer.cs">
      <DependentUpon>RestartService.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
@@ -68,13 +81,14 @@
    <None Include="App.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ProjectInstaller.resx">
      <DependentUpon>ProjectInstaller.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Service1.resx">
      <DependentUpon>Service1.cs</DependentUpon>
    <EmbeddedResource Include="RestartService.resx">
      <DependentUpon>RestartService.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
RestartService/RestartService/RestartService.resx
RestartService/RestartService/bin/Debug/Newtonsoft.Json.dll
Binary files differ
RestartService/RestartService/bin/Debug/Newtonsoft.Json.xml
New file
Diff too large
RestartService/RestartService/bin/Debug/RestartService.exe
Binary files differ
RestartService/RestartService/bin/Debug/RestartService.exe.config
@@ -8,6 +8,19 @@
    <add key="FtpServer" value="D:\Servers\FtpServer\FtpServer.exe"/>
    <add key="PushServer" value="D:\Servers\PushServer\PushServer.exe"/>
    <add key="清理工具" value="D:\FTP\清理工具\清理工具.exe"/>
    <add key="ServerIp" value="118.31.3.103"/>
    <add key="ApplicationAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/applicationWarn"/>
    <add key="WechatAlarm" value="http://iot.hdlcontrol.com:8888/hdl-support-monitor/api/alarm/alarmPush"/>
    <add key="ServiceAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/supportMonitor"/>
    <add key="AppKey" value="HDL-HOME-APP-TEST"/>
    <add key="SecretKey" value="WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"/>
    <add key="EmqClientUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService"/>
    <add key="EmqAuthToken" value="Basic MmY1ZjEyZmVkYzFlOk16QTVPREE1TURrM056a3pNemt3TWpnMk9EZ3dORGt4TnpJeU1EWTBOVEkzTXpH"/>
  </appSettings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
RestartService/RestartService/bin/Debug/RestartService.pdb
Binary files differ
RestartService/RestartService/bin/Debug/RestartService.vshost.exe.config
@@ -8,6 +8,19 @@
    <add key="FtpServer" value="D:\Servers\FtpServer\FtpServer.exe"/>
    <add key="PushServer" value="D:\Servers\PushServer\PushServer.exe"/>
    <add key="清理工具" value="D:\FTP\清理工具\清理工具.exe"/>
    <add key="ServerIp" value="118.31.3.103"/>
    <add key="ApplicationAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/applicationWarn"/>
    <add key="WechatAlarm" value="http://iot.hdlcontrol.com:8888/hdl-support-monitor/api/alarm/alarmPush"/>
    <add key="ServiceAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/supportMonitor"/>
    <add key="AppKey" value="HDL-HOME-APP-TEST"/>
    <add key="SecretKey" value="WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"/>
    <add key="EmqClientUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService"/>
    <add key="EmqAuthToken" value="Basic MmY1ZjEyZmVkYzFlOk16QTVPREE1TURrM056a3pNemt3TWpnMk9EZ3dORGt4TnpJeU1EWTBOVEkzTXpH"/>
  </appSettings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
RestartService/RestartService/bin/Release/Newtonsoft.Json.dll
Binary files differ
RestartService/RestartService/bin/Release/Newtonsoft.Json.xml
New file
Diff too large
RestartService/RestartService/bin/Release/RestartService.exe
Binary files differ
RestartService/RestartService/bin/Release/RestartService.exe.config
@@ -2,12 +2,24 @@
<configuration>
  <appSettings>
    <add key="RunAfter" value="MSMQ"/>
    <add key="Servers" value="Server,FtpServer,陈贵军特殊服务器,PushServer,清理工具"/>
    <add key="Server" value="D:\Servers\GateWayServer\Server.exe"/>
    <add key="陈贵军特殊服务器" value="D:\Servers\特殊应用\陈贵军\陈贵军特殊服务器.exe"/>
    <add key="FtpServer" value="D:\Servers\FtpServer\FtpServer.exe"/>
    <add key="PushServer" value="D:\Servers\PushServer\PushServer.exe"/>
    <add key="清理工具" value="D:\FTP\清理工具\清理工具.exe"/>
    <add key="Servers" value="Server,MQTTPush,MQTTPenetrate"/>
    <add key="Server" value="D:\Server(New)\Server.exe"/>
    <add key="MQTTPush" value="D:\MQTTPush\MQTTPush.exe"/>
    <add key="MQTTPenetrate" value="D:\MQTTPenetrate\MQTTPenetrate.exe"/>
    <add key="ServerIp" value="118.31.3.103"/>
    <add key="ApplicationAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/applicationWarn"/>
    <add key="WechatAlarm" value="http://iot.hdlcontrol.com:8888/hdl-support-monitor/api/alarm/alarmPush"/>
    <add key="ServiceAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/supportMonitor"/>
    <add key="AppKey" value="HDL-HOME-APP-TEST"/>
    <add key="SecretKey" value="WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"/>
    <add key="EmqClientUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService"/>
    <add key="EmqPushUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService1"/>
    <add key="EmqAuthToken" value="Basic MmY1ZjEyZmVkYzFlOk16QTVPREE1TURrM056a3pNemt3TWpnMk9EZ3dORGt4TnpJeU1EWTBOVEkzTXpH"/>
  </appSettings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
RestartService/RestartService/bin/Release/RestartService.pdb
Binary files differ
RestartService/RestartService/bin/Release/RestartService.vshost.exe
Binary files differ
RestartService/RestartService/bin/Release/RestartService.vshost.exe.config
New file
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="RunAfter" value="MSMQ"/>
    <add key="Servers" value="Server,FtpServer,陈贵军特殊服务器,PushServer,清理工具"/>
    <add key="Server" value="D:\Servers\GateWayServer\Server.exe"/>
    <add key="陈贵军特殊服务器" value="D:\Servers\特殊应用\陈贵军\陈贵军特殊服务器.exe"/>
    <add key="FtpServer" value="D:\Servers\FtpServer\FtpServer.exe"/>
    <add key="PushServer" value="D:\Servers\PushServer\PushServer.exe"/>
    <add key="清理工具" value="D:\FTP\清理工具\清理工具.exe"/>
    <add key="ServerIp" value="118.31.3.103"/>
    <add key="ApplicationAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/applicationWarn"/>
    <add key="WechatAlarm" value="http://iot.hdlcontrol.com:8888/hdl-support-monitor/api/alarm/alarmPush"/>
    <add key="ServiceAlarm" value="https://test-gz.hdlcontrol.com/iot-cloud/webhook/cloudmonitor/supportMonitor"/>
    <add key="AppKey" value="HDL-HOME-APP-TEST"/>
    <add key="SecretKey" value="WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"/>
    <add key="EmqClientUrl" value="http://15.185.137.39:8081/api/v4/clients/ForeignPenetrateService"/>
    <add key="EmqAuthToken" value="Basic MmY1ZjEyZmVkYzFlOk16QTVPREE1TURrM056a3pNemt3TWpnMk9EZ3dORGt4TnpJeU1EWTBOVEkzTXpH"/>
  </appSettings>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
</configuration>
RestartService/RestartService/bin/Release/RestartService.vshost.exe.manifest
RestartService/RestartService/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary files differ
RestartService/RestartService/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
RestartService/RestartService/obj/Debug/RestartService.RestartService.resources
copy from RestartService/RestartService/obj/Release/RestartService.Service1.resources copy to RestartService/RestartService/obj/Debug/RestartService.RestartService.resources Binary files differ
RestartService/RestartService/obj/Debug/RestartService.csproj.FileListAbsolute.txt
@@ -8,3 +8,14 @@
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Debug\RestartService.pdb
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Debug\RestartService.csprojAssemblyReference.cache
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Debug\RestartService.csproj.CoreCompileInputs.cache
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Debug\RestartService.exe.config
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.exe
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.pdb
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Debug\RestartService.exe
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Debug\RestartService.pdb
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Debug\Newtonsoft.Json.dll
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Debug\Newtonsoft.Json.xml
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.csprojResolveAssemblyReference.cache
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.c.resources
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.RestartService.resources
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Debug\RestartService.csproj.GenerateResource.Cache
RestartService/RestartService/obj/Debug/RestartService.csproj.GenerateResource.cache
Binary files differ
RestartService/RestartService/obj/Debug/RestartService.csprojResolveAssemblyReference.cache
Binary files differ
RestartService/RestartService/obj/Debug/RestartService.exe
Binary files differ
RestartService/RestartService/obj/Debug/RestartService.pdb
Binary files differ
RestartService/RestartService/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
RestartService/RestartService/obj/Release/RestartService.RestartService.resources
Binary files differ
RestartService/RestartService/obj/Release/RestartService.csproj.FileListAbsolute.txt
@@ -7,3 +7,14 @@
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Release\RestartService.csproj.CoreCompileInputs.cache
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Release\RestartService.exe
E:\公司项目\特殊应用\Windows服务\RestartService\RestartService\obj\Release\RestartService.pdb
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Release\RestartService.exe.config
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.exe
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.pdb
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Release\RestartService.exe
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Release\RestartService.pdb
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Release\Newtonsoft.Json.dll
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\bin\Release\Newtonsoft.Json.xml
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.c.resources
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.csproj.GenerateResource.Cache
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.RestartService.resources
E:\公司项目\服务器代码\服务器监控程序\RestartService\RestartService\RestartService\obj\Release\RestartService.csprojResolveAssemblyReference.cache
RestartService/RestartService/obj/Release/RestartService.csproj.GenerateResource.cache
Binary files differ
RestartService/RestartService/obj/Release/RestartService.csprojResolveAssemblyReference.cache
Binary files differ
RestartService/RestartService/obj/Release/RestartService.exe
Binary files differ
RestartService/RestartService/obj/Release/RestartService.pdb
Binary files differ
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
RestartService/RestartService/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
RestartService/RestartService/packages.config
New file
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net452" />
</packages>
RestartService/packages/Newtonsoft.Json.13.0.3/.signature.p7s
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/LICENSE.md
New file
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RestartService/packages/Newtonsoft.Json.13.0.3/Newtonsoft.Json.13.0.3.nupkg
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/README.md
New file
@@ -0,0 +1,71 @@
# ![Logo](https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg) Json.NET
[![NuGet version (Newtonsoft.Json)](https://img.shields.io/nuget/v/Newtonsoft.Json.svg?style=flat-square)](https://www.nuget.org/packages/Newtonsoft.Json/)
[![Build status](https://dev.azure.com/jamesnk/Public/_apis/build/status/JamesNK.Newtonsoft.Json?branchName=master)](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
Json.NET is a popular high-performance JSON framework for .NET
## Serialize JSON
```csharp
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
//   "Name": "Apple",
//   "Expiry": "2008-12-28T00:00:00",
//   "Sizes": [
//     "Small"
//   ]
// }
```
## Deserialize JSON
```csharp
string json = @"{
  'Name': 'Bad Boys',
  'ReleaseDate': '1995-4-7T00:00:00',
  'Genres': [
    'Action',
    'Comedy'
  ]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
// Bad Boys
```
## LINQ to JSON
```csharp
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
// {
//   "MyArray": [
//     "Manual text",
//     "2000-05-23T00:00:00"
//   ]
// }
```
## Links
- [Homepage](https://www.newtonsoft.com/json)
- [Documentation](https://www.newtonsoft.com/json/help)
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net20/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net20/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net35/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net35/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net40/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net40/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net45/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net6.0/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/net6.0/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.0/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.0/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.3/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard1.3/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
Binary files differ
RestartService/packages/Newtonsoft.Json.13.0.3/lib/netstandard2.0/Newtonsoft.Json.xml
New file
Diff too large
RestartService/packages/Newtonsoft.Json.13.0.3/packageIcon.png