////////////////////////////////////////////////////////////////////// /// <summary>protected void ParseUri</summary> /// <param name="targetUri">takes an incoming Uri string and parses all the properties out of it</param> /// <returns>throws a query exception when it finds something wrong with the input, otherwise returns a baseuri</returns> ////////////////////////////////////////////////////////////////////// protected override Uri ParseUri(Uri targetUri) { base.ParseUri(targetUri); if (targetUri != null) { char[] deli = { '?', '&' }; string source = HttpUtility.UrlDecode(targetUri.Query); TokenCollection tokens = new TokenCollection(source, deli); foreach (String token in tokens) { if (token.Length > 0) { char[] otherDeli = { '=' }; String[] parameters = token.Split(otherDeli, 2); switch (parameters[0]) { case "start-min": this.startTime = DateTime.Parse(parameters[1], CultureInfo.InvariantCulture); break; case "start-max": this.endTime = DateTime.Parse(parameters[1], CultureInfo.InvariantCulture); break; case "recurrence-expansion-start": this.recurrenceStart = DateTime.Parse(parameters[1], CultureInfo.InvariantCulture); break; case "recurrence-expansion-end": this.recurrenceEnd = DateTime.Parse(parameters[1], CultureInfo.InvariantCulture); break; case "singleevents": this.singleEvents = bool.Parse(parameters[1]); break; case "futureevents": this.futureEvents = bool.Parse(parameters[1]); break; case "sortorder": this.sortOrder = (CalendarSortOrder)Enum.Parse(typeof(CalendarSortOrder), parameters[1]); break; case "ctz": this.timeZone = parameters[1]; break; } } } } return(this.Uri); }
////////////////////////////////////////////////////////////////////// /// <summary>protected void ParseUri</summary> /// <param name="targetUri">takes an incoming Uri string and parses all the properties out of it</param> /// <returns>throws a query exception when it finds something wrong with the input, otherwise returns a baseuri</returns> ////////////////////////////////////////////////////////////////////// protected override Uri ParseUri(Uri targetUri) { base.ParseUri(targetUri); if (targetUri != null) { char[] deli = { '?', '&'}; TokenCollection tokens = new TokenCollection(targetUri.Query, deli); foreach (String token in tokens) { if (token.Length > 0) { char[] otherDeli = { '='}; String[] parameters = token.Split(otherDeli, 2); switch (parameters[0]) { case "start-min": this.startTime = DateTime.Parse(Utilities.UrlDecodedValue(parameters[1]), CultureInfo.InvariantCulture); break; case "start-max": this.endTime = DateTime.Parse(Utilities.UrlDecodedValue(parameters[1]), CultureInfo.InvariantCulture); break; case "recurrence-expansion-start": this.recurrenceStart = DateTime.Parse(Utilities.UrlDecodedValue(parameters[1]), CultureInfo.InvariantCulture); break; case "recurrence-expansion-end": this.recurrenceEnd = DateTime.Parse(Utilities.UrlDecodedValue(parameters[1]), CultureInfo.InvariantCulture); break; case "singleevents": this.singleEvents = bool.Parse(parameters[1]); break; case "futureevents": this.futureEvents = bool.Parse(parameters[1]); break; case "sortorder": this.sortOrder = (CalendarSortOrder) Enum.Parse(typeof(CalendarSortOrder), parameters[1]); break; case "ctz": this.timeZone = parameters[1]; break; } } } } return this.Uri; }