Exemplo n.º 1
0
 private static void GenerateList()
 {
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load(path);
         for (XmlNode xmlNode1 = document.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
         {
             if ("list".Equals(xmlNode1.Name))
             {
                 for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                 {
                     if ("cupom".Equals(xmlNode2.Name))
                     {
                         XmlNamedNodeMap xml   = xmlNode2.Attributes;
                         CupomFlag       cupom = new CupomFlag
                         {
                             ItemId     = int.Parse(xml.GetNamedItem("item_id").Value),
                             EffectFlag = (CupomEffects)int.Parse(xml.GetNamedItem("effect_flag").Value)
                         };
                         Effects.Add(cupom);
                     }
                 }
             }
         }
     }
     catch (XmlException ex)
     {
         Logger.Exception(ex);
     }
 }
Exemplo n.º 2
0
 public static CupomFlag GetCupomEffect(int id)
 {
     for (int i = 0; i < Effects.Count; i++)
     {
         CupomFlag flag = Effects[i];
         if (flag.ItemId == id)
         {
             return(flag);
         }
     }
     return(null);
 }