private bool Equals(DeviceInfo other) { return (string.Equals(MacAddressString, other.MacAddressString) && IpAddress.Equals(other.IpAddress) && string.Equals(MachineName, other.MachineName)); }
/// <summary> /// Determines whether [is valid address]. /// </summary> /// <returns> /// <c>true</c> if [is valid address]; otherwise, <c>false</c>. /// </returns> public bool IsValidAddress() { if (IpAddress.Equals("0.0.0.0") || IpAddress.Equals("255.255.255.255")) { return(false); } return(true); }
public override bool Equals(object obj) { if (obj is Peer) { Peer peer = (Peer)obj; return(IpAddress.Equals(peer.IpAddress) && Port.Equals(peer.Port)); } return(base.Equals(obj)); }
public override bool Equals(object obj) { if (obj == null || !GetType().Equals(obj.GetType())) { return(false); } CClientInfo clientInfo = (CClientInfo)obj; return(string.Equals(ComputerName, clientInfo.ComputerName, StringComparison.OrdinalIgnoreCase) && IpAddress.Equals(clientInfo.IpAddress)); }
private void SyncButton_Click() { if (IpAddress.Equals(string.Empty) || siteId.Equals(string.Empty) || deviceId.Equals(string.Empty)) { Toast.MakeText(this, "Something went wrong..", ToastLength.Short).Show(); //StartActivity(typeof(ConfigActivity)); return; } RunOnUiThread(() => { Toast.MakeText(this, "Please wait..", ToastLength.Short).Show(); mainHolder.Alpha = 0.5f; loader.Visibility = Android.Views.ViewStates.Visible; Window.SetFlags(Android.Views.WindowManagerFlags.NotTouchable, Android.Views.WindowManagerFlags.NotTouchable); }); var thread = new Thread(new ThreadStart(delegate { var resposeString = WebService.PostDeviceAndSiteIDToWebService("GetVD", deviceId, siteId); //var fuelStockRes = WebService.GetDataFromWebService("LoadFStock"); try { var VehicleList = JsonConvert.DeserializeObject <List <VehicleDetails> >(resposeString); //var fuelStoc = JsonConvert.DeserializeObject<List<Fuel>>(fuelStockRes); //Console.WriteLine(fuelStoc); CreateDatabaseOrModifyDatabase(VehicleList); } catch (Exception ec) { Console.WriteLine(ec.Message); RunOnUiThread(() => { Toast.MakeText(this, "Something wrong ...Check connectivity..", ToastLength.Short).Show(); AppPreferences.SaveBool(this, Utilities.IsDownloaded, false); return; }); } RunOnUiThread(() => { loader.Visibility = Android.Views.ViewStates.Gone; mainHolder.Alpha = 1f; Window.ClearFlags(Android.Views.WindowManagerFlags.NotTouchable); Toast.MakeText(this, "success..", ToastLength.Short).Show(); btnDownloadData.Clickable = false; AppPreferences.SaveBool(this, Utilities.IsDownloaded, true); }); })); thread.Start(); }
public ContainsResult Contains(Host host) { if (host.Format != HostFormat.DomainName && host.Format != HostFormat.IPv4 && host.Format != HostFormat.IPv6) { throw new ArgumentException($"Format must be {HostFormat.DomainName}, {HostFormat.IPv4}, or {HostFormat.IPv6}."); } switch (host.Format) { case HostFormat.DomainName: switch (Format) { case HostFormat.DomainName: return(DomainName.Equals(host.DomainName, StringComparison.OrdinalIgnoreCase) ? ContainsResult.Yes : ContainsResult.No); case HostFormat.DomainNameSuffix: return(host.DomainName.EndsWith(DomainName, StringComparison.OrdinalIgnoreCase) ? ContainsResult.Yes : ContainsResult.No); } break; case HostFormat.IPv4: switch (Format) { case HostFormat.IPv4: return(IpAddress.Equals(host.IpAddress) ? ContainsResult.Yes : ContainsResult.No); case HostFormat.IPv4Cidr: // ReSharper disable once PossibleInvalidOperationException return(CidrMatches(IpAddress, host.IpAddress, MaskBits.Value, 32) ? ContainsResult.Yes : ContainsResult.No); } break; case HostFormat.IPv6: switch (Format) { case HostFormat.IPv6: return(IpAddress.Equals(host.IpAddress) ? ContainsResult.Yes : ContainsResult.No); case HostFormat.IPv6Cidr: // ReSharper disable once PossibleInvalidOperationException return(CidrMatches(IpAddress, host.IpAddress, MaskBits.Value, 128) ? ContainsResult.Yes : ContainsResult.No); } break; } return(ContainsResult.Inapplicable); }
private void SyncButton_Click() { if (IpAddress.Equals(string.Empty) || siteId.Equals(string.Empty) || deviceId.Equals(string.Empty)) { Toast.MakeText(this, "Configure the device first", ToastLength.Short).Show(); return; } RunOnUiThread(() => { Toast.MakeText(this, "Please wait..", ToastLength.Short).Show(); mainHolder.Alpha = 0.5f; loader.Visibility = Android.Views.ViewStates.Visible; Window.SetFlags(Android.Views.WindowManagerFlags.NotTouchable, Android.Views.WindowManagerFlags.NotTouchable); }); var thread = new Thread(new ThreadStart(delegate { var resposeString = WebService.PostDeviceAndSiteIDToWebService("GetVD", deviceId, siteId); try { var VehicleList = JsonConvert.DeserializeObject <List <VehicleDetails> >(resposeString); CreateDatabaseOrModifyDatabase(VehicleList); } catch (Exception ec) { RunOnUiThread(() => { Toast.MakeText(this, "Check connectivity", ToastLength.Short).Show(); loader.Visibility = Android.Views.ViewStates.Gone; mainHolder.Alpha = 1f; Window.ClearFlags(Android.Views.WindowManagerFlags.NotTouchable); AppPreferences.SaveBool(this, Utilities.IsDownloaded, false); }); ExceptionLog.LogDetails(this, "GetVd Error in fuel Activity " + ec.Message); return; } })); thread.Start(); }
protected bool Equals(Binding other) { return(IpAddress.Equals(other.IpAddress) && Port == other.Port); }