All pastes #18142 Raw Edit

Anonymous

public text v1 · immutable
#18142 ·published 2005-07-20 16:33 UTC
rendered paste body
 class XMLReader
    {
        public void ReadConf()
        {
            string conf = "conf.xml";
            try
            {
                XmlTextReader reader = new XmlTextReader(conf);
                while (reader.Read())
                {
                    reader.MoveToElement();

                    Hashtable attributes = new Hashtable();
                    if (reader.HasAttributes)
                    {
                        for (int i = 0; i < reader.AttributeCount; i++)
                        {
                            reader.MoveToAttribute(i);

                            if (reader.Value == "nick")
                                IrcLib.nick = reader.ReadString();
                           
                            else if (reader.Value == "channel")
                                IrcLib.chan = reader.ReadString();
                            else if (reader.Value == "altNick")
                                IrcLib.altNick = reader.ReadString();
                            else if (reader.Value == "realName")
                                IrcLib.realName = reader.ReadString();
                            else if (reader.Value == "id")
                                IrcLib.id = reader.ReadString();
                            else if (reader.Value == "port")
                                IrcLib.port = Int32.Parse(reader.ReadString());
                            else if (reader.Value == "server")
                                IrcLib.server = reader.ReadString();

                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
    }