Move version-related properties to OsuGameBase.

This commit is contained in:
Dean Herbert
2017-03-06 17:09:48 +09:00
parent a7d7abe70e
commit 0ee38571a6
4 changed files with 44 additions and 25 deletions

View File

@ -32,8 +32,6 @@ namespace osu.Game
{
public class OsuGame : OsuGameBase
{
public virtual bool IsDeployedBuild => false;
public Toolbar Toolbar;
private ChatOverlay chat;

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Diagnostics;
using System.Reflection;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -37,6 +39,40 @@ namespace osu.Game
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected AssemblyName AssemblyName => Assembly.GetEntryAssembly().GetName();
public bool IsDeployedBuild => AssemblyName.Version.Major > 0;
public bool IsDebug
{
get
{
bool isDebug = false;
Debug.Assert(isDebug = true);
return isDebug;
}
}
public string Version
{
get
{
bool isDebug = false;
Debug.Assert(isDebug = true);
if (!IsDeployedBuild)
return @"local " + (isDebug ? @"debug" : @"release");
var assembly = AssemblyName;
return $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}";
}
}
public OsuGameBase()
{
Name = @"osu!lazer";
}
[BackgroundDependencyLoader]
private void load()
{