Exemplo n.º 1
0
 public static void Init()
 {
     EoiDataInterface.Init();
     Initialize();
     EoiDataInterface.CalculateAllBlueprints();
 }
Exemplo n.º 2
0
        internal static void Start(Thread mainThread)
        {
            if (mainThread == null)
            {
                return;
            }

            MainThread = mainThread;

            while (!_stop)
            {
                CheckUserAccessTokens();

                if (SettingsInterface.GlobalSettings.EnableAutoUpdater)
                {
                    var updated = false;

                    if (SynchronizeBlueprints())
                    {
                        updated = true;
                    }

                    CheckUpdated(updated, EoiInterface.BlueprintPropertyChanged);
                    updated = false;

                    Status = new BackgroundWorkerStatus("Synchronisiere Assets", -1);
                    SynchronizeAssets();
                    SynchronizeWallet();
                    CheckUpdated(true, EoiInterface.AssetPropertyChanged);

                    Status = new BackgroundWorkerStatus("Synchronisiere Markt Orders", -1);
                    SynchronizeCharacterOrders();
                    CheckUpdated(true, EoiInterface.BlueprintPropertyChanged);

                    if (SettingsInterface.GlobalSettings.EnableCorporationContractsUpdates && !_stop)
                    {
                        Status = new BackgroundWorkerStatus("Synchronisiere Corporation Verträge", -1);
                        if (SynchronizeCorporationContracts())
                        {
                            updated = true;
                        }

                        CheckUpdated(updated, EoiInterface.ContractsPropertyChanged);
                        updated = false;
                    }

                    if (SettingsInterface.GlobalSettings.EnableMarketerUpdates && !_stop)
                    {
                        Status = new BackgroundWorkerStatus("Aktualisiert Markt Preise", -1);
                        if (CheckMarketerData())
                        {
                            updated = true;
                        }

                        CheckUpdated(true, EoiInterface.AssetPropertyChanged);
                        CheckUpdated(updated, EoiInterface.BlueprintPropertyChanged);
                        updated = false;
                    }

                    if (SettingsInterface.GlobalSettings.EnableMarketHistoryUpdates && !_stop)
                    {
                        Status = new BackgroundWorkerStatus("Aktualisiert Markt Verkaufszahlen", -1);
                        if (CheckMarketHistory())
                        {
                            updated = true;
                        }

                        CheckUpdated(updated, EoiInterface.BlueprintPropertyChanged);
                        updated = false;
                    }
                }

                var preStop = false;
                for (int i = 0; i < 30; i++)
                {
                    if (!_stop)
                    {
                        CheckUserAccessTokens();

                        if (_calculateBlueprints)
                        {
                            Status = new BackgroundWorkerStatus("Berechne Blueprints", -1);
                            _calculateBlueprints = false;
                            EoiDataInterface.CalculateAllBlueprints();
                            CheckUpdated(true, EoiInterface.BlueprintPropertyChanged);
                        }

                        if (EveSwaggerInterface.Working())
                        {
                            var state = EveSwaggerInterface.GetProgressState();
                            Status  = new BackgroundWorkerStatus("Download vom Eve Online Server: " + state.FinishedOperations + " / " + state.Operations, state.Progress);
                            preStop = true;
                        }
                        else
                        {
                            Status = new BackgroundWorkerStatus("", 0);
                        }

                        Thread.Sleep(SettingsInterface.GlobalSettings.AutoUpdaterInterval / 30);

                        if (preStop && !EveSwaggerInterface.Working())
                        {
                            i = 30;
                        }
                    }
                }
            }
        }