Exemplo n.º 1
0
        //not a static !!!
        /// <summary> 
        /// Create xmlnode from all elements of Account record 
        /// </summary> 
        /// <param name="doc">recursive reference for creating node</param> 
        /// <returns>xmlnode with all info about acc</returns> 
        public XmlNode Save( XmlFile doc )
        {
            //current version=1 (Core.Accounts.version)
                XmlNode result = doc.CreateNode( "account", "" );
                doc.AddAttribute( result, xml_attr_username, username );
                doc.AddAttribute( result, xml_attr_password, password );
                doc.AddAttribute( result, xml_attr_accesslevel, ((int)accessLevel).ToString() );

                foreach ( Character ch in characteres )                        //{+} Added
                {
                    UInt64 guid = ch.Guid;
                    doc.AddNode( result, xml_attr_guid, guid.ToString() );
                }

                return result;
        }
Exemplo n.º 2
0
        public void Save( string filename )
        {
            XmlFile file = new XmlFile( false, "", "accounts" );
            int version = 0;
            file.AddAttribute( file.DocumentElement, "version", version.ToString() );//adding version of accountlist

            foreach ( Account acc in this )
            {
                file.DocumentElement.AppendChild( acc.Save( file ) );
            }

            file.Save( filename );
        }