@@ -39,8 +39,6 @@ public class ArcaeaChart
39
39
40
40
internal DifficultyInfo DifficultyInfo => DifficultyInfo . GetByIndex ( RatingClass ) ;
41
41
42
- internal string ConstString => $ "[{ DifficultyInfo . ShortStr } { Const : 0.0} ]";
43
-
44
42
internal string GetSongName ( byte length ) =>
45
43
NameEn . Length < length + 3
46
44
? NameEn
@@ -50,28 +48,20 @@ internal async Task<Image> GetSongImage()
50
48
{
51
49
var path = Path . ArcaeaSong ( this ) ;
52
50
53
- try
51
+ if ( ! SongImage . TryGetValue ( path , out var stream ) )
54
52
{
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 ) ;
75
59
}
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 ;
76
66
}
77
67
}
0 commit comments