65 lines
1.4 KiB
C#
65 lines
1.4 KiB
C#
using BS.Shared;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Core
|
|
{
|
|
public class BeWoAppVersion
|
|
{
|
|
public Version BaseVersion { get; }
|
|
public BeWoClientReleaseStage Stage { get; }
|
|
public Version StageVersion { get; }
|
|
public BeWoClientFeature Feature { get; }
|
|
public static bool IsInDeveloperMode { get; private set; }
|
|
|
|
public BeWoAppVersion(Version baseVersion, BeWoClientReleaseStage stage, Version stageVersion, BeWoClientFeature feature = BeWoClientFeature.None)
|
|
{
|
|
BaseVersion = baseVersion;
|
|
Stage = stage;
|
|
StageVersion = stageVersion;
|
|
Feature = feature;
|
|
}
|
|
|
|
public void TryActiveDeveloperMode(string[] args)
|
|
{
|
|
if (Stage != BeWoClientReleaseStage.Sandbox)
|
|
return;
|
|
|
|
#if !DEBUG
|
|
if (args.All(x => x != "/bewodevmode" && x != "--bewodevmode"))
|
|
return;
|
|
#endif
|
|
|
|
if (IsInDeveloperMode)
|
|
throw new NotImplementedException();
|
|
|
|
IsInDeveloperMode = true;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = $"Version {BaseVersion}";
|
|
|
|
if (Stage == BeWoClientReleaseStage.Release)
|
|
return result;
|
|
|
|
result += $" {Stage.ToString().ToLower()} {StageVersion}";
|
|
|
|
if (Feature != BeWoClientFeature.None)
|
|
{
|
|
result += $" ({Feature})";
|
|
}
|
|
|
|
if (Stage == BeWoClientReleaseStage.Sandbox)
|
|
{
|
|
result += $" dev:{(IsInDeveloperMode ? "1" : "0")}";
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|