Made changes to help cope with my allergy to strings

This commit is contained in:
Justin Swanson 2020-01-18 13:28:24 -06:00
parent ada207fb11
commit 80508aa494
4 changed files with 10 additions and 6 deletions

View File

@ -9,6 +9,10 @@ namespace Wabbajack.Common
{ {
public class Metrics public class Metrics
{ {
public const string Downloading = "downloading";
public const string BeginInstall = "begin_install";
public const string FinishInstall = "finish_install";
static Metrics() static Metrics()
{ {
if (!Utils.HaveEncryptedJson(Consts.MetricsKeyHeader)) if (!Utils.HaveEncryptedJson(Consts.MetricsKeyHeader))

View File

@ -43,7 +43,7 @@ namespace Wabbajack.Lib
protected override async Task<bool> _Begin(CancellationToken cancel) protected override async Task<bool> _Begin(CancellationToken cancel)
{ {
if (cancel.IsCancellationRequested) return false; if (cancel.IsCancellationRequested) return false;
var metric = Metrics.Send("begin_install", ModList.Name); var metric = Metrics.Send(Metrics.BeginInstall, ModList.Name);
ConfigureProcessor(19, ConstructDynamicNumThreads(await RecommendQueueSize())); ConfigureProcessor(19, ConstructDynamicNumThreads(await RecommendQueueSize()));
var game = ModList.GameType.MetaData(); var game = ModList.GameType.MetaData();
@ -143,7 +143,7 @@ namespace Wabbajack.Lib
SetScreenSizeInPrefs(); SetScreenSizeInPrefs();
UpdateTracker.NextStep("Installation complete! You may exit the program."); UpdateTracker.NextStep("Installation complete! You may exit the program.");
var metric2 = Metrics.Send("finish_install", ModList.Name); var metric2 = Metrics.Send(Metrics.FinishInstall, ModList.Name);
return true; return true;
} }

View File

@ -39,7 +39,7 @@ namespace Wabbajack.Lib
protected override async Task<bool> _Begin(CancellationToken cancel) protected override async Task<bool> _Begin(CancellationToken cancel)
{ {
if (cancel.IsCancellationRequested) return false; if (cancel.IsCancellationRequested) return false;
var metric = Metrics.Send("begin_install", ModList.Name); var metric = Metrics.Send(Metrics.BeginInstall, ModList.Name);
var result = await Utils.Log(new YesNoIntervention( var result = await Utils.Log(new YesNoIntervention(
"Vortex Support is still experimental and may produce unexpected results. " + "Vortex Support is still experimental and may produce unexpected results. " +
"If anything fails please go to the special Vortex support channels on the Wabbajack Discord and contact @erri120#2285 " + "If anything fails please go to the special Vortex support channels on the Wabbajack Discord and contact @erri120#2285 " +
@ -103,7 +103,7 @@ namespace Wabbajack.Lib
await InstallSteamWorkshopItems(); await InstallSteamWorkshopItems();
//InstallIncludedDownloadMetas(); //InstallIncludedDownloadMetas();
var metric2 = Metrics.Send("finish_install", ModList.Name); var metric2 = Metrics.Send(Metrics.FinishInstall, ModList.Name);
UpdateTracker.NextStep("Installation complete! You may exit the program."); UpdateTracker.NextStep("Installation complete! You may exit the program.");
return true; return true;
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -143,7 +143,7 @@ namespace Wabbajack
var sub = queue.Status.Select(i => i.ProgressPercent) var sub = queue.Status.Select(i => i.ProgressPercent)
.Subscribe(percent => ProgressPercent = percent); .Subscribe(percent => ProgressPercent = percent);
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(); TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
var metric = Metrics.Send("downloading", Metadata.Title); var metric = Metrics.Send(Metrics.Downloading, Metadata.Title);
queue.QueueTask(async () => queue.QueueTask(async () =>
{ {
var downloader = DownloadDispatcher.ResolveArchive(Metadata.Links.Download); var downloader = DownloadDispatcher.ResolveArchive(Metadata.Links.Download);