// Decompiled with JetBrains decompiler // Type: Rei.Fs.HostRootedUriParser // Assembly: Rei.Fs, Version=1.13.2.8796, Culture=neutral, PublicKeyToken=null // MVID: D8B08A8B-697C-4439-9CFF-1BE4EE46F7B0 // Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.dll using Microsoft.VisualBasic.CompilerServices; using System; using System.Reflection; using System.Security.Permissions; namespace Rei.Fs { public class HostRootedUriParser : GenericUriParser { private static readonly GenericUriParserOptions ParserOptions = GenericUriParserOptions.DontUnescapePathDotsAndSlashes | GenericUriParserOptions.Idn | GenericUriParserOptions.IriParsing; private const int MustHaveAuthority = 1; private const int OptionalAuthority = 2; public static void Register(string scheme, int defaultport) { if (UriParser.IsKnownScheme(scheme)) return; UriParser.Register((UriParser) new HostRootedUriParser(), scheme, defaultport); } public HostRootedUriParser() : base(HostRootedUriParser.ParserOptions) { ReflectionPermission reflectionPermission = new ReflectionPermission(ReflectionPermissionFlag.AllFlags); SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.AllFlags); reflectionPermission.Demand(); securityPermission.Demand(); FieldInfo field = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic); int num = Conversions.ToInteger(field.GetValue((object) this)) & -3 | 1; field.SetValue((object) this, (object) num); } protected override void InitializeAndValidate(Uri uri, out UriFormatException parsingError) { base.InitializeAndValidate(uri, out parsingError); if (parsingError == null && Operators.CompareString(uri.Host, "", false) == 0) parsingError = new UriFormatException("should contain host"); if (parsingError == null && !uri.AbsolutePath.StartsWith("/")) parsingError = new UriFormatException("should be absolute path"); if (parsingError != null || uri.Port > 0) return; parsingError = new UriFormatException("should not contain port"); } } }