Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToUri()

static Uri System.Xml.Extensions.ExtensionMethods.ToUri ( string s)
inlinestaticpackage

Definition at line 5 of file ExtensionMethods.cs.

6 {
7 if (s != null && s.Length > 0)
8 {
9 s = s.Trim(' ', '\t', '\n', '\r');
10 if (s.Length == 0 || s.IndexOf("##", StringComparison.Ordinal) != -1)
11 {
12 throw new FormatException(System.SR.Format(System.SR.XmlConvert_BadFormat, s, "Uri"));
13 }
14 }
15 if (!Uri.TryCreate(s, UriKind.RelativeOrAbsolute, out Uri result))
16 {
17 throw new FormatException(System.SR.Format(System.SR.XmlConvert_BadFormat, s, "Uri"));
18 }
19 return result;
20 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlConvert_BadFormat
Definition SR.cs:370
Definition SR.cs:7
UriKind
Definition UriKind.cs:4

References System.Xml.Dictionary, System.SR.Format(), System.s, System.Uri.TryCreate(), and System.SR.XmlConvert_BadFormat.

Referenced by System.Xml.Serialization.XmlSerializerNamespaces.Add().