/// <summary> /// Initializes a new instance of an object. /// </summary> /// <param name="copyFrom">Object to copy state from.</param> /// <exception cref="System.ArgumentNullException"><paramref name="copyFrom">copyFrom</paramref> is null.</exception> public Route(Route copyFrom) { if (copyFrom == null) throw new System.ArgumentNullException("copyFrom"); else copyFrom.CopyTo(this); }
/// <summary> /// Returns the specified grade system representation of the current route grade. /// </summary> /// <param name="route">Owning route.</param> /// <param name="gradeSystem">Grade system to apply.</param> /// <returns>The specified grade system representation of the current route grade.</returns> public string ToGrade(Route route, RouteGradeSystem gradeSystem) { string ret = string.Empty; if (route != null) { if (route.Climbing.HasFlag(ClimbingTypes.Bouldering)) ret = ToHueco(); } if (string.IsNullOrEmpty(ret)) { switch (gradeSystem) { case RouteGradeSystem.YDS: ret = ToYDS(); break; case RouteGradeSystem.French: ret = ToFrench(); break; case RouteGradeSystem.Hueco: ret = ToHueco(); break; case RouteGradeSystem.Ewbank: ret = ToEwbank(); break; } } if (string.IsNullOrEmpty(ret)) ret = "-"; return ret; }
/// <summary> /// Copies the state of the current object into the given one. /// </summary> /// <param name="target">Target object.</param> /// <exception cref="System.ArgumentNullException"><paramref name="target">target</paramref> is null.</exception> public void CopyTo(Route target) { if (target == null) throw new System.ArgumentNullException("target"); else { target.Id = this.Id; target.SectorId = this.SectorId; target.Name = this.Name; target.Description = this.Description; target.Climbing = this.Climbing; if (this.Grade != null) target.Grade = new RouteGrade(this.Grade); else target.Grade = null; target.Order = this.Order; } }