diff --git a/TJAPlayer3/Common/CCrypto.cs b/TJAPlayer3/Common/CCrypto.cs new file mode 100644 index 00000000..c2f641f9 --- /dev/null +++ b/TJAPlayer3/Common/CCrypto.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Security.Cryptography; + +namespace TJAPlayer3 +{ + internal class CCrypto + { + internal static readonly char[] chars = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray(); + + public static string GetUniqueKey(int size) + { + byte[] data = new byte[4 * size]; + using (var crypto = RandomNumberGenerator.Create()) + { + crypto.GetBytes(data); + } + StringBuilder result = new StringBuilder(size); + for (int i = 0; i < size; i++) + { + var rnd = BitConverter.ToUInt32(data, i * 4); + var idx = rnd % chars.Length; + + result.Append(chars[idx]); + } + + return result.ToString(); + } + } +} diff --git a/TJAPlayer3/Common/Favorites.cs b/TJAPlayer3/Common/Favorites.cs new file mode 100644 index 00000000..30a7c3a7 --- /dev/null +++ b/TJAPlayer3/Common/Favorites.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace TJAPlayer3 +{ + internal class Favorites + { + public void tFavorites() { + if (!File.Exists("Favorite.json")) + tSaveFile(); + + tLoadFile(); + } + + public class Data + { + + } + + public Data data = new Data(); + + #region [private] + + private void tSaveFile() + { + ConfigManager.SaveConfig(data, "Favorite.json"); + } + + private void tLoadFile() + { + data = ConfigManager.GetConfig(@"Favorite.json"); + } + + #endregion + } + +} diff --git a/TJAPlayer3/Common/TJAPlayer3.cs b/TJAPlayer3/Common/TJAPlayer3.cs index 0be06de4..a340c7bf 100644 --- a/TJAPlayer3/Common/TJAPlayer3.cs +++ b/TJAPlayer3/Common/TJAPlayer3.cs @@ -268,6 +268,12 @@ namespace TJAPlayer3 private set; } + public static Favorites Favorites + { + get; + private set; + } + public static Databases Databases { get; @@ -2046,11 +2052,14 @@ for (int i = 0; i < 3; i++) { //----------------- #endregion - #region [ Config.ini の読込み ] + #region [ Read Config.ini and Database files ] //--------------------- NamePlateConfig = new NamePlateConfig(); NamePlateConfig.tNamePlateConfig(); + Favorites = new Favorites(); + Favorites.tFavorites(); + Databases = new Databases(); Databases.tDatabases(); diff --git a/TJAPlayer3/Songs/CScoreIni.cs b/TJAPlayer3/Songs/CScoreIni.cs index d9a8a2dc..113445a3 100644 --- a/TJAPlayer3/Songs/CScoreIni.cs +++ b/TJAPlayer3/Songs/CScoreIni.cs @@ -37,6 +37,7 @@ namespace TJAPlayer3 public int HistoryCount; public string[] History; public int BGMAdjust; + } // 演奏記録セクション(9種類) diff --git a/TJAPlayer3/Songs/CSongUniqueID.cs b/TJAPlayer3/Songs/CSongUniqueID.cs new file mode 100644 index 00000000..acb787c1 --- /dev/null +++ b/TJAPlayer3/Songs/CSongUniqueID.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using Newtonsoft.Json; + +namespace TJAPlayer3 +{ + internal class CSongUniqueID + { + public CSongUniqueID(string path) + { + filePath = path; + + tGenerateUniqueID(); + tSongUniqueID(); + } + + public void tSongUniqueID() + { + if (!File.Exists(filePath)) + tSaveFile(); + + tLoadFile(); + } + + #region [Auxiliary methods] + + public void tAttachOnlineAddress(string url) + { + data.url = url; + } + + public void tGenerateUniqueID() + { + data.id = CCrypto.GetUniqueKey(64); + } + + #endregion + + public class Data + { + public string id = ""; + public string url = ""; + } + + public Data data = new Data(); + + public string filePath; + + #region [private] + + private void tSaveFile() + { + ConfigManager.SaveConfig(data, filePath); + } + + private void tLoadFile() + { + data = ConfigManager.GetConfig(filePath); + } + + #endregion + } +} diff --git a/TJAPlayer3/TJAPlayer3.csproj b/TJAPlayer3/TJAPlayer3.csproj index 672069e7..573075ff 100644 --- a/TJAPlayer3/TJAPlayer3.csproj +++ b/TJAPlayer3/TJAPlayer3.csproj @@ -120,6 +120,7 @@ + diff --git a/Test/System/SimpleStyle/OtherConfig.ini b/Test/System/SimpleStyle/OtherConfig.ini index a8f422b1..b75a0faa 100644 --- a/Test/System/SimpleStyle/OtherConfig.ini +++ b/Test/System/SimpleStyle/OtherConfig.ini @@ -1,6 +1,5 @@ ;Included file ;Ƃ͒ʏʂݒł܂ -; TJAPlayer3-Develop-ReWriteŒljSkinConfig SongSelect_BoxExplanation_X=0 SongSelect_BoxExplanation_Y=0 @@ -8,7 +7,6 @@ SongSelect_Title_X=0 SongSelect_Title_Y=0 SongSelect_BoxExplanation_Interval=30 -;GenreName deprecated -SongSelect_GenreName=|bvX,Aj,Q[oGeB,iRIWi,NVbN,oGeB,LbY,{[JCh,ŋߗV񂾋 +SongSelect_GenreName= Game_DanC_Dan_Plate=1120,535 \ No newline at end of file diff --git a/Test/System/SimpleStyle/Progress.txt b/Test/System/SimpleStyle/Progress.txt deleted file mode 100644 index 364ae2dc..00000000 --- a/Test/System/SimpleStyle/Progress.txt +++ /dev/null @@ -1,30 +0,0 @@ -Folders done : - -Graphics : - -2_Config -4_SongLoading - -5_Game : -- 1_Chara (Empty) -- 2_Dancer (Empty) -- 3_Mob (Empty) -- 6_Taiko -- 7_Gauge -- 8_Footer -- 12_Lane -- 13_GENRE -- 14_GameMode -- 18_PuchiChara (Blank) - -7_Exit -8_TowerResult -9_NamePlateEffect -10_Heya -11_Characters (Blank) - -Sounds : - -Combo_1P (Empty) -Tower_Combo (Empty) -Taiko \ No newline at end of file