58 lines
No EOL
1.2 KiB
C#
58 lines
No EOL
1.2 KiB
C#
using FrostFS.Refs;
|
|
using FrostFS.SDK.Client;
|
|
using FrostFS.SDK.Client.Mappers.GRPC;
|
|
using FrostFS.SDK.Cryptography;
|
|
|
|
namespace FrostFS.SDK;
|
|
|
|
public class FrostFsContainerId
|
|
{
|
|
private string? modelId;
|
|
private ContainerID? containerID;
|
|
|
|
public FrostFsContainerId(string id)
|
|
{
|
|
this.modelId = id;
|
|
}
|
|
|
|
internal FrostFsContainerId(ContainerID id)
|
|
{
|
|
this.containerID = id;
|
|
}
|
|
|
|
public string GetValue()
|
|
{
|
|
if (this.modelId != null)
|
|
return this.modelId;
|
|
|
|
if (containerID != null)
|
|
{
|
|
this.modelId = Base58.Encode(containerID.Value.Span);
|
|
return this.modelId;
|
|
}
|
|
|
|
throw new FrostFsInvalidObjectException();
|
|
}
|
|
|
|
internal ContainerID ContainerID
|
|
{
|
|
get
|
|
{
|
|
if (this.containerID != null)
|
|
return this.containerID;
|
|
|
|
if (modelId != null)
|
|
{
|
|
this.containerID = this.ToMessage();
|
|
return this.containerID;
|
|
}
|
|
|
|
throw new FrostFsInvalidObjectException();
|
|
}
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return GetValue();
|
|
}
|
|
} |