Checkpoint

This commit is contained in:
2020-05-01 05:08:04 -04:00
parent abba062f4f
commit 1a394ddb31
20 changed files with 239 additions and 102 deletions

View File

@@ -6,7 +6,7 @@ namespace Foodsoft.Alpm
public readonly struct Backup : IEquatable<Backup>
{
public string Name { get; }
public string Hash { get; }
public string? Hash { get; }
public bool Equals(Backup other)
{
@@ -24,17 +24,17 @@ namespace Foodsoft.Alpm
}
[StructLayout(LayoutKind.Sequential)]
private readonly unsafe struct NativeBackup
private readonly struct NativeBackup
{
internal readonly sbyte* name;
internal readonly sbyte* hash;
internal readonly IntPtr name;
internal readonly IntPtr hash;
}
internal unsafe Backup(IntPtr ptr)
{
var native = (NativeBackup*) ptr;
Name = new string(native->name);
Hash = new string(native->hash);
Name = Marshal.PtrToStringUTF8(native->name)!;
Hash = Marshal.PtrToStringUTF8(native->hash)!;
}
}
}