コード例 #1
0
        /// <exception cref="ArgumentNullException"><paramref name="infoNode"/> is <see langword="null" />.</exception>
        public CourseInfo ParseCourseInfo(INode infoNode)
        {
            if (infoNode == null)
            {
                throw new ArgumentNullException("infoNode");
            }

            var description = infoNode.GetAttributeValue(Constants.CourseDescriptionAttribute);

            var relativeUrl = infoNode.GetAttributeValue(Constants.CourseUrlAttribute);
            var amendedUrl  = AmendCourseUrl(relativeUrl);

            var courseUri = new Uri(_host, amendedUrl);

            var courseInfo = new CourseInfo
            {
                Name        = HttpUtility.HtmlDecode(infoNode.InnerText),
                Description = HttpUtility.HtmlDecode(description),
                SiteUrl     = courseUri.ToString(),
                UrlName     = courseUri.Segments.Last()
            };

            return(courseInfo);
        }
コード例 #2
0
      /// <exception cref="ArgumentNullException"><paramref name="infoNode"/> is <see langword="null" />.</exception>
      public CourseInfo ParseCourseInfo(INode infoNode)
      {
         if (infoNode == null) 
            throw new ArgumentNullException("infoNode");

         var description = infoNode.GetAttributeValue(Constants.CourseDescriptionAttribute);

         var relativeUrl = infoNode.GetAttributeValue(Constants.CourseUrlAttribute);
         var amendedUrl = AmendCourseUrl(relativeUrl);

         var courseUri = new Uri(_host, amendedUrl);

         var courseInfo = new CourseInfo
         {
            Name = HttpUtility.HtmlDecode(infoNode.InnerText),
            Description = HttpUtility.HtmlDecode(description),
            SiteUrl = courseUri.ToString(),
            UrlName = courseUri.Segments.Last()
         };

         return courseInfo;
      }