mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AaruFormat] Implement Open
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
|
|
||||||
@@ -7,7 +8,10 @@ namespace Aaru.Images;
|
|||||||
/// <summary>Implements reading and writing AaruFormat media images</summary>
|
/// <summary>Implements reading and writing AaruFormat media images</summary>
|
||||||
public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage
|
public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage
|
||||||
{
|
{
|
||||||
|
const string MODULE_NAME = "Aaru Format plugin";
|
||||||
|
|
||||||
readonly ImageInfo _imageInfo;
|
readonly ImageInfo _imageInfo;
|
||||||
|
IntPtr _context;
|
||||||
|
|
||||||
public AaruFormat() => _imageInfo = new ImageInfo
|
public AaruFormat() => _imageInfo = new ImageInfo
|
||||||
{
|
{
|
||||||
|
|||||||
42
Aaru.Images/AaruFormat/Open.cs
Normal file
42
Aaru.Images/AaruFormat/Open.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Aaru.CommonTypes.Enums;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
|
using Aaru.Logging;
|
||||||
|
|
||||||
|
namespace Aaru.Images;
|
||||||
|
|
||||||
|
public sealed partial class AaruFormat
|
||||||
|
{
|
||||||
|
#region IWritableOpticalImage Members
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ErrorNumber Open(IFilter imageFilter)
|
||||||
|
{
|
||||||
|
string imagePath = imageFilter.BasePath;
|
||||||
|
|
||||||
|
_context = aaruf_open(imagePath);
|
||||||
|
|
||||||
|
if(_context != IntPtr.Zero) return ErrorNumber.NoError;
|
||||||
|
|
||||||
|
int errno = Marshal.GetLastWin32Error();
|
||||||
|
|
||||||
|
AaruLogging.Debug(MODULE_NAME,
|
||||||
|
"Failed to open AaruFormat image {0}, libaaruformat returned error number {1}",
|
||||||
|
imagePath,
|
||||||
|
errno);
|
||||||
|
|
||||||
|
return (ErrorNumber)errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// AARU_EXPORT void AARU_CALL *aaruf_open(const char *filepath)
|
||||||
|
[LibraryImport("libaaruformat",
|
||||||
|
EntryPoint = "aaruf_open",
|
||||||
|
StringMarshalling = StringMarshalling.Utf8,
|
||||||
|
SetLastError = true)]
|
||||||
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||||
|
private static partial IntPtr aaruf_open(string filepath);
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
using TapeFile = Aaru.CommonTypes.Structs.TapeFile;
|
using TapeFile = Aaru.CommonTypes.Structs.TapeFile;
|
||||||
using TapePartition = Aaru.CommonTypes.Structs.TapePartition;
|
using TapePartition = Aaru.CommonTypes.Structs.TapePartition;
|
||||||
@@ -22,9 +21,6 @@ public sealed partial class AaruFormat
|
|||||||
|
|
||||||
#region IWritableOpticalImage Members
|
#region IWritableOpticalImage Members
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public ErrorNumber Open(IFilter imageFilter) => throw new NotImplementedException();
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ErrorNumber ReadMediaTag(MediaTagType tag, out byte[] buffer) => throw new NotImplementedException();
|
public ErrorNumber ReadMediaTag(MediaTagType tag, out byte[] buffer) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
|
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||||
|
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xml:space="preserve">
|
||||||
<s:String x:Key="/Default/CodeInspection/CppInitialization/DefaultPointerInitializer/@EntryValue">Null</s:String>
|
<s:String x:Key="/Default/CodeInspection/CppInitialization/DefaultPointerInitializer/@EntryValue">Null</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=858398D1_002D7321_002D4763_002D8BAB_002D56BBFEC74E29_002Fd_003Acuetools_002Enet/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=858398D1_002D7321_002D4763_002D8BAB_002D56BBFEC74E29_002Fd_003Acuetools_002Enet/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AnnotateCanBeNullTypeMember/@EntryIndexedValue"></s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AnnotateCanBeNullTypeMember/@EntryIndexedValue"></s:String>
|
||||||
@@ -1316,6 +1319,7 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=legacyesx/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=legacyesx/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Legendia/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Legendia/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=LEOT/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=LEOT/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=libaaruformat/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=libc/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=libc/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=libudev/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=libudev/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lisafs/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=lisafs/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|||||||
Reference in New Issue
Block a user