示例#1
0
文件: DressList.cs 项目: roxya/Razor
        public static void Load(XmlElement xml)
        {
            ClearAll();

            if (xml == null)
            {
                return;
            }

            foreach (XmlElement el in xml.GetElementsByTagName("list"))
            {
                try
                {
                    string    name = el.GetAttribute("name");
                    DressList list = new DressList(name);
                    Add(list);

                    try
                    {
                        list.m_UndressBag = Serial.Parse(el.GetAttribute("undressbag"));
                    }
                    catch
                    {
                        list.m_UndressBag = Serial.Zero;
                    }

                    foreach (XmlElement el2 in el.GetElementsByTagName("item"))
                    {
                        try
                        {
                            string ser = el2.GetAttribute("serial");
                            list.Items.Add((Serial)Convert.ToUInt32(ser));
                        }
                        catch
                        {
                            try
                            {
                                string iid = el2.GetAttribute("id");
                                list.Items.Add((ItemID)Convert.ToUInt16(iid));
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }
示例#2
0
        public static void LoadCharList()
        {
            if (m_Chars == null)
            {
                m_Chars = new Dictionary <Serial, string>();
            }
            else
            {
                m_Chars.Clear();
            }

            string file = Path.Combine(Config.GetUserDirectory("Profiles"), "chars.lst");

            if (!File.Exists(file))
            {
                return;
            }

            using (StreamReader reader = new StreamReader(file))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.Length <= 0 || line[0] == ';' || line[0] == '#')
                    {
                        continue;
                    }
                    string[] split = line.Split('=');
                    try
                    {
                        m_Chars.Add(Serial.Parse(split[0]), split[1]);
                    }
                    catch
                    {
                    }
                }
            }
        }
示例#3
0
        public static void Load(XmlElement xml)
        {
            ClearAll();

            if (xml == null)
            {
                return;
            }

            foreach (XmlElement el in xml.GetElementsByTagName("list"))
            {
                string    name = el.GetAttribute("name");
                DressList list = new DressList(name);
                Add(list);

                list.m_UndressBag = Serial.Parse(el.GetAttribute("undressbag"));

                foreach (XmlElement el2 in el.GetElementsByTagName("item"))
                {
                    string ser = el2.GetAttribute("serial");
                    uint   val = Utility.ToUInt32(ser, Serial.MinusOne);
                    if (val == Serial.MinusOne)
                    {
                        val = Utility.ToUInt32(el2.GetAttribute("id"), 0);
                        if (val > 0)
                        {
                            list.Items.Add((ItemID)val);
                        }
                    }
                    else
                    {
                        list.Items.Add((Serial)val);
                    }
                }
            }
        }