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

@@ -5,22 +5,12 @@ namespace Foodsoft.Alpm
{
public class Depend : IEquatable<Depend>
{
public enum ModType
{
Any = 1,
Equal,
GreaterThanOrEqual,
LessThanOrEqual,
GreaterThan,
LessThan
}
internal unsafe Depend(IntPtr ptr)
{
var native = (NativeDepend*) ptr;
Name = new string(native->name);
Version = new string(native->version);
Description = new string(native->description);
Name = Marshal.PtrToStringUTF8(native->name)!;
Version = Marshal.PtrToStringUTF8(native->version)!;
Description = Marshal.PtrToStringUTF8(native->description)!;
NameHash = native->name_hash;
Mod = native->mod;
}
@@ -48,13 +38,23 @@ namespace Foodsoft.Alpm
}
[StructLayout(LayoutKind.Sequential)]
private readonly unsafe struct NativeDepend
private readonly struct NativeDepend
{
internal readonly sbyte* name;
internal readonly sbyte* version;
internal readonly sbyte* description;
internal readonly IntPtr name;
internal readonly IntPtr version;
internal readonly IntPtr description;
internal readonly ulong name_hash;
internal readonly ModType mod;
}
}
public enum ModType
{
Any = 1,
Equal,
GreaterThanOrEqual,
LessThanOrEqual,
GreaterThan,
LessThan
}
}