Ejemplo n.º 1
0
        internal bool SynchronizedReset()
        {
            var updated = false;

            this.EsiSynchronized = true;
            this.Owned           = false;

            if (_fileSystemBlueprint == null)
            {
                return(updated);
            }
            else
            {
                updated = true;
            }

            FileSystemDataInterface.RemoveBlueprint(_fileSystemBlueprint);

            if (_eoiBlueprint != null)
            {
                _eoiBlueprint.MaterialEfficency = 0;
                _eoiBlueprint.TimeEfficency     = 0;
                _eoiBlueprint.Owned             = false;
            }

            return(updated);
        }
Ejemplo n.º 2
0
        public EoiDataUser(FileSystemDataUser user)
        {
            _fileSystemUser = user;

            if (_fileSystemUser.TokenResponse != null)
            {
                var token = WebDataInterface.RefreshAccessToken(_fileSystemUser.TokenResponse.refresh_token);
                if (token != null)
                {
                    if (this.Id == 0)
                    {
                        Authenticate(token);
                    }

                    _fileSystemUser.TokenResponse = token;
                    FileSystemDataInterface.ExportUsers();
                }
            }

            if (_fileSystemUser != null && _fileSystemUser.TokenResponse != null)
            {
                CorporationWebInterface.RegisterUser(_fileSystemUser.Name);
            }

            this.Name = user.Name;
        }
Ejemplo n.º 3
0
 internal void Delete()
 {
     if (_fileSystemAsset != null)
     {
         FileSystemDataInterface.RemoveAsset(_fileSystemAsset);
     }
 }
Ejemplo n.º 4
0
        private static void InitializeUsers()
        {
            _eoiDataUsers = new List <EoiDataUser>();
            var users = FileSystemDataInterface.GetUsers();

            foreach (var user in users)
            {
                _eoiDataUsers.Add(new EoiDataUser(user));
            }
        }
Ejemplo n.º 5
0
        private static void InitializeAssets()
        {
            _eoiDataAsset = new List <EoiDataAsset>();
            var assets = FileSystemDataInterface.GetAssets();

            foreach (var asset in assets)
            {
                _eoiDataAsset.Add(new EoiDataAsset(asset));
            }
        }
Ejemplo n.º 6
0
        internal bool Synchronize(EsiDataBlueprint blueprint)
        {
            var updated = false;

            if (blueprint == null)
            {
                return(false);
            }

            this.EsiSynchronized = true;

            if (_fileSystemBlueprint == null)
            {
                _fileSystemBlueprint = FileSystemDataInterface.CreateBlueprint(this.Id);
            }

            if (_fileSystemBlueprint.MaterialEfficency != blueprint.MaterialEfficency)
            {
                _fileSystemBlueprint.MaterialEfficency = blueprint.MaterialEfficency;

                if (_eoiBlueprint != null)
                {
                    _eoiBlueprint.MaterialEfficency = blueprint.MaterialEfficency;
                }

                updated = true;
            }

            if (_fileSystemBlueprint.TimeEfficency != blueprint.TimeEfficency)
            {
                _fileSystemBlueprint.TimeEfficency = blueprint.TimeEfficency;

                if (_eoiBlueprint != null)
                {
                    _eoiBlueprint.TimeEfficency = blueprint.TimeEfficency;
                }

                updated = true;
            }

            if (!this.Owned)
            {
                _fileSystemBlueprint.Owned = true;
                this.Owned = true;

                if (_eoiBlueprint != null)
                {
                    _eoiBlueprint.Owned = true;
                }

                updated = true;
            }

            return(updated);
        }
Ejemplo n.º 7
0
        public static void Init()
        {
            StaticDataInterface.Init();
            FileSystemDataInterface.Init();

            InitializeEoiData();

            EsiDataInterface.Init();

            InitEoiDataContent();
        }
Ejemplo n.º 8
0
        private static void CreateDefaultUser()
        {
            FileSystemDataInterface.CreateDefaultUser();
            var user = FileSystemDataInterface.GetUsers().FirstOrDefault(x => x.Name == "Default");

            if (user != null)
            {
                var eoiDataUser = new EoiDataUser(user);
                _eoiDataUsers.Add(eoiDataUser);
                EoiInterface.AddUser(eoiDataUser.GetEoiUser());
            }
        }
Ejemplo n.º 9
0
        public EoiDataAsset(RawEsiAsset esiAsset)
        {
            if (esiAsset != null)
            {
                this.Id = esiAsset.type_id;

                _type = EoiDataInterface.GetTypeById(this.Id);

                if (_fileSystemAsset == null)
                {
                    _fileSystemAsset = FileSystemDataInterface.CreateAsset(esiAsset.type_id, esiAsset.quantity);
                }
            }
        }
Ejemplo n.º 10
0
        internal void Synchronize(RawEsiAsset esiAsset)
        {
            if (esiAsset.type_id != this.Id)
            {
                return;
            }

            if (_fileSystemAsset == null)
            {
                _fileSystemAsset = FileSystemDataInterface.CreateAsset(esiAsset.type_id, esiAsset.quantity);
            }
            else
            {
                _fileSystemAsset.Quantity += esiAsset.quantity;
            }
        }
Ejemplo n.º 11
0
        internal void Init()
        {
            var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub));

            var marketOrders = EsiDataInterface.GetMarketOrders(Id, region);

            if (marketOrders != null)
            {
                _esiMarketOrders.Add(marketOrders);
            }

            _fileSystemBlueprint = FileSystemDataInterface.GetBlueprintById(Id);

            if (_fileSystemBlueprint != null && _fileSystemBlueprint.IsCopy)
            {
                this.IsCopy = true;
            }
        }
Ejemplo n.º 12
0
        private void EoiBlueprint_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(EoiBlueprint.Private))
            {
                if (_fileSystemBlueprint == null)
                {
                    _fileSystemBlueprint = FileSystemDataInterface.CreateBlueprint(this.Id);
                }

                _fileSystemBlueprint.Private = _eoiBlueprint.Private;
            }
            else if (e.PropertyName == nameof(EoiBlueprint.Owned))
            {
                if (_fileSystemBlueprint == null)
                {
                    _fileSystemBlueprint = FileSystemDataInterface.CreateBlueprint(this.Id);
                }

                _fileSystemBlueprint.Owned = _eoiBlueprint.Owned;
                this.Owned = _eoiBlueprint.Owned;
            }
            else if (e.PropertyName == nameof(EoiBlueprint.MaterialEfficency))
            {
                if (_fileSystemBlueprint == null)
                {
                    _fileSystemBlueprint = FileSystemDataInterface.CreateBlueprint(this.Id);
                }

                _fileSystemBlueprint.MaterialEfficency = _eoiBlueprint.MaterialEfficency;

                BlueprintCalculator.Calculate(this);
            }
            else if (e.PropertyName == nameof(EoiBlueprint.TimeEfficency))
            {
                if (_fileSystemBlueprint == null)
                {
                    _fileSystemBlueprint = FileSystemDataInterface.CreateBlueprint(this.Id);
                }

                _fileSystemBlueprint.TimeEfficency = _eoiBlueprint.TimeEfficency;

                BlueprintCalculator.Calculate(this);
            }
        }
Ejemplo n.º 13
0
        internal void VerifyUser(RawEsiVerify verifyResult, RawAccessTokenResponse token)
        {
            _fileSystemUser.TokenResponse = token;
            _fileSystemUser.Name          = verifyResult.CharacterName;
            _fileSystemUser.Id            = verifyResult.CharacterID;

            FileSystemDataInterface.ExportUsers();

            this.Id   = verifyResult.CharacterID;
            this.Name = verifyResult.CharacterName;

            if (_eoiUser != null)
            {
                _eoiUser.Name          = verifyResult.CharacterName;
                _eoiUser.IsDefault     = false;
                _eoiUser.Authenticated = true;
                _eoiUser.InvokePropertyChanged();
            }

            CorporationWebInterface.RegisterUser(_fileSystemUser.Name);
        }
Ejemplo n.º 14
0
        internal void CheckAccessToken()
        {
            if (_fileSystemUser.TokenResponse != null)
            {
                var difference = DateTime.Now - _fileSystemUser.TokenResponse.Timestamp;
                if (difference.TotalMinutes >= 15)
                {
                    var token = WebDataInterface.RefreshAccessToken(_fileSystemUser.TokenResponse.refresh_token);
                    if (token != null)
                    {
                        if (this.Id == 0)
                        {
                            Authenticate(token);
                        }

                        _fileSystemUser.TokenResponse = token;
                        FileSystemDataInterface.ExportUsers();
                    }
                }
            }
        }
Ejemplo n.º 15
0
 internal static void Close()
 {
     FileSystemDataInterface.Close();
 }