checkpoint
This commit is contained in:
21
Alpm/File.cs
21
Alpm/File.cs
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user