// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System; namespace Core.Components.Gis { /// /// This class defines properties for a WMTS connection. /// public class WmtsConnectionInfo : IEquatable { /// /// Creates a new instance of . /// /// The name associated with the . /// The WMTS URL. /// Thrown when is null. /// Thrown when is null, /// , or consists exclusively of white-space characters. public WmtsConnectionInfo(string name, string url) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentException($@"{nameof(url)} must have a value.", nameof(url)); } Name = name; Url = url; } /// /// Gets the name associated with the URL. /// public string Name { get; } /// /// Gets the URL. /// public string Url { get; } #region IEquatable members public override int GetHashCode() { return GetType().GetHashCode() ^ Name.GetHashCode() ^ Url.GetHashCode(); } public bool Equals(WmtsConnectionInfo other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return string.Equals(Name, other.Name) && string.Equals(Url, other.Url); } public override bool Equals(object obj) { return Equals(obj as WmtsConnectionInfo); } #endregion } }