Beispiel #1
0
        public override string ToString()
        {
            if (FileName.EndsWithAny(new[] { ".less", ".css", ".scss" }))
            {
                if (Phrase.HasValue() == false)
                {
                    return(FileName);
                }

                var splittedDisplayPath = DisplayPath.Split('\\');
                if (splittedDisplayPath.Length == 4 || splittedDisplayPath.Length < 4)
                {
                    return("{0} -----> {1}".FormatWith(Phrase, DisplayPath));
                }
                else
                {
                    var path = splittedDisplayPath.Skip(splittedDisplayPath.Length - 3).Aggregate((a, b) => a + "\\" + b);
                    return("{0} -----> {1}".FormatWith(Phrase, path));
                }
            }
            else
            {
                return(Phrase.HasValue() ? "{0} -----> {1}".FormatWith(Phrase, DisplayPath) : FileName);
            }
        }
Beispiel #2
0
        public override string ToString()
        {
            const string format = "{0}    -----> {1}";

            if (!FileName.EndsWithAny(styleExtensions))
            {
                return(Phrase.HasValue() ? format.FormatWith(Phrase, DisplayPath) : FileName);
            }

            if (!Phrase.HasValue())
            {
                return(FileName);
            }

            var splittedDisplayPath = DisplayPath.Split('\\');

            if (splittedDisplayPath.Length <= 4)
            {
                return(format.FormatWith(Phrase, DisplayPath));
            }

            var path = splittedDisplayPath.Skip(splittedDisplayPath.Length - 3).Aggregate((a, b) => a + "\\" + b);

            return(format.FormatWith(Phrase, path));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            try
            {
                Map         map         = Map.GetMapFromFile(dataFile);
                DisplayMaze displayMaze = new DisplayMaze();
                displayMaze.Display(map);

                StartPointSelector startPointSelector = new StartPointSelector();
                Coordinates        startPoint         = startPointSelector.GetCoordinates(map.StartPoint);
                map.ChangeStartPoint(startPoint);

                Path        path        = new Path(map);
                DisplayPath displayPath = new DisplayPath();
                displayPath.Display(path);
                PathLog pathLog = new PathLog();
                pathLog.PrintLogToFile(path.ShortestPath, logFile);
            }
            catch (System.IO.FileNotFoundException e)
            {
                Console.WriteLine("[ERROR] File " + dataFile + " not found.");
            }
            catch (ArgumentException e)
            {
                Console.WriteLine("[ERROR] Map without exit.");
            }
            catch (System.IO.InvalidDataException e)
            {
                Console.WriteLine("[ERROR] Multiple start points.");
            }
            catch (IndexOutOfRangeException e)
            {
                Console.WriteLine("[ERROR] Start point outside of maze.");
            }
            catch (InvalidOperationException e)
            {
                Console.WriteLine("[ERROR] Wrong place for start point.");
            }

            Console.ReadKey();
        }