/// <summary>
 /// Write profile.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="ip"></param>
 /// <exception cref="System.InvalidOperationException">Can't format certain profile.</exception>
 /// <exception cref="System.IO.IOException">If an I/O error occurs.</exception>
 private void WriteProfile(string type, InstrumentProfile ip)
 {
     writer.WriteField(type);
     foreach (InstrumentProfileField field in enumFormats[type])
     {
         writer.WriteField(field.GetField(ip));
     }
     foreach (string field in customFormats[type])
     {
         writer.WriteField(ip.GetField(field));
     }
     writer.WriteRecord(null);
 }