示例#1
0
        private void OnButtonClick_OK(object sender, System.EventArgs e)
        {
            // create an instance of the data logger
            MccDaq.DataLogger logger = new MccDaq.DataLogger(m_SrcFilename);

            //  Get the sample info for the first file in the directory
            //   Parameters:
            //     sampleInterval		:receives the sample interval (time between samples)
            //     sampleCount			:receives the sample count
            //	   startDate			:receives the start date
            //	   startTime			:receives the start time

            int sampleInterval = 0;
            int sampleCount    = 0;
            int startDate      = 0;
            int startTime      = 0;

            ULStat = logger.GetSampleInfo
                         (ref sampleInterval, ref sampleCount, ref startDate, ref startTime);
            if (ULStat.Value != MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                lblResult.Text = ULStat.Message;
                return;
            }
            // get the destination path from the source file name
            int    index          = m_SrcFilename.LastIndexOf(".");
            string m_DestFilename = m_SrcFilename.Substring(0, index + 1) + "csv" + "\0";

            //  convert the file
            //   Parameters:
            //     m_DestFilename		:destination file
            //     startSample			:first sample to convert
            //     sampleCount			:number of samples to convert
            //	   m_Delimiter			:field seperator

            int startSample = 0;

            ULStat = logger.ConvertFile(m_DestFilename, startSample, sampleCount, m_Delimiter);
            if (ULStat.Value != MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                lblResult.Text = ULStat.Message;
                return;
            }
            else
            {
                lblResult.Text = logger.FileName + " converted to " + m_DestFilename + ".";
            }
        }
示例#2
0
文件: Form1.cs 项目: otoauler/sdkpub
        private void OnButtonClick_OK(object sender, System.EventArgs e)
        {
            // create an instance of the data logger
            MccDaq.DataLogger logger = new MccDaq.DataLogger(m_SrcFilename);

            //  Get the sample info for the first file in the directory
            //   Parameters:
            //     sampleInterval					 :receives the sample interval (time between samples)
            //     sampleCount						 :receives the sample count
            //	   startDate						 :receives the start date
            //	   startTime						 :receives the start time
            int	sampleInterval = 0;
            int	sampleCount = 0;
            int	startDate = 0;
            int startTime = 0;
            m_ErrorInfo = logger.GetSampleInfo(ref sampleInterval, ref sampleCount, ref startDate, ref startTime);

            // get the destination path from the source file name
            int index = m_SrcFilename.LastIndexOf(".");
            string m_DestFilename = m_SrcFilename.Substring(0, index+1) + "csv";

            //  convert the file
            //   Parameters:
            //     m_DestFilename					 :destination file
            //     startSample						 :first sample to convert
            //     sampleCount						 :number of samples to convert
            //	   m_Delimiter						 :field seperator
            int startSample = 0;
            if (m_ErrorInfo.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                m_ErrorInfo = logger.ConvertFile(m_DestFilename, startSample, sampleCount, m_Delimiter);
            }

            if (m_ErrorInfo.Value != MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                MessageBox.Show(m_ErrorInfo.Message);
                return;
            }
        }