private void URGetOnlineInfoCompleted(object sender, RunWorkerCompletedEventArgs e) { this.OnLineInfo = OnlineInfo.GetInstance(); if ((this.OnLineInfo.Plugins.Count != 0) || (this.OnLineInfo.Updates.Count != 0)) { //add updates to the list foreach (Update u in this.OnLineInfo.Updates) { ListViewItem item = new ListViewItem(new string[] { "Update", u.Name, u.Link }); item.Tag = u.TargetLocation; PluginListView.Items.Add(item); } //add plugin to listview foreach (Plugin p in this.OnLineInfo.Plugins) { string localfile = Path.GetDirectoryName(Application.ExecutablePath) + AppSettings.GetFolder("pluginsfolder") + Path.GetFileName(p.Link); if (!new FileInfo(localfile).Exists) { ListViewItem item = new ListViewItem(new string[] { "Plugin", p.Name, p.Link }); item.Tag = p.Description; PluginListView.Items.Add(item); } } } PluginDescription.Text = ""; DownloadProgress.Style = ProgressBarStyle.Blocks; }
private void URGetOnlineInfo(object sender, DoWorkEventArgs e) { if (OnlineInfo.IsInternet()) { OnlineInfo.CheckOutForUpdate(); } }
public void GetMonitorInfo() { MonitorOutput monitorOutput = new MonitorOutput() { CPUInfo = CPUInfo.GetCPUInfo(), MemInfo = MemoryInfo.GetMemInfo(), TCPCount = TCPInfo.GetTCPCount(), OnlineCount = OnlineInfo.GetOnlineCount() }; Clients.All.getMonitorInfo(monitorOutput); }
//接受在线信息 public void acceptOnlineInfo() { IPAddress ip = IPAddress.Any; IPEndPoint ipe = new IPEndPoint(ip, 8849); Socket serv_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); serv_socket.Bind(ipe); bool isE = false; while (!isE) { isE = serv_socket.Poll(-1, SelectMode.SelectRead); if (isE) { byte[] buf = new byte[1024]; IPEndPoint receiver = new IPEndPoint(IPAddress.Any, 28001); EndPoint endPoint = (EndPoint)receiver; int bytelen = serv_socket.ReceiveFrom(buf, 1024, SocketFlags.None, ref endPoint); if (bytelen != 0) { OnlineInfo info = (OnlineInfo)DeserializeObject(buf); IPAddress remote_ip = info.ip; Console.WriteLine("acceptThread_sorceIP:" + remote_ip); Console.WriteLine("acceptThread_sorceIP:" + info.mac); //判断是否存在于设备列表 if (!isEstInDevices(remote_ip)) //如果不存在,则添加新设备 { Device d = new Device(); d.ip = remote_ip; d.mac = info.mac; d.isOnline = true; deviceList.Add(d); } else //如果存在,把状态改为在线,更新一下信息 { Device d = findDevice(remote_ip.ToString()); d.isOnline = true; d.mac = info.mac; } updateListView(); } isE = false; } } }
/// <summary> /// 系统登录,成功返回Handle字符串,失败返回null /// </summary> /// <param name="endpoint"></param> /// <param name="user"></param> /// <param name="pass"></param> /// <returns></returns> public string Login(string user, string pass) { lock (_onlines) { int level = UserMgr.Instance.Login(user, pass); if (level < 0) { Common.Log.Logger.Default.Error($"登录失败, {user},{pass}"); return(null); } string iep = Guid.NewGuid().ToString(); lock (_onlines) _onlines[iep] = new OnlineInfo(user, level); Common.Log.Logger.Default.Trace($"{user} 登录。"); save(); return(iep); } }
public ActionResult <UserInfo> Login([FromBody] UserInfo userinfo) { UserInfo resultInfo = new UserInfo(); using (var session = factory.OpenSession()) { IList <UserInfo> list = session.CreateQuery("from UserInfo u where u.LoginName=?") .SetString(0, userinfo.LoginName).List <UserInfo>(); if (list.Count() < 1) { list = session.CreateQuery("from UserInfo u where u.Mobile=?") .SetString(0, userinfo.LoginName).List <UserInfo>(); } if (list.Count() < 1) { resultInfo.ID = 10001; //用户不存在,请联系统管理员! return(resultInfo); } if (list[0].Password != userinfo.Password) { resultInfo.ID = 10002; //密码错误,请重新输入! return(resultInfo); } resultInfo = list[0]; string strSession = OnlineInfo.Add(resultInfo); resultInfo.ID = 0; resultInfo.Password = strSession; } return(resultInfo); }