Replace obsolete BinaryFormatter with ZeroFormatter
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Platforms>AnyCPU;x64;x86</Platforms>
|
||||
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
|
||||
@@ -346,13 +346,12 @@ namespace OpenMetaverse
|
||||
{
|
||||
using (Stream stream = File.Open(filename, FileMode.Create))
|
||||
{
|
||||
BinaryFormatter bformatter = new BinaryFormatter();
|
||||
lock (Items)
|
||||
{
|
||||
Logger.Log("Caching " + Items.Count.ToString() + " inventory items to " + filename, Helpers.LogLevel.Info);
|
||||
foreach (KeyValuePair<UUID, InventoryNode> kvp in Items)
|
||||
{
|
||||
bformatter.Serialize(stream, kvp.Value);
|
||||
ZeroFormatter.ZeroFormatterSerializer.Serialize(stream, kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,7 +383,7 @@ namespace OpenMetaverse
|
||||
|
||||
while (stream.Position < stream.Length)
|
||||
{
|
||||
OpenMetaverse.InventoryNode node = (InventoryNode)bformatter.Deserialize(stream);
|
||||
var node = ZeroFormatter.ZeroFormatterSerializer.Deserialize<InventoryNode>(stream);
|
||||
nodes.Add(node);
|
||||
item_count++;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2016, openmetaverse.co
|
||||
* Copyright (c) 2021, Sjofn LLC.
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,18 +27,24 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using ZeroFormatter;
|
||||
|
||||
namespace OpenMetaverse
|
||||
{
|
||||
[Serializable]
|
||||
public class InventoryNode : ISerializable
|
||||
[ZeroFormattable]
|
||||
public class InventoryNode
|
||||
{
|
||||
[Index(0)]
|
||||
private InventoryBase data;
|
||||
[Index(1)]
|
||||
private InventoryNode parent;
|
||||
[Index(3)]
|
||||
private UUID parentID; //used for de-seralization
|
||||
[Index(4)]
|
||||
private InventoryNodeDictionary nodes;
|
||||
[Index(5)]
|
||||
private bool needsUpdate = true;
|
||||
[NonSerialized]
|
||||
[IgnoreFormat]
|
||||
private object tag;
|
||||
|
||||
/// <summary></summary>
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Channels" Version="5.0.0" />
|
||||
<PackageReference Include="XmlRpcCore" Version="3.1.2.77" />
|
||||
<PackageReference Include="ZeroFormatter" Version="1.6.4" />
|
||||
<PackageReference Include="zlib.net-mutliplatform" Version="1.0.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user