mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Change serialize slightly
This commit is contained in:
@@ -6260,15 +6260,16 @@ namespace SabreTools.Helper
|
|||||||
/// Serialze object to file
|
/// Serialze object to file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="df">DatFile to serialize</param>
|
/// <param name="df">DatFile to serialize</param>
|
||||||
|
/// <param name="output">File to write out to</param>
|
||||||
/// <returns>Name of the outputted file</returns>
|
/// <returns>Name of the outputted file</returns>
|
||||||
public static string Serialize(DatFile df)
|
public static string Serialize(DatFile df, string output)
|
||||||
{
|
{
|
||||||
BinaryFormatter bf = new BinaryFormatter();
|
BinaryFormatter bf = new BinaryFormatter();
|
||||||
string filename = (String.IsNullOrEmpty(df.Name) ? "default" : df.Name) + ".bin";
|
string filename = (String.IsNullOrEmpty(output) ? "default.bin" : output);
|
||||||
Stream output = File.Open(filename, FileMode.Create);
|
Stream outStream = File.Open(filename, FileMode.Create);
|
||||||
bf.Serialize(output, df);
|
bf.Serialize(outStream, df);
|
||||||
output.Flush();
|
outStream.Flush();
|
||||||
output.Dispose();
|
outStream.Dispose();
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user