Skip to content

Commit

Permalink
Merge pull request #1995 from andy840119/upgrade-package-to-the-latest
Browse files Browse the repository at this point in the history
Upgrade package to the latest
  • Loading branch information
andy840119 authored May 10, 2023
2 parents 4bac827 + df5fcb0 commit 53679a5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void TestLyricConverterWithNoConfig()
var lyric = new Lyric();

const string expected =
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}";
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}";
string actual = JsonConvert.SerializeObject(lyric, CreateSettings());
Assert.AreEqual(expected, actual);
}
Expand All @@ -33,7 +33,7 @@ public void TestLyricConverterWithNoConfig()
public void TestDeserializeWithNoConfig()
{
const string json =
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}";
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}";

var expected = new Lyric();
var actual = JsonConvert.DeserializeObject<Lyric>(json, CreateSettings())!;
Expand Down Expand Up @@ -66,7 +66,7 @@ public void TestLyricConverterWithSyncConfig()
};

const string expected =
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"reference_lyric_id\":0,\"reference_lyric_config\":{\"$type\":\"SyncLyricConfig\"},\"samples\":[],\"auxiliary_samples\":[]}";
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"reference_lyric_id\":0,\"reference_lyric_config\":{\"$type\":\"SyncLyricConfig\"},\"samples\":[],\"auxiliary_samples\":[]}";
string actual = JsonConvert.SerializeObject(lyric, CreateSettings());
Assert.AreEqual(expected, actual);
}
Expand All @@ -83,7 +83,7 @@ public void TestLyricConverterWithReferenceConfig()
};

const string expected =
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"reference_lyric_id\":0,\"reference_lyric_config\":{\"$type\":\"ReferenceLyricConfig\"},\"samples\":[],\"auxiliary_samples\":[]}";
"{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singer_ids\":[],\"translates\":{},\"reference_lyric_id\":0,\"reference_lyric_config\":{\"$type\":\"ReferenceLyricConfig\"},\"samples\":[],\"auxiliary_samples\":[]}";
string actual = JsonConvert.SerializeObject(lyric, CreateSettings());
Assert.AreEqual(expected, actual);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void TestSerializeLyric()
var lyric = new Lyric();

const string expected =
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}";
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}";

string actual = JsonConvert.SerializeObject(lyric, createSettings());
Assert.AreEqual(expected, actual);
Expand All @@ -27,7 +27,7 @@ public void TestSerializeLyric()
public void TestDeserializeLyric()
{
const string json =
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}";
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singer_ids"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}";

var expected = new Lyric();
var actual = JsonConvert.DeserializeObject<Lyric>(json, createSettings())!;
Expand All @@ -40,7 +40,7 @@ public void TestSerializeNote()
var note = new Note();

const string expected =
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}";
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""samples"":[],""auxiliary_samples"":[]}";

string actual = JsonConvert.SerializeObject(note, createSettings());
Assert.AreEqual(expected, actual);
Expand All @@ -50,7 +50,7 @@ public void TestSerializeNote()
public void TestDeserializeNote()
{
const string json =
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}";
@"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""samples"":[],""auxiliary_samples"":[]}";

var expected = new Note();
var actual = JsonConvert.DeserializeObject<Note>(json, createSettings())!;
Expand Down
14 changes: 11 additions & 3 deletions osu.Game.Rulesets.Karaoke/Edit/Export/ExportLyricManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Karaoke.Beatmaps.Formats;
using osu.Game.Rulesets.Karaoke.Edit.Utils;
using osu.Game.Screens.Edit;
Expand Down Expand Up @@ -83,10 +85,16 @@ public void ExportToJsonBeatmap()
// note : this is for develop testing purpose.
// will be removed eventually
string beatmapName = string.IsNullOrEmpty(beatmap.Name) ? "[NoName]" : beatmap.Name;
var exportStorage = storage.GetStorageForDirectory("exports");
string filename = $"{beatmapName}.osu";
string beatmapText = generateJsonBeatmap();

new KaraokeLegacyBeatmapExporter(storage, filename, beatmapText).Export(beatmap.BeatmapInfo.BeatmapSet);
using (var outputStream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create))
{
string beatmapText = generateJsonBeatmap();
new KaraokeLegacyBeatmapExporter(storage, filename, beatmapText).ExportToStream(beatmap.BeatmapInfo.BeatmapSet!, outputStream, null);
}

exportStorage.PresentFileExternally(filename);
}

private string generateJsonBeatmap()
Expand Down Expand Up @@ -125,7 +133,7 @@ public KaraokeLegacyBeatmapExporter(Storage storage, string filename, string con
this.content = content;
}

public override void ExportModelTo(BeatmapSetInfo model, Stream outputStream)
public override void ExportToStream(BeatmapSetInfo model, Stream outputStream, ProgressNotification? notification, CancellationToken cancellationToken = new())
{
// base.ExportModelTo(model, outputStream);
using var zipArchive = ZipArchive.Create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private static bool isWriteLyricPropertyLockedByState(LockState lockState, strin
nameof(Lyric.ReferenceLyricConfig) => lockState > LockState.Partial,
// base class
nameof(Lyric.Samples) => false,
nameof(Lyric.LegacyBpmMultiplier) => false,
_ => throw new NotSupportedException()
};
}
Expand Down Expand Up @@ -116,6 +117,7 @@ private static bool isWriteLyricPropertyLockedByConfig(IReferenceLyricPropertyCo
nameof(Lyric.ReferenceLyricConfig) => false,
// base class
nameof(Lyric.Samples) => false,
nameof(Lyric.LegacyBpmMultiplier) => false,
_ => throw new NotSupportedException()
},
null => false,
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<PackageReference Include="osu.Game.Rulesets.Karaoke.Resources" Version="2022.611.0" />
<PackageReference Include="LanguageDetection.karaoke-dev" Version="1.3.3-alpha" />
<PackageReference Include="LrcParser" Version="2023.308.0" />
<PackageReference Include="Octokit" Version="5.0.4" />
<PackageReference Include="Octokit" Version="6.0.0" />
<PackageReference Include="osu.Framework.KaraokeFont" Version="2023.419.0" />
<PackageReference Include="osu.Framework.Microphone" Version="2023.402.0" />
<PackageReference Include="osu.Framework.Microphone" Version="2023.502.0" />
<PackageReference Include="ppy.LocalisationAnalyser" Version="2022.809.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ppy.osu.Game" Version="2023.419.0" />
<PackageReference Include="ppy.osu.Game" Version="2023.510.0" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageReference Include="Lucene.Net.Analysis.Kuromoji" Version="4.8.0-beta00016" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta18" />
Expand Down

0 comments on commit 53679a5

Please sign in to comment.