store without parse

This commit is contained in:
Alireza 2024-03-23 01:35:47 +01:00
parent 909287ab90
commit 9b8c59f888

View file

@ -1180,8 +1180,8 @@ namespace v2rayN.Handler
ProfileItem profileItem = new(); ProfileItem profileItem = new();
//Is v2ray array configuration //Is v2ray array configuration
var v2rayArrayConfig = JsonUtile.Deserialize<V2rayConfig[]>(clipboardData); var configObjects = JsonUtile.Deserialize<Object[]>(clipboardData);
if (v2rayArrayConfig != null && v2rayArrayConfig.Length > 0) if (configObjects != null && configObjects.Length > 0)
{ {
if (isSub && !Utile.IsNullOrEmpty(subid)) if (isSub && !Utile.IsNullOrEmpty(subid))
{ {
@ -1189,13 +1189,14 @@ namespace v2rayN.Handler
} }
profileItem = new(); profileItem = new();
int count = 0; int count = 0;
foreach (var v2rayJson in v2rayArrayConfig) foreach (var configObject in configObjects)
{ {
var objectString = JsonUtile.Serialize(configObject);
var v2rayJson = JsonUtile.Deserialize<V2rayConfig>(objectString);
if (v2rayJson?.inbounds?.Count > 0 && v2rayJson.outbounds?.Count > 0) if (v2rayJson?.inbounds?.Count > 0 && v2rayJson.outbounds?.Count > 0)
{ {
var fileName = Utile.GetTempPath($"{Utile.GetGUID(false)}.json"); var fileName = Utile.GetTempPath($"{Utile.GetGUID(false)}.json");
var v2rayConfigString = JsonUtile.Serialize(v2rayJson); File.WriteAllText(fileName, objectString);
File.WriteAllText(fileName, v2rayConfigString);
profileItem.coreType = ECoreType.Xray; profileItem.coreType = ECoreType.Xray;
profileItem.address = fileName; profileItem.address = fileName;