Rename differ to patcher, add xmldoc

This commit is contained in:
Dean Herbert
2020-04-13 17:20:01 +09:00
parent bb53f96c71
commit 6aab19413c
3 changed files with 12 additions and 9 deletions

View File

@ -20,15 +20,15 @@ using Decoder = osu.Game.Beatmaps.Formats.Decoder;
namespace osu.Game.Tests.Editor namespace osu.Game.Tests.Editor
{ {
[TestFixture] [TestFixture]
public class LegacyEditorBeatmapDifferTest public class LegacyEditorBeatmapPatcherTest
{ {
private LegacyEditorBeatmapDiffer differ; private LegacyEditorBeatmapPatcher patcher;
private EditorBeatmap current; private EditorBeatmap current;
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
differ = new LegacyEditorBeatmapDiffer(current = new EditorBeatmap(new OsuBeatmap patcher = new LegacyEditorBeatmapPatcher(current = new EditorBeatmap(new OsuBeatmap
{ {
BeatmapInfo = BeatmapInfo =
{ {
@ -312,7 +312,7 @@ namespace osu.Game.Tests.Editor
patch = decode(encode(patch)); patch = decode(encode(patch));
// Apply the patch. // Apply the patch.
differ.Patch(encode(current), encode(patch)); patcher.Patch(encode(current), encode(patch));
// Convert beatmaps to strings for assertion purposes. // Convert beatmaps to strings for assertion purposes.
string currentStr = Encoding.ASCII.GetString(encode(current)); string currentStr = Encoding.ASCII.GetString(encode(current));

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Edit
/// </summary> /// </summary>
public class EditorChangeHandler : IEditorChangeHandler public class EditorChangeHandler : IEditorChangeHandler
{ {
private readonly LegacyEditorBeatmapDiffer differ; private readonly LegacyEditorBeatmapPatcher patcher;
private readonly List<byte[]> savedStates = new List<byte[]>(); private readonly List<byte[]> savedStates = new List<byte[]>();
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Edit
editorBeatmap.HitObjectRemoved += hitObjectRemoved; editorBeatmap.HitObjectRemoved += hitObjectRemoved;
editorBeatmap.HitObjectUpdated += hitObjectUpdated; editorBeatmap.HitObjectUpdated += hitObjectUpdated;
differ = new LegacyEditorBeatmapDiffer(editorBeatmap); patcher = new LegacyEditorBeatmapPatcher(editorBeatmap);
// Initial state. // Initial state.
SaveState(); SaveState();
@ -103,7 +103,7 @@ namespace osu.Game.Screens.Edit
isRestoring = true; isRestoring = true;
differ.Patch(savedStates[currentState], savedStates[newState]); patcher.Patch(savedStates[currentState], savedStates[newState]);
currentState = newState; currentState = newState;
isRestoring = false; isRestoring = false;

View File

@ -14,11 +14,14 @@ using Decoder = osu.Game.Beatmaps.Formats.Decoder;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
{ {
public class LegacyEditorBeatmapDiffer /// <summary>
/// Patches an <see cref="EditorBeatmap"/> based on the difference between two legacy (.osu) states.
/// </summary>
public class LegacyEditorBeatmapPatcher
{ {
private readonly EditorBeatmap editorBeatmap; private readonly EditorBeatmap editorBeatmap;
public LegacyEditorBeatmapDiffer(EditorBeatmap editorBeatmap) public LegacyEditorBeatmapPatcher(EditorBeatmap editorBeatmap)
{ {
this.editorBeatmap = editorBeatmap; this.editorBeatmap = editorBeatmap;
} }