示例#1
0
 private List <Streamers> streamer_processing(string data)
 {
     try
     {
         List <Streamers> ls  = new List <Streamers>();
         XmlDocument      doc = new XmlDocument();
         doc.LoadXml(data);
         foreach (XmlElement xitem in doc.DocumentElement.SelectNodes("//item"))
         {
             Streamers   stream = new Streamers();
             XmlDocument mdoc   = new XmlDocument();
             mdoc.LoadXml("<root>" + xitem.GetXml() + "</root>");
             foreach (XmlElement link in mdoc.DocumentElement.SelectNodes("//id"))
             {
                 stream.id = link.InnerText;
             }
             foreach (XmlElement link in mdoc.DocumentElement.SelectNodes("//name"))
             {
                 stream.name = link.InnerText;
             }
             ls.Add(stream);
         }
         return(ls);
     }
     catch (Exception)
     {
         throw new System.InvalidOperationException("Error to load streamers");
     }
 }
示例#2
0
文件: DB.cs 项目: darkclouddev/Rift
 static DB()
 {
     ActiveEvents        = new ActiveEvents();
     ActiveGiveaways     = new ActiveGiveaways();
     BackgroundInventory = new BackgroundInventory();
     Cooldowns           = new Cooldowns();
     Events             = new Database.Events();
     EventLogs          = new EventLogs();
     EventSchedule      = new EventSchedule();
     GiveawayLogs       = new GiveawayLogs();
     Giveaways          = new Giveaways();
     Inventory          = new Inventory();
     LeagueData         = new LeagueData();
     Mappings           = new Mappings();
     ModerationLogs     = new ModerationLogs();
     PendingUsers       = new PendingUsers();
     ProfileBackgrounds = new ProfileBackgrounds();
     Rewards            = new Rewards();
     RoleInventory      = new RoleInventory();
     Roles        = new Roles();
     Settings     = new Settings();
     Statistics   = new Statistics();
     Streamers    = new Streamers();
     SystemTimers = new SystemTimers();
     TempRoles    = new TempRoles();
     Toxicity     = new Toxicity();
     Users        = new Users();
 }
示例#3
0
 public void AddNewStreamer(StreamerData streamer)
 {
     if (!CheckNotifyLimit())
     {
         streamer.UseNotify = false;
     }
     Streamers.Add(streamer);
 }
示例#4
0
        public void SaveStreamer(StreamerData streamer)
        {
            if (!Streamers.Contains(streamer))
            {
                throw new Exception("Tried to save streamer data that not managed in detector!");
            }
            var path = Path.Combine(PlatformUtils.Instance.GetConfigBasePath(), "Streamers");

            PlatformUtils.Instance.EnsureDirectory(path);

            path = Path.Combine(path, streamer.Id + ".json");
            PlatformUtils.Instance.WriteAllBytes(path, streamer.SaveToBytes());
        }
示例#5
0
 public void RemoveStreamerById(string id)
 {
     Streamers.RemoveAll(t =>
     {
         return(t.Id == id);
     });
     try
     {
         PlatformUtils.Instance.DeleteFile(Path.Combine(PlatformUtils.Instance.GetConfigBasePath(), "Streamers", id + ".json"));
     }
     catch
     {
     }
 }
示例#6
0
 public void LoadStreamers()
 {
     Streamers.Clear();
     try
     {
         var basePath = Path.Combine(PlatformUtils.Instance.GetConfigBasePath(), "Streamers");
         foreach (var path in PlatformUtils.Instance.GetFiles(basePath))
         {
             Streamers.Add(StreamerData.LoadFromBytes(PlatformUtils.Instance.ReadAllBytes(Path.Combine(basePath, path))));
         }
     }
     catch
     {
     }
 }
示例#7
0
 public int GetUseNotifyTotal()
 {
     return(Streamers.FindAll(t => t.UseNotify).Count);
 }
示例#8
0
 public bool CheckNotifyLimit()
 {
     return(Streamers.FindAll(t => t.UseNotify).Count < 100);
 }