public override int GetHashCode() { int hash = 1; if (CmdCode.Length != 0) { hash ^= CmdCode.GetHashCode(); } if (Identity.Length != 0) { hash ^= Identity.GetHashCode(); } if (TimeToken.Length != 0) { hash ^= TimeToken.GetHashCode(); } if (ResultCode != 0) { hash ^= ResultCode.GetHashCode(); } if (ServerId != 0) { hash ^= ServerId.GetHashCode(); } if (ServerIp.Length != 0) { hash ^= ServerIp.GetHashCode(); } hash ^= lights_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
//метод не сильно связан с остальным классом, стоит доработать public void FindServer() { if (ServerIp != null) { string[] ipOctetsStr = ServerIp.Split('.'); int variableOctet = Convert.ToInt32(ipOctetsStr[3]); for (int i = 0; i < 255; i++) { string searchIpServerString = String.Format("{0:s}.{1:s}.{2:s}.{3:D}", ipOctetsStr[0], ipOctetsStr[1], ipOctetsStr[2], i); ServerIp = searchIpServerString; if (TryPing(searchIpServerString, 8000, 100)) { string logString = String.Format("tried ip {0:s} - FOUND!", searchIpServerString); loger.Print(logString); //break; } else { string logString = String.Format("tried ip {0:s} - fail!", searchIpServerString); loger.Print(logString); } } } }
private void ServerStart_Click(object sender, RoutedEventArgs e) { ServerIp sip = cmboIP.SelectedItem as ServerIp; App.vM.NetCtrl = new NetCtrl(sip.Ip.ToString(), tbxPort.Text); gridSuccess.Visibility = Visibility.Visible; gridStart.Visibility = Visibility.Collapsed; }
public void Write(BinaryWriter writer) { writer.Write((byte)Opcode); writer.Write(ServerIp.GetAddressBytes()); writer.Write(ServerPort); writer.Write(UserId); writer.Write(OneTimeKey); }
static WebTools() { IPAddress[] list = Dns.GetHostAddresses(Dns.GetHostName()); if (list.Length == 1) { ServerIp = list[0].ToString(); } else if (list.Length > 1) { ServerIp = list[0].ToString(); if (ServerIp.StartsWith("10.")) { ServerIp = list[1].ToString(); } } }
public override int GetHashCode() { int hash = 1; if (ServerAddress.Length != 0) { hash ^= ServerAddress.GetHashCode(); } if (ServerIp.Length != 0) { hash ^= ServerIp.GetHashCode(); } if (ServerPort != 0) { hash ^= ServerPort.GetHashCode(); } return(hash); }
public async Task <ActionResult> ServerIpEdit(int sid, int ipid) { var serverIP = await serverRepo.GetServerIpAsync(sid, ipid); if (serverIP == null) { serverIP = new ServerIp(); } //项目 var PartyList = new List <SelectListItem>(); var party = await partyRepo.GetPartyListAsync(); var party2 = new SelectList(party, "PartyID", "name"); PartyList.AddRange(party2); ViewBag.PartyList = PartyList; return(View(serverIP)); }
public async Task <bool> AddOrUpdateServerIpAsync(ServerIp serverIPPara) { var isAdd = false; var model = await context.ServerIps.Where(p => p.Id == serverIPPara.Id).FirstOrDefaultAsync(); if (model == null) { isAdd = true; model = new ServerIp() { ipid = serverIPPara.ipid, sid = serverIPPara.sid }; } model.partyID = serverIPPara.partyID; if (isAdd) { context.ServerIps.Add(model); } return(await context.SaveChangesAsync() == 1); }
private Server GetServer(LogEventInfo logEventInfo) { var serverUser = ServerUser?.Render(logEventInfo); var serverAddress = ServerAddress?.Render(logEventInfo); var serverIp = ServerIp?.Render(logEventInfo); if (string.IsNullOrEmpty(serverUser) && string.IsNullOrEmpty(serverAddress) && string.IsNullOrEmpty(serverIp)) { return(null); } return(new Server { User = !string.IsNullOrEmpty(serverUser) ? new User { Name = serverUser } : null, Address = serverAddress, Ip = serverIp }); }
/// <summary> /// 保存配置 /// </summary> /// <returns></returns> public static string SaveConfiguration() { // Validate if (!ValidateUtil.ValidateIp(ConfigurationDto.DataSource)) { return("连接数据库的数据源地址格式有误!"); } if (!ValidateUtil.ValidateIp(ConfigurationDto.ServerIp)) { return("连接数据中心的地址格式有误!"); } if (!ValidateUtil.ValidatePort(ConfigurationDto.ServerPort)) { return("连接数据中心的端口设置有误!"); } bool configParameterBlured = false; List <string> tagNames = new List <string>(); List <string> newValues = new List <string>(); /// CloseMainwindowToExit if (CloseMainwindowToExit != ConfigurationDto.CloseMainwindowToExit) { tagNames.Add("CloseMainwindowToExit"); newValues.Add(ConfigurationDto.CloseMainwindowToExit.ToString()); CloseMainwindowToExit = ConfigurationDto.CloseMainwindowToExit; } /// DataBase Parameters if (!DataSource.Equals(ConfigurationDto.DataSource)) { configParameterBlured = true; tagNames.Add("DataSource"); newValues.Add(ConfigurationDto.DataSource); DataSource = ConfigurationDto.DataSource; } if (!InitialCatalog.Equals(ConfigurationDto.InitialCatalog)) { configParameterBlured = true; tagNames.Add("InitialCatalog"); newValues.Add(ConfigurationDto.InitialCatalog); InitialCatalog = ConfigurationDto.InitialCatalog; } if (!UserId.Equals(ConfigurationDto.UserId)) { configParameterBlured = true; tagNames.Add("UserId"); newValues.Add(ConfigurationDto.UserId); UserId = ConfigurationDto.UserId; } if (!Password.Equals(ConfigurationDto.Password)) { configParameterBlured = true; tagNames.Add("Password"); newValues.Add(EncryptionDecryption.Encrypt(ConfigurationDto.Password)); Password = ConfigurationDto.Password; } if (configParameterBlured) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { AppEventsManager.UpdateConnectionString(); }), null); } configParameterBlured = false; /// Data Server Parameter if (!ServerIp.Equals(ConfigurationDto.ServerIp)) { configParameterBlured = true; tagNames.Add("DataServerIP"); newValues.Add(ConfigurationDto.ServerIp); ServerIp = ConfigurationDto.ServerIp; } if (!ServerPort.Equals(ConfigurationDto.ServerPort)) { configParameterBlured = true; tagNames.Add("DataServerPort"); newValues.Add(ConfigurationDto.ServerPort); ServerPort = ConfigurationDto.ServerPort; } if (configParameterBlured) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { AppEventsManager.UpdateDataServer(); }), null); } configParameterBlured = false; if (OuterDiameterUpper != ConfigurationDto.OuterDiameterUpper) { tagNames.Add("Upper"); configParameterBlured = true; newValues.Add("" + ConfigurationDto.OuterDiameterUpper); OuterDiameterUpper = ConfigurationDto.OuterDiameterUpper; } if (OuterDiameterLower != ConfigurationDto.OuterDiameterLower) { tagNames.Add("Lower"); configParameterBlured = true; newValues.Add("" + ConfigurationDto.OuterDiameterLower); OuterDiameterLower = ConfigurationDto.OuterDiameterLower; } if (configParameterBlured) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { AppEventsManager.UpdateOuterDiameterUpperAndLower(); }), null); } if (tagNames.Count > 0) { XmlUtil.ChangeXmlByTagNames(AppConfig, tagNames, newValues); } return(null); }
public override int GetHashCode() { int hash = 1; if (RequestMethod.Length != 0) { hash ^= RequestMethod.GetHashCode(); } if (RequestUrl.Length != 0) { hash ^= RequestUrl.GetHashCode(); } if (RequestSize != 0L) { hash ^= RequestSize.GetHashCode(); } if (Status != 0) { hash ^= Status.GetHashCode(); } if (ResponseSize != 0L) { hash ^= ResponseSize.GetHashCode(); } if (UserAgent.Length != 0) { hash ^= UserAgent.GetHashCode(); } if (RemoteIp.Length != 0) { hash ^= RemoteIp.GetHashCode(); } if (ServerIp.Length != 0) { hash ^= ServerIp.GetHashCode(); } if (Referer.Length != 0) { hash ^= Referer.GetHashCode(); } if (latency_ != null) { hash ^= Latency.GetHashCode(); } if (CacheLookup != false) { hash ^= CacheLookup.GetHashCode(); } if (CacheHit != false) { hash ^= CacheHit.GetHashCode(); } if (CacheValidatedWithOriginServer != false) { hash ^= CacheValidatedWithOriginServer.GetHashCode(); } if (CacheFillBytes != 0L) { hash ^= CacheFillBytes.GetHashCode(); } return(hash); }
public async Task <JsonResult> SaveServerIp(ServerIp serIp) { var result = await serverRepo.AddOrUpdateServerIpAsync(serIp); return(Json(new { isOk = result })); }
public async Task <JsonResult> IsExistsServerIp(ServerIp sip) { var model = await serverRepo.GetServerIpAsync(sip.sid, sip.ipid); return(Json(new { IsExists = model != null })); }