예제 #1
0
            public static bool Parse(SeekableReader r, out System system)
            {
                Unit u;

                if (!Unit.Parse(r, out u))
                {
                    throw new InvalidSystemException("No core star");
                }

                system      = new System();
                system.Core = u;

                while (r.Peek() == ' ')
                {
                    while (r.Peek() == ' ') // w+
                    {
                        r.Read();
                    }

                    Companion companion;
                    if (!Companion.Parse(r, out companion))
                    {
                        throw new InvalidSystemException("Expected companion");
                    }
                    system.Companions.Add(companion);
                }

                return(true);
            }
예제 #2
0
            public static bool Parse(SeekableReader r, out System system)
            {
                if (!Unit.Parse(r, out Unit? u))
                {
                    throw new InvalidSystemException("No core star");
                }

                system = new System()
                {
                    Core = u
                };
                while (r.Peek() == ' ')
                {
                    while (r.Peek() == ' ') // w+
                    {
                        r.Read();
                    }

                    if (!Companion.Parse(r, out Companion? companion) || companion == null)
                    {
                        throw new InvalidSystemException("Expected companion");
                    }
                    system.Companions.Add(companion);
                }

                return(true);
            }