This commit is contained in:
Dustin Campbell 2024-10-15 14:31:14 -07:00
Родитель 67168aae32
Коммит 0b85574932
4 изменённых файлов: 0 добавлений и 60 удалений

Просмотреть файл

@ -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);