/// <summary>Saves the table to a dat stream.</summary> /// <param name="table">Table to save.</param> /// <param name="stream">The stream to save to.</param> public static void SaveTo(this ITable table, Stream stream) { using (var writer = new DatWriter(table.Layout, stream)) { writer.WriteTable(table); } }
/// <summary>Saves the table to a dat file.</summary> /// <param name="table">Table to save.</param> /// <param name="fileName">The filename to save to.</param> public static void SaveTo(this ITable table, string fileName) { using (var stream = File.Create(fileName)) using (var writer = new DatWriter(table.Layout, stream)) { writer.WriteTable(table); writer.Close(); } }
/// <summary>Saves the table to a dat stream.</summary> /// <param name="table">Table to save.</param> /// <param name="stream">The stream to save to.</param> public static void SaveTo(this ITable table, Stream stream) { if (table == null) { throw new ArgumentNullException(nameof(table)); } using var writer = new DatWriter(table.Layout, stream); writer.WriteTable(table); }
/// <summary> /// Creates a new dat file with the specified name and writes the whole table. /// </summary> /// <param name="fileName">Filename to write to.</param> /// <param name="table">Table to write.</param> public static void WriteTable(string fileName, ITable table) { if (table == null) { throw new ArgumentNullException(nameof(table)); } using var writer = new DatWriter(table.Layout, fileName); writer.WriteTable(table); }
/// <summary>Saves the table to a dat file.</summary> /// <param name="table">Table to save.</param> /// <param name="fileName">The filename to save to.</param> public static void SaveTo(this ITable table, string fileName) { if (table == null) { throw new ArgumentNullException(nameof(table)); } using var stream = File.Create(fileName); using var writer = new DatWriter(table.Layout, stream); writer.WriteTable(table); writer.Close(); }