Esempio n. 1
0
        public void AddLine(Node startNode, Node endNode)
        {
            int    linenumber = LinesList.Count + 1;
            string linename   = ("e" + linenumber.ToString());
            Line   newLine    = new Line(linename, startNode, endNode);

            LinesList.Add(linename, newLine);

            //SetTheConnectionAndStartArray();
        }
Esempio n. 2
0
        public bool MoveNext()
        {
            var result = true;

            if (LinesList.Count > 0)
            {
                Current = LinesList[0];
                LinesList.RemoveAt(0);
            }
            else
            {
                int i;
                for (i = 0; i < MaxRetryCount; i++)
                {
                    result = ChunksEnumerator.MoveNext();
                    if (result)
                    {
                        var c   = ChunksEnumerator.Current;
                        var str = LastStr + Encoding.UTF8.GetString(c);
                        if (string.IsNullOrEmpty(NewLine))
                        {
                            NewLine = GetEmbeddedNewLineChars(str);
                        }
                        var lines = (string.IsNullOrEmpty(NewLine)) ? new string[0] : str.Split(NewLine);

                        if (Current == null && lines.Length > 0)
                        {
                            if (!ValidateHeader(lines[0]))
                            {
                                throw new InvalidOperationException();
                            }
                        }

                        if (Current == null && lines.Length == 2)
                        {
                            LastStr = lines[1];
                            continue;
                        }
                        else if (Current == null && lines.Length > 2)
                        {
                            for (int t = 1; t < lines.Length - 1; t++)
                            {
                                LinesList.Add(GetPTurnData(lines[t]));
                            }
                            Current = LinesList[0];
                            LinesList.RemoveAt(0);
                            LastStr = lines[^ 1];