1/// <summary>
2/// Write a binary file
3/// </summary>
4/// <param name="filePath">Full path of file to be written</param>
5/// <returns>True, if success</returns>
6public bool WriteBinaryFile(string filePath, byte[] contents)
7{
8 bool okok = true;
9
10 try
11 {
12 using (FileStream fs = new FileStream(filePath, FileMode.CreateNew))
13 {
14 using (BinaryWriter w = new BinaryWriter(fs))
15 {
16 w.Write(contents);
17 }
18 }
19 }
20 catch (IOException e)
21 {
22 okok = false;
23 }
24
25 return okok;
26}