///
/// Write a binary file
///
/// Complete path to the file to be written
/// True, if file was correctly saved.
public bool WriteBinaryFile(string filePath, byte[] contents)
{
bool okok = true; // ok, file written
FileStream fs = null;
BinaryWriter w = null;
try
{
fs = new FileStream(filePath, FileMode.CreateNew);
w = new BinaryWriter(fs);
w.Write(contents);
}
catch (IOException e)
{
okok = false; // houston, we have a problem
}
finally
{
if (w!=null)
w.Close();
if (fs!=null)
fs.Close();
}
return okok;
}