osu/osu.Android/OsuGameAndroid.cs

40 lines
1.2 KiB
C#
Raw Normal View History

2019-03-17 14:39:07 +00:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using Android.App;
using osu.Game;
2019-09-24 09:12:04 +00:00
using osu.Game.Updater;
2019-03-17 14:39:07 +00:00
namespace osu.Android
{
public class OsuGameAndroid : OsuGame
{
2019-09-24 08:45:45 +00:00
public override Version AssemblyVersion
{
get
{
2019-09-24 09:12:04 +00:00
var packageInfo = Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0);
2019-09-24 08:45:45 +00:00
try
{
2019-09-24 09:12:04 +00:00
string versionName = packageInfo.VersionCode.ToString();
2019-09-24 08:45:45 +00:00
// undo play store version garbling
return new Version(int.Parse(versionName.Substring(0, 4)), int.Parse(versionName.Substring(4, 4)), int.Parse(versionName.Substring(8, 1)));
}
catch
{
}
2019-09-24 09:12:04 +00:00
return new Version(packageInfo.VersionName);
2019-09-24 08:45:45 +00:00
}
}
2019-09-24 09:12:04 +00:00
protected override void LoadComplete()
{
base.LoadComplete();
Add(new SimpleUpdateManager());
}
2019-03-17 14:39:07 +00:00
}
2019-09-24 08:45:45 +00:00
}