29 lines
694 B
C#
29 lines
694 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Foodsoft.Alpm
|
|
{
|
|
public readonly struct File
|
|
{
|
|
public string Name { get; }
|
|
|
|
public long Size { get; }
|
|
public int Mode { get; }
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal readonly unsafe struct NativeFile
|
|
{
|
|
internal readonly sbyte* Name;
|
|
internal readonly long size;
|
|
internal readonly uint mode;
|
|
}
|
|
|
|
internal unsafe File(IntPtr ptr)
|
|
{
|
|
var native = (NativeFile*) ptr;
|
|
Name = new string(native->Name);
|
|
Size = native->size;
|
|
Mode = (int) native->mode;
|
|
}
|
|
}
|
|
} |