示例#1
0
 /// <summary>
 /// unregister the LogfileScanner
 /// </summary>
 /// <param name="LogfileScanner"></param>
 public void unregisterLogFileScanner()
 {
     try
     {
         if(m_LogfileScanner != null)
         {
             m_LogfileScanner.LocationChanged -= LogfileScanner_LocationChanged;
             m_LogfileScanner = null;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error while unregistering the LogfileScanner", ex);
     }
 }
示例#2
0
        //private void setLocationInfo(string Systemname, string Locationname, Boolean ForceChangedLocation)
        //{
        //    //bool Jumped_To      = false;
        //    bool systemFirstTimeVisited      = false;
        //    bool newLocation    = false;
        //    bool InitialRun     = false;
        //    if(!String.IsNullOrEmpty(Systemname))
        //    {
        //        // system info found
        //        if(!Program.actualCondition.System.Equals(Systemname, StringComparison.InvariantCultureIgnoreCase))
        //        {
        //            // it's a new system
        //            Debug.Print("tbCurrentSystemFromLogs=" + tbCurrentSystemFromLogs);
        //            Program.actualCondition.System = Systemname;
        //            systemFirstTimeVisited = true;
        //        }
        //        // system info found
        //        if(!_LoggedSystem.Equals(Systemname, StringComparison.InvariantCultureIgnoreCase))
        //        {
        //            // system is not logged yet
        //            // update Cmdr's Log ?
        //            if(_LoggedSystem != ID_NOT_SET)
        //            {
        //                // it's not the first run, create a event if wanted
        //                if (Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoAdd_JumpedTo", true.ToString(), false, true))
        //                {
        //                    // create event is enabled
        //                    CommandersLog_CreateJumpedToEvent(Systemname);
        //                }
        //            }
        //            else
        //            {
        //                InitialRun = true;
        //            }
        //            //Jumped_To = true;
        //            _LoggedSystem = Systemname;
        //        }
        //    }
        //    if(!String.IsNullOrEmpty(Locationname))
        //    {
        //        // system info found
        //        if(!Program.actualCondition.Location.Equals(Locationname, StringComparison.InvariantCultureIgnoreCase))
        //        {
        //            // it's a new location
        //            Program.actualCondition.Location = Locationname;
        //            newLocation = true;
        //            throw new NotImplementedException();
        //            List<EDStation> SystemStations = null; // _Milkyway.getStations(Systemname);
        //            if((SystemStations != null) && (SystemStations.Find(x => x.Name.Equals(Locationname, StringComparison.InvariantCultureIgnoreCase)) != null))
        //                if (Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoAdd_Visited", true.ToString(), false, true))
        //                {
        //                    // create event is enabled
        //                    CommandersLog_StationVisitedEvent(Systemname, Locationname);
        //                }
        //            _LoggedLocation = Locationname;
        //            _LoggedMarketData = "";
        //            _LoggedVisited = "";
        //        }
        //    }else if(systemFirstTimeVisited || ForceChangedLocation)
        //        Program.actualCondition.Location = Condition.STR_Scanning;
        //    if((systemFirstTimeVisited || newLocation) && (!InitialRun))
        //    {
        //        loadSystemData(_LoggedSystem);
        //        loadStationData(_LoggedSystem, _LoggedLocation);
        //        if(Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoActivateSystemTab", true.ToString(), false, true))
        //            tabCtrlMain.SelectedTab = tabCtrlMain.TabPages["tabSystemData"];
        //    }
        //    tbCurrentSystemFromLogs.Text        = Program.actualCondition.System;
        //    tbCurrentStationinfoFromLogs.Text   = Program.actualCondition.Location;
        //}
        //private void CommandersLog_StationVisitedEvent(string Systemname, string StationName)
        //{
        //    if (InvokeRequired)
        //    {
        //        Invoke(new del_EventLocationInfo(CommandersLog_StationVisitedEvent), Systemname, StationName);
        //    }
        //    else
        //    {
        //        if (!_LoggedVisited.Equals(Systemname + "|" + StationName, StringComparison.InvariantCultureIgnoreCase))
        //        {
        //            bool noLogging = _LoggedVisited.Equals(ID_NOT_SET);
        //            _LoggedVisited = Systemname + "|" + StationName;
        //            if (Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoAdd_Visited", true.ToString(), false, true) && !noLogging)
        //            {
        //                Program.CommandersLog.SaveEvent(DateTime.UtcNow, Systemname, StationName, "", "", 0, 0, 0, "Visited", "");
        //            }
        //        }
        //    }
        //}
        //private void CommandersLog_MarketDataCollectedEvent(string Systemname, string StationName)
        //{
        //    if (InvokeRequired)
        //    {
        //        Invoke(new del_EventLocationInfo(CommandersLog_MarketDataCollectedEvent), Systemname, StationName);
        //    }
        //    else
        //    {
        //        try
        //        {
        //            if (!_LoggedMarketData.Equals(Systemname + "|" + StationName, StringComparison.InvariantCultureIgnoreCase))
        //            {
        //                _LoggedMarketData = Systemname + "|" + StationName;
        //                if (Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoAdd_Marketdata", true.ToString(), false, true))
        //                {
        //                    if (Program.DBCon.getIniValue<Boolean>(MTSettings.tabSettings.DB_GROUPNAME, "AutoAdd_ReplaceVisited", true.ToString(), false, true))
        //                    {
        //                        //object logEvent = Program.CommandersLog.LogEvents.SingleOrDefault(x => x.EventID == _CmdrsLog_LastAutoEventID);
        //                        //if (logEvent != null &&
        //                        //   logEvent.System.Equals(Systemname, StringComparison.InvariantCultureIgnoreCase) &&
        //                        //   logEvent.Location.Equals(StationName, StringComparison.InvariantCultureIgnoreCase) &&
        //                        //   logEvent.EventType.Equals("Visited", StringComparison.InvariantCultureIgnoreCase))
        //                        //{
        //                        //    logEvent.EventType = "Market m_BaseData Collected";
        //                        //    Program.CommandersLog.UpdateCommandersLogListView();
        //                        //}
        //                        //else
        //                        //{
        //                        //    _CmdrsLog_LastAutoEventID = Program.CommandersLog.SaveEvent("Market m_BaseData Collected", StationName, Systemname, "", "", 0, "", DateTime.UtcNow);
        //                        //    setActiveItem(_CmdrsLog_LastAutoEventID);
        //                        //}
        //                    }
        //                    else
        //                    {
        //                        Program.CommandersLog.SaveEvent(DateTime.Now, Systemname, StationName, "", "", 0, 0, 0, "Market Data Collected", "");
        //                    }
        //                }
        //            }
        //        }
        //        catch (Exception ex)
        //        {
        //            throw ex;
        //        }
        //    }
        //}
        /// <summary>
        /// register the LogfileScanner in the CommandersLog for the DataEvent
        /// </summary>
        /// <param name="LogfileScanner"></param>
        public void registerLogFileScanner(FileScanner.EDLogfileScanner LogfileScanner)
        {
            try
            {
                if(m_LogfileScanner == null)
                {
                    m_LogfileScanner = LogfileScanner;
                    m_LogfileScanner.LocationChanged += LogfileScanner_LocationChanged;
                }
                else
                    throw new Exception("LogfileScanner already registered");

            }
            catch (Exception ex)
            {
                throw new Exception("Error while registering the LogfileScanner", ex);
            }
        }