Example #1
0
        public static Inviter Create(ulong inviterId, bool isBot = false)
        {
            var inviter = new Inviter(inviterId, ignored: isBot);

            InviterList.Update(inviter);

            return(inviter);
        }
Example #2
0
        public static void ReadFromXML(string fileName)
        {
            var doc = XDocument.Load(fileName);

            foreach (var inviter in doc.Element("inviters").Elements("inviter"))
            {
                var elem = new Inviter(Convert.ToUInt64(inviter.Attribute("id").Value),
                                       Convert.ToBoolean(inviter.Attribute("active").Value),
                                       Convert.ToBoolean(inviter.Attribute("ignored").Value));

                foreach (var referral in inviter.Elements("referral"))
                {
                    elem.AddReferral(
                        Convert.ToUInt64(referral.Attribute("id").Value),
                        Convert.ToBoolean(referral.Attribute("active").Value),
                        DateTime.ParseExact(referral.Attribute("date").Value, "dd'.'MM'.'yyyy", CultureInfo.InvariantCulture)
                        );
                }
            }
        }
Example #3
0
 public static void Update(Inviter inviter)
 {
     Inviters[inviter.InviterId] = inviter;
 }