public static ILocation Copy(this ILocation location) { var result = new Location(); result.Update(location); return result; }
protected Device(Network network, DeviceType type = null) { Network = network; Location = new Location(); Type = type ?? DeviceType.Unknown; Name = null; IsConnected = null; CurrentStateGenerator = new CurrentStateGenerator(); }
public IEnumerable<Tuple<string, int, string>> GetHeaders() { if (_lastLocation.CompareByParts(_thisLocation) != 0) { var lastLocationParts = (_lastLocation == null) ? new string[0] : _lastLocation.GetParts().ToArray(); var locationParts = _thisLocation.GetParts().ToArray(); if (locationParts.Length > 0) { for (var i = 0; i < locationParts.Length; i++) { if (i >= lastLocationParts.Length || lastLocationParts[i] != locationParts[i]) { var subLocation = new Location(locationParts.Take(i + 1)); yield return new Tuple<string, int, string>(locationParts[i], i, subLocation.Format()); } } } } }