diff --git a/SabreTools.Helper/Objects/Dat/DatFile.cs b/SabreTools.Helper/Objects/Dat/DatFile.cs
index 0f17e4d1..81cb9962 100644
--- a/SabreTools.Helper/Objects/Dat/DatFile.cs
+++ b/SabreTools.Helper/Objects/Dat/DatFile.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@@ -6253,6 +6254,42 @@ namespace SabreTools.Helper
#endregion
+ #region Serialization
+
+ ///
+ /// Serialze the current object to file
+ ///
+ public static void Serialize(DatFile df)
+ {
+ BinaryFormatter bf = new BinaryFormatter();
+ Stream output = File.Open((String.IsNullOrEmpty(df.Name) ? "default" : df.Name) + ".bin", FileMode.Create);
+ bf.Serialize(output, df);
+ output.Flush();
+ output.Dispose();
+ }
+
+ ///
+ /// Repopulate the current object from a file
+ ///
+ /// Name of the input file to populate from
+ public static DatFile Deserialize(string input)
+ {
+ if (!File.Exists(input))
+ {
+ return new DatFile();
+ }
+
+ BinaryFormatter bf = new BinaryFormatter();
+ Stream output = File.Open(input, FileMode.Open);
+ DatFile df = (DatFile)bf.Deserialize(output);
+
+ output.Flush();
+ output.Dispose();
+ return df;
+ }
+
+ #endregion
+
#region Statistics
///