private void load_xml(string file_name)
 {
     this.m_list.Clear();
     try
     {
         XmlDocument xmlDocument = new XmlDocument();
         xmlDocument.Load(file_name);
         if (xmlDocument.DocumentElement == null || xmlDocument.DocumentElement.ChildNodes.Count <= 0)
         {
             return;
         }
         foreach (XmlNode n in xmlDocument.DocumentElement.ChildNodes)
         {
             if (n.Attributes["name"] != null)
             {
                 ShipPartsDataBase.ShipPart shipPart = ShipPartsDataBase.ShipPart.FromXml(n);
                 if (shipPart != null)
                 {
                     this.m_list.Add(shipPart);
                 }
             }
         }
     }
     catch
     {
         this.m_list.Clear();
     }
 }
            internal void MergeShipPartsDatabase(ShipPartsDataBase.ShipPart i)
            {
                if (i == null)
                {
                    return;
                }
                ItemDatabase.Data data = this;
                string            str  = data.m_document + i.ToStringParamsOnly();

                data.m_document = str;
            }
 public ShipPartsDataBase.ShipPart Find(string name, ShipPartsDataBase.PartsType type)
 {
     ShipPartsDataBase.ShipPart shipPart = this.Find(name);
     if (shipPart == null)
     {
         return((ShipPartsDataBase.ShipPart)null);
     }
     if (shipPart.PartsType != type)
     {
         return((ShipPartsDataBase.ShipPart)null);
     }
     else
     {
         return(shipPart);
     }
 }
            internal static ShipPartsDataBase.ShipPart FromXml(XmlNode n)
            {
                if (n == null)
                {
                    return((ShipPartsDataBase.ShipPart)null);
                }
                if (n.ChildNodes == null)
                {
                    return((ShipPartsDataBase.ShipPart)null);
                }
                if (n.Name != "ship_part")
                {
                    return((ShipPartsDataBase.ShipPart)null);
                }
                if (n.Attributes["name"] == null)
                {
                    return((ShipPartsDataBase.ShipPart)null);
                }
                ShipPartsDataBase.ShipPart shipPart = new ShipPartsDataBase.ShipPart();
                shipPart.m_name               = Useful.XmlGetAttribute(n, "name", shipPart.m_name);
                shipPart.m_type               = ShipPartsDataBase.ToPartsType(Useful.XmlGetAttribute(n, "PartsType", ShipPartsDataBase.ToString(shipPart.m_type)));
                shipPart.m_ship_size_type     = ShipPartsDataBase.ToShipSizeType(Useful.XmlGetAttribute(n, "ShipSizeType", ShipPartsDataBase.ToString(shipPart.m_ship_size_type)));
                shipPart.m_is_general_purpose = Useful.ToBool(Useful.XmlGetAttribute(n, "IsGeneralPurpose", shipPart.m_is_general_purpose.ToString()), shipPart.m_is_general_purpose);
                for (int index = 0; index < Enum.GetValues(typeof(ShipPartsDataBase.BuildTargetType)).Length; ++index)
                {
                    XmlNode element = Useful.XmlGetElement(n, "data_values", ShipPartsDataBase.ToString(ShipPartsDataBase.ToBuildTargetType(index)));
                    if (element != null)
                    {
                        int min = Useful.ToInt32(Useful.XmlGetAttribute(element, "Min", shipPart.m_value_tbl[index].Min.ToString()), shipPart.m_value_tbl[index].Min);
                        int max = Useful.ToInt32(Useful.XmlGetAttribute(element, "Max", shipPart.m_value_tbl[index].Max.ToString()), shipPart.m_value_tbl[index].Max);
                        shipPart.m_value_tbl[index].SetData(min, max, max - (max - min) / 2);
                    }
                }
                XmlNode node = (XmlNode)n["detail"];

                if (node != null)
                {
                    shipPart.Skill     = Useful.XmlGetAttribute(node, "Skill", shipPart.Skill);
                    shipPart.Citys     = Useful.XmlGetAttribute(node, "Citys", shipPart.Citys);
                    shipPart.NPC       = Useful.XmlGetAttribute(node, "NPC", shipPart.NPC);
                    shipPart.Materials = Useful.XmlGetAttribute(node, "Materials", shipPart.Materials);
                    shipPart.ShipType  = Useful.XmlGetAttribute(node, "ShipType", shipPart.ShipType);
                    shipPart.Price     = Useful.XmlGetAttribute(node, "Price", shipPart.Price);
                }
                shipPart.optimize();
                return(shipPart);
            }