Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void PostClientInfo()
        {
            var status         = "在线";
            var request        = new RestRequest("v1/client/", Method.POST);
            var ip             = ClientDeviceHelper.GetIpAddress();
            var mac            = ClientDeviceHelper.GetMacAddress();
            var appName        = ClientDeviceHelper.GetApplicationName();
            var systemInfo     = string.Empty;
            var loadSystemInfo = configHelper.GetManifestConfigValue("LoadSystemInfo");

            if (loadSystemInfo == "1")
            {
                systemInfo = ClientDeviceHelper.GetSystemInfo();
            }
            var monitorPort = configHelper.GetManifestConfigValue("MonitorPort");

            request.RequestFormat = DataFormat.Json;
            request.AddBody(new Client
            {
                ClientMac   = mac,
                ClientIp    = ip,
                LaunchTime  = DateTime.Now,
                Status      = status,
                SystemName  = appName,
                SystemInfo  = systemInfo,
                MonitorPort = monitorPort
            });
            restClient.Execute(request);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private void PostClientUnline()
        {
            var mac     = ClientDeviceHelper.GetMacAddress();
            var request = new RestRequest(string.Format("v1/client/{0}/{1}", mac, "离线"), Method.GET);

            request.RequestFormat = DataFormat.Json;
            restClient.Get(request);
        }