예제 #1
0
        public void Initialize(Dictionary<String, String> parameters)
        {
            string tldfile = "tld.txt";
            string sitePrefixTableFile = "PrefixTable.txt";
            string getReversedSiteString = "false";

            lock( InitializeLock )
            {
                try
                {
                    if (!parameters.TryGetValue("getreversedsite", out getReversedSiteString ))
                    {
                        getReversedSiteString = "false";
                        Console.WriteLine( " getreversedsite missing. Default set to " + getReversedSiteString );
                    }

                    if (!parameters.TryGetValue("tldfile", out tldfile ))
                    {
                        tldfile = "tld.txt";
                        Console.WriteLine( " tldfile missing. Default set to " + tldfile );
                    }

                    if (!parameters.TryGetValue("siteprefixtable", out sitePrefixTableFile ))
                    {
                        sitePrefixTableFile = "PrefixTable.txt";
                        Console.WriteLine( " siteprefixtable  missing. Default set to "  +  sitePrefixTableFile  );
                    }

                    getReversedSite = bool.Parse( getReversedSiteString );
                    table = LoadPrefixTable( sitePrefixTableFile );
                    reverser = new UrlReverser(tldfile);
                    isDefined = true;

                }
                catch( Exception e )
                {
                    isDefined =false;
                    throw new Exception( "SitePrefixTable : Initialization error : " + e.ToString() );
                }
            }
        }
예제 #2
0
 public void Initialize(string sitePrefixTableFile, string tldFile, bool isRev)
 {
     getReversedSite = isRev;
     table = LoadPrefixTable( sitePrefixTableFile );
     reverser = new UrlReverser(tldFile);
     isDefined = true;
 }