Remix file service

This commit is contained in:
2025-07-14 13:50:41 +08:00
parent 06f1cc3ca1
commit ef9175d27d
12 changed files with 110 additions and 184 deletions

View File

@ -1,3 +1,4 @@
using DysonNetwork.Shared.Proto;
using Google.Protobuf.WellKnownTypes;
namespace DysonNetwork.Shared.Data;
@ -10,13 +11,30 @@ public class CloudFileReferenceObject : ModelBase, ICloudFile
{
public string Id { get; set; } = null!;
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? FileMeta { get; set; } = null!;
public Dictionary<string, object>? UserMeta { get; set; } = null!;
public Dictionary<string, object?> FileMeta { get; set; } = null!;
public Dictionary<string, object?> UserMeta { get; set; } = null!;
public string? MimeType { get; set; }
public string? Hash { get; set; }
public long Size { get; set; }
public bool HasCompression { get; set; } = false;
public static CloudFileReferenceObject FromProtoValue(Proto.CloudFile proto)
{
return new CloudFileReferenceObject
{
Id = proto.Id,
Name = proto.Name,
FileMeta = proto.FileMeta
.ToDictionary(kvp => kvp.Key, kvp => GrpcTypeHelper.ConvertField(kvp.Value)),
UserMeta = proto.UserMeta
.ToDictionary(kvp => kvp.Key, kvp => GrpcTypeHelper.ConvertField(kvp.Value)),
MimeType = proto.MimeType,
Hash = proto.Hash,
Size = proto.Size,
HasCompression = proto.HasCompression
};
}
/// <summary>
/// Converts the current object to its protobuf representation
/// </summary>