示例#1
0
 public static bool Contains(int number)
 {
     for (int i = 0; i < _items.Count; i++)
     {
         MeleeExcep exc = _items[i];
         if (exc.Number == number)
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        private static void parse(string path)
        {
            XmlDocument xmlDocument = new XmlDocument();

            using (FileStream fileStream = new FileStream(path, FileMode.Open))
            {
                if (fileStream.Length > 0)
                {
                    try
                    {
                        xmlDocument.Load(fileStream);
                        for (XmlNode xmlNode1 = xmlDocument.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
                        {
                            if ("list".Equals(xmlNode1.Name))
                            {
                                for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                                {
                                    if ("weapon".Equals(xmlNode2.Name))
                                    {
                                        XmlNamedNodeMap xml  = xmlNode2.Attributes;
                                        MeleeExcep      item = new MeleeExcep
                                        {
                                            Number = int.Parse(xml.GetNamedItem("number").Value)
                                        };
                                        _items.Add(item);
                                    }
                                }
                            }
                        }
                    }
                    catch (XmlException ex)
                    {
                        SaveLog.fatal(ex.ToString());
                        Printf.b_danger("[MeleeExceptionsXML.parse] Erro fatal!");
                    }
                }
                fileStream.Dispose();
                fileStream.Close();
            }
        }
示例#3
0
        private static void parse(string path)
        {
            XmlDocument xmlDocument = new XmlDocument();

            using (FileStream fileStream = new FileStream(path, FileMode.Open))
            {
                if (fileStream.Length > 0L)
                {
                    try
                    {
                        xmlDocument.Load((Stream)fileStream);
                        for (XmlNode xmlNode1 = xmlDocument.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
                        {
                            if ("list".Equals(xmlNode1.Name))
                            {
                                for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
                                {
                                    if ("weapon".Equals(xmlNode2.Name))
                                    {
                                        XmlNamedNodeMap attributes = (XmlNamedNodeMap)xmlNode2.Attributes;
                                        MeleeExcep      meleeExcep = new MeleeExcep()
                                        {
                                            Number = int.Parse(attributes.GetNamedItem("number").Value)
                                        };
                                        MeleeExceptionsXML._items.Add(meleeExcep);
                                    }
                                }
                            }
                        }
                    }
                    catch (XmlException ex)
                    {
                        Logger.warning(ex.ToString(), false);
                    }
                }
                fileStream.Dispose();
                fileStream.Close();
            }
            Logger.warning("[Aviso] Loaded " + (object)MeleeExceptionsXML._items.Count + " melee exceptions", false);
        }