private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) { throw new InvalidOperationException(SR.GetString("net_uri_NeedFreshParser", new object[] { syntax.SchemeName })); } lock (m_Table) { syntax.m_Flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser parser = (UriParser)m_Table[lwrCaseSchemeName]; if (parser != null) { throw new InvalidOperationException(SR.GetString("net_uri_AlreadyRegistered", new object[] { parser.SchemeName })); } parser = (UriParser)m_TempTable[syntax.SchemeName]; if (parser != null) { lwrCaseSchemeName = parser.m_Scheme; m_TempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax.m_Scheme = lwrCaseSchemeName; syntax.CheckSetIsSimpleFlag(); syntax.m_Port = defaultPort; m_Table[syntax.SchemeName] = syntax; } }
private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) { throw new InvalidOperationException(SR.Format(SR.net_uri_NeedFreshParser, syntax.SchemeName)); } lock (s_table) { syntax._flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser oldSyntax = null; s_table.TryGetValue(lwrCaseSchemeName, out oldSyntax); if (oldSyntax != null) { throw new InvalidOperationException(SR.Format(SR.net_uri_AlreadyRegistered, oldSyntax.SchemeName)); } s_tempTable.TryGetValue(syntax.SchemeName, out oldSyntax); if (oldSyntax != null) { // optimization on schemeName, will try to keep the first reference lwrCaseSchemeName = oldSyntax._scheme; s_tempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax._scheme = lwrCaseSchemeName; syntax.CheckSetIsSimpleFlag(); syntax._port = defaultPort; s_table[syntax.SchemeName] = syntax; } }
private static void InternalRegister(Hashtable table, UriParser uriParser, string schemeName, int defaultPort) { uriParser.SchemeName = schemeName; uriParser.DefaultPort = defaultPort; if (uriParser is GenericUriParser) { table.Add(schemeName, uriParser); } else { DefaultUriParser defaultUriParser = new DefaultUriParser(); defaultUriParser.SchemeName = schemeName; defaultUriParser.DefaultPort = defaultPort; table.Add(schemeName, defaultUriParser); } uriParser.OnRegister(schemeName, defaultPort); }
private static void InternalRegister(Hashtable table, System.UriParser uriParser, string schemeName, int defaultPort) { uriParser.SchemeName = schemeName; uriParser.DefaultPort = defaultPort; if (uriParser is System.GenericUriParser) { table.Add(schemeName, uriParser); } else { table.Add(schemeName, new DefaultUriParser { SchemeName = schemeName, DefaultPort = defaultPort }); } uriParser.OnRegister(schemeName, defaultPort); }
// *no* check version private static void InternalRegister(Hashtable table, UriParser uriParser, string schemeName, int defaultPort) { uriParser.SchemeName = schemeName; uriParser.DefaultPort = defaultPort; // FIXME: MS doesn't seems to call most inherited parsers if (uriParser is GenericUriParser) { table.Add(schemeName, uriParser); } else { DefaultUriParser parser = new DefaultUriParser(); parser.SchemeName = schemeName; parser.DefaultPort = defaultPort; table.Add(schemeName, parser); } // note: we cannot set schemeName and defaultPort inside OnRegister uriParser.OnRegister(schemeName, defaultPort); }
private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) throw new InvalidOperationException(SR.Format(SR.net_uri_NeedFreshParser, syntax.SchemeName)); lock (s_table) { syntax._flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser oldSyntax = null; s_table.TryGetValue(lwrCaseSchemeName, out oldSyntax); if (oldSyntax != null) throw new InvalidOperationException(SR.Format(SR.net_uri_AlreadyRegistered, oldSyntax.SchemeName)); s_tempTable.TryGetValue(syntax.SchemeName, out oldSyntax); if (oldSyntax != null) { // optimization on schemeName, will try to keep the first reference lwrCaseSchemeName = oldSyntax._scheme; s_tempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax._scheme = lwrCaseSchemeName; syntax._port = defaultPort; s_table[syntax.SchemeName] = syntax; } }
// *no* check version private static void InternalRegister (Hashtable table, UriParser uriParser, string schemeName, int defaultPort) { uriParser.SchemeName = schemeName; uriParser.DefaultPort = defaultPort; // FIXME: MS doesn't seems to call most inherited parsers if (uriParser is GenericUriParser) { table.Add (schemeName, uriParser); } else { DefaultUriParser parser = new DefaultUriParser (); parser.SchemeName = schemeName; parser.DefaultPort = defaultPort; table.Add (schemeName, parser); } // note: we cannot set schemeName and defaultPort inside OnRegister uriParser.OnRegister (schemeName, defaultPort); }
// private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) throw new InvalidOperationException(SR.GetString(SR.net_uri_NeedFreshParser, syntax.SchemeName)); lock (m_Table) { syntax.m_Flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser oldSyntax = (UriParser)m_Table[lwrCaseSchemeName]; if (oldSyntax != null) throw new InvalidOperationException(SR.GetString(SR.net_uri_AlreadyRegistered, oldSyntax.SchemeName)); oldSyntax = (UriParser)m_TempTable[syntax.SchemeName]; if (oldSyntax != null) { // optimization on schemeName, will try to keep the first reference lwrCaseSchemeName = oldSyntax.m_Scheme; m_TempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax.m_Scheme = lwrCaseSchemeName; syntax.CheckSetIsSimpleFlag(); syntax.m_Port = defaultPort; m_Table[syntax.SchemeName] = syntax; } }
private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) { throw new InvalidOperationException(SR.GetString("net_uri_NeedFreshParser", new object[] { syntax.SchemeName })); } lock (m_Table) { syntax.m_Flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser parser = (UriParser) m_Table[lwrCaseSchemeName]; if (parser != null) { throw new InvalidOperationException(SR.GetString("net_uri_AlreadyRegistered", new object[] { parser.SchemeName })); } parser = (UriParser) m_TempTable[syntax.SchemeName]; if (parser != null) { lwrCaseSchemeName = parser.m_Scheme; m_TempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax.m_Scheme = lwrCaseSchemeName; syntax.CheckSetIsSimpleFlag(); syntax.m_Port = defaultPort; m_Table[syntax.SchemeName] = syntax; } }