Fix something

pull/4711/head
2dust 11 months ago
parent f5deb8e168
commit 655d411afe

@ -12,7 +12,6 @@ using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
@ -898,22 +897,26 @@ namespace v2rayN
}
/// <summary>
/// 深度拷贝
/// DeepCopy
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static T DeepCopy<T>(T obj)
{
object retval;
MemoryStream ms = new();
BinaryFormatter bf = new();
//序列化成流
bf.Serialize(ms, obj);
ms.Seek(0, SeekOrigin.Begin);
//反序列化成对象
retval = bf.Deserialize(ms);
return (T)retval;
return FromJson<T>(ToJson(obj, false))!;
// object retval;
// MemoryStream ms = new();
//#pragma warning disable SYSLIB0011 // 类型或成员已过时
// BinaryFormatter bf = new();
//#pragma warning restore SYSLIB0011 // 类型或成员已过时
// //序列化成流
// bf.Serialize(ms, obj);
// ms.Seek(0, SeekOrigin.Begin);
// //反序列化成对象
// retval = bf.Deserialize(ms);
// return (T)retval;
}
/// <summary>

@ -367,6 +367,7 @@ namespace v2rayN.ViewModels
break;
case 7:
case 8:
continue;
}
item.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);

@ -22,9 +22,9 @@
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="TaskScheduler" Version="2.10.1" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.1" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.31" />
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
<PackageReference Include="ReactiveUI.WPF" Version="19.5.1" />
<PackageReference Include="ReactiveUI.WPF" Version="19.5.31" />
<PackageReference Include="Splat.NLog" Version="14.8.12" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
</ItemGroup>

Loading…
Cancel
Save