Example #1
0
        public void CreateCopy(string text)
        {
            var _ = new AppDataFile(CompanyName, "copies", $"commands_{DateTime.Now:MM_dd_yyyy_hh_mm_ss_tt}.json")
            {
                FileData = text
            };

            new AppDataFolder(CompanyName, "copies")
            .Files
            .OrderByDescending(File.GetLastWriteTimeUtc)
            .Skip(MaxCopiesCount)
            .AsParallel()
            .ForAll(File.Delete);
        }
Example #2
0
        public static TileGrid FromFile(AppDataFile file, Package p)
        {
            var    stream = file.Load();
            int    w1     = stream.ReadByte();
            int    w0     = stream.ReadByte();
            int    h1     = (byte)stream.ReadByte();
            int    h0     = (byte)stream.ReadByte();
            ushort width  = (ushort)((w1 * 0x100) + w0);
            ushort height = (ushort)((h1 * 0x100) + h0);

            Tile[][] grid = new Tile[width][];
            for (int x = 0; x < width; x++)
            {
                grid[x] = new Tile[height];
                for (int y = 0; y < height; y++)
                {
                    grid[x][y] = Core.GetTile(p, (byte)stream.ReadByte());
                }
            }
            return(new TileGrid(grid, p));
        }
Example #3
0
 public Level(Package pack, AppDataFile path)
 {
     grid = TileGrid.FromFile(path, pack);
 }