Esempio n. 1
0
        public ICardsDatabase GetLatestCardsDB()
        {
            string         url                = settings.VersionCheck_CardsDBUrl;
            ICardsDatabase returnValue        = null;
            var            requestErrorPolicy = Policy
                                                .Handle <System.Net.WebException>()
                                                .Fallback(
                () => { returnValue = trackerFactory.GetService <ICardsDatabase>(); },
                (ex, context) => {
                Logger.Trace(ex, "Exception when retreiving cards DB from {0}", url);
                Logger log = LogManager.GetLogger(App.UserInfoLogger);
                log.Info(ex.Message);
            }
                );

            requestErrorPolicy.Execute(() =>
            {
                Logger.Trace("Start retreiving cards DB from {0}", url);
                IHTTPService httpService = trackerFactory.GetService <IHTTPService>();
                string cardsDBContent    = httpService.SendGetRequest(url);
                ICardsDatabase cardsDB   = trackerFactory.GetFileManager().UpdateCardsDB(cardsDBContent);
                Logger.Trace("Finished retreiving cards DB from {0}", url);
                returnValue = cardsDB;
            });

            return(returnValue);
        }
        public NewVersioInfo CheckNewAppVersionAvailable()
        {
            var requestErrorPolicy = Policy <NewVersioInfo>
                                     .Handle <System.Net.WebException>()
                                     .Fallback(new NewVersioInfo()
            {
                IsAvailable = false
            });

            string       url         = "https://raw.githubusercontent.com/MarioZG/elder-scrolls-legends-tracker/master/Build/versions.json";
            IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();

            return(requestErrorPolicy.Execute(() =>
            {
                string versionJSON = httpService.SendGetRequest(url);
                JObject versions = JObject.Parse(versionJSON);
                SerializableVersion latest = new SerializableVersion(new Version(versions["Application"].ToString()));
                IApplicationService appService = (IApplicationService)trackerFactory.GetService <IApplicationService>();

                return new NewVersioInfo()
                {
                    IsAvailable = latest > appService.GetAssemblyVersion(),
                    Number = latest.ToString(),
                    DownloadUrl = GetLatestDownladUrl()
                };
            }));
        }
Esempio n. 3
0
        public NewVersioInfo CheckNewAppVersionAvailable()
        {
            string url = settings.VersionCheck_VersionsUrl;

            var requestErrorPolicy = Policy <NewVersioInfo>
                                     .Handle <System.Net.WebException>()
                                     .Fallback(
                new NewVersioInfo()
            {
                IsAvailable = false
            }
                );

            IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();

            return(requestErrorPolicy.Execute(() =>
            {
                string versionJSON = httpService.SendGetRequest(url);
                JObject versions = JObject.Parse(versionJSON);
                SerializableVersion latest = new SerializableVersion(new Version(versions["Application"].ToString()));
                IApplicationService appService = (IApplicationService)trackerFactory.GetService <IApplicationService>();

                return new NewVersioInfo()
                {
                    IsAvailable = latest > appService.GetAssemblyVersion(),
                    Number = latest.ToString(),
                    DownloadUrl = GetLatestDownladUrl()
                };
            }));
        }
 public PersonalizationRequestService(IHTTPService _httpService) : base(_httpService)
 {
     getUrl    = ApiEndpoints.FindPersonalizationRequestById;
     getAllUrl = ApiEndpoints.AllPersonalizationRequests;
     updateUrl = ApiEndpoints.UpdatePersonalizationRequest;
     createUrl = ApiEndpoints.CreatePersonalizationRequest;
     deleteUrl = ApiEndpoints.DeletePersonalizationRequest;
 }
 public CardTypeService(IHTTPService httpService) : base(httpService)
 {
     getUrl    = ApiEndpoints.FindCardTypeById;
     getAllUrl = ApiEndpoints.AllCardTypes;
     updateUrl = ApiEndpoints.UpdateCardType;
     createUrl = ApiEndpoints.CreateCardType;
     deleteUrl = ApiEndpoints.DeleteCardType;
 }
Esempio n. 6
0
 public CardRequestService(IHTTPService _httpService) : base(_httpService)
 {
     getUrl    = ApiEndpoints.FindCardRequestById;
     getAllUrl = ApiEndpoints.AllCardRequests;
     updateUrl = ApiEndpoints.UpdateCardRequest;
     createUrl = ApiEndpoints.CreateCardRequest;
     deleteUrl = ApiEndpoints.DeleteCardRequest;
 }
 public CardholderService(IHTTPService httpService) : base(_httpService: httpService)
 {
     getUrl    = ApiEndpoints.FindCardholderById;
     getAllUrl = ApiEndpoints.AllCardholders;
     updateUrl = ApiEndpoints.UpdateCardholder;
     createUrl = ApiEndpoints.CreateCardholder;
     deleteUrl = ApiEndpoints.DeleteCardholder;
 }
 public CardVendorService(IHTTPService httpService) : base(httpService)
 {
     getUrl    = ApiEndpoints.FindCardVendorById;
     getAllUrl = ApiEndpoints.AllCardVendors;
     updateUrl = ApiEndpoints.UpdateCardVendor;
     createUrl = ApiEndpoints.CreateCardVendor;
     deleteUrl = ApiEndpoints.DeleteCardVendor;
 }
        public TenantService(IHTTPService httpService, ICardholderService _cardholderService) : base(_httpService: httpService)
        {
            cardholderService = _cardholderService;

            getUrl    = ApiEndpoints.FindTenantById;
            getAllUrl = ApiEndpoints.AllTenants;
            updateUrl = ApiEndpoints.UpdateTenant;
            createUrl = ApiEndpoints.CreateTenant;
            deleteUrl = ApiEndpoints.DeleteTenant;
        }
Esempio n. 10
0
 public DownloadedImagesViewModel(IHTTPService httpService, IIOManager iOManager, IDataService dataService)
 {
     IsLoaded      = false;
     _httpService  = httpService ?? throw new System.ArgumentNullException(nameof(httpService));
     _iOManager    = iOManager ?? throw new System.ArgumentNullException(nameof(iOManager));
     _dataService  = dataService ?? throw new System.ArgumentNullException(nameof(dataService));
     _lastPage     = 1;
     _downloadPath = _iOManager.DownloadPath;
     _templatePath = _iOManager.TemplatePath;
 }
Esempio n. 11
0
        public EmployeeService(IHTTPService httpService, ICardholderService _cardholderService) : base(_httpService: httpService)
        {
            cardholderService = _cardholderService;

            getUrl    = ApiEndpoints.FindEmployeeById;
            getAllUrl = ApiEndpoints.AllEmployees;
            updateUrl = ApiEndpoints.UpdateEmployee;
            createUrl = ApiEndpoints.CreateEmployee;
            deleteUrl = ApiEndpoints.DeleteEmployee;
        }
 public ImageGalleryDetailViewModel(IIOManager iOManager,
                                    IHTTPService hTTPService,
                                    IWallpaperService wallpaperService,
                                    IDialogService dialogService)
 {
     _iOManager        = iOManager ?? throw new ArgumentNullException(nameof(iOManager));
     _hTTPService      = hTTPService ?? throw new ArgumentNullException(nameof(hTTPService));
     _wallpaperService = wallpaperService ?? throw new ArgumentNullException(nameof(wallpaperService));
     _dialogService    = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
 }
Esempio n. 13
0
 public DataService(IHTTPService httpService,
                    IBingHTTPService bingHTTPService,
                    IIOManager iOManager,
                    IDialogService dialogService)
 {
     _httpService     = httpService ?? throw new ArgumentNullException(nameof(httpService));
     _bingHTTPService = bingHTTPService ?? throw new ArgumentNullException(nameof(bingHTTPService));
     _iOManager       = iOManager ?? throw new ArgumentNullException(nameof(iOManager));
     _dialogService   = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
     _iOManager.Initialize();
 }
Esempio n. 14
0
 public SettingsViewModel(IBackgroundTaskService backgroundTaskService,
                          IWallpaperService wallpaperService,
                          IHTTPService hTTPService,
                          IIOManager iOManager,
                          IBingHTTPService bingHTTPService)
 {
     _backgroundTaskService = backgroundTaskService ?? throw new System.ArgumentNullException(nameof(backgroundTaskService));
     _wallpaperService      = wallpaperService ?? throw new System.ArgumentNullException(nameof(wallpaperService));
     _hTTPService           = hTTPService ?? throw new System.ArgumentNullException(nameof(hTTPService));
     _iOManager             = iOManager ?? throw new System.ArgumentNullException(nameof(iOManager));
     _bingHTTPService       = bingHTTPService ?? throw new ArgumentNullException(nameof(bingHTTPService));
 }
 public BingImageViewModel(IHTTPService httpService,
                           IDataService dataService,
                           IIOManager iOManager,
                           IWallpaperService wallpaperService,
                           IDialogService dialogService)
 {
     ImgPath           = "a/b";
     ImageDTOList      = new List <ImageDTO>();
     _httpService      = httpService ?? throw new ArgumentNullException(nameof(httpService));
     _dataService      = dataService ?? throw new ArgumentNullException(nameof(dataService));
     _iOManager        = iOManager ?? throw new ArgumentNullException(nameof(iOManager));
     _wallpaperService = wallpaperService ?? throw new ArgumentNullException(nameof(wallpaperService));
     _dialogService    = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
 }
        public void GetLatestCardsDB()
        {
            var requestErrorPolicy = Policy
                                     .Handle <System.Net.WebException>()
                                     .Fallback(() => { /* do nothing*/ });

            string url = "https://raw.githubusercontent.com/MarioZG/elder-scrolls-legends-tracker/master/ESLTracker/Resources/cards.json";

            requestErrorPolicy.Execute(() =>
            {
                IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();
                string cardsDBContent    = httpService.SendGetRequest(url);
                trackerFactory.GetFileManager().UpdateCardsDB(cardsDBContent);
            });
        }
Esempio n. 17
0
        public SpotlightViewModel(IDataService dataService,
                                  IIOManager iOManager,
                                  IHTTPService hTTPService,
                                  IDialogService dialogService,
                                  IBackgroundTaskService backgroundTaskService)
        {
            IsLoaded = false;

            _dataService           = dataService ?? throw new ArgumentNullException(nameof(dataService));
            _iOManager             = iOManager ?? throw new ArgumentNullException(nameof(iOManager));
            _hTTPService           = hTTPService ?? throw new ArgumentNullException(nameof(hTTPService));
            _dialogService         = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
            _backgroundTaskService = backgroundTaskService ?? throw new ArgumentNullException(nameof(backgroundTaskService));
            _downloadPath          = _iOManager.DownloadPath;
            _templatePath          = _iOManager.TemplatePath;
        }
        internal string GetLatestDownladUrl()
        {
            var requestErrorPolicy = Policy <string>
                                     .Handle <System.Net.WebException>()
                                     .Or <ArgumentOutOfRangeException>() //no assets on release
                                     .Fallback("");

            string url = "https://api.github.com/repos/MarioZG/elder-scrolls-legends-tracker/releases/latest";

            return(requestErrorPolicy.Execute(() =>
            {
                IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();
                string versionJSON = httpService.SendGetRequest(url);
                JObject lastetRelease = JObject.Parse(versionJSON);
                return lastetRelease["assets"]?[0]?["browser_download_url"]?.ToString();
            }));
        }
        public bool IsNewCardsDBAvailable()
        {
            var requestErrorPolicy = Policy <bool>
                                     .Handle <System.Net.WebException>()
                                     .Fallback(false);

            string url = "https://raw.githubusercontent.com/MarioZG/elder-scrolls-legends-tracker/master/Build/versions.json";

            return(requestErrorPolicy.Execute(() =>
            {
                IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();
                string versionJSON = httpService.SendGetRequest(url);
                JObject versions = JObject.Parse(versionJSON);
                Version latest = new Version(versions["CardsDB"].ToString());
                return latest > trackerFactory.GetCardsDatabase().Version;
            }));
        }
Esempio n. 20
0
        public bool IsNewCardsDBAvailable()
        {
            var requestErrorPolicy = Policy <bool>
                                     .Handle <System.Net.WebException>()
                                     .Fallback(false);

            string url = settings.VersionCheck_VersionsUrl;

            return(requestErrorPolicy.Execute(() =>
            {
                IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();
                string versionJSON = httpService.SendGetRequest(url);
                JObject versions = JObject.Parse(versionJSON);
                Version latest = new Version(versions["CardsDB"].ToString());
                return latest > trackerFactory.GetService <ICardsDatabase>().Version;
            }));
        }
Esempio n. 21
0
        internal string GetLatestDownladUrl()
        {
            var requestErrorPolicy = Policy <string>
                                     .Handle <System.Net.WebException>()
                                     .Or <ArgumentOutOfRangeException>() //no assets on release
                                     .Fallback("");

            string url = settings.VersionCheck_LatestBuildUrl;

            return(requestErrorPolicy.Execute(() =>
            {
                IHTTPService httpService = (IHTTPService)trackerFactory.GetService <IHTTPService>();
                string versionJSON = httpService.SendGetRequest(url);
                JObject lastetRelease = JObject.Parse(versionJSON);
                return lastetRelease["assets"]?[0]?["browser_download_url"]?.ToString();
            }));
        }
Esempio n. 22
0
 public UpdateCheckService(IHTTPService httpService)
 {
     _httpService = httpService;
 }
 protected AbstractService(IHTTPService _httpService)
 {
     httpService = _httpService;
 }
Esempio n. 24
0
 public UpdateCheckService(IHTTPService httpService,
                           IUpdateAvailableViewModel updateAvailableViewModel)
 {
     _httpService = httpService;
     _updateAvailableViewModel = updateAvailableViewModel;
 }
 public AuthenticationService(IHTTPService _httpService)
 {
     httpService = _httpService;
 }
 public CarParkService(IHTTPService _service) : base(_httpService: _service)
 {
 }
Esempio n. 27
0
 public UpdateCheckService(IHTTPService httpService,
                           IUpdateAvailableViewModel updateAvailableViewModel)
 {
     _httpService = httpService;
     _updateAvailableViewModel = updateAvailableViewModel;
 }
 public StartDbConfig(IHTTPService httpS)
 {
     httpService = httpS;
 }
Esempio n. 29
0
 public UpdateCheckService(IHTTPService httpService)
 {
     _httpService = httpService;
 }
 public YgoProDeckAPIService(IHTTPService httpService)
 {
     HTTPService = httpService;
 }
 public VehicleService(IHTTPService _service) : base(_httpService: _service)
 {
 }
 public BuildingService(IHTTPService _service) : base(_httpService: _service)
 {
 }