/// <summary>
        /// поток загрузки данных из буффера
        /// </summary>
        private static void DoWork1(object data)
        {
            status            = eDataSetStatus.loadingFromFile;
            descryption       = @"Загрузка данных из файла";
            percentCompleated = 0;
            int countLines  = 0;
            int currentLine = 0;

            string tmp = (string)data;

            tmp = tmp.Replace('\r', ' ');

            string[] Gkode = tmp.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); //"\r\n"

            countLines = Gkode.Length;

            foreach (string line in Gkode)
            {
                GkodeWorker.Gkode.Add(line);

                /*
                 * DataRows.Add(new DataRow(currentLine, line));
                 */
                percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
                currentLine++;
            }

            /*
             *
             * status = eDataSetStatus.parsingData;
             *
             * DataRow tmpDataRowRecord = new DataRow(0, "");
             *
             * //if (DataRows.Count != 0)
             * //{
             * //    DataRow curDataRow = DataRows[currentLine];
             * //    FillStructure(tmpDataRowRecord, ref curDataRow);
             * //}
             *
             * descryption = @"Парсинг данных";
             * percentCompleated = 0;
             * currentLine = 0;
             *
             * while ((currentLine < DataRows.Count) && !_shouldStop)
             * {
             *  percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
             *
             *  DataRow curDataRow = DataRows[currentLine];
             *  FillStructure(tmpDataRowRecord, ref curDataRow);
             *
             *  //скопируем, ля возможности дальше знать предыдущие параметры
             *  tmpDataRowRecord = curDataRow;
             *
             *  currentLine++;
             * }
             */
            GkodeWorker.Parsing();
            status             = eDataSetStatus.none;
            dateGetNewDataCode = DateTime.Now;
        }
        /// <summary>
        /// поток загрузки данных из файла
        /// </summary>
        private static void DoWork(object data)
        {
            status            = eDataSetStatus.loadingFromFile;
            descryption       = @"Загрузка данных из файла";
            percentCompleated = 0;
            int countLines  = 0;
            int currentLine = 0;

            // в начале узнаем сколько строк
            using (StreamReader r = new StreamReader((string)data))
            {
                while ((r.ReadLine()) != null)
                {
                    countLines++;
                }
            }
            // а теперь из файла прочитаем
            using (StreamReader srReader = File.OpenText((string)data))
            {
                string line;
                while ((line = srReader.ReadLine()) != null && !_shouldStop)
                {
                    GkodeWorker.Gkode.Add(line);

                    // в переменной line имеем строку которую парсим
                    /*DataRows.Add(new DataRow(currentLine, line));*/
                    //Data_string.Add(new stringData(indx++,line));

                    percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
                    currentLine++;
                }
            }


            //status = eDataSetStatus.parsingData;
            //descryption = @"Парсинг данных";
            //percentCompleated = 0;
            //currentLine = 0;

            //PointCNC tmpPoint = new PointCNC();

            //while ((currentLine < PointsFor3D.Count) && !_shouldStop)
            //{
            //    percentCompleated = (int)(((decimal)100 / countLines) * currentLine);

            //    PointCNC curPoint = PointsFor3D[currentLine];
            //    FillStructure(tmpPoint, ref curPoint;

            //    //скопируем, ля возможности дальше знать предыдущие параметры
            //    tmpPoint = curPoint;

            //    currentLine++;
            //}


            GkodeWorker.Parsing();
            status             = eDataSetStatus.none;
            dateGetNewDataCode = DateTime.Now;
        }
        /// <summary>
        /// поток загрузки данных из файла
        /// </summary>
        private static void DoWork(object data)
        {
            status            = eDataSetStatus.loadingFromFile;
            descryption       = @"Загрузка данных из файла";
            percentCompleated = 0;
            int countLines  = 0;
            int currentLine = 0;

            // в начале узнаем сколько строк
            using (StreamReader r = new StreamReader((string)data))
            {
                while ((r.ReadLine()) != null)
                {
                    countLines++;
                }
            }
            // а теперь из файла прочитаем
            using (StreamReader srReader = File.OpenText((string)data))
            {
                string line;
                while ((line = srReader.ReadLine()) != null && !_shouldStop)
                {
                    // в переменной line имеем строку которую парсим
                    DataRows.Add(new DataRow(currentLine, line));
                    //Data_string.Add(new stringData(indx++,line));

                    percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
                    currentLine++;
                }
            }

            status            = eDataSetStatus.parsingData;
            descryption       = @"Парсинг данных";
            percentCompleated = 0;
            currentLine       = 0;

            DataRow tmpDataRowRecord = new DataRow(0, "");

            while ((currentLine < countLines) && !_shouldStop)
            {
                percentCompleated = (int)(((decimal)100 / countLines) * currentLine);

                DataRow curDataRow = DataRows[currentLine];
                FillStructure(tmpDataRowRecord, ref curDataRow);

                //скопируем, ля возможности дальше знать предыдущие параметры
                tmpDataRowRecord = curDataRow;

                currentLine++;
            }

            status             = eDataSetStatus.none;
            dateGetNewDataCode = DateTime.Now;
        }
Example #4
0
        /// <summary>
        /// поток загрузки данных из буффера
        /// </summary>
        private static void DoWork1(object data)
        {
            status = eDataSetStatus.loadingFromFile;
            descryption = @"Загрузка данных из файла";
            percentCompleated = 0;
            int countLines = 0;
            int currentLine = 0;

            string tmp = (string) data;
            tmp = tmp.Replace('\r', ' ');

            string[] Gkode = tmp.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); //"\r\n"

            countLines = Gkode.Length;

            foreach (string line in Gkode)
            {
                DataRows.Add(new DataRow(currentLine, line));

                percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
                currentLine++;
            }



            status = eDataSetStatus.parsingData;
            descryption = @"Парсинг данных";
            percentCompleated = 0;
            currentLine = 0;

            DataRow tmpDataRowRecord = new DataRow(0, "");

            while ((currentLine < countLines) && !_shouldStop)
            {
                percentCompleated = (int)(((decimal)100 / countLines) * currentLine);

                DataRow curDataRow = DataRows[currentLine];
                FillStructure(tmpDataRowRecord, ref curDataRow);

                //скопируем, ля возможности дальше знать предыдущие параметры
                tmpDataRowRecord = curDataRow;

                currentLine++;
            }

            status = eDataSetStatus.none;
            dateGetNewDataCode = DateTime.Now;
        }
Example #5
0
        /// <summary>
        /// поток загрузки данных из файла
        /// </summary>
        private static void DoWork(object data)
        {
            status = eDataSetStatus.loadingFromFile;
            descryption = @"Загрузка данных из файла";
            percentCompleated = 0;
            int countLines = 0;
            int currentLine = 0;

            // в начале узнаем сколько строк
            using (StreamReader r = new StreamReader((string)data))
            {
                while ((r.ReadLine()) != null)
                {
                    countLines++;
                }
            }
            // а теперь из файла прочитаем
            using (StreamReader srReader = File.OpenText((string)data))
            {
                string line;
                while ((line = srReader.ReadLine()) != null && !_shouldStop)
                {

                    // в переменной line имеем строку которую парсим
                    DataRows.Add(new DataRow(currentLine, line));
                    //Data_string.Add(new stringData(indx++,line));

                    percentCompleated = (int)(((decimal)100 / countLines) * currentLine);
                    currentLine++;
                }
            }

            status = eDataSetStatus.parsingData;
            descryption = @"Парсинг данных";
            percentCompleated = 0;
            currentLine = 0;

            DataRow tmpDataRowRecord = new DataRow(0, "");

            while ((currentLine < countLines) && !_shouldStop)
            {
                percentCompleated = (int)(((decimal)100 / countLines) * currentLine);

                DataRow curDataRow = DataRows[currentLine];
                FillStructure(tmpDataRowRecord, ref curDataRow);

                //скопируем, ля возможности дальше знать предыдущие параметры
                tmpDataRowRecord = curDataRow;

                currentLine++;
            }

            status = eDataSetStatus.none;
            dateGetNewDataCode = DateTime.Now;
        }