Esempio n. 1
0
            void PTag(string s, out PrimaryTag tag, out SecondaryTag stag, out string tertiary)
            {
                tag      = PrimaryTag.END;
                stag     = SecondaryTag.NONE;
                tertiary = string.Empty;
                string[] r    = s.Substring(1).Split(':');
                bool     good = false;

                if (r.Length >= 1)
                {
                    good = Enum.TryParse(r[0], out tag);
                }
                if (r.Length >= 2)
                {
                    good = Enum.TryParse(r[1], out stag);
                }
                if (r.Length >= 3)
                {
                    tertiary = r[2];
                }
            }
Esempio n. 2
0
            public void ScanSections()
            {
                PrimaryTag tag = PrimaryTag.END; SecondaryTag stag = SecondaryTag.NONE; string ttag;
                string     line;

                while ((line = reader.ReadLine()) != null)
                {
                    if (line.Length < 1)
                    {
                        continue;
                    }
                    if (line[0] == TagSignifier)
                    {
                        PTag(line, out tag, out stag, out ttag);  // TODO: ttag (used for index labels) not used yet, but must be for full implementation
                    }
                    else
                    {
                        switch (tag)
                        {
                        case PrimaryTag.HEADER:
                        {
                            Tuple <string, string> tp = BreakAssignmentLine(line);
                            if (tp.Item1.Length > 0)          // skip blanks
                            {
                                Header.Add(tp.Item1, tp.Item2);
                            }
                        }
                        break;

                        case PrimaryTag.CONFIGURATION:
                            switch (stag)
                            {
                            case SecondaryTag.MULTIPLICITY:
                            case SecondaryTag.SG:
                            case SecondaryTag.SEQUENCES:
                            case SecondaryTag.INCC:
                            case SecondaryTag.MAIN:
                            {
                                Tuple <string, string> tp = BreakAssignmentLine(line);
                                if (tp.Item1.Length > 0)              // skip blanks
                                {
                                    Configuration[stag].Add(tp.Item1, tp.Item2);
                                }
                            }
                            break;
                            }
                            break;

                        case PrimaryTag.SETTINGS:
                            switch (stag)
                            {
                            case SecondaryTag.MULTIPLICITY:
                            {
                                Tuple <string, string> tp = BreakAssignmentLine(line);
                                if (tp.Item1.Length > 0)              // skip blanks
                                {
                                    Settings[stag].Add(tp.Item1, tp.Item2);
                                }
                            }
                            break;
                            }
                            break;

                        case PrimaryTag.DATA:
                            switch (stag)
                            {
                            case SecondaryTag.MULTIPLICITY:
                                Data[stag].Add(CaptureCSVLine(line));
                                break;
                            }
                            break;

                        case PrimaryTag.SEQUENCES:
                            switch (stag)
                            {
                            case SecondaryTag.MULTIPLICITY:
                                Sequences[stag].Add(CaptureCSVLine(line));
                                break;
                            }
                            break;

                        case PrimaryTag.HISTORY:
                            History.Add(BreakAssignmentLine(line));
                            break;

                        case PrimaryTag.END:
                            break;
                        }
                    }
                }
            }