frostfs-sdk-csharp/src/FrostFS.SDK.ModelsV2/SplitId.cs
Pavel Gross c988ff3c76
All checks were successful
DCO / DCO (pull_request) Successful in 41s
[#11] Add Network Snapshot
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-06-26 12:29:33 +03:00

50 lines
848 B
C#

using System;
namespace FrostFS.SDK.ModelsV2;
public class SplitId
{
private Guid id;
public SplitId()
{
this.id = Guid.NewGuid();
}
public SplitId(Guid guid)
{
this.id = guid;
}
private SplitId(byte[] binary)
{
this.id = new Guid(binary);
}
private SplitId(string str)
{
this.id = new Guid(str);
}
public static SplitId CreateFromBinary(byte[] binaryData)
{
return new SplitId(binaryData);
}
public static SplitId CreateFromString(string stringData)
{
return new SplitId(stringData);
}
public override string ToString()
{
return this.id.ToString();
}
public byte[]? ToBinary()
{
if (this.id == Guid.Empty)
return null;
return this.id.ToByteArray();
}
}