Skip to content

Commit c604e15

Browse files
committed
branch switching changes
1 parent 7db20e3 commit c604e15

5 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎Torch.API/ITorchConfig.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public interface ITorchConfig
2929
int WindowHeight { get; set; }
3030
int FontSize { get; set; }
3131
UGCServiceType UgcServiceType { get; set; }
32+
TorchBranchType BranchName { get; set; }
3233

3334
void Save(string path = null);
3435
}

‎Torch.API/TorchBranchType.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Torch.API
99
public enum TorchBranchType
1010
{
1111
master,
12-
staging
12+
staging,
13+
dev
1314
}
1415
}

‎Torch.API/WebAPI/JenkinsQuery.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public async Task<Job> GetLatestVersion(string branch)
6565
try
6666
{
6767
job = JsonConvert.DeserializeObject<Job>(r);
68+
job.BranchName = response.Name;
6869
}
6970
catch (Exception ex)
7071
{
@@ -109,6 +110,7 @@ public class Build
109110

110111
public class Job
111112
{
113+
public string BranchName;
112114
public int Number;
113115
public bool Building;
114116
public string Description;

‎Torch.Server/TorchConfig.cs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class TorchConfig : CommandLine, ITorchConfig, INotifyPropertyChanged
4141
private bool _enableAsserts = false;
4242
private int _fontSize = 16;
4343
private UGCServiceType _ugcServiceType = UGCServiceType.Steam;
44+
private TorchBranchType _torchBranch = TorchBranchType.master;
4445

4546

4647
/// <inheritdoc />
@@ -144,7 +145,14 @@ public UGCServiceType UgcServiceType
144145
set => Set(value, ref _ugcServiceType);
145146
}
146147

147-
public string LastUsedTheme { get; set; } = "Torch Theme";
148+
[Display(Name = "Torch branch", Description = "Select what branch of torch you want to use.", GroupName = "Server")]
149+
public TorchBranchType BranchName
150+
{
151+
get => _torchBranch;
152+
set => Set(value, ref _torchBranch);
153+
}
154+
155+
public string LastUsedTheme { get; set; } = "Torch Theme";
148156

149157
//Prevent reserved players being written to disk, but allow it to be read
150158
//remove this when ReservedPlayers is removed

‎Torch/Managers/UpdateManager.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ private async void CheckAndUpdateTorch()
4949

5050
try
5151
{
52-
var job = await JenkinsQuery.Instance.GetLatestVersion(Torch.TorchVersion.Branch);
52+
var job = await JenkinsQuery.Instance.GetLatestVersion(Torch.Config.BranchName.ToString());
5353
if (job == null)
5454
{
5555
_log.Info("Failed to fetch latest version.");
5656
return;
5757
}
5858

59-
if (job.Version > Torch.TorchVersion)
59+
if (job.Version > Torch.TorchVersion || (Torch.TorchVersion.Branch != Torch.Config.BranchName.ToString()))
6060
{
6161
_log.Warn($"Updating Torch from version {Torch.TorchVersion} to version {job.Version}");
6262
var updateName = Path.Combine(_fsManager.TempDirectory, "torchupdate.zip");

0 commit comments

Comments
 (0)