예제 #1
0
        //byte[] beebTile = new byte[64];

        public void ToBeebFiles(string Filename, Tiles tiles, LevelScreens screens)
        {
            string beebTilesFN        = Filename + "_Unshifted.bin";
            string beebTilesShiftedFN = Filename + "_Shifted.bin";

            LeftShift leftShift    = new LeftShift();
            Tiles     shiftedTiles = new Tiles();


            WriteBeebTileFile(tiles, beebTilesFN);

            shiftedTiles = leftShift.ByTwoPixels(tiles);
            WriteBeebTileFile(shiftedTiles, beebTilesShiftedFN);


            int i = 0;

            foreach (LevelScreen level in screens.list)
            {
                string beebLevelFN = Filename + "_Level" + i + ".bin";
                WriteBeebLevelFile(level, beebLevelFN);
                i++;
            }
        }
예제 #2
0
        public void ToFile(string Filename, Tiles tiles, PaletteModel palette, SelectedColourModel selectedcolours, LevelScreens screens)
        {
            var serializer       = new JavaScriptSerializer();
            var serializedResult =
                serializer.Serialize(tiles.TileList.Select(x => new { x.tileNumber, x.Pixels, x.prevPixels }));
            var serPalette       = new JavaScriptSerializer();
            var serPaletteResult = serPalette.Serialize(palette.CurrentPalette);
            var serPalRes        = serPalette.Serialize(palette.pal);
            var serSelColRes     = serPalette.Serialize(selectedcolours.pal);
            var serLevelScreens  = serializer.Serialize(screens.list);
            var AllResults       =
                serializedResult + Constants.SEPARATOR +
                serPaletteResult + Constants.SEPARATOR +
                serPalRes + Constants.SEPARATOR +
                serSelColRes + Constants.SEPARATOR +
                serLevelScreens;



            System.IO.File.WriteAllText(Filename, AllResults);
        }
예제 #3
0
        public void FromFile(string Filename, Tiles tiles, PaletteModel palette, SelectedColourModel selectedcolours, LevelScreens screens)
        {
            var stuff = System.IO.File.ReadAllText(Filename);

            string[] separatingChars = { Constants.SEPARATOR };
            string[] SplitData       = stuff.Split(separatingChars, System.StringSplitOptions.None);

            var deserialized = new JavaScriptSerializer();

            tiles.TileList         = deserialized.Deserialize <List <Tile> >(SplitData[0]);
            palette.CurrentPalette = deserialized.Deserialize <Constants.Colour[]>(SplitData[1]);
            selectedcolours.pal    = deserialized.Deserialize <int[]>(SplitData[3]);
            screens.list           = deserialized.Deserialize <List <LevelScreen> >(SplitData[4]);

            //  var deserialized = new JavaScriptSerializer();
            //  tiles.TileList = deserialized.Deserialize<List<Tile>>(stuff);
            //palette.pal = deserialized.Deserialize<>
        }