예제 #1
0
        private void getDoorDict(Tuple <int, int> t, int i)
        {
            List <string> Link_String = web.GetAllLinks();
            Random        rand        = new Random();

            i = rand.Next(0, Link_String.Count);
            while (i >= Link_String.Count || Link_String[i] == "" || Link_String[i][0] == '#' || Link_String[i].IndexOf("javascipt") > 0)
            {
                i = rand.Next(0, Link_String.Count);
            }
            if (!dict.Keys.Contains(t))
            {
                dict.Add(t, Link_String[i]);
            }
        }
예제 #2
0
 public LevelGen(string url)
 {
     //while (true) {
     Console.WriteLine("Creating web page parser");
     try {
         //String uri = Console.ReadLine();
         //if (uri.Equals("q")) Environment.Exit(1);
         web = WebPageParser.FromUrl(url);
     }
     catch (Exception e) {
         Console.WriteLine(e.Message);
         web = new WebPageParser();
     }
     Console.WriteLine("Web page parser created successfully");
     this.GetLevel(web.GetTotalWebsiteElements());
     this.MakeDoors(Math.Min((LevelGrid.GetLength(0) + LevelGrid.GetLength(1)) / 2, web.GetAllLinks().Count));
     this.title        = web.GetWebpageTitle();
     this.colors       = GetAllColors(web);
     this.primaryColor = getMostColorful(this.colors);
     //}
 }