private bool eventJumping(JumpingEvent theEvent) { bool passEvent; Logging.Debug("Jumping to " + theEvent.system); if (CurrentStarSystem == null || CurrentStarSystem.name != theEvent.system) { // New system passEvent = true; updateCurrentSystem(theEvent.system); // The information in the event is more up-to-date than the information we obtain from external sources, so update it here CurrentStarSystem.x = theEvent.x; CurrentStarSystem.y = theEvent.y; CurrentStarSystem.z = theEvent.z; CurrentStarSystem.visits++; CurrentStarSystem.lastvisit = DateTime.Now; StarSystemSqLiteRepository.Instance.SaveStarSystem(CurrentStarSystem); setCommanderTitle(); } else { // Restatement of current system passEvent = false; } // Whilst jumping we are in witch space Environment = Constants.ENVIRONMENT_WITCH_SPACE; return passEvent; }
private static void HandleNetLogLine(string line, Action<Event> callback) { string starSystem = null; string environment = null; decimal x = 0; decimal y = 0; decimal z = 0; Match oldMatch = OldSystemRegex.Match(line); if (oldMatch.Success) { Logging.Debug("Match against old regex"); if (@"Training" == oldMatch.Groups[3].Value || @"Destination" == oldMatch.Groups[3].Value) { // We ignore training missions return; } if (@"ProvingGround" == oldMatch.Groups[4].Value) { // We ignore CQC return; } starSystem = oldMatch.Groups[3].Value; environment = oldMatch.Groups[3].Value; } else { Match match = SystemRegex.Match(line); if (match.Success) { Logging.Debug("Match against new regex"); if (@"Training" == match.Groups[2].Value || @"Destination" == match.Groups[2].Value) { // We ignore training missions return; } if (@"ProvingGround" == match.Groups[6].Value) { // We ignore CQC return; } starSystem = match.Groups[2].Value; environment = match.Groups[6].Value; x = Math.Round(decimal.Parse(match.Groups[3].Value) * 32) / (decimal)32.0; y = Math.Round(decimal.Parse(match.Groups[4].Value) * 32) / (decimal)32.0; z = Math.Round(decimal.Parse(match.Groups[5].Value) * 32) / (decimal)32.0; } } Event theEvent = null; if (starSystem != null) { if (starSystem != lastStarsystem) { // Change of system theEvent = new JumpingEvent(DateTime.Now.ToUniversalTime(), starSystem, x, y, z); lastStarsystem = starSystem; lastEnvironment = environment; } //else if (environment != lastEnvironment) //{ // // Change of environment // if (environment == "Supercruise") // { // theEvent = new EnteredSupercruiseEvent(DateTime.Now.ToUniversalTime(), starSystem); // lastEnvironment = environment; // } // else if (environment == "NormalFlight") // { // theEvent = new EnteredNormalSpaceEvent(DateTime.Now.ToUniversalTime(), starSystem, null, null); // lastEnvironment = environment; // } //} } if (theEvent != null) { Logging.Debug("Returning event " + theEvent); callback(theEvent); } }