1
0
mirror of synced 2025-02-17 19:09:25 +01:00

Transfer existing box.def to downloaded song subfolders if existing

This commit is contained in:
0aubsq 2022-05-25 04:01:46 +02:00
parent 1f7dea5f08
commit 2f94599b96

View File

@ -557,7 +557,8 @@ namespace TJAPlayer3
C曲リストード downloadBox = null; C曲リストード downloadBox = null;
for (int i = 0; i < TJAPlayer3.Songs管理.list曲ルート.Count; i++) for (int i = 0; i < TJAPlayer3.Songs管理.list曲ルート.Count; i++)
{ {
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download") if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download"
&& TJAPlayer3.Songs管理.list曲ルート[i].eード種別 == C曲リストード.Eード種別.BOX)
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i]; downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
} }
@ -572,23 +573,46 @@ namespace TJAPlayer3
// Create Genre sub-folder if does not exist // Create Genre sub-folder if does not exist
Directory.CreateDirectory(genredPath); Directory.CreateDirectory(genredPath);
// Generate box.def // Search a corresponding box-def if exists
C曲リストード correspondingBox = null;
for (int i = 0; i < TJAPlayer3.Songs管理.list曲ルート.Count; i++)
{
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == song.Genre.genre
&& TJAPlayer3.Songs管理.list曲ルート[i].eード種別 == C曲リストード.Eード種別.BOX)
correspondingBox = TJAPlayer3.Songs管理.list曲ルート[i];
}
var newBoxDef = $@"{genredPath}\box.def"; var newBoxDef = $@"{genredPath}\box.def";
//File.Create(newBoxDef);
StreamWriter sw = new StreamWriter(newBoxDef, false, Encoding.GetEncoding(TJAPlayer3.sEncType)); if (correspondingBox == null)
{
// Generate box.def if none available
//File.Create(newBoxDef);
sw.WriteLine($@"#TITLE:{song.Genre.genre}"); StreamWriter sw = new StreamWriter(newBoxDef, false, Encoding.GetEncoding(TJAPlayer3.sEncType));
sw.WriteLine($@"#GENRE:{song.Genre.genre}");
sw.WriteLine($@"#BOXEXPLANATION1:"); sw.WriteLine($@"#TITLE:{song.Genre.genre}");
sw.WriteLine($@"#BOXEXPLANATION2:"); sw.WriteLine($@"#GENRE:{song.Genre.genre}");
sw.WriteLine($@"#BOXEXPLANATION3:"); sw.WriteLine($@"#BOXEXPLANATION1:");
sw.WriteLine($@"#BGCOLOR:#ff00a2"); sw.WriteLine($@"#BOXEXPLANATION2:");
sw.WriteLine($@"#BOXCOLOR:#ff00a2"); sw.WriteLine($@"#BOXEXPLANATION3:");
sw.WriteLine($@"#BOXTYPE:0"); sw.WriteLine($@"#BGCOLOR:#ff00a2");
sw.WriteLine($@"#BGTYPE:1"); sw.WriteLine($@"#BOXCOLOR:#ff00a2");
sw.WriteLine($@"#BOXCHARA:0"); sw.WriteLine($@"#BOXTYPE:0");
sw.Close(); sw.WriteLine($@"#BGTYPE:1");
sw.WriteLine($@"#BOXCHARA:0");
sw.Close();
}
else
{
// Copy the existing box.def if available
var corPath = correspondingBox.arスコア[0]..;
File.Copy($@"{corPath}\box.def", newBoxDef);
}
} }