Clear() public method

public Clear ( ) : void
return void
Beispiel #1
0
        private void PopulateDataTableFromUploadedFile(System.IO.Stream strm)
        {
            System.IO.StreamReader srdr = new System.IO.StreamReader(strm);
            String strLine    = String.Empty;
            Int32  iLineCount = 0;

            DFLog.Clear();

            do
            {
                strLine = srdr.ReadLine();
                if (strLine == null)
                {
                    break;
                }
                else if (strLine == "")
                {
                    // continue;
                }
                if (0 == iLineCount++)
                {
                    m_dtCSV = new DataTable("CSVTable");
                }
                this.AddDataRowToTable(strLine, m_dtCSV);

                strLine = strLine.Replace(", ", ",");
                strLine = strLine.Replace(": ", ":");

                string[] items = strLine.Split(',', ':');

                // populate fw type
                if (items[0].Contains("SYSID_SW_TYPE"))
                {
                    switch (items[1].ToString())
                    {
                    case "10":
                        MainV2.comPort.MAV.cs.firmware = MainV2.Firmwares.ArduCopter2;
                        break;

                    case "7":
                        MainV2.comPort.MAV.cs.firmware = MainV2.Firmwares.Ateryx;
                        break;

                    case "20":
                        MainV2.comPort.MAV.cs.firmware = MainV2.Firmwares.ArduRover;
                        break;

                    case "0":
                        MainV2.comPort.MAV.cs.firmware = MainV2.Firmwares.ArduPlane;
                        break;
                    }
                }

                if (items[0].Contains("FMT"))
                {
                    try
                    {
                        DFLog.FMTLine(strLine);
                    }
                    catch { }
                }
            } while (true);
        }