Add CSongUniqueID class (not integrated yet)
This commit is contained in:
parent
3bced7fdc0
commit
7a37f669ff
34
TJAPlayer3/Common/CCrypto.cs
Normal file
34
TJAPlayer3/Common/CCrypto.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
42
TJAPlayer3/Common/Favorites.cs
Normal file
42
TJAPlayer3/Common/Favorites.cs
Normal file
@ -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<Data>(@"Favorite.json");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
|
||||
|
@ -37,6 +37,7 @@ namespace TJAPlayer3
|
||||
public int HistoryCount;
|
||||
public string[] History;
|
||||
public int BGMAdjust;
|
||||
|
||||
}
|
||||
|
||||
// 演奏記録セクション(9種類)
|
||||
|
67
TJAPlayer3/Songs/CSongUniqueID.cs
Normal file
67
TJAPlayer3/Songs/CSongUniqueID.cs
Normal file
@ -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<Data>(filePath);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -120,6 +120,7 @@
|
||||
<Compile Include="Animations\FadeOut.cs" />
|
||||
<Compile Include="Animations\IAnimatable.cs" />
|
||||
<Compile Include="Animations\Linear.cs" />
|
||||
<Compile Include="Common\Favorites.cs" />
|
||||
<Compile Include="Common\ConfigManager.cs" />
|
||||
<Compile Include="Common\Discord.cs" />
|
||||
<Compile Include="Common\Easing.cs" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
;Included file
|
||||
;あとは通常通り設定できます
|
||||
; TJAPlayer3-Develop-ReWriteで追加したSkinConfig
|
||||
|
||||
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=ポップス,アニメ,ゲームバラエティ,ナムコオリジナル,クラシック,バラエティ,キッズ,ボーカロイド,最近遊んだ曲
|
||||
SongSelect_GenreName=
|
||||
|
||||
Game_DanC_Dan_Plate=1120,535
|
@ -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
|
Loading…
Reference in New Issue
Block a user