Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string ComputeHash(string truc)
- {
- using (var sha = SHA256.Create())
- {
- byte[] bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(truc));
- return System.Convert.ToBase64String(bytes);
- }
- }
- string json = JsonUtility.ToJson(data);
- string newHash = ComputeHash(json);
- if (newHash != lastSavedHash)
- {
- File.WriteAllText(path, json);
- lastSavedHash = newHash;
- }
Add Comment
Please, Sign In to add comment