зеркало из https://github.com/dotnet/razor.git
Remove DocumentSnapshotHandle
This commit is contained in:
Родитель
67168aae32
Коммит
0b85574932
|
@ -1,6 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Serialization;
|
||||
|
||||
internal record DocumentSnapshotHandle(string FilePath, string TargetPath, string FileKind);
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
using MessagePack;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Serialization.MessagePack.Formatters;
|
||||
|
||||
internal sealed class DocumentSnapshotHandleFormatter : ValueFormatter<DocumentSnapshotHandle>
|
||||
{
|
||||
public static readonly ValueFormatter<DocumentSnapshotHandle> Instance = new DocumentSnapshotHandleFormatter();
|
||||
|
||||
private DocumentSnapshotHandleFormatter()
|
||||
{
|
||||
}
|
||||
|
||||
public override DocumentSnapshotHandle Deserialize(ref MessagePackReader reader, SerializerCachingOptions options)
|
||||
{
|
||||
reader.ReadArrayHeaderAndVerify(3);
|
||||
|
||||
var filePath = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull();
|
||||
var targetPath = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull();
|
||||
var fileKind = CachedStringFormatter.Instance.Deserialize(ref reader, options).AssumeNotNull();
|
||||
|
||||
return new DocumentSnapshotHandle(filePath, targetPath, fileKind);
|
||||
}
|
||||
|
||||
public override void Serialize(ref MessagePackWriter writer, DocumentSnapshotHandle value, SerializerCachingOptions options)
|
||||
{
|
||||
writer.WriteArrayHeader(3);
|
||||
|
||||
CachedStringFormatter.Instance.Serialize(ref writer, value.FilePath, options);
|
||||
CachedStringFormatter.Instance.Serialize(ref writer, value.TargetPath, options);
|
||||
CachedStringFormatter.Instance.Serialize(ref writer, value.FileKind, options);
|
||||
}
|
||||
}
|
|
@ -91,15 +91,6 @@ internal static partial class ObjectReaders
|
|||
return new(projectId, configuration, rootNamespace);
|
||||
}
|
||||
|
||||
public static DocumentSnapshotHandle ReadDocumentSnapshotHandleFromProperties(JsonDataReader reader)
|
||||
{
|
||||
var filePath = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.FilePath));
|
||||
var targetPath = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.TargetPath));
|
||||
var fileKind = reader.ReadNonNullString(nameof(DocumentSnapshotHandle.FileKind));
|
||||
|
||||
return new DocumentSnapshotHandle(filePath, targetPath, fileKind);
|
||||
}
|
||||
|
||||
public static HostDocument ReadHostDocumentFromProperties(JsonDataReader reader)
|
||||
{
|
||||
var filePath = reader.ReadNonNullString(nameof(HostDocument.FilePath));
|
||||
|
|
|
@ -69,16 +69,6 @@ internal static class ObjectWriters
|
|||
writer.WriteIfNotNull(nameof(value.RootNamespace), value.RootNamespace);
|
||||
}
|
||||
|
||||
public static void Write(JsonDataWriter writer, DocumentSnapshotHandle? value)
|
||||
=> writer.WriteObject(value, WriteProperties);
|
||||
|
||||
public static void WriteProperties(JsonDataWriter writer, DocumentSnapshotHandle value)
|
||||
{
|
||||
writer.Write(nameof(value.FilePath), value.FilePath);
|
||||
writer.Write(nameof(value.TargetPath), value.TargetPath);
|
||||
writer.Write(nameof(value.FileKind), value.FileKind);
|
||||
}
|
||||
|
||||
public static void Write(JsonDataWriter writer, HostDocument? value)
|
||||
=> writer.WriteObject(value, WriteProperties);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче