Exemplo n.º 1
0
		/**
     * Sets the packet error. Calling this method will automatically set
     * the packet "type" attribute to "error".
     *
     * @param error the packet error.
     */
		public void SetError(PacketError error) {
			if (element == null) {
				throw new NullReferenceException("Error cannot be null");
			}
			// Force the packet type to "error".
			element.Add(new XAttribute("type", "error"));
			// Remove an existing error packet.
			if (element.Element("error") != null)
			{
			    element.Element("error").Remove();
			}
			// Add the error element.
			element.Add(error.GetElement());
		}