diff --git a/.idea/.idea.Sitreamai/.idea/vcs.xml b/.idea/.idea.Sitreamai/.idea/vcs.xml index ee5ff3d..6b5faa8 100644 --- a/.idea/.idea.Sitreamai/.idea/vcs.xml +++ b/.idea/.idea.Sitreamai/.idea/vcs.xml @@ -3,6 +3,7 @@ + diff --git a/MaiChartManager/Controllers/Music/MusicTransferController.cs b/MaiChartManager/Controllers/Music/MusicTransferController.cs index 07242c0..108b683 100644 --- a/MaiChartManager/Controllers/Music/MusicTransferController.cs +++ b/MaiChartManager/Controllers/Music/MusicTransferController.cs @@ -228,28 +228,24 @@ public void ModifyId(int id, [FromBody] int newId, string assetDir) var abJacketTarget = Path.Combine(StaticSettings.StreamingAssets, assetDir, "AssetBundleImages", "jacket", $"ui_jacket_{newNonDxId:000000}.ab"); var acbawbTarget = Path.Combine(StaticSettings.StreamingAssets, assetDir, "SoundData", $"music{newNonDxId:000000}"); var movieTarget = Path.Combine(StaticSettings.StreamingAssets, assetDir, "MovieData", $"{newNonDxId:000000}"); - var newMusicDir = Path.Combine(StaticSettings.StreamingAssets, assetDir, "music", $"music{newNonDxId:000000}"); + var newMusicDir = Path.Combine(StaticSettings.StreamingAssets, assetDir, "music", $"music{newId:000000}"); DeleteIfExists(abJacketTarget, abJacketTarget + ".manifest", acbawbTarget + ".acb", acbawbTarget + ".awb", movieTarget + ".dat", movieTarget + ".mp4", newMusicDir); - var abiDir = Path.Combine(StaticSettings.GamePath, "StreamingAssets", assetDir, @"AssetBundleImages\jacket"); + var abiDir = Path.Combine(StaticSettings.StreamingAssets, assetDir, @"AssetBundleImages\jacket"); Directory.CreateDirectory(abiDir); // jacket - if (music.JacketPath is not null) - { - var localJacketTarget = Path.Combine(abiDir, $"ui_jacket_{newNonDxId:000000}{Path.GetExtension(music.JacketPath)}"); - DeleteIfExists(localJacketTarget); - logger.LogInformation("Move jacket: {music.JacketPath} -> {localJacketTarget}", music.JacketPath, localJacketTarget); - FileSystem.MoveFile(music.JacketPath, localJacketTarget, UIOption.OnlyErrorDialogs); - } - else if (music.PseudoAssetBundleJacket is not null) + var jacketSourcePath = music.JacketPath is not null ? music.JacketPath : music.PseudoAssetBundleJacket; + if (jacketSourcePath is not null) { - var localJacketTarget = Path.Combine(abiDir, $"ui_jacket_{newNonDxId:000000}{Path.GetExtension(music.PseudoAssetBundleJacket)}"); + // 如果music.JacketPath或music.PseudoAssetBundleJacket不为空,则直接执行移动逻辑即可 + var localJacketTarget = Path.Combine(abiDir, $"ui_jacket_{newNonDxId:000000}{Path.GetExtension(jacketSourcePath)}"); DeleteIfExists(localJacketTarget); - logger.LogInformation("Move jacket: {music.PseudoAssetBundleJacket} -> {localJacketTarget}", music.PseudoAssetBundleJacket, localJacketTarget); - FileSystem.MoveFile(music.PseudoAssetBundleJacket, localJacketTarget, UIOption.OnlyErrorDialogs); + logger.LogInformation("Move jacket: {jacketSourcePng} -> {localJacketTarget}", jacketSourcePath, localJacketTarget); + FileSystem.MoveFile(jacketSourcePath, localJacketTarget, UIOption.OnlyErrorDialogs); } else if (music.AssetBundleJacket is not null) { + // 否则需要执行转换逻辑 var localJacketTarget = Path.Combine(abiDir, $"ui_jacket_{newNonDxId:000000}.png"); logger.LogInformation("Convert jacket: {music.AssetBundleJacket} -> {abJacketTarget}", music.AssetBundleJacket, abJacketTarget); System.IO.File.WriteAllBytes(localJacketTarget, music.GetMusicJacketPngData()!);