Beispiel #1
0
            private void ParseTable(string file)
            {
                Account acc = null;

                Account.Character Char = null;
                var currentSection     = "";
                var subSection         = "";

                foreach (var line in File.ReadAllLines(file))
                {
                    if (IsRubbish(line))
                    {
                        continue;
                    }
                    if (IsAccount(line))
                    {
                        if (acc != null)
                        {
                            Accounts.Add(acc);
                        }
                        acc = new Account(GetSectionName(line));
                        continue;
                    }
                    if (acc == null)
                    {
                        continue;
                    }
                    if (IsEndMarker(line))
                    {
                        if (Char != null && currentSection == "" && subSection == "")
                        {
                            acc.Characters.Add(Char);
                            Char = null;
                        }
                        if (subSection == "")
                        {
                            currentSection = "";
                        }
                        else
                        {
                            subSection = "";
                        }
                        continue;
                    }
                    if (Char == null)
                    {
                        Char = new Account.Character(GetSectionName(line));
                        continue;
                    }
                    if (currentSection == "")
                    {
                        currentSection = GetSectionName(line);
                        continue;
                    }
                    if (subSection == "" && !currentSection.Equals("styles", StringComparison.CurrentCultureIgnoreCase))
                    {
                        subSection = GetSectionName(line);
                        continue;
                    }
                    if (subSection == "")
                    {
                        Char.AddSection(currentSection, line);
                    }
                    else
                    {
                        Char.AddSection(currentSection, subSection, line);
                    }
                }
                if (acc != null)
                {
                    Accounts.Add(acc);
                }
            }