private async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder = null) { if (File.Exists(outputFolder + "RESULTS.zip")) { File.Delete(outputFolder + "RESULTS.zip"); } var oldSeedVersion = baseFilter.GetHeaderMetaData("version:"); var newVersion = LocalConfiguration.GetInstance().YieldConfiguration().First(x => x.Key == "Version Number").Value; if (oldSeedVersion == newVersion) { var isStopping = !InfoPopUpMessageDisplay.DisplayQuestionMessageBox("Error: \n\nVersion did not change!\nDo you want to continue the filter generation?"); if (isStopping) { return; } } else { baseFilter.SetHeaderMetaData("version:", newVersion); } await FilterWriter.WriteFilter(baseFilter, isGeneratingStylesAndSeed, outputFolder, Configuration.AppSettings["StyleSheet Folder"]); }
public void Run(FileRequestResult dataRes) { if (dataRes != FileRequestResult.Success) { PublishPrice = false; } var filterOutFolder = Path.GetTempPath() + "filterGenerationResult"; var repoFolder = filterOutFolder + "\\" + RepoName; LoggingFacade.LogInfo($"Tempfolder prepared"); if (!Directory.Exists(filterOutFolder)) { Directory.CreateDirectory(filterOutFolder); } // clone/pull the repo. after that, we will edit these existing files by generating the new versions // and push the update as the actual small changes. if (Directory.Exists(repoFolder)) { LoggingFacade.LogInfo($"Repo folder existing... pulling"); RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master"); using (var repo = new Repository(repoFolder)) { var options = new PullOptions(); var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options); LoggingFacade.LogInfo($"Pulling done"); } } else { LoggingFacade.LogInfo($"Repo folder not existing... cloning"); Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder); LoggingFacade.LogInfo($"Cloning done!"); } // create filter LoggingFacade.LogInfo($"Performing filter generation operations"); FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(GenerateFilters.DataFiles.FilterStyleFilesPaths.First().Value) + "\\"); LoggingFacade.LogInfo($"Performing filter generation operations: DONE"); LoggingFacade.LogInfo($"Starting publishing!"); PushToFTP("www", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType); LoggingFacade.LogInfo($"Publishing to filterblade: done"); PushToFTP("beta", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType); LoggingFacade.LogInfo($"Publishing to filterblade-beta: done"); PushToGit(repoFolder, PublishPrice); LoggingFacade.LogInfo($"Publishing to GitHub: done"); UploadToPoe(repoFolder); LoggingFacade.LogInfo($"PoeUpload: done"); // no cleanUp -> we keep this folder here and just pull/push whenever we generate new filters }
public void Init(FileRequestResult dataRes) { if (dataRes != FileRequestResult.Success) { PublishPrice = false; } var filterOutFolder = Path.GetTempPath() + "filterGenerationResult"; var repoFolder = filterOutFolder + "\\" + RepoName; this.RepoFolder = repoFolder; LoggingFacade.LogInfo($"Tempfolder prepared"); if (!Directory.Exists(filterOutFolder)) { Directory.CreateDirectory(filterOutFolder); } // clone/pull the repo. after that, we will edit these existing files by generating the new versions // and push the update as the actual small changes. if (Directory.Exists(repoFolder)) { LoggingFacade.LogInfo($"Repo folder existing... renewing"); DeleteDirectory(repoFolder); // RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master"); // using (var repo = new Repository(repoFolder)) // { // var options = new PullOptions(); // var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; // var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; // Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options); // LoggingFacade.LogInfo($"Pulling done"); // } } { LoggingFacade.LogInfo($"Repo folder not existing... cloning"); Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder); LoggingFacade.LogInfo($"Cloning done!"); } // create filter LoggingFacade.LogInfo($"Performing filter generation operations"); var filterWriter = FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(MainGenerationRoutine.DataFiles.FilterStyleFilesPaths.First().Value) + "\\"); filterWriter.Wait(); LoggingFacade.LogInfo($"Performing filter generation operations: DONE"); LoggingFacade.LogInfo($"Repofolder is: {RepoFolder}"); }
public void Run() { var repoName = "NeverSink-EconomyUpdated-Filter"; var filterOutFolder = Path.GetTempPath() + "filterGenerationResult"; var repoFolder = filterOutFolder + "\\" + repoName; if (!Directory.Exists(filterOutFolder)) { Directory.CreateDirectory(filterOutFolder); } if (Directory.Exists(repoFolder)) { DeleteDirectory(repoFolder); } Repository.Clone("https://github.com/NeverSinkDev/" + repoName + ".git", repoFolder); // create filter FilterWriter.WriteFilter(this.Filter, false, repoFolder, null); var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; var gitToken = Environment.GetEnvironmentVariable("githubPAT", EnvironmentVariableTarget.Process); Signature sig = new Signature(author, email, DateTime.Now); Signature committer = sig; using (var repo = new Repository(repoFolder)) { Commands.Stage(repo, "*"); Commit commit = repo.Commit("automated economy update " + DateTime.Today.ToString(), sig, committer); LibGit2Sharp.PushOptions options = new LibGit2Sharp.PushOptions(); options.CredentialsProvider = new CredentialsHandler( (url, usernameFromUrl, types) => new UsernamePasswordCredentials() { Username = author, Password = gitToken }); repo.Network.Push(repo.Branches["master"], options); } // cleanUp DeleteDirectory(repoFolder); }
private async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder = null) { await FilterWriter.WriteFilter(baseFilter, isGeneratingStylesAndSeed, outputFolder); }