internal static void StoreDatFile(string filePath, IEnumerable <Translation> translations) { if (filePath == null) { throw new ArgumentNullException($"The argument {nameof(filePath)} must not be null."); } if (translations == null) { throw new ArgumentNullException($"The argument {nameof(translations)} must not be null."); } List <Translation> enumerable = translations.ToList(); if (!enumerable.Any()) { throw new ArgumentException($"{nameof(translations)} must not be empty."); } UnsortedDatFileBinaryFileBuilder builder = new UnsortedDatFileBinaryFileBuilder(); DatFile datFile = builder.Build(new DatFileAttribute() { Translations = enumerable }); using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.CreateNew))) { writer.Write(datFile.GetBytes()); } }