protected bool DeleteTile(TileDto tile) { if (tile is not TileDto || !File.Exists(tile.Path)) { return(false); } File.Delete(tile.Path); return(true); }
public static string Hash(TileDto tile) { try { lock (tile) { return(Hash(tile.Image)); } } catch (Exception e) { Console.WriteLine(e); } return(null); }
public new object CaptureState() { var dto = new TileDto { Texture = Texture, BType = BiomeType, IsFloor = false, Position = new Vector2Int(Position.X, Position.Y), TType = TileType }; return(dto); }
public static float Compare(TileDto t1, TileDto t2) { float tileScore; if (t1.Hash != null && t2.Hash != null && t1.Hash.Equals(t2.Hash)) { tileScore = 1; } else { lock (t1) lock (t2) using (Bitmap bm1 = new(t1.Path), bm2 = new(t2.Path)) { tileScore = Compare(bm1, bm2); } } return(tileScore); }