mirror of
https://git.oceanpay.cc/danial/kami_itunes_june.git
synced 2025-12-18 22:31:24 +00:00
- Removed DotRas library dependency in RasTools.cs, providing empty implementations for Connect and Disconnect methods. - Updated context menu implementation in ReddemHelp.cs to use ToolStripMenuItem and ContextMenuStrip. - Replaced caching mechanism in SiteHelper.cs with a custom dictionary-based implementation, removing reliance on HttpRuntime.Cache. - Switched from JavaScriptSerializer to Newtonsoft.Json for JSON serialization/deserialization in multiple files (Tools.cs, addMaterial.cs). - Added WebHeaderCollection property to HttpItem.cs for better header management. - Deleted obsolete AssemblyInfo.cs file. - Introduced apple_balance_query.py for querying Apple ID balance via Privacy Center, implementing authentication and balance retrieval logic.
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
using AppleBatch_June.Model;
|
|
|
|
namespace AppleBatch_June.Domain
|
|
{
|
|
public class UserNationalData
|
|
{
|
|
private string path => AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
private string mvationPath => path + "userNationalData.json";
|
|
|
|
public List<NationalList> getMation()
|
|
{
|
|
if (File.Exists(mvationPath))
|
|
{
|
|
string input = Tools.readFile(mvationPath, Encoding.UTF8);
|
|
return JsonConvert.DeserializeObject<List<NationalList>>(input);
|
|
}
|
|
return new List<NationalList>();
|
|
}
|
|
|
|
public void saveMation(NationalList item)
|
|
{
|
|
List<NationalList> mation = getMation();
|
|
mation.Add(item);
|
|
string contents = JsonConvert.SerializeObject(mation);
|
|
File.WriteAllText(mvationPath, contents, Encoding.UTF8);
|
|
}
|
|
|
|
public void removeMation(string code)
|
|
{
|
|
List<NationalList> mation = getMation();
|
|
NationalList nationalList = mation.Where((NationalList c) => c.Id == code).FirstOrDefault();
|
|
if (nationalList != null)
|
|
{
|
|
mation.Remove(nationalList);
|
|
string contents = JsonConvert.SerializeObject(mation);
|
|
File.WriteAllText(mvationPath, contents, Encoding.UTF8);
|
|
}
|
|
}
|
|
}
|
|
}
|