private static bool UpdateText(FILE file, string text) { var data = UserInfoEx.GetTextData(text); var hash = UserInfoEx.ComputeHash(data); if (file.HashCode == hash) return false; file.Data = data; file.HashCode = hash; return true; }
private static FILE CreateText(string text, string fileName = "") { var result = new FILE(); if (string.IsNullOrEmpty(fileName)) fileName = string.Format("{0}", Guid.NewGuid()) + ".rtf"; result.Name = fileName; result.Data = UserInfoEx.GetTextData(text); result.HashCode = UserInfoEx.ComputeHash(result.Data); return result; }
private static bool UpdateBitmap(FILE file, Bitmap bitmap) { var data = UserInfoEx.GetBitmapData(bitmap); var hash = UserInfoEx.ComputeHash(data); if (file.HashCode == hash) return false; file.Data = data; file.HashCode = hash; return true; }
private static FILE CreateBitmap(Bitmap bitmap, string fileName = "") { var result = new FILE(); if (string.IsNullOrEmpty(fileName)) fileName = string.Format("{0}", Guid.NewGuid()) + ".png"; result.Name = fileName; result.Data = UserInfoEx.GetBitmapData(bitmap); result.HashCode = UserInfoEx.ComputeHash(result.Data); return result; }