Skip to content

Commit 7f28d0b

Browse files
author
Awbugl
committed
Fix Bug
1 parent 7352f8f commit 7f28d0b

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

Model/ArcaeaChart.cs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public class ArcaeaChart
3939

4040
internal DifficultyInfo DifficultyInfo => DifficultyInfo.GetByIndex(RatingClass);
4141

42-
internal string ConstString => $"[{DifficultyInfo.ShortStr} {Const:0.0}]";
43-
4442
internal string GetSongName(byte length) =>
4543
NameEn.Length < length + 3
4644
? NameEn
@@ -50,28 +48,20 @@ internal async Task<Image> GetSongImage()
5048
{
5149
var path = Path.ArcaeaSong(this);
5250

53-
try
51+
if (!SongImage.TryGetValue(path, out var stream))
5452
{
55-
if (!SongImage.TryGetValue(path, out var stream))
56-
{
57-
await using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
58-
var bytes = new byte[fileStream.Length];
59-
fileStream.Read(bytes, 0, bytes.Length);
60-
fileStream.Close();
61-
stream = new MemoryStream(bytes);
62-
SongImage.Add(path, stream);
63-
}
64-
65-
var img = new Image(stream);
66-
if (img.Width == 512) return img;
67-
var newimg = new Image(img, 512, 512);
68-
img.Dispose();
69-
return newimg;
70-
}
71-
catch
72-
{
73-
File.Delete(path);
74-
throw new ArgumentException($"InvalidSongImage: {NameEn}, deleted.");
53+
await using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
54+
var bytes = new byte[fileStream.Length];
55+
fileStream.Read(bytes, 0, bytes.Length);
56+
fileStream.Close();
57+
stream = new MemoryStream(bytes);
58+
SongImage.Add(path, stream);
7559
}
60+
61+
var img = new Image(stream);
62+
if (img.Width == 512) return img;
63+
var newimg = new Image(img, 512, 512);
64+
img.Dispose();
65+
return newimg;
7666
}
7767
}

Path.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ internal static Path ArcaeaBg3(string sid, sbyte difficulty) =>
6969
internal static Path ArcaeaBg3Mask(int side) => new(_arcaeaSourceRoot + $"RawV3Bg_{side}.png");
7070

7171
internal static string ArcaeaSong(ArcaeaChart chart) =>
72-
$"{_songPath}/{(chart.RemoteDownload ? "dl_" : "")}/{(chart.JacketOverride ? chart.RatingClass.ToString() : "base")}.jpg";
72+
$"{_songPath}/{(chart.RemoteDownload ? "dl_" : "")}{chart.SongID}/{(chart.JacketOverride ? chart.RatingClass.ToString() : "base")}.jpg";
7373

7474
internal static Path ArcaeaRating(short potential)
7575
{

0 commit comments

Comments
 (0)