checkpoint
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Foodsoft.Alpm
|
||||
{
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "ConvertToConstant.Local")]
|
||||
public class Depend
|
||||
{
|
||||
public enum ModType
|
||||
@@ -19,16 +16,31 @@ namespace Foodsoft.Alpm
|
||||
LessThan
|
||||
}
|
||||
|
||||
[field: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8OutMarshaler))]
|
||||
public string Name { get; } = null!;
|
||||
public string Name { get; }
|
||||
public string Version { get; }
|
||||
public string Description { get; }
|
||||
public ulong NameHash { get; }
|
||||
public ModType Mod { get; }
|
||||
|
||||
[field: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8OutMarshaler))]
|
||||
public string Version { get; } = null!;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private readonly unsafe struct NativeDepend
|
||||
{
|
||||
internal readonly sbyte* name;
|
||||
internal readonly sbyte* version;
|
||||
internal readonly sbyte* description;
|
||||
internal readonly ulong name_hash;
|
||||
internal readonly Depend.ModType mod;
|
||||
}
|
||||
|
||||
[field: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8OutMarshaler))]
|
||||
public string Description { get; } = null!;
|
||||
|
||||
public ulong NameHash { get; } = 0;
|
||||
public ModType Mod { get; } = ModType.Any;
|
||||
internal unsafe Depend(IntPtr ptr)
|
||||
{
|
||||
var native = (NativeDepend*) ptr;
|
||||
Name = new string(native->name);
|
||||
Version = new string(native->version);
|
||||
Description = new string(native->description);
|
||||
NameHash = native->name_hash;
|
||||
Mod = native->mod;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user