/// <summary> /// Deserializes a list of Mobile instances from an xml element. /// </summary> /// <param name="node">The XmlElement instance from which to deserialize.</param> /// <returns>Mobile list. Value will never be null.</returns> public static Mobile[] LoadMobiles(XmlElement node) { Mobile[] list = new Mobile[6]; XmlElement chars = node["chars"]; //int length = Accounts.GetInt32( Accounts.GetAttribute( chars, "length", "6" ), 6 ); //list = new Mobile[length]; //Above is legacy, no longer used if (chars != null) { foreach (XmlElement ele in chars.GetElementsByTagName("char")) { try { int index = Accounts.GetInt32(Accounts.GetAttribute(ele, "index", "0"), 0); int serial = Accounts.GetInt32(Accounts.GetText(ele, "0"), 0); if (index >= 0 && index < list.Length) { list[index] = World.FindMobile(serial); } } catch { } } } return(list); }
/// <summary> /// Deserializes a list of Mobile instances from an xml element. /// </summary> /// <param name="node">The XmlElement instance from which to deserialize.</param> /// <returns>Mobile list. Value will never be null.</returns> public static Mobile[] LoadMobiles(XmlElement node) { Mobile[] list; XmlElement chars = node["chars"]; if (chars == null) { list = new Mobile[5]; } else { int length = Accounts.GetInt32(Accounts.GetAttribute(chars, "length", "5"), 5); list = new Mobile[length]; foreach (XmlElement ele in chars.GetElementsByTagName("char")) { try { int index = Accounts.GetInt32(Accounts.GetAttribute(ele, "index", "0"), 0); int serial = Accounts.GetInt32(Accounts.GetText(ele, "0"), 0); if (index >= 0 && index < list.Length) { list[index] = World.FindMobile(serial); } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } return(list); }
/// <summary> /// Deserializes a list of IPAddress values from an xml element. /// </summary> /// <param name="node">The XmlElement from which to deserialize.</param> /// <returns>Address list. Value will never be null.</returns> public static IPAddress[] LoadAddressList(XmlElement node) { IPAddress[] list; XmlElement addressList = node["addressList"]; if (addressList != null) { int count = Accounts.GetInt32(Accounts.GetAttribute(addressList, "count", "0"), 0); list = new IPAddress[count]; count = 0; foreach (XmlElement ip in addressList.GetElementsByTagName("ip")) { try { if (count < list.Length) { list[count] = IPAddress.Parse(Accounts.GetText(ip, null)); count++; } } catch { } } if (count != list.Length) { IPAddress[] old = list; list = new IPAddress[count]; for (int i = 0; i < count && i < old.Length; ++i) { list[i] = old[i]; } } } else { list = new IPAddress[0]; } return(list); }
/// <summary> /// Deserializes an AccountComment instance from an xml element. /// </summary> /// <param name="node">The XmlElement instance from which to deserialize.</param> public AccountComment(XmlElement node) { m_AddedBy = Accounts.GetAttribute(node, "addedBy", "empty"); m_LastModified = Accounts.GetDateTime(Accounts.GetAttribute(node, "lastModified"), DateTime.Now); m_Content = Accounts.GetText(node, ""); }
/// <summary> /// Deserializes an AccountTag instance from an xml element. /// </summary> /// <param name="node">The XmlElement instance from which to deserialize.</param> public AccountTag(XmlElement node) { m_Name = Accounts.GetAttribute(node, "name", "empty"); m_Value = Accounts.GetText(node, ""); }