1
0
mirror of synced 2024-11-28 09:20:53 +01:00
OpenTaiko/TJAPlayer3/Songs/CSongUniqueID.cs

68 lines
1.3 KiB
C#

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
}
}