예제 #1
0
        public MapCell(int cellIndexX, int cellIndexY)
        {
            CellImgX = CellIndexX = cellIndexX;
            CellImgY = CellIndexY = cellIndexY;

            NumCellX = Math.Max(NumCellX, cellIndexX + 1);
            NumCellY = Math.Max(NumCellY, cellIndexY + 1);

            ChangedProperties = new List <string>();

            CurrMapPage = MapPage.GetMapPage('M', 36, "061");
        }
예제 #2
0
파일: Program.cs 프로젝트: snklim/WpfDemo
        static void Main(string[] args)
        {
            Regex regex    = new Regex("<area.*href=\"(.*?)\".*>", RegexOptions.Multiline);
            Regex regexMap = new Regex(@"(\w-\d+-\d+)");

            Dictionary <string, MapPage> ukraine = new Dictionary <string, MapPage>();

            using (System.IO.StreamReader streamReader =
                       new System.IO.StreamReader(@"C:\work\WpfDemo\WpfDemo.Downloader\bin\Debug\map.html"))
            {
                string htmlPage = streamReader.ReadToEnd();
                if (regex.IsMatch(htmlPage))
                {
                    foreach (Match match in regex.Matches(htmlPage))
                    {
                        string url = match.Groups[1].Value;
                        if (regexMap.IsMatch(url))
                        {
                            Match  matchUrl  = regexMap.Match(url);
                            string mapPageId = matchUrl.Groups[1].Value.ToUpper();
                            ukraine.Add(mapPageId, MapPage.GetMapPage(mapPageId));
                        }
                    }
                }
            }

            MapPage mapPageBegin   = MapPage.GetMapPage("N-34-001");
            MapPage mapPageCurrent = mapPageBegin;

            int numbers = ukraine.Count;

            int x = 0;
            int y = 0;

            List <Point> shape = new List <Point>();

            while (numbers > 0)
            {
                string mapPageId = string.Format("{0}-{1}-{2}", mapPageCurrent.Letter, mapPageCurrent.Sector, mapPageCurrent.Square);

                y++;

                if (ukraine.ContainsKey(mapPageId))
                {
                    numbers--;

                    shape.Add(new Point(x, y));
                }

                mapPageCurrent = mapPageCurrent.Bottom;

                if (mapPageCurrent == mapPageBegin)
                {
                    mapPageCurrent = mapPageCurrent.Right;
                    mapPageBegin   = mapPageCurrent;

                    x++;
                    y = 0;
                }
            }

            foreach (var point in shape)
            {
                Console.SetCursorPosition(2 * point.X, point.Y);
                Console.WriteLine("xx");
            }

            Console.SetCursorPosition(0, Point._maxY - Point._minY + 1);
        }
예제 #3
0
파일: Program.cs 프로젝트: snklim/WpfDemo
 public DownloadTarget(string beginMapPage, int numberToDownload)
 {
     BeginMapPage     = MapPage.GetMapPage(beginMapPage);
     NumberToDownload = numberToDownload;
 }