2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 22:48:42 +00:00
This commit is contained in:
2026-06-08 18:01:02 +03:00
parent 340798a5fa
commit 253a24a466
34 changed files with 237 additions and 1135 deletions
@@ -0,0 +1,63 @@
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Esiur.Resource;
using Google.Protobuf;
using System;
namespace Esiur.Tests.RPC.EsiurServer
{
[Remote("Esiur.Tests.RPC.EsiurServer.Attachment", "")]
[Export]
public class Attachment : IRecord
{
[Annotation("", "Byte[]")]
public byte[] Data { get; set; }
[Annotation("", "String")]
public string MimeType { get; set; }
[Annotation("", "String")]
public string Name { get; set; }
public override bool Equals(object? obj)
{
var other = obj as Attachment;
if (Name != other.Name) return false;
if (MimeType != other.MimeType) return false;
if (!(Data.SequenceEqual(other.Data))) return false;
return true;
}
public Client.SharedModel.Attachment ToShared()
{
return new Client.SharedModel.Attachment()
{
Data = Data,
MimeType = MimeType,
Name = Name,
};
}
public Esiur.Tests.RPC.Client.Grpc.Attachment ToGrpc()
{
return new Esiur.Tests.RPC.Client.Grpc.Attachment()
{
Data = ByteString.CopyFrom(Data),
MimeType = MimeType,
Name = Name,
};
}
public Echo.ThriftModel.Attachment ToThrift()
{
return new Echo.ThriftModel.Attachment()
{
Data = Data,
MimeType = MimeType,
Name = Name,
};
}
}
}