46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Foodsoft.Alpm
|
|
{
|
|
public class Depend
|
|
{
|
|
public enum ModType
|
|
{
|
|
Any = 1,
|
|
Equal,
|
|
GreaterThanOrEqual,
|
|
LessThanOrEqual,
|
|
GreaterThan,
|
|
LessThan
|
|
}
|
|
|
|
public string Name { get; }
|
|
public string Version { get; }
|
|
public string Description { get; }
|
|
public ulong NameHash { get; }
|
|
public ModType Mod { get; }
|
|
|
|
[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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
} |