Esempio n. 1
0
        void m_ExternalDataInterface_ExternalDataEvent(object sender, ExternalDataInterface.LocationChangedEventArgs e)
        {
            try
            {
                if((e.Changed & ExternalDataInterface.enExternalDataEvents.Landed) > 0)
                {

                    SaveEvent(DateTime.UtcNow, e.System, e.Location, "", "", 0, 0, 0, "Visited", "");
                }

                if((e.Changed & ExternalDataInterface.enExternalDataEvents.DataCollected) > 0)
                {
                    createMarketdataCollectedEvent();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while processing the LocationChanged-event", ex);
            }
        }
Esempio n. 2
0
        void ExternalDataInterface_ExternalDataEvent(object sender, ExternalDataInterface.LocationChangedEventArgs e)
        {
            try
            {
                if((e.Changed & ExternalDataInterface.enExternalDataEvents.Landed) != 0)
                {
                    Program.actualCondition.System   = e.System;
                    Program.actualCondition.Location = e.Location;

                    setText(tbCurrentSystemFromLogs,      Program.actualCondition.System);
                    setText(tbCurrentStationinfoFromLogs, Program.actualCondition.Location);
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Error while processing the LocationChanged-event", ex);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// unregister the LogfileScanner
 /// </summary>
 /// <param name="LogfileScanner"></param>
 public void unregisterExternalTool()
 {
     try
     {
         if(m_ExternalDataInterface != null)
         {
             m_ExternalDataInterface.ExternalDataEvent -= m_ExternalDataInterface_ExternalDataEvent;
             m_ExternalDataInterface = null;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error while unregistering the ExternalDataTool", ex);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// register the external tool in the CommandersLog for the DataEvent
        /// </summary>
        /// <param name="LogfileScanner"></param>
        public void registerExternalTool(ExternalDataInterface ExternalDataInterface)
        {
            try
            {
                if(m_ExternalDataInterface == null)
                {
                    m_ExternalDataInterface                    = ExternalDataInterface;
                    m_ExternalDataInterface.ExternalDataEvent += m_ExternalDataInterface_ExternalDataEvent;
                }
                else
                    throw new Exception("LogfileScanner already registered");

            }
            catch (Exception ex)
            {
                throw new Exception("Error while registering the LogfileScanner", ex);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// forwards a potentially new system or station information to database
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static void ExternalData_LocationInfo(object sender, ExternalDataInterface.LocationInfoEventArgs e)
 {
     try
     {
         Data.checkPotentiallyNewSystemOrStation(e.System, e.Location, false);
     }
     catch (Exception ex)
     {
         throw new Exception("Error while in ExternalData_LocationInfo", ex);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// starts the initialization of the global objects
        /// </summary>
        public static void Init()
        {
            try
            {
                if(!m_initDone)
                {
                    Program.SplashScreen = new SplashScreenForm();
                    Program.SplashScreen.Show();

                    Program.SplashScreen.InfoAdd("initializing logger...");
                    Program.Logger = new SingleThreadLogger(ThreadLoggerType.Form);
                    Program.Logger.Log("Initialising...\n");
                    Program.SplashScreen.InfoAppendLast("<OK>");

                    Program.SplashScreen.InfoAdd("starting sql server...");

                    // load settings from file
                    IniFile = new STA.Settings.INIFile(GetDataPath("ED-IBE.ini"), false, true);

                    // starT database process (if not running)
                    DBProcess.DBProcessParams newProcessParams  = new DBProcess.DBProcessParams() { };
                    newProcessParams.Commandline                = IniFile.GetValue("DB_Server",        "Commandline",      @"bin\mysqld.exe");
                    newProcessParams.Commandargs                = IniFile.GetValue("DB_Server",        "CommandArgs",      @"--defaults-file=Elite.ini --console");
                    newProcessParams.Workingdirectory           = IniFile.GetValue("DB_Server",        "WorkingDirectory", @"..\..\..\RNDatabase\Database");
                    newProcessParams.Port                       = IniFile.GetValue<Int16>("DB_Server", "Port",             "3306");
                    newProcessParams.DBStartTimeout             = IniFile.GetValue<Int16>("DB_Server", "DBStartTimeout",   "60");

                    EliteDBProcess                              = new DBProcess(newProcessParams);

                    if (EliteDBProcess.WasRunning)
                        Program.SplashScreen.InfoAppendLast("already running...<OK>");
                    else
                        Program.SplashScreen.InfoAppendLast("<OK>");

                    // connecT to the database
                    Program.SplashScreen.InfoAdd("connect to sql server...");

                    DBConnector.ConnectionParams newConnectionParams = new DBConnector.ConnectionParams() { };

                    newConnectionParams.Name                    = IniFile.GetValue("DB_Connection",          "Name",           "master");
                    newConnectionParams.Server                  = IniFile.GetValue("DB_Connection",          "Server",         "localhost");
                    newConnectionParams.Database                = IniFile.GetValue("DB_Connection",          "Database",       "Elite_DB");
                    newConnectionParams.User                    = IniFile.GetValue("DB_Connection",          "User",           "RN_User");
                    newConnectionParams.Pass                    = IniFile.GetValue("DB_Connection",          "Pass",           "Elite");
                    newConnectionParams.ConnectTimeout          = IniFile.GetValue<Int16>("DB_Connection",   "ConnectTimeout", "60");
                    newConnectionParams.StayAlive               = IniFile.GetValue<Boolean>("DB_Connection", "StayAlive",      "false");
                    newConnectionParams.TimeOut                 = IniFile.GetValue<Int16>("DB_Connection",   "TimeOut",        "60");

                    DBCon                                       = new DBConnector(newConnectionParams);

                    DBCon.Connect();

                    Program.SplashScreen.InfoAppendLast("<OK>");

                    /* **************** database is running ********************** */

                    Program.SplashScreen.InfoAdd("preparing global objects...");

                    // prepare colors-object
                    Colors                                      = new GUIColors();

                    // preprare main data object
                    Data                                        = new IBE.SQL.EliteDBIO();
                    Data.PrepareBaseTables();

                    // create global paths-object
                    //Paths                                       = new ProgramPaths();

                    // prepare settings
                    Settings                                    = new Settings();
                    Settings.BaseData                           = Data.BaseData;

                    // prepare commanders log
                    CommandersLog                               = new CommandersLog();
                    CommandersLog.BaseData                      = Data.BaseData;

                    // prepare price analysis
                    PriceAnalysis                               = new PriceAnalysis(new DBConnector(DBCon.ConfigData, true));
                    PriceAnalysis.BaseData                      = Data.BaseData;

                    // starting the external data interface
                    ExternalData                                = new ExternalDataInterface();

                    // initializing the object for the actual condition
                    actualCondition                             = new Condition();

                    // initializing the LogfileScanner
                    LogfileScanner                              = new EDLogfileScanner();

                    // forwards a potentially new system or station information to database
                    Program.LogfileScanner.LocationInfo += LogfileScanner_LocationInfo;
                    Program.ExternalData.LocationInfo   += ExternalData_LocationInfo;

                    // register the LogfileScanner in the CommandersLog for the ExternalDataEvent-event
                    CommandersLog.registerLogFileScanner(LogfileScanner);
                    CommandersLog.registerExternalTool(ExternalData);

                    PriceAnalysis.registerLogFileScanner(LogfileScanner);
                    PriceAnalysis.registerExternalTool(ExternalData);

                    Program.SplashScreen.InfoAppendLast("<OK>");

                    m_initDone = true;

                }
            }
            catch (Exception ex)
            {
                cErr.processError(ex, "Error while initializing the program object", true);
            }
        }
Esempio n. 7
0
        void m_ExternalDataInterface_ExternalDataEvent(object sender, ExternalDataInterface.LocationChangedEventArgs e)
        {
            try
            {
                if((e.Changed & ExternalDataInterface.enExternalDataEvents.Landed) > 0)
                {

                }

                if((e.Changed & ExternalDataInterface.enExternalDataEvents.DataCollected) > 0)
                {
                    GUI.setFilterHasChanged(true);
                    //GUI.RefreshData();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while processing the LocationChanged-event", ex);
            }
        }