private static AICostFactors ReadChances(BinaryReader r)
            {
                AICostFactors zero = AICostFactors.Zero;
                int           num1 = r.ReadInt32();

                for (int index = 0; index < num1; ++index)
                {
                    string faction = r.ReadString();
                    float  num2    = r.ReadSingle();
                    zero.SetFaction(faction, num2);
                }
                return(zero);
            }
            private static AICostFactors ParseChances(XmlElement e)
            {
                if (e == null)
                {
                    return(AICostFactors.Zero);
                }
                AICostFactors zero = AICostFactors.Zero;

                foreach (XmlElement xmlElement in e.OfType <XmlElement>().Where <XmlElement>((Func <XmlElement, bool>)(x => x.Name == "chance")))
                {
                    zero.SetFaction(xmlElement.GetAttribute("faction"), float.Parse(xmlElement.GetAttribute("value")));
                }
                return(zero);
            }