Skip to content

Commit 393fcf5

Browse files
authored
Merge pull request #48 from Starrah/fix-some-bugs
修了一些小bug
2 parents f6a1360 + e70df2c commit 393fcf5

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

MaiChartManager/Controllers/Music/MusicTransferController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ public async Task ExportAsMaidata(int id, string assetDir, bool ignoreVideo = fa
636636
var img = music.GetMusicJacketPngData();
637637
if (img is not null)
638638
{
639-
var imgExt = (Path.GetExtension(music.JacketPath ?? music.PseudoAssetBundleJacket ?? music.AssetBundleJacket) ?? ".png").ToLowerInvariant();
639+
var imgExt = (Path.GetExtension(music.RealJacketPath) ?? ".png").ToLowerInvariant();
640640
if (imgExt == ".ab") imgExt = ".png";
641641
var imageEntry = zipArchive.CreateEntry($"bg{imgExt}");
642642
await using var imageStream = imageEntry.Open();

MaiChartManager/Front/src/views/Charts/MusicSelectedTopRightToolbar/SaveButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineComponent({
1616
setTimeout(() => {
1717
isAnimationShow.value = false;
1818
}, 250);
19-
await updateMusicList();
19+
await updateMusicList(true);
2020
}
2121

2222
const {ctrl_s} = useMagicKeys({

MaiChartManager/Models/MusicXmlWithABJacket.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class MusicXmlWithABJacket(string filePath, string gamePath, string asset
1111

1212
// 在 mod 里文件的 jacket 是优先的
1313
public new bool HasJacket => JacketPath is not null || AssetBundleJacket is not null || PseudoAssetBundleJacket is not null;
14+
public string RealJacketPath => JacketPath ?? PseudoAssetBundleJacket ?? AssetBundleJacket;
1415

1516
public new static MusicXmlWithABJacket CreateNew(int id, string gamePath, string assetDir)
1617
{
@@ -122,16 +123,18 @@ public List<string> Problems
122123

123124
public void Delete()
124125
{
125-
if (HasJacket && !JacketPath?.Contains(@"\A000\", StringComparison.InvariantCultureIgnoreCase) == true)
126+
if (HasJacket && RealJacketPath?.Contains(@"\A000\", StringComparison.InvariantCultureIgnoreCase) == false)
126127
{
127-
Console.WriteLine("删除 jacket: " + JacketPath);
128+
Console.WriteLine("删除 jacket: " + RealJacketPath);
128129
try
129130
{
130-
FileSystem.DeleteFile(JacketPath);
131+
FileSystem.DeleteFile(RealJacketPath);
132+
if (RealJacketPath.EndsWith(".ab")) // .ab的情况,要额外把manifest也干掉
133+
FileSystem.DeleteFile(RealJacketPath + ".manifest");
131134
}
132135
catch
133136
{
134-
Console.WriteLine($"删除 jacket 失败: {JacketPath}");
137+
Console.WriteLine($"删除 jacket 失败: {RealJacketPath}");
135138
}
136139
}
137140

MaiChartManager/Utils/Audio.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,13 @@ public static Stream ConvertToWav(Stream src, string extension, float padding =
8484
}
8585

8686
var stream = new MemoryStream();
87-
WaveFileWriter.WriteWavFileToStream(stream, sample.ToWaveProvider16()); // 淦
88-
stream.Position = 0; // 淦 x2
87+
WaveFileWriter.WriteWavFileToStream(stream, sample.ToWaveProvider16());
88+
#if DEBUG
89+
Console.WriteLine($"ConvertToWav: extension={extension}, padding={padding}, forceUseNAudio={forceUseNAudio}");
90+
stream.Position = 0; // 把wav的内容写到本地文件以供调试
91+
File.WriteAllBytes(Path.Combine(StaticSettings.tempPath, "ConvertToWav_debug.wav"), stream.ToArray());
92+
#endif
93+
stream.Position = 0;
8994
return stream;
9095
}
9196

0 commit comments

Comments
 (0)