Files
kami_itunes_june/AppleBatch_June/AppSysConfig.cs
2024-07-22 00:43:14 +08:00

113 lines
2.7 KiB
C#

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using AppleBatch_June.Model;
namespace AppleBatch_June
{
public static class AppSysConfig
{
private static Dictionary<string, string> configDic = new Dictionary<string, string>();
public static readonly object reddemLock = new object();
public static bool iTunesisRemoteLogin = true;
public static bool webProtocolS2k = false;
public static ConcurrentDictionary<string, string> DoubleGuid = new ConcurrentDictionary<string, string>();
public static ConcurrentDictionary<string, string> ReddemVerifyGuid = new ConcurrentDictionary<string, string>();
public static ConcurrentDictionary<string, int> ReddemStoreSeriveIndex = new ConcurrentDictionary<string, int>();
private static DateTime getIpUpTime = DateTime.Now.AddMinutes(-1.0);
private static Dictionary<int, Listtype> typeDic = new Dictionary<int, Listtype>();
public static string saffMac { get; set; }
public static string newSaffMac { get; set; }
public static string userToken { get; set; }
public static int integral { get; set; }
public static int freezeIntegral { get; set; }
public static string userName { get; set; }
public static string userNumber { get; set; }
public static string guid { get; set; }
public static long uid { get; set; }
public static string userPwd { get; set; }
public static string userType { get; set; }
public static DateTime expirationTime { get; set; }
public static bool ckShowTime { get; set; } = false;
public static byte[] AditionalEntropy { get; set; }
public static Stack<ProxyModel2> proxyModels { get; set; } = new Stack<ProxyModel2>();
public static bool isLowMemoryModel { get; set; } = false;
public static int CheckCodeDelay { get; set; } = 5;
public static bool loadConfig(string data)
{
configDic.Clear();
typeDic.Clear();
ConfigModel configModel = Tools.Todejosn<ConfigModel>(data);
if (configModel.Code == "0000")
{
Listconfig[] listConfig = configModel.Data.listConfig;
foreach (Listconfig listconfig in listConfig)
{
configDic.Add(listconfig.code, listconfig.value);
}
Listtype[] listTypes = configModel.Data.listTypes;
foreach (Listtype listtype in listTypes)
{
typeDic.Add(listtype.id, listtype);
}
return true;
}
return false;
}
public static Listtype getTypeById(int id)
{
if (typeDic.ContainsKey(id))
{
return typeDic[id];
}
return new Listtype
{
consNum = 1,
name = "错误",
code = "123",
state = 0
};
}
public static string getConfig(string code)
{
if (configDic.ContainsKey(code))
{
return configDic[code];
}
return "";
}
}
}