示例#1
0
        internal void Load(BinaryReader br)
        {
            int ver   = br.ReadInt32();
            int count = br.ReadInt32();

            lock (this)
            {
                while (count-- > 0)
                {
                    string  name = br.ReadString();
                    SoftCmd cmd  = new SoftCmd();
                    cmd.Load(br);
                    Cmds.Add(name, cmd);
                }
                count = br.ReadInt32();
                while (count-- > 0)
                {
                    ulong user = br.ReadUInt64();
                    Inbox inb  = new Inbox();
                    inb.Load(br);
                    Msgs.Add(user, inb);
                }
                ShowChanges = br.ReadBoolean();
                count       = br.ReadInt32();
                while (count-- > 0)
                {
                    string name  = br.ReadString();
                    string value = br.ReadString();
                    Vars.Add(name, value);
                }
                SetLanguage(br.ReadString());
                MusicChannel  = ver >= 1 ? br.ReadString() : "";
                CommandPrefix = ver >= 2 ? br.ReadString() : ">";
            }
        }
示例#2
0
 public void Add(Msg msg)
 {
     if (msg != null)
     {
         Msgs.Add(msg);
     }
 }
 public void AddMaterial(List <MaterialItemData> items)
 {
     for (int i = 0; i < items.Count; i++)
     {
         Msgs.Add(items[i]);
     }
     RefreshDisplay(Msgs, false, true);
 }
示例#4
0
 private void _client_message(string msg)
 {
     if (msg != null)
     {
         Msgs.Add(msg);
         NewMessage?.Invoke(msg);
     }
 }
示例#5
0
 private void GUIBroadcast(string newMsg)
 {
     App.Current.Dispatcher.Invoke(() =>
     {
         string uname = newMsg.Split(':')[0]; //name is everything before ':'
         if (!Clients.Contains(uname))
         {
             Clients.Add(uname);
         }
         Msgs.Add(newMsg);
         RaisePropertyChanged("MsgCounter"); //invokes reload
     });
 }
示例#6
0
        public string AddMessage(ulong sender, ulong recipient, string message)
        {
            Inbox i;

            lock (this)
                if (!Msgs.ContainsKey(recipient))
                {
                    i = new Inbox();
                    Msgs.Add(recipient, i);
                }
                else
                {
                    i = Msgs[recipient];
                }
            return(i.AddMessage(sender, message));
        }
示例#7
0
 public static void Init(string file)
 {
     //	Logger.Debug("msg file="+file);
     if (File.Exists(file))
     {
         Msgs.Clear();
         string[] msgs = File.ReadAllLines(file);
         foreach (string msg in msgs)
         {
             if (string.IsNullOrEmpty(msg) || msg.StartsWith("#"))
             {
                 continue;
             }
             Msgs.Add(msg);
         }
     }
 }