Exemplo n.º 1
0
        //schemeStr must be in lower case!
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
        {
            // check may be other thread just added one
            UriParser syntax = null;

            s_table.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null)
            {
                return(syntax);
            }
            s_tempTable.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null)
            {
                return(syntax);
            }
            lock (s_table)
            {
                if (s_tempTable.Count >= c_MaxCapacity)
                {
                    s_tempTable = new LowLevelDictionary <string, UriParser>(c_InitialTableSize);
                }
                syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
                s_tempTable[lwrCaseScheme] = syntax;
                return(syntax);
            }
        }
Exemplo n.º 2
0
        //schemeStr must be in lower case!
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
        {
            // check may be other thread just added one
            UriParser?syntax = (UriParser?)s_table[lwrCaseScheme];

            if (syntax != null)
            {
                return(syntax);
            }
            syntax = (UriParser?)s_tempTable[lwrCaseScheme];
            if (syntax != null)
            {
                return(syntax);
            }
            lock (s_table)
            {
                if (s_tempTable.Count >= c_MaxCapacity)
                {
                    s_tempTable = new Hashtable(c_InitialTableSize);
                }
                syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
                s_tempTable[lwrCaseScheme] = syntax;
                return(syntax);
            }
        }
Exemplo n.º 3
0
        //schemeStr must be in lower case!
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
        {
            // check may be other thread just added one
            UriParser syntax = null;

            m_Table.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null)
            {
                return(syntax);
            }
            m_TempTable.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null)
            {
                return(syntax);
            }
            lock (m_Table) {
                // This is a bit paranoid but let's prevent static table growing infinitly
                if (m_TempTable.Count >= c_MaxCapacity)
                {
                    m_TempTable = new Dictionary <String, UriParser>(c_InitialTableSize);
                }
                syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
                m_TempTable[lwrCaseScheme] = syntax;
                return(syntax);
            }
        }
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
        {
            UriParser parser = (UriParser)m_Table[lwrCaseScheme];

            if (parser != null)
            {
                return(parser);
            }
            parser = (UriParser)m_TempTable[lwrCaseScheme];
            if (parser != null)
            {
                return(parser);
            }
            lock (m_Table)
            {
                if (m_TempTable.Count >= 0x200)
                {
                    m_TempTable = new Hashtable(0x19);
                }
                parser = new BuiltInUriParser(lwrCaseScheme, -1, UriSyntaxFlags.AllowIriParsing | UriSyntaxFlags.AllowIdn | UriSyntaxFlags.CompressPath | UriSyntaxFlags.ConvertPathSlashes | UriSyntaxFlags.PathIsRooted | UriSyntaxFlags.AllowDOSPath | UriSyntaxFlags.V1_UnknownUri | UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.AllowEmptyHost | UriSyntaxFlags.MayHaveFragment | UriSyntaxFlags.MayHaveQuery | UriSyntaxFlags.MayHavePath | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.OptionalAuthority);
                m_TempTable[lwrCaseScheme] = parser;
                return(parser);
            }
        }
Exemplo n.º 5
0
 //schemeStr must be in lower case!
 internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
 {
     // check may be other thread just added one
     UriParser syntax = null;
     s_table.TryGetValue(lwrCaseScheme, out syntax);
     if (syntax != null)
     {
         return syntax;
     }
     s_tempTable.TryGetValue(lwrCaseScheme, out syntax);
     if (syntax != null)
     {
         return syntax;
     }
     lock (s_table)
     {
         if (s_tempTable.Count >= c_MaxCapacity)
         {
             s_tempTable = new LowLevelDictionary<string, UriParser>(c_InitialTableSize);
         }
         syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
         s_tempTable[lwrCaseScheme] = syntax;
         return syntax;
     }
 }
Exemplo n.º 6
0
        //schemeStr must be in lower case!
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme) {

            // check may be other thread just added one
            UriParser syntax = null;
            m_Table.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null) {
                return syntax;
            }
            m_TempTable.TryGetValue(lwrCaseScheme, out syntax);
            if (syntax != null) {
                return syntax;
            }
            lock (m_Table) {
                // This is a bit paranoid but let's prevent static table growing infinitly
                if (m_TempTable.Count >= c_MaxCapacity) {
                    m_TempTable = new Dictionary<String, UriParser>(c_InitialTableSize);
                }
                syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
                m_TempTable[lwrCaseScheme] = syntax;
                return syntax;
            }
        }
Exemplo n.º 7
0
        //schemeStr must be in lower case!
        internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme) {

            // check may be other thread just added one
            UriParser syntax = (UriParser)m_Table[lwrCaseScheme];
            if (syntax != null) {
                return syntax;
            }
            syntax = (UriParser)m_TempTable[lwrCaseScheme];
            if (syntax != null) {
                return syntax;
            }
            lock (m_Table) {
                if (m_TempTable.Count >= c_MaxCapacity) {
                    m_TempTable = new System.Collections.Hashtable(c_InitialTableSize);
                }
                syntax = new BuiltInUriParser(lwrCaseScheme, NoDefaultPort, UnknownV1SyntaxFlags);
                m_TempTable[lwrCaseScheme] = syntax;
                return syntax;
            }
        }
 internal static UriParser FindOrFetchAsUnknownV1Syntax(string lwrCaseScheme)
 {
     UriParser parser = (UriParser) m_Table[lwrCaseScheme];
     if (parser != null)
     {
         return parser;
     }
     parser = (UriParser) m_TempTable[lwrCaseScheme];
     if (parser != null)
     {
         return parser;
     }
     lock (m_Table)
     {
         if (m_TempTable.Count >= 0x200)
         {
             m_TempTable = new Hashtable(0x19);
         }
         parser = new BuiltInUriParser(lwrCaseScheme, -1, UriSyntaxFlags.AllowIriParsing | UriSyntaxFlags.AllowIdn | UriSyntaxFlags.CompressPath | UriSyntaxFlags.ConvertPathSlashes | UriSyntaxFlags.PathIsRooted | UriSyntaxFlags.AllowDOSPath | UriSyntaxFlags.V1_UnknownUri | UriSyntaxFlags.AllowAnInternetHost | UriSyntaxFlags.AllowUncHost | UriSyntaxFlags.AllowEmptyHost | UriSyntaxFlags.MayHaveFragment | UriSyntaxFlags.MayHaveQuery | UriSyntaxFlags.MayHavePath | UriSyntaxFlags.MayHavePort | UriSyntaxFlags.MayHaveUserInfo | UriSyntaxFlags.OptionalAuthority);
         m_TempTable[lwrCaseScheme] = parser;
         return parser;
     }
 }