Exemple #1
0
 private static void json2dat(string file, string dest)
 {
     try
     {
         string          graph           = StringEncrypt.EncryptData(File.ReadAllText(file));
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         FileStream      fileStream      = File.Open(dest, FileMode.OpenOrCreate);
         binaryFormatter.Serialize(fileStream, graph);
         fileStream.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("An error occured: " + ex.Message);
     }
 }
Exemple #2
0
 private static void dat2json(string file, string dest)
 {
     try
     {
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         FileStream      fileStream      = File.Open(file, FileMode.Open);
         string          toDecrypt       = (string)binaryFormatter.Deserialize(fileStream);
         fileStream.Close();
         string contents = StringEncrypt.DecryptData(toDecrypt);
         File.WriteAllText(dest, contents);
     }
     catch (Exception ex)
     {
         MessageBox.Show("An error occured: " + ex.Message);
     }
 }