public void Open() { // Validating Write Permissions on output path if (!ValidateFilePermissions(OutputFilePath)) { throw new IOException("Insuficient Permissions - Cannot write on path : " + OutputFilePath); } writer = new StreamWriter(OutputFilePath); writer.AutoFlush = true; Console.WriteLine("Result will be written to: " + OutputFilePath); if (FieldNames != null) { _fieldNames = FieldNames; ValidateFieldNames(_fieldNames); } else { _fieldNames = AppModel.GetAllPropertyNames(); } writer.Write("["); // Write opening bracket }
public void Open() { // Validating Write Permissions on output path if (!ValidateFilePermissions(OutputFilePath)) { throw new IOException("Insuficient Permissions - Cannot write on path : " + OutputFilePath); } writer = new StreamWriter(OutputFilePath, IsAppend); writer.AutoFlush = true; Console.WriteLine("Result will be written to: " + OutputFilePath); if (FieldNames != null) { _fieldNames = FieldNames; ValidateFieldNames(_fieldNames); } else { _fieldNames = AppModel.GetAllPropertyNames(); } if (IsWriteHeaders) { writer.WriteLine("\"" + string.Join("\",\"", _fieldNames) + "\""); } }