[#3] Move to netstandard 2.0
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
ae3fc419a4
commit
0c4723c705
55 changed files with 2508 additions and 1818 deletions
|
@ -1,17 +1,24 @@
|
|||
using Google.Protobuf;
|
||||
using System;
|
||||
|
||||
namespace FrostFS.SDK.Cryptography
|
||||
namespace FrostFS.SDK.Cryptography;
|
||||
|
||||
public static class UUIDExtension
|
||||
{
|
||||
public static class UUIDExtension
|
||||
public static Guid ToUuid(this ByteString id)
|
||||
{
|
||||
public static Guid ToUuid(this ByteString id)
|
||||
{
|
||||
return Guid.Parse(Convert.ToHexString(id.ToByteArray()));
|
||||
}
|
||||
return Guid.Parse(BitConverter.ToString(id.ToByteArray()).Replace("-", ""));
|
||||
}
|
||||
|
||||
public static byte[] ToBytes(this Guid id)
|
||||
{
|
||||
var str = id.ToString("N");
|
||||
var len = str.Length;
|
||||
var bytes = new byte[len/2];
|
||||
|
||||
for (int i = 0; i < len; i += 2)
|
||||
bytes[i/2] = Convert.ToByte(str.Substring(i, 2), 16);
|
||||
|
||||
public static byte[] ToBytes(this Guid id)
|
||||
{
|
||||
return Convert.FromHexString(id.ToString("N"));
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue