Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        //private bool FillCoordData(StreamReader sr, List<PointCoords> list,bool bIsNeed,Color col)
        private bool FillCoordData(StreamReader sr, PointsCoordSet list, bool bIsNeed, Color col)
        {
            if (sr == null)
            {
                if (bIsNeed)
                {
                    MessageBox.Show("Не задан файл координат");
                }
                return(false);
            }
            //list = new List<PointCoords>();
            string strTemp;
            var    iNum = -1;

            while (true)
            {
                strTemp = sr.ReadLine();
                if (strTemp == null)
                {
                    break;
                }

                var pC = new PointCoords();
                if (pC.SetDataFromFile(strTemp, col) == false)
                {
                    continue;
                }
                if (iNum == -1)
                {
                    iNum = pC.NumFrame;
                }
                else
                {
                    iNum++;
                    if (pC.NumFrame > iNum)
                    {
                        var iNumDel = pC.NumFrame;
                        while (iNumDel != iNum)
                        {
                            var pC1 = new PointCoords();
                            pC1.NumFrame = iNum;
                            pC1.col      = pC.col;
                            pC1.Width    = pC.Width;
                            list.Add(pC1);
                            iNum++;
                        }
                    }
                }
                list.Add(pC);
            }
            if (NCurrentFile == -1)
            {
                NCurrentFile = NFirstFile = list[0].NumFrame;
                NLastFile    = list[list.Count - 1].NumFrame;
            }
            var iReminder = NLastFile - NFirstFile + 1 - list.Count;

            iNum++;
            for (var jc = 0; jc < iReminder; jc++)
            {
                var pC1 = new PointCoords();
                pC1.NumFrame = iNum;
                pC1.col      = Color.AntiqueWhite;
                pC1.Width    = 40;
                list.Add(pC1);
                iNum++;
            }
            PointsCoordSet.AddList(list);
            return(true);
        }