示例#1
0
        public bool GetData(string getterName, out string[] data)
        {
            RconGetter index = this.m_cachedGetterData.Select <KeyValuePair <RconGetter, string[]>, RconGetter>((Func <KeyValuePair <RconGetter, string[]>, RconGetter>)(entry => entry.Key)).Where <RconGetter>((Func <RconGetter, bool>)(key => key.Name.Equals(getterName))).FirstOrDefault <RconGetter>();

            if (index == null)
            {
                data = new string[0];
                return(RconStaticLibrary.FindGetterByName(getterName).GetData(this, out data));
            }
            data = this.m_cachedGetterData[index];
            return(true);
        }
示例#2
0
 public async void UpdateServerInfo()
 {
     if (this.Disconnected)
     {
         return;
     }
     foreach (RconGetter rconGetter in RconStaticLibrary.AvailableGetters.Where <RconGetter>((Func <RconGetter, bool>)(getter => getter.AutoRefresh)).ToList <RconGetter>())
     {
         RconGetter getter = rconGetter;
         string[]   data   = new string[1] {
             ""
         };
         if (!await Task.Run <bool>((Func <bool>)(() => getter.GetData(this, out data))))
         {
             data = new string[1] {
                 "Failed to get data."
             }
         }
         ;
         else if (RconStaticLibrary.IsFailReply(data[0]))
         {
             data = new string[1]
             {
                 "Getter not supported by the server."
             }
         }
         ;
         if (this.m_cachedGetterData.ContainsKey(getter))
         {
             this.m_cachedGetterData[getter] = data;
         }
         else
         {
             this.m_cachedGetterData.Add(getter, data);
         }
     }
     this.OnPropertyChanged("ServerInfo");
 }