Beispiel #1
0
        static void Main(string[] args)
        {
            /*Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form_Splash());*/
            //new Controller(new ConsoleView(), new Game(), new FileHandler(), new LevelBuilder()).Init();

            FileHandler filer = new FileHandler();
            LevelBuilder builder = new LevelBuilder();
            /*Game theGame = new Game();
            filer.Init();
            filer.SetMap(0, "Map 1.");

            theGame.SetFiler(filer);
            theGame.SetMap();

            foreach (Tile tile in theGame.GetMap())
            {
                Console.WriteLine(tile.Coordinate);
            }

            Tile theTile = theGame.GetMap()[3, 2];
            Console.WriteLine(theTile.Coordinate);
            Console.WriteLine(theGame.GetMap().GetLength(0));
            Console.WriteLine(theTile.IsOuter(Direction.Left));

            int i = 105;

            Console.WriteLine(i / 50);*/
            /*
            Point p = new Point(4, 4);
            builder.Init(p);
            p = new Point(3, 0);
            builder.SelectTile(p);
            builder.Exit();
            builder.EastWall();

            p = new Point(0, 3);
            builder.SelectTile(p);
            builder.SetTheseus();
            p = new Point(0, 2);
            builder.SelectTile(p);
            builder.SetMinotaur();

            Console.WriteLine(builder.Test());

            builder.Clear();

            Console.WriteLine(builder.Test());

            /*filer.Init();
            filer.SetMap(0, "Map 6");
            filer.GetNextMap();*/

            //Console.WriteLine(MapCreator.ObjectsToString(filer.GetMap().Tiles, filer.GetMap().TheTheseus, filer.GetMap().TheMinotaur));
            Loader loader = new Loader();
            Compressor compressor = new Compressor();
            Decompressor decompressor;

            /*string str = filer.LoadTextFile(@"H:\2015\semester 2\PR 283 C#\Theseus\level1.txt");
            Console.WriteLine(str);

            string[] stra = loader.ToStringArray(str);
            compressor.LoadMap(stra);
            compressor.FindSpecialCharacters();
            compressor.CompressLevel1();
            compressor.SetTheResult();
            Console.WriteLine(compressor.GetLvl1());
            Saver saver = new Saver();
            saver.SetFileName("lvl1c1");
            saver.SaveSingle(@"H:\2015\semester 2\PR 283 C#\Theseus", compressor.GetLvl1());*/

            string newFile = filer.LoadTextFile(@"H:\2015\semester 2\PR 283 C#\Theseus\lvl1c1.txt");
            decompressor = new Decompressor();

            decompressor.SetCompressed(newFile);

            //try
            //{
                decompressor.SeparateToArrays();
            //}

                decompressor.DecompressLevel1();
                decompressor.SetCharacters();

            /*int x = 0;
            foreach (string st in stra)
            {
                Console.WriteLine(x.ToString() + st);
                Console.WriteLine(st.Length);
                x++;
            }

            Bridger bridger = new Bridger();

            AMap newMap = new AMap();
            newMap.Map = stra;

            newMap = bridger.Convert(newMap);

            Console.WriteLine(newMap.TheMinotaur.Coordinate);
            Console.WriteLine(newMap.TheTheseus.Coordinate);*/

            //filer.IsValid(@"H:\2015\semester 2\PR 283 C#\Theseus\level1.txt");

            Console.ReadKey();
        }
Beispiel #2
0
        public string LoadTextFile(string theFile)
        {
            if (loader == null)
            {
                loader = new Loader();
            }

            loader.SetFilePath(theFile);
            loader.ExtractFileContents();
            return loader.GetFileContents();
        }
Beispiel #3
0
        public bool TestUncompressed(string theFile)
        {
            string str = LoadTextFile(theFile);
            string[] strArray;
            if (loader == null)
            {
                loader = new Loader();
            }

            strArray = loader.ToStringArray(str);
            AMap newMap = new AMap();

            if (bridger == null)
            {
                bridger = new Bridger();
            }
            bridger.Init(newMap);

            if (!bridger.IsValid())
            {
                return false;
            }

            try
            {
                bridger.Convert(newMap);
            }
            catch (IndexOutOfRangeException)
            {
                return false;
            }
            return true;
        }
Beispiel #4
0
        public void LoadOriginalMaps()
        {
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            originalMaps = new List<AMap> { };
            List<string[]> uncompressedMaps;
            loader = new Loader();

            loader.LoadMultiple(originalMapsLocation);
            uncompressedMaps = loader.ParseMap2();

            foreach (string[] map in uncompressedMaps)
            {
                AMap newEntry = new AMap();

                newEntry.Name = map[0];
                newEntry.Map = decompressor.GetTheMap(map[1]);

                originalMaps.Add(newEntry);
            }

            /*foreach (AMap map in originalMaps)
            {
                Console.WriteLine("name: {0}\n", map.Name);
                foreach (string str in map.Map)
                {
                    Console.WriteLine(str);
                }
            }*/
        }