public ToCsvProcessor(string osFilename, string oiFilename, OutputFormat outputFormat)
 {
     OutputFormat = outputFormat;
     #if !DEBUG
     if (File.Exists(osFilename)) throw new ApplicationException(string.Format("Output file, '{0}' already exists.", osFilename));
     if (File.Exists(oiFilename)) throw new ApplicationException(string.Format("Output file, '{0}' already exists.", oiFilename));
     #endif
     if (osFilename != null)
     {
         m_sWriter = new Parse.CsvWriter(osFilename, false);
         string[] fieldNames = (OutputFormat == OutputFormat.Dw) ? Enum.GetNames(typeof(DwStudentFieldNames)) : Enum.GetNames(typeof(AllStudentFieldNames));
         m_sWriter.Write(fieldNames);
     }
     if (oiFilename != null)
     {
         m_iWriter = new Parse.CsvWriter(oiFilename, false);
         string[] fieldNames = (OutputFormat == OutputFormat.Dw) ? Enum.GetNames(typeof(DwItemFieldNames)) : Enum.GetNames(typeof(AllItemFieldNames));
         m_iWriter.Write(fieldNames);
     }
 }
 void Dispose(bool disposing)
 {
     if (m_sWriter != null)
     {
     #if DEBUG
         if (!disposing) Debug.Fail("Failed to dispose CsvWriter");
     #endif
         m_sWriter.Dispose();
         m_sWriter = null;
     }
     if (m_iWriter != null)
     {
         m_iWriter.Dispose();
         m_iWriter = null;
     }
     if (disposing)
     {
         GC.SuppressFinalize(this);
     }
 }
 void Dispose(bool disposing)
 {
     if (m_itemWriter != null)
     {
     #if DEBUG
         if (!disposing) Debug.Fail("Failed to dispose TestPackageProcessor");
     #endif
         m_itemWriter.Dispose();
         m_itemWriter = null;
     }
     if (m_stimWriter != null)
     {
         m_stimWriter.Dispose();
         m_stimWriter = null;
     }
     if (m_errWriter != null)
     {
         m_errWriter.Dispose();
         m_errWriter = null;
     }
     if (disposing)
     {
         GC.SuppressFinalize(this);
     }
 }
        void ReportError(string testName, ErrorSeverity severity, string itemId, string message, params object[] args)
        {
            if (m_errWriter == null)
            {
                m_errWriter = new Parse.CsvWriter(m_errFilename, false);
                m_errWriter.Write(new string[] { "TestName", "Severity", "ItemId", "Message" });
            }

            string outMessage = string.Format(message, args);
            m_errWriter.Write(new string[] { testName, severity.ToString(), itemId, outMessage });
            //Console.WriteLine("    " + outMessage);
            #if DEBUG1
            Debug.Fail(outMessage);
            #endif
        }
        public TestPackageProcessor(string oFilename)
        {
            string itemFilename = oFilename + ".items.csv";
            string stimFilename = oFilename + ".stims.csv";
            m_errFilename = oFilename + ".errors.csv";
            #if DEBUG
            if (File.Exists(m_errFilename)) File.Delete(m_errFilename);
            #else
            if (File.Exists(itemFilename)) throw new ApplicationException(string.Format("Output file, '{0}' already exists.", itemFilename));
            if (File.Exists(stimFilename)) throw new ApplicationException(string.Format("Output file, '{0}' already exists.", stimFilename));
            if (File.Exists(m_errFilename)) throw new ApplicationException(string.Format("Output file, '{0}' already exists.", m_errFilename));
            #endif
            m_itemWriter = new Parse.CsvWriter(itemFilename, false);
            m_itemWriter.Write(Enum.GetNames(typeof(ItemFieldNames)));

            m_stimWriter = new Parse.CsvWriter(stimFilename, false);
            m_stimWriter.Write(Enum.GetNames(typeof(StimFieldNames)));
        }