mirror of
https://github.com/osukey/osukey.git
synced 2025-05-15 02:27:33 +09:00
Merge pull request #9709 from peppy/send-exe-hash
Include executable hash when submitting multiplayer scores
This commit is contained in:
commit
80496d8d7f
@ -11,17 +11,20 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
{
|
{
|
||||||
private readonly int roomId;
|
private readonly int roomId;
|
||||||
private readonly int playlistItemId;
|
private readonly int playlistItemId;
|
||||||
|
private readonly string versionHash;
|
||||||
|
|
||||||
public CreateRoomScoreRequest(int roomId, int playlistItemId)
|
public CreateRoomScoreRequest(int roomId, int playlistItemId, string versionHash)
|
||||||
{
|
{
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
this.playlistItemId = playlistItemId;
|
this.playlistItemId = playlistItemId;
|
||||||
|
this.versionHash = versionHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WebRequest CreateWebRequest()
|
protected override WebRequest CreateWebRequest()
|
||||||
{
|
{
|
||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
req.Method = HttpMethod.Post;
|
req.Method = HttpMethod.Post;
|
||||||
|
req.AddParameter("version_hash", versionHash);
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Development;
|
using osu.Framework.Development;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
@ -97,6 +98,11 @@ namespace osu.Game
|
|||||||
|
|
||||||
public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version();
|
public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MD5 representation of the game executable.
|
||||||
|
/// </summary>
|
||||||
|
public string VersionHash { get; private set; }
|
||||||
|
|
||||||
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
|
public bool IsDeployedBuild => AssemblyVersion.Major > 0;
|
||||||
|
|
||||||
public virtual string Version
|
public virtual string Version
|
||||||
@ -128,6 +134,9 @@ namespace osu.Game
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
using (var str = File.OpenRead(typeof(OsuGameBase).Assembly.Location))
|
||||||
|
VersionHash = str.ComputeMD5Hash();
|
||||||
|
|
||||||
Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly));
|
Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly));
|
||||||
|
|
||||||
dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage));
|
dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage));
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
if (!playlistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
|
if (!playlistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
|
||||||
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
|
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
|
||||||
|
|
||||||
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);
|
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID, Game.VersionHash);
|
||||||
req.Success += r => token = r.ID;
|
req.Success += r => token = r.ID;
|
||||||
req.Failure += e =>
|
req.Failure += e =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user