mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 19:27:26 +08: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 playlistItemId;
|
||||
private readonly string versionHash;
|
||||
|
||||
public CreateRoomScoreRequest(int roomId, int playlistItemId)
|
||||
public CreateRoomScoreRequest(int roomId, int playlistItemId, string versionHash)
|
||||
{
|
||||
this.roomId = roomId;
|
||||
this.playlistItemId = playlistItemId;
|
||||
this.versionHash = versionHash;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
req.AddParameter("version_hash", versionHash);
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.IO.Stores;
|
||||
@ -97,6 +98,11 @@ namespace osu.Game
|
||||
|
||||
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 virtual string Version
|
||||
@ -128,6 +134,9 @@ namespace osu.Game
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
using (var str = File.OpenRead(typeof(OsuGameBase).Assembly.Location))
|
||||
VersionHash = str.ComputeMD5Hash();
|
||||
|
||||
Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly));
|
||||
|
||||
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)))
|
||||
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.Failure += e =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user