private string GetRawIntel(Intel intel) { string rawIntel = Intel.Message; if (rawIntel.Length > 50) { rawIntel = rawIntel.Substring(0, 50) + "..."; } return(rawIntel); }
public void NotifyLogMessage(LogMessage message) { if (!Active) { return; } foreach (string searchText in MatchStrings) { Match match = Regex.Match(message.Message, ".*" + searchText + ".*", RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase); if (match.Success) { Intel intel = new Intel(); intel.LogMessage = message; string formattedMessage = message.Message; foreach (string word in IntelSettings.Default.DetectIgroreWords) { formattedMessage = formattedMessage.Replace(word, ""); } /*(string formattedMessage = message.Message.Replace("at ", ""). * Replace("near ", ""). * Replace("in ", ""). * Replace("the ", ""). * Replace("a ", ""); */ string[] systemKeywords = null; foreach (string systemKeyword in IntelSettings.Default.DetectSystem) { if (formattedMessage.Contains(systemKeyword)) { systemKeywords = systemKeyword.Split(' '); break; } } string[] messageParts = formattedMessage.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (systemKeywords != null) { for (int i = 0; i < messageParts.Length; i++) { if (systemKeywords[0] == messageParts[i] && i - 1 >= 0) { intel.System = SolarSystem.GetSystem(messageParts[i - 1]); } else if (systemKeywords.Contains(messageParts[i])) { // ignore the rest of the solar system keyword } else if (messageParts[i].ToLower() == "nv" || messageParts[i].ToLower() == "novisual" || messageParts[i].ToLower() == "visual") { intel.NoVisual = true; intel.Location = "No Visual"; } else if (messageParts[i].ToLower() == "docked" || messageParts[i].ToLower() == "doc") { intel.Docked = true; intel.Location = "Docked"; } else if (messageParts[i].ToLower() == "clear" || messageParts[i].ToLower() == "clr") { intel.Clear = true; intel.Location = "Clear"; } else if (i + 1 < messageParts.Length && !systemKeywords.Contains(messageParts[i + 1])) { intel.Players += (intel.Players != "" ? " " : "") + messageParts[i]; } else if (i + 1 < messageParts.Length && systemKeywords.Contains(messageParts[i + 1])) { // since this keyword is a system, we need to skip it. } else if (i < messageParts.Length && !systemKeywords.Contains(messageParts[i])) { intel.Players += (intel.Players != "" ? " " : "") + messageParts[i]; } } } if (ChangedIntel != null) { ChangedIntel(intel); // since we alrady matched this intel, we do not want to keep searching } return; } } }
public IntelPresentation(Intel intel) { this.Intel = intel; }
public void Remove(Intel intel) { this.intel.Remove(intel); }
public void Add(Intel intel) { this.intel.Add(intel); }