Example #1
0
 public void Raise(RaiseAlert Raise)
 {
     if (this._Parent != null)
     {
         this._Raise = Raise;
     }
 }
Example #2
0
        internal void Refresh()
        {
            // Basic re-entrancy guard
            if (Refreshing)
            {
                // Warning: previous refresh took longer than 5s. Will skip this cycle
                App.LogMessage("A refresh cycle took far longer than expected, and conflicted with the subsequent call");
                return;
            }
            Refreshing = true;
            try {
                // Scan the logfiles for alerts or other state messages
                OpenGameLogs(); // Ensure open logs match up to open client instances
                foreach (var logReader in LogReaders.Values)
                {
                    while (!logReader.EndOfStream)
                    {
                        var line = logReader.ReadLine();
                        if (line.Length > 32 && line.IndexOf("Scaleform.Clockwatcher", 32) != -1)
                        {
                            if (line.EndsWith("Groupfinder queue popped"))
                            {
                                RaiseAlert?.Invoke(this, new AudioAlertEventArgs(AudioAlertType.GroupfinderAlert));
                            }
                        }
                    }
                }

                // Load settings files
                var charNames = new List <string>();
                foreach (var charFile in FindCharacterFiles())
                {
                    var charData = ExtractCharacterMissions(charFile, out var charName);
                    if (charNames.Contains(charName))
                    {
                        // Character name was encountered multiple times on this pass
                        // Likely caused by duplication of game settings data in multiple folders (either a bug, or intentional backup)
                        // Is likely to cause conflicts, but can't tell from here which version is definitive, log for reporting
                        App.LogMessage(charName + " has duplicated settings data, reported values may not synch");
                    }
                    else
                    {
                        charNames.Add(charName);
                    }
                    if (charData != null)
                    {
                        var existing = (from e in CharacterMissionLists
                                        where e.TabName == charName
                                        select e).SingleOrDefault();
                        if (existing != null)   // Merge with existing character record
                        {
                            existing.Merge(charData);
                        }
                        else     // Add new character
                        {
                            var charPanel = new CharacterTimers(charName, charData);
                            CharacterMissionLists.Add(charPanel);
                            TabPanels.Insert(TabPanels.Count - 1, charPanel);
                        }
                    }
                }

                // Update time displays and trigger alert states
                if ((from c in CharacterMissionLists
                     from m in c.TimerList
                     where m.Refresh(Settings.AlertFilter)
                     select m).ToList().Any())
                {
                    RaiseAlert?.Invoke(this, new AudioAlertEventArgs(AudioAlertType.AgentAlert));
                }
            } finally {
                Refreshing = false;
            }
        }
Example #3
0
 public RaiseAlertFixture()
 {
     alert = new RaiseAlert(alertName, 10.0m, 0.5m, () => { alertRaised = true; });
 }