Fix IFormatter

This commit is contained in:
Marc Hernandez 2024-03-07 17:30:54 -08:00
parent 5e025284f0
commit 6c5980a7a5
2 changed files with 60 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<RootNamespace>lib</RootNamespace>
<AssemblyVersion>0.0.1.0</AssemblyVersion>
<FileVersion>0.0.1.0</FileVersion>

View File

@ -1,15 +1,73 @@
using System;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Net.Sockets;
using System.IO;
using System.Diagnostics.CodeAnalysis;
//using Util;
namespace lib
{
public interface IFormatter
{
//
// Summary:
// Gets or sets the System.Runtime.Serialization.SerializationBinder that performs
// type lookups during deserialization.
//
// Returns:
// The System.Runtime.Serialization.SerializationBinder that performs type lookups
// during deserialization.
SerializationBinder? Binder { get; set; }
//
// Summary:
// Gets or sets the System.Runtime.Serialization.StreamingContext used for serialization
// and deserialization.
//
// Returns:
// The System.Runtime.Serialization.StreamingContext used for serialization and
// deserialization.
StreamingContext Context { get; set; }
//
// Summary:
// Gets or sets the System.Runtime.Serialization.SurrogateSelector used by the current
// formatter.
//
// Returns:
// The System.Runtime.Serialization.SurrogateSelector used by this formatter.
ISurrogateSelector? SurrogateSelector { get; set; }
//
// Summary:
// Deserializes the data on the provided stream and reconstitutes the graph of objects.
//
//
// Parameters:
// serializationStream:
// The stream that contains the data to deserialize.
//
// Returns:
// The top object of the deserialized graph.
[RequiresDynamicCode("BinaryFormatter serialization uses dynamic code generation, the type of objects being processed cannot be statically discovered.")]
[RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the type of objects being processed cannot be statically discovered.")]
object Deserialize(Stream serializationStream);
//
// Summary:
// Serializes an object, or graph of objects with the given root to the provided
// stream.
//
// Parameters:
// serializationStream:
// The stream where the formatter puts the serialized data. This stream can reference
// a variety of backing stores (such as files, network, memory, and so on).
//
// graph:
// The object, or root of the object graph, to serialize. All child objects of this
// root object are automatically serialized.
[RequiresUnreferencedCode("BinaryFormatter serialization is not trim compatible because the type of objects being processed cannot be statically discovered.")]
void Serialize(Stream serializationStream, object graph);
}
public interface IProcess