2022-03-02 08:00:37 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace TJAPlayer3
|
|
|
|
|
{
|
2022-05-29 23:57:09 +02:00
|
|
|
|
[Serializable()]
|
2022-03-02 08:00:37 +01:00
|
|
|
|
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;
|
2022-05-25 21:18:31 +02:00
|
|
|
|
tSaveFile();
|
2022-03-02 08:00:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|