Esempio n. 1
0
        private void UploadToPoe_Single(string filterId, string accessToken, string descr, string filterContent)
        {
            var url = "https://www.pathofexile.com/api/item-filter/" + filterId + "?access_token=" + accessToken;

            var body = new
            {
                filter      = filterContent,
                filterID    = filterId,
                description = descr,
                version     = FilterAccessFacade.GetInstance().PrimaryFilter.GetHeaderMetaData("VERSION")
            };

            LoggingFacade.LogInfo($"[PoeUpload] Sending request...");

            var resp = FileDownloader.StaticHttpClient.PostAsJsonAsync(url, body);

            resp.Wait();
            if (resp.Result.StatusCode != HttpStatusCode.OK)
            {
                LoggingFacade.LogError($"[PoeUpload] Error: " + resp.Result.StatusCode);
            }
            else
            {
                LoggingFacade.LogInfo($"[PoeUpload] Success");
            }
        }
Esempio n. 2
0
        public static void PerformMainRoutine(string req)
        {
            // 0) Cleanup
            EconomyData?.Clean();
            ItemInfoData?.Clean();
            TierListFacade?.Clean();
            FilterAccessFacade?.Clean();

            BaseTypeDataProvider.Initialize();
            EconomyData        = EconomyRequestFacade.GetInstance();
            TierListFacade     = TierListFacade.GetInstance();
            FilterAccessFacade = FilterAccessFacade.GetInstance();
            ItemInfoData       = ItemInformationFacade.GetInstance();

            // 0) Get Current League information etc

            EconomyData.RequestPoeLeagueInfo();

            if (!EconomyData.IsLeagueActive())
            {
                LoggingFacade.LogWarning("No Active League detected!");
            }

            var requestedLeagueName = EconomyData.GetActiveLeagueName();

            // 1) Acquire Data

            var localMode = Environment.GetEnvironmentVariable("localMode", EnvironmentVariableTarget.Process) ?? "true";

            // string body = new StreamReader(req.Body).ReadToEnd();
            // var repoName = GetReqParams(req, data, "repoName", "NeverSink-EconomyUpdated-Filter");
            // var leagueType = GetReqParams(req, data.leagueType, "leagueType", "tmpstandard");

            dynamic data = JsonConvert.DeserializeObject(req);

            string leagueType = data.leagueType ?? "tmpstandard";
            string repoName   = data.repoName ?? "NeverSink-EconomyUpdated-Filter";

            string league = requestedLeagueName; //GetReqParams(req, data, "currentLeague", "Metamorph");

            LoggingFacade.LogInfo($"[CONFIG] leagueType: {leagueType}");
            LoggingFacade.LogInfo($"[CONFIG] league: {league}");
            LoggingFacade.LogInfo($"[CONFIG] repoName: {repoName}");
            LoggingFacade.LogInfo($"[CONFIG] localMode: {localMode}");

            FilterPolishConfig.ApplicationExecutionMode = ExecutionMode.Function;

            if (localMode == "true")
            {
                FilterPolishConfig.ActiveRequestMode = RequestType.Dynamic;
            }
            else
            {
                FilterPolishConfig.ActiveRequestMode = RequestType.ForceOnline;
            }

            DataFiles = new DataFileRequestFacade();
            LoggingFacade.LogInfo($"[CONFIG] FileRequestFacade Created!");

            FileRequestResult dataRes = DataFiles.GetAllFiles(league, leagueType);

            // 3) Parse filter
            FilterAccessFacade.PrimaryFilter = new Filter(DataFiles.SeedFilter);
            var newVersion = FilterAccessFacade.PrimaryFilter.GetHeaderMetaData("VERSION") + "." + DateTime.Now.Year + "." + DateTime.Now.DayOfYear + "." + DateTime.Now.Hour;

            FilterAccessFacade.PrimaryFilter.SetHeaderMetaData("VERSION", newVersion);

            LoggingFacade.LogInfo($"[CONFIG] version: {newVersion}");
            LoggingFacade.LogInfo($"[DEBUG] FileRequestResult: {dataRes.ToString()}");
            LoggingFacade.LogInfo($"[DEBUG] League Active: {EconomyData.IsLeagueActive().ToString()}");

            // null check the ecoData in case of disabled/early leagues
            if (dataRes == FileRequestResult.Success)
            {
                // 4) Load tier list information and enrichment procedures
                var tiers = FilterAccessFacade.PrimaryFilter.ExtractTiers(FilterPolishConfig.FilterTierLists);
                TierListFacade.TierListData = tiers;
                EconomyData.CreateSubEconomyTiers();

                ConcreteEnrichmentProcedures.Initialize();
                EconomyData.EnrichAll(EnrichmentProcedureConfiguration.PriorityEnrichmentProcedures);
                FilterPolishUtil.FilterPolishConfig.AdjustPricingInformation();
                EconomyData.EnrichAll(EnrichmentProcedureConfiguration.EnrichmentProcedures);

                // EconomyData.PerformClassAbstractionProcedures();

                TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate());

                // 5) Generate Suggestions
                var economyTieringSystem = new ConcreteEconomyRules();
                economyTieringSystem.GenerateSuggestions();

                // 6) Apply suggestions
                TierListFacade.ApplyAllSuggestions();
            }

            // 7) Generate changelogs
            // todo

            LoggingFacade.LogInfo($"[DEBUG] Seedfiler regeneration done. Starting publishing...");

            // 8) Generate and Upload Filters
            new FilterPublisher(FilterAccessFacade.PrimaryFilter, repoName, leagueType).Run(dataRes);
        }
#pragma warning restore CS0067

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Filter = FilterAccessFacade.GetInstance().PrimaryFilter;
            this.MigrateBaseTypes();
        }
Esempio n. 4
0
        public static void PerformMainRoutine()
        {
            // 0) Cleanup
            EconomyData?.Clean();
            ItemInfoData?.Clean();
            TierListFacade?.Clean();
            FilterAccessFacade?.Clean();

            EconomyData        = EconomyRequestFacade.GetInstance();
            TierListFacade     = TierListFacade.GetInstance();
            FilterAccessFacade = FilterAccessFacade.GetInstance();
            ItemInfoData       = ItemInformationFacade.GetInstance();

            // 0) Get Current League information etc
            // 1) Acquire Data
            var league    = Environment.GetEnvironmentVariable("ninjaLeague", EnvironmentVariableTarget.Process) ?? "tmpstandard";
            var localMode = Environment.GetEnvironmentVariable("localMode", EnvironmentVariableTarget.Process) ?? "true";

            if (localMode == "true")
            {
                FilterPolishConfig.ActiveRequestMode = RequestType.Dynamic;
            }
            else
            {
                FilterPolishConfig.ActiveRequestMode = RequestType.ForceOnline;
            }

            DataFiles = new DataFileRequestFacade();
            DataFiles.GetAllFiles(league);

            // 2) Test Data
            // todo

            // 3) Parse filter
            FilterAccessFacade.PrimaryFilter = new Filter(DataFiles.SeedFilter);

            // 4) Load ier list information and enrichment procedures
            var tiers = FilterAccessFacade.PrimaryFilter.ExtractTiers(FilterPolishConfig.FilterTierLists);

            TierListFacade.TierListData = tiers;
            CreateSubEconomyTiers();

            ConcreteEnrichmentProcedures.Initialize();
            EconomyData.EnrichAll(EnrichmentProcedureConfiguration.PriorityEnrichmentProcedures);
            FilterPolishUtil.FilterPolishConfig.AdjustPricingInformation();
            EconomyData.EnrichAll(EnrichmentProcedureConfiguration.EnrichmentProcedures);

            TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate());

            // 5) Generate Suggestions
            var economyTieringSystem = new ConcreteEconomyRules();

            economyTieringSystem.GenerateSuggestions();

            // 6) Apply suggestions
            TierListFacade.ApplyAllSuggestions();

            // 7) Generate changelogs
            // todo

            // 8) Generate and Upload Filters
            new FilterPublisher(FilterAccessFacade.PrimaryFilter).Run();
        }