コード例 #1
0
        private void ParseNameLine(string data)
        {
            data = data.Replace("[*]", "").Trim();
            Name = data.Split('(')[0].Trim();

            data = data.Remove(0, Name.Length + 2);
            string dates = data.Split(')')[0];

            if (!dates.Contains("b.???"))
            {
                if (dates.Contains("d."))
                {
                    Birth = new WorldTime(Convert.ToInt32(dates.Substring(2, dates.IndexOf("d.") - 2)));
                }
                else
                {
                    Birth = new WorldTime(Convert.ToInt32(dates.Substring(2, dates.IndexOf(",") - 2)));
                }
            }
            if (dates.Contains("d."))
            {
                Death = new WorldTime(Convert.ToInt32(dates.Substring(dates.IndexOf("d. ") + 3, dates.IndexOf(',') - dates.IndexOf("d. ") - 3)));
            }
            else
            {
                Death = WorldTime.Present;
            }
            ReignBegan  = new WorldTime(Convert.ToInt32(dates.Split(':')[1]));
            data        = data.Remove(0, dates.Length + 2).Trim();
            Inheritance = data.Split(',')[0];
            if (Inheritance.Contains("from"))
            {
                InheritedFromName = Inheritance.Substring(Inheritance.IndexOf(" from ") + 6);
                Inheritance       = "Inherited";
            }
            else
            {
                Inheritance = Inheritance.Replace("***", "").Trim();
            }

            data = data.Split(',')[1];

            Married = !data.Contains("Never");
            if (data.Contains("d."))
            {
                MarriedDeath = new WorldTime(Convert.ToInt32(data.Substring(data.IndexOf("d.") + 3, data.IndexOf(')') - data.IndexOf("d.") - 3)));
            }
        }
コード例 #2
0
 public bool DirectInheritsFrom(string name) => Inheritance.Contains(name);