曲をダウンロード可能に (#197)
* 曲をダウンロード可能に * Commit漏れ * Cacheフォルダがない場合クラッシュする問題を修正
This commit is contained in:
parent
e8cb4aed41
commit
7f3bd0a5b0
@ -95,6 +95,27 @@ namespace TJAPlayer3
|
|||||||
|
|
||||||
#region [ Fetch song list ]
|
#region [ Fetch song list ]
|
||||||
//-----------------
|
//-----------------
|
||||||
|
|
||||||
|
public void UpdateDownloadBox()
|
||||||
|
{
|
||||||
|
C曲リストノード downloadBox = null;
|
||||||
|
for (int i = 0; i < TJAPlayer3.Songs管理.list曲ルート.Count; i++)
|
||||||
|
{
|
||||||
|
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download")
|
||||||
|
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
|
||||||
|
}
|
||||||
|
for (int i = 0; i < downloadBox.list子リスト.Count; i++)
|
||||||
|
{
|
||||||
|
if (downloadBox.list子リスト[i].eノード種別 != C曲リストノード.Eノード種別.BACKBOX)
|
||||||
|
{
|
||||||
|
downloadBox.list子リスト.Remove(downloadBox.list子リスト[i]);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t曲を検索してリストを作成する(@"Songs\S3 Download", true, downloadBox.list子リスト, downloadBox);
|
||||||
|
tSongsDBになかった曲をファイルから読み込んで反映する(downloadBox.list子リスト);
|
||||||
|
}
|
||||||
public void t曲を検索してリストを作成する( string str基点フォルダ, bool b子BOXへ再帰する )
|
public void t曲を検索してリストを作成する( string str基点フォルダ, bool b子BOXへ再帰する )
|
||||||
{
|
{
|
||||||
this.t曲を検索してリストを作成する( str基点フォルダ, b子BOXへ再帰する, this.list曲ルート, null );
|
this.t曲を検索してリストを作成する( str基点フォルダ, b子BOXへ再帰する, this.list曲ルート, null );
|
||||||
|
@ -59,6 +59,8 @@ namespace TJAPlayer3
|
|||||||
dbCDN = TJAPlayer3.Databases.DBCDN;
|
dbCDN = TJAPlayer3.Databases.DBCDN;
|
||||||
dbCDNData = null;
|
dbCDNData = null;
|
||||||
|
|
||||||
|
IsDownloading = false;
|
||||||
|
|
||||||
#region [Main menu]
|
#region [Main menu]
|
||||||
|
|
||||||
this.ttkMainMenuOpt = new TitleTextureKey[3];
|
this.ttkMainMenuOpt = new TitleTextureKey[3];
|
||||||
@ -112,6 +114,8 @@ namespace TJAPlayer3
|
|||||||
{
|
{
|
||||||
// On de-activation
|
// On de-activation
|
||||||
|
|
||||||
|
TJAPlayer3.Songs管理.UpdateDownloadBox();
|
||||||
|
|
||||||
base.On非活性化();
|
base.On非活性化();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +276,14 @@ namespace TJAPlayer3
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
if (IsDownloading)
|
||||||
|
{
|
||||||
|
TJAPlayer3.Tx.OnlineLounge_Box.t2D描画(TJAPlayer3.app.Device, 0, 0);
|
||||||
|
|
||||||
|
var text = TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(
|
||||||
|
new TitleTextureKey("DownloadNow", this.pfOLFontLarge, Color.White, Color.Black, 1000));
|
||||||
|
text.t2D中心基準描画(TJAPlayer3.app.Device, 640, 605);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -280,6 +291,8 @@ namespace TJAPlayer3
|
|||||||
|
|
||||||
#region [Input]
|
#region [Input]
|
||||||
|
|
||||||
|
if (!IsDownloading)
|
||||||
|
{
|
||||||
if (TJAPlayer3.Input管理.Keyboard.bキーが押された((int)SlimDXKeys.Key.RightArrow) ||
|
if (TJAPlayer3.Input管理.Keyboard.bキーが押された((int)SlimDXKeys.Key.RightArrow) ||
|
||||||
TJAPlayer3.Pad.b押された(E楽器パート.DRUMS, Eパッド.RBlue))
|
TJAPlayer3.Pad.b押された(E楽器パート.DRUMS, Eパッド.RBlue))
|
||||||
{
|
{
|
||||||
@ -413,12 +426,40 @@ namespace TJAPlayer3
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (currentMenu == ECurrentMenu.CDN_SONGS)
|
||||||
|
{
|
||||||
|
if (this.cdnSongListIndex == 0)
|
||||||
|
{
|
||||||
|
TJAPlayer3.Skin.sound取消音.t再生する();
|
||||||
|
currentMenu = ECurrentMenu.CDN_OPTION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.cdnSongListIndex < apiMethods.FetchedSongsList.Length)
|
||||||
|
{
|
||||||
|
var song = apiMethods.FetchedSongsList[this.cdnSongListIndex - 1];
|
||||||
|
var zipPath = $@"Cache\{song.Md5}.zip";
|
||||||
|
|
||||||
|
if (System.IO.Directory.Exists($@"Songs\S3 Download\{song.Md5}"))
|
||||||
|
{
|
||||||
|
TJAPlayer3.Skin.soundError.t再生する();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TJAPlayer3.Skin.sound決定音.t再生する();
|
||||||
|
System.Threading.Thread download =
|
||||||
|
new System.Threading.Thread(new System.Threading.ThreadStart(DownloadSong));
|
||||||
|
download.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// Menu exit fade out transition
|
// Menu exit fade out transition
|
||||||
@ -471,6 +512,25 @@ namespace TJAPlayer3
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DownloadSong()
|
||||||
|
{
|
||||||
|
IsDownloading = true;
|
||||||
|
|
||||||
|
System.IO.Directory.CreateDirectory($@"Cache\");
|
||||||
|
|
||||||
|
var song = apiMethods.FetchedSongsList[this.cdnSongListIndex - 1];
|
||||||
|
var zipPath = $@"Cache\{song.Md5}.zip";
|
||||||
|
|
||||||
|
System.Net.WebClient wc = new System.Net.WebClient();
|
||||||
|
|
||||||
|
wc.DownloadFile($"{dbCDNData.BaseUrl}{dbCDNData.Download["default"]}{song.Id}", zipPath);
|
||||||
|
wc.Dispose();
|
||||||
|
|
||||||
|
System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, $@"Songs\S3 Download\{song.Md5}");
|
||||||
|
|
||||||
|
IsDownloading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum E戻り値 : int
|
public enum E戻り値 : int
|
||||||
{
|
{
|
||||||
@ -527,6 +587,8 @@ namespace TJAPlayer3
|
|||||||
private TitleTextureKey[] ttkCDNSongSubtitles;
|
private TitleTextureKey[] ttkCDNSongSubtitles;
|
||||||
private int cdnSongListIndex;
|
private int cdnSongListIndex;
|
||||||
|
|
||||||
|
private bool IsDownloading;
|
||||||
|
|
||||||
private class CMenuInfo
|
private class CMenuInfo
|
||||||
{
|
{
|
||||||
public CMenuInfo(string ttl)
|
public CMenuInfo(string ttl)
|
||||||
|
@ -107,6 +107,7 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
10
Test/Songs/S3 Download/box.def
Normal file
10
Test/Songs/S3 Download/box.def
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#TITLE:Download
|
||||||
|
#GENRE:Download
|
||||||
|
#BOXEXPLANATION1:
|
||||||
|
#BOXEXPLANATION2:
|
||||||
|
#BOXEXPLANATION3:
|
||||||
|
#BGCOLOR:#ff00a2
|
||||||
|
#BOXCOLOR:#ff00a2
|
||||||
|
#BOXTYPE:0
|
||||||
|
#BGTYPE:1
|
||||||
|
#BOXCHARA:0
|
Loading…
x
Reference in New Issue
Block a user