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); }