Beispiel #1
0
 public static void Save(string s, string fn)
 {
     byte[] bytes = Util.EncodingGb2312.GetBytes(s);
     using (var ms = new MemoryStream(bytes))
     {
         SafetyFile.Save(ms, fn);
     }
 }
Beispiel #2
0
 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);
     }
 }