/// <summary>
        /// Don't overwrite if we've already got details
        /// </summary>
        /// <param name="activeSessions"></param>
        public void SetSessionDefaults(ActiveSessions activeSessions)
        {
            if (string.IsNullOrEmpty(this.SessionCommanderName))
            {
                this.SessionCommanderName = activeSessions.CommanderName;
            }
            UpdateLocation(activeSessions.CurrentLocation);

            if (string.IsNullOrEmpty(this.SessionShipName))
            {
                this.SessionShipName = activeSessions.CurrentShip;
            }
            if (string.IsNullOrEmpty(this.SessionShipIdent))
            {
                this.SessionShipIdent = activeSessions.CurrentShipIdent;
            }
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            var userDir = System.Environment.GetEnvironmentVariable("USERPROFILE");
            var journalDirectoryPath = userDir + @"\Saved Games\Frontier Developments\Elite Dangerous";
            var journalDirectory     = new DirectoryInfo(journalDirectoryPath);

            if (!journalDirectory.Exists)
            {
                Console.WriteLine("Could not find journal directory");
                Console.WriteLine($"Tried: {journalDirectoryPath}");
                Application.Exit();
            }
            EliteConfiguration cfg = new EliteConfiguration()
            {
                JournalDirectory       = journalDirectory,
                RaiseOnCatchup         = _raiseOnCatchup,
                UseDiscordRichPresence = false,
            };

            EliteAPI = new EliteDangerousAPI(cfg);
            if (_consoleDebug)
            {
                Logger.AddHandler(new ConsoleHandler());
            }

            _mapperConfig = new MapperConfiguration(mapcfg =>
            {
                mapcfg.CreateMap <StatSession, StatSessionSummary>();
            }
                                                    );

            currentSessions = new ActiveSessions(Directory.GetCurrentDirectory());
            currentSessions.ObjectMapper = _mapperConfig.CreateMapper();

            EliteAPI.Events.LoadGameEvent    += Events_LoadGameEvent;
            EliteAPI.Events.ShutdownEvent    += Events_ShutdownEvent;
            EliteAPI.Events.CommanderEvent   += Events_CommanderEvent;
            EliteAPI.Events.LoadoutEvent     += Events_LoadoutEvent;
            EliteAPI.Events.StatusInMainMenu += Events_StatusInMainMenu;
            EliteAPI.Events.MusicEvent       += Events_MusicEvent;

            // Mining
            EliteAPI.Events.CargoEvent += Events_CargoEvent;
            EliteAPI.Events.ProspectedAsteroidEvent += Events_ProspectedAsteroidEvent;
            EliteAPI.Events.LaunchDroneEvent        += Events_LaunchDroneEvent;
            EliteAPI.Events.MiningRefinedEvent      += Events_MiningRefinedEvent;
            EliteAPI.Events.AsteroidCrackedEvent    += Events_AsteroidCrackedEvent;

            // Trade related
            EliteAPI.Events.MarketSellEvent += Events_MarketSellEvent;
            EliteAPI.Events.MarketBuyEvent  += Events_MarketBuyEvent;

            // Travel related
            EliteAPI.Events.StatusFsdChargingEvent += Events_StatusFsdChargingEvent;
            EliteAPI.Events.FSDJumpEvent           += Events_FSDJumpEvent;
            EliteAPI.Events.LocationEvent          += Events_LocationEvent;
            EliteAPI.Events.SupercruiseEntryEvent  += Events_SupercruiseEntryEvent;
            EliteAPI.Events.SupercruiseExitEvent   += Events_SupercruiseExitEvent;
            EliteAPI.Events.DockedEvent            += Events_DockedEvent;
            EliteAPI.Events.UndockedEvent          += Events_UndockedEvent;

            // Exploration
            EliteAPI.Events.FuelScoopEvent           += Events_FuelScoopEvent;
            EliteAPI.Events.SellExplorationDataEvent += Events_SellExplorationDataEvent;

            // Scavenging
            EliteAPI.Events.StatusScoopingEvent += Events_StatusScoopingEvent;

            // Mission running
            EliteAPI.Events.MissionAbandonedEvent  += Events_MissionAbandonedEvent;
            EliteAPI.Events.MissionAcceptedEvent   += Events_MissionAcceptedEvent;
            EliteAPI.Events.MissionCompletedEvent  += Events_MissionCompletedEvent;
            EliteAPI.Events.MissionFailedEvent     += Events_MissionFailedEvent;
            EliteAPI.Events.MissionRedirectedEvent += Events_MissionRedirectedEvent;
            EliteAPI.Events.MissionsEvent          += Events_MissionsEvent;

            // Combat
            EliteAPI.Events.CockpitBreachedEvent += Events_CockpitBreachedEvent;
            EliteAPI.Events.RedeemVoucherEvent   += Events_RedeemVoucherEvent;

            // Tricks
            EliteAPI.Events.AllEvent += Events_AllEvent;

            EliteAPI.Start();

            Console.WriteLine("Press any key to quit");
            Console.ReadKey();
        }