using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Foodsoft.Alpm.Marshalling; namespace Foodsoft.Alpm { public readonly struct File { public string Name { get; } public long Size { get; } public uint 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 = native->mode; } } }