public static void Save(string s, string fn) { byte[] bytes = Util.EncodingGb2312.GetBytes(s); using (var ms = new MemoryStream(bytes)) { SafetyFile.Save(ms, fn); } }
public static void SerializeToFileWithFileName(object obj, string fn, bool isEncrypt = true) { if (obj != null) { string text = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented, Serializer._settings); if (isEncrypt) { text = Crypto.Encrypt(text); } SafetyFile.Save(text, fn); } }