private bool ReadAddSchemeSetting() { string schemeValue = reader.GetAttribute(CommonConfigurationStrings.SchemeName); string genericUriParserOptionsValue = reader.GetAttribute( CommonConfigurationStrings.GenericUriParserOptions); if (string.IsNullOrEmpty(schemeValue) || string.IsNullOrEmpty(genericUriParserOptionsValue)) { return(false); } try { GenericUriParserOptions genericUriParserOptions = (GenericUriParserOptions)Enum.Parse( typeof(GenericUriParserOptions), genericUriParserOptionsValue); SchemeSettingInternal schemeSetting = new SchemeSettingInternal(schemeValue, genericUriParserOptions); sectionData.SchemeSettings[schemeSetting.Name] = schemeSetting; return(true); } catch (ArgumentException) { return(false); } }
public SchemeSettingInternal(string name, GenericUriParserOptions options) { Debug.Assert(name != null, "'name' must not be null."); this.name = name.ToLowerInvariant(); this.options = options; }
public SchemeSettingInternal(string name, GenericUriParserOptions options) { Debug.Assert(name != null, "'name' must not be null."); this.name = name.ToLowerInvariant(); this.options = options; }
public void AllOptions() { for (int i = 0; i < 512; i++) { GenericUriParserOptions gupo = (GenericUriParserOptions)i; Assert.IsNotNull(new GenericUriParser(gupo), gupo.ToString()); } }
// private static UriSyntaxFlags MapGenericParserOptions(GenericUriParserOptions options) { // // Here we map public flags to internal ones // Note an instacne of this parser is always a "simple parser" since the class is sealed. // UriSyntaxFlags flags = DefaultGenericUriParserFlags; if ((options & GenericUriParserOptions.GenericAuthority) != 0) { // Disable some options that are not compatible with generic authority flags &= ~(UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.AllowAnInternetHost); flags |= UriSyntaxFlags.AllowAnyOtherHost; } if ((options & GenericUriParserOptions.AllowEmptyAuthority) != 0) { flags |= UriSyntaxFlags.AllowEmptyHost; } if ((options & GenericUriParserOptions.NoUserInfo) != 0) { flags &= ~UriSyntaxFlags.MayHaveUserInfo; } if ((options & GenericUriParserOptions.NoPort) != 0) { flags &= ~UriSyntaxFlags.MayHavePort; } if ((options & GenericUriParserOptions.NoQuery) != 0) { flags &= ~UriSyntaxFlags.MayHaveQuery; } if ((options & GenericUriParserOptions.NoFragment) != 0) { flags &= ~UriSyntaxFlags.MayHaveFragment; } if ((options & GenericUriParserOptions.DontConvertPathBackslashes) != 0) { flags &= ~UriSyntaxFlags.ConvertPathSlashes; } if ((options & GenericUriParserOptions.DontCompressPath) != 0) { flags &= ~(UriSyntaxFlags.CompressPath | UriSyntaxFlags.CanonicalizeAsFilePath); } if ((options & GenericUriParserOptions.DontUnescapePathDotsAndSlashes) != 0) { flags &= ~UriSyntaxFlags.UnEscapeDotsAndSlashes; } return(flags); }
/// <summary>Registers the ice and ice+universal schemes.</summary> internal static void RegisterCommon() { RegisterTransport("universal", defaultPort: 0); // There is actually no authority at all with the ice scheme, but we emulate it with an empty authority // during parsing by the Uri class and the GenericUriParser. GenericUriParserOptions options = ParserOptions | GenericUriParserOptions.AllowEmptyAuthority | GenericUriParserOptions.NoPort; System.UriParser.Register(new GenericUriParser(options), "ice", -1); }
private static UriSyntaxFlags MapGenericParserOptions(GenericUriParserOptions options) { UriSyntaxFlags flags = UriSyntaxFlags.UnEscapeDotsAndSlashes | UriSyntaxFlags.CanonicalizeAsFilePath | UriSyntaxFlags.CompressPath | UriSyntaxFlags.ConvertPathSlashes | UriSyntaxFlags.PathIsRooted | UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.MayHaveFragment | UriSyntaxFlags.MayHaveQuery | UriSyntaxFlags.MayHavePath | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.MustHaveAuthority; if ((options & GenericUriParserOptions.GenericAuthority) != GenericUriParserOptions.Default) { flags &= ~(UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo); flags |= UriSyntaxFlags.AllowAnyOtherHost; } if ((options & GenericUriParserOptions.AllowEmptyAuthority) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowEmptyHost; } if ((options & GenericUriParserOptions.NoUserInfo) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveUserInfo; } if ((options & GenericUriParserOptions.NoPort) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHavePort; } if ((options & GenericUriParserOptions.NoQuery) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveQuery; } if ((options & GenericUriParserOptions.NoFragment) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveFragment; } if ((options & GenericUriParserOptions.DontConvertPathBackslashes) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.ConvertPathSlashes; } if ((options & GenericUriParserOptions.DontCompressPath) != GenericUriParserOptions.Default) { flags &= ~(UriSyntaxFlags.CanonicalizeAsFilePath | UriSyntaxFlags.CompressPath); } if ((options & GenericUriParserOptions.DontUnescapePathDotsAndSlashes) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.UnEscapeDotsAndSlashes; } if ((options & GenericUriParserOptions.Idn) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowIdn; } if ((options & GenericUriParserOptions.IriParsing) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowIriParsing; } return(flags); }
private static UriSyntaxFlags MapGenericParserOptions(GenericUriParserOptions options) { UriSyntaxFlags flags = UriSyntaxFlags.UnEscapeDotsAndSlashes | UriSyntaxFlags.CanonicalizeAsFilePath | UriSyntaxFlags.CompressPath | UriSyntaxFlags.ConvertPathSlashes | UriSyntaxFlags.PathIsRooted | UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.MayHaveFragment | UriSyntaxFlags.MayHaveQuery | UriSyntaxFlags.MayHavePath | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.MustHaveAuthority; if ((options & GenericUriParserOptions.GenericAuthority) != GenericUriParserOptions.Default) { flags &= ~(UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo); flags |= UriSyntaxFlags.AllowAnyOtherHost; } if ((options & GenericUriParserOptions.AllowEmptyAuthority) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowEmptyHost; } if ((options & GenericUriParserOptions.NoUserInfo) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveUserInfo; } if ((options & GenericUriParserOptions.NoPort) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHavePort; } if ((options & GenericUriParserOptions.NoQuery) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveQuery; } if ((options & GenericUriParserOptions.NoFragment) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.MayHaveFragment; } if ((options & GenericUriParserOptions.DontConvertPathBackslashes) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.ConvertPathSlashes; } if ((options & GenericUriParserOptions.DontCompressPath) != GenericUriParserOptions.Default) { flags &= ~(UriSyntaxFlags.CanonicalizeAsFilePath | UriSyntaxFlags.CompressPath); } if ((options & GenericUriParserOptions.DontUnescapePathDotsAndSlashes) != GenericUriParserOptions.Default) { flags &= ~UriSyntaxFlags.UnEscapeDotsAndSlashes; } if ((options & GenericUriParserOptions.Idn) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowIdn; } if ((options & GenericUriParserOptions.IriParsing) != GenericUriParserOptions.Default) { flags |= UriSyntaxFlags.AllowIriParsing; } return flags; }
private bool ReadAddSchemeSetting() { string attribute = this.reader.GetAttribute("name"); string str2 = this.reader.GetAttribute("genericUriParserOptions"); if (string.IsNullOrEmpty(attribute) || string.IsNullOrEmpty(str2)) { return(false); } try { GenericUriParserOptions options = (GenericUriParserOptions)Enum.Parse(typeof(GenericUriParserOptions), str2); SchemeSettingInternal internal2 = new SchemeSettingInternal(attribute, options); this.sectionData.SchemeSettings[internal2.Name] = internal2; return(true); } catch (ArgumentException) { return(false); } }
public GenericUriParser (GenericUriParserOptions options) { }
public GenericUriParser(GenericUriParserOptions options) { this.options = options; }
// Constructors public GenericUriParser(GenericUriParserOptions options) { }
public GenericUriParser(GenericUriParserOptions options) { throw new NotImplementedException(); }
// private static UriSyntaxFlags MapGenericParserOptions(GenericUriParserOptions options) { // // Here we map public flags to internal ones // Note an instacne of this parser is always a "simple parser" since the class is sealed. // UriSyntaxFlags flags = DefaultGenericUriParserFlags; if ((options & GenericUriParserOptions.GenericAuthority) != 0) { // Disable some options that are not compatible with generic authority flags &= ~(UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.AllowAnInternetHost); flags |= UriSyntaxFlags.AllowAnyOtherHost; } if ((options & GenericUriParserOptions.AllowEmptyAuthority) != 0) { flags |= UriSyntaxFlags.AllowEmptyHost; } if ((options & GenericUriParserOptions.NoUserInfo) != 0) { flags &= ~UriSyntaxFlags.MayHaveUserInfo; } if ((options & GenericUriParserOptions.NoPort) != 0) { flags &= ~UriSyntaxFlags.MayHavePort; } if ((options & GenericUriParserOptions.NoQuery) != 0) { flags &= ~UriSyntaxFlags.MayHaveQuery; } if ((options & GenericUriParserOptions.NoFragment) != 0) { flags &= ~UriSyntaxFlags.MayHaveFragment; } if ((options & GenericUriParserOptions.DontConvertPathBackslashes) != 0) { flags &= ~UriSyntaxFlags.ConvertPathSlashes; } if ((options & GenericUriParserOptions.DontCompressPath) != 0) { flags &= ~(UriSyntaxFlags.CompressPath | UriSyntaxFlags.CanonicalizeAsFilePath); } if ((options & GenericUriParserOptions.DontUnescapePathDotsAndSlashes) != 0) { flags &= ~UriSyntaxFlags.UnEscapeDotsAndSlashes; } return flags; }
// // The only availabe .ctor. // public GenericUriParser(GenericUriParserOptions options) : base(MapGenericParserOptions(options)) { }
public SchemeSettingInternal(string name, GenericUriParserOptions options) { this.name = name.ToLowerInvariant(); this.options = options; }
public BasicURIParser(GenericUriParserOptions options = GenericUriParserOptions.Default) : base(options) { }
public GenericUriParser(GenericUriParserOptions options) : base(MapGenericParserOptions(options)) { }
//You may want to have your constructor do more, but it usually //isn't necesssary. See the MSDN documentation for //GenericUriParserOptions for a full explanation of what it does. //Basically it lets you define escaping rules and the presence of //certain URI fields. public PWUriParser(GenericUriParserOptions options) : base(options) { }