checkpoint

This commit is contained in:
2020-04-30 13:33:30 -04:00
parent 19a9fc06ba
commit 9bc522180d
21 changed files with 337 additions and 276 deletions

View File

@@ -1,15 +1,32 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Foodsoft.Alpm.Marshalling;
namespace Foodsoft.Alpm
{
[SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")]
public readonly struct File
{
[field: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8OutMarshaler))]
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;
}
}
}