Exemplo n.º 1
0
 public static void LoadEmotions(object object1)
 {
     try {
         using (XmlReader reader = XmlReader.Create(IO.Paths.DataFolder + "emoticons.xml")) {
             while (reader.Read()) {
                 if (reader.IsStartElement()) {
                     switch (reader.Name) {
                         case "Emoticon": {
                                 string idval = reader["id"];
                                 int id = 0;
                                 if (idval != null) {
                                     id = idval.ToInt();
                                 }
                                 emoticons[id] = new Emoticon();
                                 if (reader.Read()) {
                                     emoticons[id].Pic = reader.ReadElementString("Pic").ToInt();
                                     emoticons[id].Command = reader.ReadElementString("Command");
                                 }
                                 if (LoadUpdate != null)
                                     LoadUpdate(null, new LoadingUpdateEventArgs(id, emoticons.MaxEmoticons));
                             }
                             break;
                     }
                 }
             }
         }
         if (LoadComplete != null)
             LoadComplete(null, null);
     } catch (Exception ex) {
         Exceptions.ErrorLogger.WriteToErrorLog(ex);
     }
 }