[Aaru] Reformat and cleanup.

This commit is contained in:
2023-10-03 22:38:23 +01:00
parent 1252feea0c
commit 8815beffd8
33 changed files with 3008 additions and 2971 deletions

View File

@@ -56,6 +56,7 @@ dotnet_style_qualification_for_property
dotnet_style_require_accessibility_modifiers = never:suggestion
# ReSharper properties
resharper_align_first_arg_by_paren = false
resharper_align_linq_query = true
resharper_align_multiline_argument = true
resharper_align_multiline_array_and_object_initializer = false
@@ -82,7 +83,7 @@ resharper_braces_for_ifelse
resharper_braces_for_while = required_for_multiline
resharper_builtin_type_apply_to_native_integer = true
resharper_constructor_or_destructor_body = expression_body
resharper_csharp_align_first_arg_by_paren = true
resharper_csharp_align_first_arg_by_paren = false
resharper_csharp_empty_block_style = together_same_line
resharper_csharp_place_comments_at_first_column = true
resharper_csharp_prefer_qualified_reference = false
@@ -95,7 +96,7 @@ resharper_for_built_in_types
resharper_function_declaration_return_type_style = on_single_line
resharper_function_definition_return_type_style = on_single_line
resharper_html_pi_attribute_style = first_attribute_on_single_line
resharper_indent_anonymous_method_block = true
resharper_indent_anonymous_method_block = false
resharper_indent_preprocessor_if = outdent
resharper_indent_preprocessor_other = outdent
resharper_indent_preprocessor_region = outdent

View File

@@ -1,211 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7A4B05BE-73C9-4F34-87FE-E80CCF1F732D}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Aaru</RootNamespace>
<AssemblyName>aaru</AssemblyName>
<ReleaseVersion>$(Version)</ReleaseVersion>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>6.0.0~alpha9</Version>
<Company>Claunia.com</Company>
<Copyright>Copyright © 2011-2023 Natalia Portillo</Copyright>
<Product>Aaru Data Preservation Suite</Product>
<Title>Aaru</Title>
<ApplicationVersion>$(Version)</ApplicationVersion>
<!-- TODO win-arm doesn't seem to work in RC1, try again in final -->
<RuntimeIdentifiers>linux-musl-arm;linux-musl-arm64;linux-musl-x64;linux-arm64;linux-arm;linux-x64;osx-x64;osx-arm64;win-arm64;win-x64;win-x86</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>12</LangVersion>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)+{chash:8}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>false</NrtShowRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugPackage>-dbg</DebugPackage>
<NoWarn>CS1591;CS1574</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<InternalsVisibleTo Include="Aaru.Tests"/>
<InternalsVisibleTo Include="Aaru.Tests.Devices"/>
</ItemGroup>
<ItemGroup>
<None Remove="Packaging.Targets"/>
</ItemGroup>
<ItemGroup>
<None Include="..\README.md">
<Link>README.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\.travis.yml">
<Link>.travis.yml</Link>
</None>
<None Include="..\CONTRIBUTING.md">
<Link>CONTRIBUTING.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\NEEDED.md">
<Link>NEEDED.md</Link>
</None>
<None Include="..\Changelog.md">
<Link>Changelog.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Checksums\Aaru.Checksums.csproj"/>
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj"/>
<ProjectReference Include="..\Aaru.Gui\Aaru.Gui.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Images\Aaru.Images.csproj"/>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Localization\Aaru.Localization.csproj"/>
<ProjectReference Include="..\Aaru.Partitions\Aaru.Partitions.csproj"/>
<ProjectReference Include="..\Aaru.Filesystems\Aaru.Filesystems.csproj"/>
<ProjectReference Include="..\Aaru.Decoders\Aaru.Decoders.csproj"/>
<ProjectReference Include="..\Aaru.Devices\Aaru.Devices.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Settings\Aaru.Settings.csproj"/>
<ProjectReference Include="..\Aaru.Filters\Aaru.Filters.csproj"/>
<ProjectReference Include="..\Aaru.Core\Aaru.Core.csproj"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.MIT">
<Link>LICENSE.MIT</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="..\LICENSE.LGPL">
<Link>LICENSE.LGPL</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<Folder Include="..\LICENSE"/>
</ItemGroup>
<ItemGroup>
<None Include="..\.github\CODE_OF_CONDUCT.md"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\.github\PULL_REQUEST_TEMPLATE.md"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Humanizer" Version="2.14.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6"/>
<PackageReference Include="Spectre.Console" Version="0.47.0"/>
<PackageReference Include="Spectre.Console.Analyzer" Version="0.47.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="System.Text.Json" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1"/>
<PackageReference Include="System.Runtime.Handles" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Net.Primitives" Version="4.3.1"/>
<PackageReference Include="System.IO.FileSystem" Version="4.3.0"/>
<PackageReference Update="Packaging.Targets" Version="0.1.220"/>
<PackageReference Include="Packaging.Targets" Version="0.1.220"/>
</ItemGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7A4B05BE-73C9-4F34-87FE-E80CCF1F732D}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Aaru</RootNamespace>
<AssemblyName>aaru</AssemblyName>
<ReleaseVersion>$(Version)</ReleaseVersion>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>6.0.0~alpha9</Version>
<Company>Claunia.com</Company>
<Copyright>Copyright © 2011-2023 Natalia Portillo</Copyright>
<Product>Aaru Data Preservation Suite</Product>
<Title>Aaru</Title>
<ApplicationVersion>$(Version)</ApplicationVersion>
<!-- TODO win-arm doesn't seem to work in RC1, try again in final -->
<RuntimeIdentifiers>linux-musl-arm;linux-musl-arm64;linux-musl-x64;linux-arm64;linux-arm;linux-x64;osx-x64;osx-arm64;win-arm64;win-x64;win-x86</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>12</LangVersion>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)+{chash:8}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>false</NrtShowRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugPackage>-dbg</DebugPackage>
<NoWarn>CS1591;CS1574</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<InternalsVisibleTo Include="Aaru.Tests"/>
<InternalsVisibleTo Include="Aaru.Tests.Devices"/>
</ItemGroup>
<ItemGroup>
<None Remove="Packaging.Targets"/>
</ItemGroup>
<ItemGroup>
<None Include="..\README.md">
<Link>README.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\.travis.yml">
<Link>.travis.yml</Link>
</None>
<None Include="..\CONTRIBUTING.md">
<Link>CONTRIBUTING.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\NEEDED.md">
<Link>NEEDED.md</Link>
</None>
<None Include="..\Changelog.md">
<Link>Changelog.md</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Checksums\Aaru.Checksums.csproj"/>
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj"/>
<ProjectReference Include="..\Aaru.Gui\Aaru.Gui.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Images\Aaru.Images.csproj"/>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Localization\Aaru.Localization.csproj"/>
<ProjectReference Include="..\Aaru.Partitions\Aaru.Partitions.csproj"/>
<ProjectReference Include="..\Aaru.Filesystems\Aaru.Filesystems.csproj"/>
<ProjectReference Include="..\Aaru.Decoders\Aaru.Decoders.csproj"/>
<ProjectReference Include="..\Aaru.Devices\Aaru.Devices.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Settings\Aaru.Settings.csproj"/>
<ProjectReference Include="..\Aaru.Filters\Aaru.Filters.csproj"/>
<ProjectReference Include="..\Aaru.Core\Aaru.Core.csproj"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.MIT">
<Link>LICENSE.MIT</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="..\LICENSE.LGPL">
<Link>LICENSE.LGPL</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<Folder Include="..\LICENSE"/>
</ItemGroup>
<ItemGroup>
<None Include="..\.github\CODE_OF_CONDUCT.md"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\.github\PULL_REQUEST_TEMPLATE.md"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Humanizer" Version="2.14.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6"/>
<PackageReference Include="Spectre.Console" Version="0.47.0"/>
<PackageReference Include="Spectre.Console.Analyzer" Version="0.47.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="System.Text.Json" Version="8.0.0-rc.1.23419.4"/>
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Collections" Version="4.3.0"/>
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0"/>
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1"/>
<PackageReference Include="System.Runtime.Handles" Version="4.3.0"/>
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0"/>
<PackageReference Include="System.Net.Primitives" Version="4.3.1"/>
<PackageReference Include="System.IO.FileSystem" Version="4.3.0"/>
<PackageReference Update="Packaging.Targets" Version="0.1.220"/>
<PackageReference Include="Packaging.Targets" Version="0.1.220"/>
</ItemGroup>
<PropertyGroup>
<PackageVersion>6.0.0-alpha9</PackageVersion>
<PackagePrefix>aaru</PackagePrefix>
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<Section>net</Section>
<PackageDescription>Disc image management and creation tool for disks, tapes, optical and solid state media</PackageDescription>
</PropertyGroup>
<PropertyGroup>
<PackageVersion>6.0.0-alpha9</PackageVersion>
<PackagePrefix>aaru</PackagePrefix>
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<Section>net</Section>
<PackageDescription>Disc image management and creation tool for disks, tapes, optical and solid state media</PackageDescription>
</PropertyGroup>
<ItemGroup>
<Content Include="aaruformat.xml" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="0644">
<LinuxPath>/usr/share/mime/packages/aaruformat.xml</LinuxPath>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="aaruformat.xml" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="0644">
<LinuxPath>/usr/share/mime/packages/aaruformat.xml</LinuxPath>
</Content>
</ItemGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_arm64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_arm64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_amd64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_amd64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos_applesilicon$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos_applesilicon$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_arm$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_arm$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x86$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x86$(DebugPackage)</PackageName>
</PropertyGroup>
<!-- TODO: Distribution specific RIDs where removed in .NET 8.0. We need to detect packaging in another way
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-arm64'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_arm64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-arm'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-x64'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_amd64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'rhel-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).el.aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'rhel-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).el.x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'sles-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).sles.x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
-->
<!-- TODO: Distribution specific RIDs where removed in .NET 8.0. We need to detect packaging in another way
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-arm64'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_arm64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-arm'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_armhf$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'debian-x64'">
<PackageName>$(PackagePrefix)_$(PackageVersion)_amd64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'rhel-arm64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).el.aarch64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'rhel-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).el.x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'sles-x64'">
<PackageName>$(PackagePrefix)-$(PackageVersion).sles.x86_64$(DebugPackage)</PackageName>
</PropertyGroup>
-->
</Project>

View File

@@ -69,23 +69,23 @@ sealed class ArchiveInfoCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("archive-info");

View File

@@ -58,23 +58,23 @@ sealed class ConfigureCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
return DoConfigure(false);

View File

@@ -59,23 +59,23 @@ sealed class StatisticsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
@@ -118,7 +118,7 @@ sealed class StatisticsCommand : Command
ulong count = 0;
foreach(Aaru.Database.Models.Command fsInfo in ctx.Commands.Where(c => c.Name == "fs-info" &&
c.Synchronized))
c.Synchronized))
{
count += fsInfo.Count;
ctx.Remove(fsInfo);

View File

@@ -75,23 +75,23 @@ sealed class UpdateCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);

File diff suppressed because it is too large Load Diff

View File

@@ -92,23 +92,23 @@ sealed class DeviceInfoCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("device-info");
@@ -355,8 +355,9 @@ sealed class DeviceInfoCommand : Command
dev.IsCompactFlash, dev.IsPcmcia, blocks);
AaruConsole.
WriteLine(removable ? Localization.Core.Media_identified_as_0 : Localization.Core.Device_identified_as_0,
mediaType);
WriteLine(
removable ? Localization.Core.Media_identified_as_0 : Localization.Core.Device_identified_as_0,
mediaType);
Statistics.AddMedia(mediaType, true);
}

View File

@@ -71,23 +71,23 @@ sealed class ListDevicesCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("list-devices");

View File

@@ -96,23 +96,23 @@ sealed class ExtractFilesCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("extract-files");
@@ -129,10 +129,10 @@ sealed class ExtractFilesCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
@@ -176,11 +176,11 @@ sealed class ExtractFilesCommand : Command
IBaseImage baseImage = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
if(baseImage == null)
{
@@ -223,10 +223,10 @@ sealed class ExtractFilesCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -261,10 +261,10 @@ sealed class ExtractFilesCommand : Command
List<Partition> partitions = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitions = Core.Partitions.GetAll(imageFormat);
});
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitions = Core.Partitions.GetAll(imageFormat);
});
Core.Partitions.AddSchemesToStats(partitions);
@@ -293,12 +293,12 @@ sealed class ExtractFilesCommand : Command
List<string> idPlugins = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitions[i]);
});
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitions[i]);
});
if(idPlugins.Count == 0)
AaruConsole.WriteLine(UI.Filesystem_not_identified);
@@ -323,14 +323,14 @@ sealed class ExtractFilesCommand : Command
continue;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Mounting_filesystem).
IsIndeterminate();
{
ctx.AddTask(UI.Mounting_filesystem).
IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
if(error == ErrorNumber.NoError)
{
@@ -358,12 +358,12 @@ sealed class ExtractFilesCommand : Command
AaruConsole.WriteLine($"[bold]{string.Format(UI.Identified_by_0, pluginType.Name)}[/]");
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Mounting_filesystem).IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
{
ctx.AddTask(UI.Mounting_filesystem).IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
if(error == ErrorNumber.NoError)
{
@@ -413,10 +413,10 @@ sealed class ExtractFilesCommand : Command
FileEntryInfo stat = new();
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Retrieving_file_information).IsIndeterminate();
error = fs.Stat(path + "/" + entry, out stat);
});
{
ctx.AddTask(UI.Retrieving_file_information).IsIndeterminate();
error = fs.Stat(path + "/" + entry, out stat);
});
if(error == ErrorNumber.NoError)
{
@@ -483,11 +483,11 @@ sealed class ExtractFilesCommand : Command
List<string> xattrs = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Listing_extended_attributes).
IsIndeterminate();
error = fs.ListXAttr(path + "/" + entry, out xattrs);
});
{
ctx.AddTask(UI.Listing_extended_attributes).
IsIndeterminate();
error = fs.ListXAttr(path + "/" + entry, out xattrs);
});
if(error == ErrorNumber.NoError)
{
@@ -496,12 +496,12 @@ sealed class ExtractFilesCommand : Command
byte[] xattrBuf = Array.Empty<byte>();
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Reading_extended_attribute).
IsIndeterminate();
error = fs.GetXattr(path + "/" + entry, xattr,
ref xattrBuf);
});
{
ctx.AddTask(UI.Reading_extended_attribute).
IsIndeterminate();
error = fs.GetXattr(path + "/" + entry, xattr,
ref xattrBuf);
});
if(error != ErrorNumber.NoError)
continue;
@@ -534,19 +534,19 @@ sealed class ExtractFilesCommand : Command
if(!File.Exists(outputPath))
{
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Writing_extended_attribute).
IsIndeterminate();
{
ctx.AddTask(UI.Writing_extended_attribute).
IsIndeterminate();
outputFile =
new FileStream(outputPath,
FileMode.CreateNew,
FileAccess.ReadWrite,
FileShare.None);
outputFile =
new FileStream(outputPath,
FileMode.CreateNew,
FileAccess.ReadWrite,
FileShare.None);
outputFile.Write(xattrBuf, 0, xattrBuf.Length);
outputFile.Close();
});
outputFile.Write(xattrBuf, 0, xattrBuf.Length);
outputFile.Close();
});
var fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -620,47 +620,47 @@ sealed class ExtractFilesCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask task =
ctx.AddTask(string.Format(UI.Reading_file_0, Markup.Escape(entry)));
{
ProgressTask task =
ctx.AddTask(string.Format(UI.Reading_file_0, Markup.Escape(entry)));
task.MaxValue = stat.Length;
var outBuf = new byte[BUFFER_SIZE];
error = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
task.MaxValue = stat.Length;
var outBuf = new byte[BUFFER_SIZE];
error = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
if(error == ErrorNumber.NoError)
{
while(position < stat.Length)
{
long bytesToRead;
if(error == ErrorNumber.NoError)
{
while(position < stat.Length)
{
long bytesToRead;
if(stat.Length - position > BUFFER_SIZE)
bytesToRead = BUFFER_SIZE;
else
bytesToRead = stat.Length - position;
if(stat.Length - position > BUFFER_SIZE)
bytesToRead = BUFFER_SIZE;
else
bytesToRead = stat.Length - position;
error = fs.ReadFile(fileNode, bytesToRead, outBuf,
out long bytesRead);
error = fs.ReadFile(fileNode, bytesToRead, outBuf,
out long bytesRead);
if(error == ErrorNumber.NoError)
outputFile.Write(outBuf, 0, (int)bytesRead);
else
{
AaruConsole.ErrorWriteLine(UI.Error_0_reading_file_1, error,
entry);
if(error == ErrorNumber.NoError)
outputFile.Write(outBuf, 0, (int)bytesRead);
else
{
AaruConsole.ErrorWriteLine(UI.Error_0_reading_file_1, error,
entry);
break;
}
break;
}
position += bytesToRead;
task.Increment(bytesToRead);
}
position += bytesToRead;
task.Increment(bytesToRead);
}
fs.CloseFile(fileNode);
}
else
AaruConsole.ErrorWriteLine(UI.Error_0_reading_file_1, error, entry);
});
fs.CloseFile(fileNode);
}
else
AaruConsole.ErrorWriteLine(UI.Error_0_reading_file_1, error, entry);
});
outputFile.Close();

View File

@@ -83,23 +83,23 @@ sealed class FilesystemInfoCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("fs-info");
@@ -115,10 +115,10 @@ sealed class FilesystemInfoCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -156,11 +156,11 @@ sealed class FilesystemInfoCommand : Command
IBaseImage baseImage = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
if(baseImage == null)
{
@@ -188,10 +188,10 @@ sealed class FilesystemInfoCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -229,10 +229,10 @@ sealed class FilesystemInfoCommand : Command
List<Partition> partitionsList = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitionsList = Core.Partitions.GetAll(imageFormat);
});
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitionsList = Core.Partitions.GetAll(imageFormat);
});
Core.Partitions.AddSchemesToStats(partitionsList);
@@ -284,12 +284,12 @@ sealed class FilesystemInfoCommand : Command
continue;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitionsList[i]);
});
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitionsList[i]);
});
switch(idPlugins.Count)
{
@@ -357,10 +357,10 @@ sealed class FilesystemInfoCommand : Command
};
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_filesystems).IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
});
{
ctx.AddTask(UI.Identifying_filesystems).IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins, wholePart);
});
switch(idPlugins.Count)
{

View File

@@ -88,23 +88,23 @@ sealed class LsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(Markup.Escape(format));
else
stderrConsole.MarkupLine(Markup.Escape(format), objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(Markup.Escape(format));
else
stderrConsole.MarkupLine(Markup.Escape(format), objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
@@ -118,10 +118,10 @@ sealed class LsCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine(MODULE_NAME, UI.Parsed_options);
@@ -165,11 +165,11 @@ sealed class LsCommand : Command
IBaseImage baseImage = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
imageFormat = baseImage as IMediaImage;
});
if(baseImage == null)
{
@@ -195,10 +195,10 @@ sealed class LsCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -233,10 +233,10 @@ sealed class LsCommand : Command
List<Partition> partitions = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitions = Core.Partitions.GetAll(imageFormat);
});
{
ctx.AddTask(UI.Enumerating_partitions).IsIndeterminate();
partitions = Core.Partitions.GetAll(imageFormat);
});
Core.Partitions.AddSchemesToStats(partitions);
@@ -265,12 +265,12 @@ sealed class LsCommand : Command
List<string> idPlugins = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitions[i]);
});
{
ctx.AddTask(UI.Identifying_filesystems_on_partition).
IsIndeterminate();
Core.Filesystems.Identify(imageFormat, out idPlugins,
partitions[i]);
});
if(idPlugins.Count == 0)
AaruConsole.WriteLine(UI.Filesystem_not_identified);
@@ -294,14 +294,14 @@ sealed class LsCommand : Command
AaruConsole.WriteLine($"[bold]{string.Format(UI.As_identified_by_0, fs.Name)}[/]");
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Mounting_filesystem).
IsIndeterminate();
{
ctx.AddTask(UI.Mounting_filesystem).
IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
if(error == ErrorNumber.NoError)
{
@@ -324,12 +324,12 @@ sealed class LsCommand : Command
AaruConsole.WriteLine($"[bold]{string.Format(UI.Identified_by_0, fs.Name)}[/]");
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Mounting_filesystem).IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
{
ctx.AddTask(UI.Mounting_filesystem).IsIndeterminate();
error = fs.Mount(imageFormat, partitions[i],
encodingClass, parsedOptions,
@namespace);
});
if(error == ErrorNumber.NoError)
{
@@ -367,10 +367,10 @@ sealed class LsCommand : Command
: string.Format(UI.Directory_0, Markup.Escape(path)));
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Reading_directory).IsIndeterminate();
error = fs.OpenDir(path, out node);
});
{
ctx.AddTask(UI.Reading_directory).IsIndeterminate();
error = fs.OpenDir(path, out node);
});
if(error != ErrorNumber.NoError)
{
@@ -382,19 +382,19 @@ sealed class LsCommand : Command
Dictionary<string, FileEntryInfo> stats = new();
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Retrieving_file_information).IsIndeterminate();
{
ctx.AddTask(UI.Retrieving_file_information).IsIndeterminate();
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError &&
entry is not null)
{
fs.Stat(path + "/" + entry, out FileEntryInfo stat);
while(fs.ReadDir(node, out string entry) == ErrorNumber.NoError &&
entry is not null)
{
fs.Stat(path + "/" + entry, out FileEntryInfo stat);
stats.Add(entry, stat);
}
stats.Add(entry, stat);
}
fs.CloseDir(node);
});
fs.CloseDir(node);
});
foreach(KeyValuePair<string, FileEntryInfo> entry in
stats.OrderBy(e => e.Value?.Attributes.HasFlag(FileAttributes.Directory) == false))

View File

@@ -64,23 +64,23 @@ sealed class ListOptionsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);

View File

@@ -64,23 +64,23 @@ sealed class FormatsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("formats");
@@ -171,7 +171,7 @@ sealed class FormatsCommand : Command
Title = new TableTitle(string.Format(UI.Supported_filesystems_for_identification_and_information_only_0,
plugins.Filesystems.Count(t => !t.Value.GetInterfaces().
Contains(typeof(
IReadOnlyFilesystem)))))
IReadOnlyFilesystem)))))
};
if(verbose)
@@ -181,7 +181,7 @@ sealed class FormatsCommand : Command
foreach(KeyValuePair<string, Type> kvp in plugins.Filesystems.Where(t => !t.Value.GetInterfaces().
Contains(typeof(
IReadOnlyFilesystem))))
IReadOnlyFilesystem))))
{
if(Activator.CreateInstance(kvp.Value) is not IFilesystem fs)
continue;

View File

@@ -106,23 +106,23 @@ sealed class ChecksumCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("checksum");
@@ -149,10 +149,10 @@ sealed class ChecksumCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -164,10 +164,10 @@ sealed class ChecksumCommand : Command
IBaseImage inputFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
if(inputFormat == null)
{
@@ -179,10 +179,10 @@ sealed class ChecksumCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -252,154 +252,158 @@ sealed class ChecksumCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask discTask = ctx.AddTask(Localization.Core.Hashing_tracks);
discTask.MaxValue = inputTracks.Count;
{
ProgressTask discTask = ctx.AddTask(Localization.Core.Hashing_tracks);
discTask.MaxValue = inputTracks.Count;
foreach(Track currentTrack in inputTracks)
{
discTask.Description =
string.Format(UI.Hashing_track_0_of_1, discTask.Value + 1,
inputTracks.Count);
foreach(Track currentTrack in inputTracks)
{
discTask.Description =
string.Format(UI.Hashing_track_0_of_1, discTask.Value + 1,
inputTracks.Count);
ProgressTask trackTask = ctx.AddTask(UI.Hashing_sector);
ProgressTask trackTask = ctx.AddTask(UI.Hashing_sector);
/*
if(currentTrack.StartSector - previousTrackEnd != 0 && wholeDisc)
for(ulong i = previousTrackEnd + 1; i < currentTrack.StartSector; i++)
{
AaruConsole.Write("\rHashing track-less sector {0}", i);
/*
if(currentTrack.StartSector - previousTrackEnd != 0 && wholeDisc)
for(ulong i = previousTrackEnd + 1; i < currentTrack.StartSector; i++)
{
AaruConsole.Write("\rHashing track-less sector {0}", i);
byte[] hiddenSector = inputFormat.ReadSector(i);
byte[] hiddenSector = inputFormat.ReadSector(i);
mediaChecksum?.Update(hiddenSector);
}
*/
mediaChecksum?.Update(hiddenSector);
}
*/
AaruConsole.DebugWriteLine(MODULE_NAME,
UI.
Track_0_starts_at_sector_1_and_ends_at_sector_2,
currentTrack.Sequence,
currentTrack.StartSector,
currentTrack.EndSector);
AaruConsole.DebugWriteLine(MODULE_NAME,
UI.
Track_0_starts_at_sector_1_and_ends_at_sector_2,
currentTrack.Sequence,
currentTrack.StartSector,
currentTrack.EndSector);
if(separatedTracks)
trackChecksum = new Checksum(enabledChecksums);
if(separatedTracks)
trackChecksum = new Checksum(enabledChecksums);
ulong sectors = currentTrack.EndSector - currentTrack.StartSector + 1;
ulong sectors = currentTrack.EndSector - currentTrack.StartSector + 1;
trackTask.MaxValue = sectors;
trackTask.MaxValue = sectors;
ulong doneSectors = 0;
ulong doneSectors = 0;
while(doneSectors < sectors)
{
byte[] sector;
while(doneSectors < sectors)
{
byte[] sector;
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = opticalInput.ReadSectors(doneSectors, SECTORS_TO_READ,
currentTrack.Sequence, out sector);
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = opticalInput.ReadSectors(doneSectors, SECTORS_TO_READ,
currentTrack.Sequence, out sector);
trackTask.Description =
string.Format(UI.Hashing_sectors_0_to_2_of_track_1,
doneSectors,
currentTrack.Sequence,
doneSectors + SECTORS_TO_READ);
trackTask.Description =
string.Format(UI.Hashing_sectors_0_to_2_of_track_1,
doneSectors,
currentTrack.Sequence,
doneSectors + SECTORS_TO_READ);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.
Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors));
return;
}
return;
}
doneSectors += SECTORS_TO_READ;
}
else
{
errno = opticalInput.ReadSectors(doneSectors,
(uint)(sectors - doneSectors), currentTrack.Sequence,
out sector);
doneSectors += SECTORS_TO_READ;
}
else
{
errno = opticalInput.ReadSectors(doneSectors,
(uint)(sectors - doneSectors), currentTrack.Sequence,
out sector);
trackTask.Description =
string.Format(UI.Hashing_sectors_0_to_2_of_track_1,
doneSectors,
currentTrack.Sequence,
doneSectors + (sectors - doneSectors));
trackTask.Description =
string.Format(UI.Hashing_sectors_0_to_2_of_track_1,
doneSectors,
currentTrack.Sequence,
doneSectors + (sectors - doneSectors));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.
Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors));
return;
}
return;
}
doneSectors += sectors - doneSectors;
}
doneSectors += sectors - doneSectors;
}
if(wholeDisc)
mediaChecksum?.Update(sector);
if(wholeDisc)
mediaChecksum?.Update(sector);
if(separatedTracks)
trackChecksum?.Update(sector);
if(separatedTracks)
trackChecksum?.Update(sector);
trackTask.Value = doneSectors;
}
trackTask.Value = doneSectors;
}
trackTask.StopTask();
AaruConsole.WriteLine();
trackTask.StopTask();
AaruConsole.WriteLine();
if(!separatedTracks)
continue;
if(!separatedTracks)
continue;
if(trackChecksum == null)
continue;
if(trackChecksum == null)
continue;
foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_Track_0_has_1,
currentTrack.Sequence, chk.Type)}[/] {chk.Value}");
}
foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_Track_0_has_1,
currentTrack.Sequence, chk.Type)}[/] {chk.Value}");
}
discTask.Increment(1);
}
discTask.Increment(1);
}
/*
if(opticalInput.Info.Sectors - previousTrackEnd != 0 && wholeDisc)
for(ulong i = previousTrackEnd + 1; i < opticalInput.Info.Sectors; i++)
{
AaruConsole.Write("\rHashing track-less sector {0}", i);
/*
if(opticalInput.Info.Sectors - previousTrackEnd != 0 && wholeDisc)
for(ulong i = previousTrackEnd + 1; i < opticalInput.Info.Sectors; i++)
{
AaruConsole.Write("\rHashing track-less sector {0}", i);
byte[] hiddenSector = inputFormat.ReadSector(i);
mediaChecksum?.Update(hiddenSector);
}
*/
byte[] hiddenSector = inputFormat.ReadSector(i);
mediaChecksum?.Update(hiddenSector);
}
*/
if(!wholeDisc)
return;
if(!wholeDisc)
return;
if(mediaChecksum == null)
return;
if(mediaChecksum == null)
return;
AaruConsole.WriteLine();
AaruConsole.WriteLine();
foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_Disc_has_0, chk.Type)
}:[/] {chk.Value}");
}
});
foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_Disc_has_0, chk.Type)
}:[/] {chk.Value}");
}
});
if(errno != ErrorNumber.NoError)
return (int)errno;
@@ -426,166 +430,170 @@ sealed class ChecksumCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask tapeTask = ctx.AddTask(Localization.Core.Hashing_files);
tapeTask.MaxValue = tapeImage.Files.Count;
{
ProgressTask tapeTask = ctx.AddTask(Localization.Core.Hashing_files);
tapeTask.MaxValue = tapeImage.Files.Count;
foreach(TapeFile currentFile in tapeImage.Files)
{
tapeTask.Description =
string.Format(UI.Hashing_file_0_of_1, currentFile.File,
tapeImage.Files.Count);
foreach(TapeFile currentFile in tapeImage.Files)
{
tapeTask.Description =
string.Format(UI.Hashing_file_0_of_1, currentFile.File,
tapeImage.Files.Count);
if(currentFile.FirstBlock - previousFileEnd != 0 && wholeDisc)
{
ProgressTask preFileTask = ctx.AddTask(UI.Hashing_sector);
preFileTask.MaxValue = currentFile.FirstBlock - previousFileEnd;
if(currentFile.FirstBlock - previousFileEnd != 0 && wholeDisc)
{
ProgressTask preFileTask = ctx.AddTask(UI.Hashing_sector);
preFileTask.MaxValue = currentFile.FirstBlock - previousFileEnd;
for(ulong i = previousFileEnd + 1; i < currentFile.FirstBlock; i++)
{
preFileTask.Description =
string.Format(UI.Hashing_file_less_block_0, i);
for(ulong i = previousFileEnd + 1; i < currentFile.FirstBlock; i++)
{
preFileTask.Description =
string.Format(UI.Hashing_file_less_block_0, i);
errno = tapeImage.ReadSector(i, out byte[] hiddenSector);
errno = tapeImage.ReadSector(i, out byte[] hiddenSector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.Format(UI.Error_0_while_reading_block_1,
errno, i));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.Format(UI.Error_0_while_reading_block_1,
errno, i));
return;
}
return;
}
mediaChecksum?.Update(hiddenSector);
preFileTask.Increment(1);
}
mediaChecksum?.Update(hiddenSector);
preFileTask.Increment(1);
}
preFileTask.StopTask();
}
preFileTask.StopTask();
}
AaruConsole.DebugWriteLine(MODULE_NAME,
UI.File_0_starts_at_block_1_and_ends_at_block_2,
currentFile.File, currentFile.FirstBlock,
currentFile.LastBlock);
AaruConsole.DebugWriteLine(MODULE_NAME,
UI.File_0_starts_at_block_1_and_ends_at_block_2,
currentFile.File, currentFile.FirstBlock,
currentFile.LastBlock);
if(separatedTracks)
trackChecksum = new Checksum(enabledChecksums);
if(separatedTracks)
trackChecksum = new Checksum(enabledChecksums);
ulong sectors = currentFile.LastBlock - currentFile.FirstBlock + 1;
ulong doneSectors = 0;
ulong sectors = currentFile.LastBlock - currentFile.FirstBlock + 1;
ulong doneSectors = 0;
ProgressTask fileTask = ctx.AddTask(UI.Hashing_sector);
fileTask.MaxValue = sectors;
ProgressTask fileTask = ctx.AddTask(UI.Hashing_sector);
fileTask.MaxValue = sectors;
while(doneSectors < sectors)
{
byte[] sector;
while(doneSectors < sectors)
{
byte[] sector;
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = tapeImage.ReadSectors(doneSectors + currentFile.FirstBlock,
SECTORS_TO_READ, out sector);
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = tapeImage.ReadSectors(doneSectors + currentFile.FirstBlock,
SECTORS_TO_READ, out sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors +
currentFile.FirstBlock));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.
Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors +
currentFile.FirstBlock));
return;
}
return;
}
fileTask.Description =
string.Format(UI.Hashing_blocks_0_to_2_of_file_1, doneSectors,
currentFile.File, doneSectors + SECTORS_TO_READ);
fileTask.Description =
string.Format(UI.Hashing_blocks_0_to_2_of_file_1, doneSectors,
currentFile.File, doneSectors + SECTORS_TO_READ);
doneSectors += SECTORS_TO_READ;
}
else
{
errno = tapeImage.ReadSectors(doneSectors + currentFile.FirstBlock,
(uint)(sectors - doneSectors),
out sector);
doneSectors += SECTORS_TO_READ;
}
else
{
errno = tapeImage.ReadSectors(doneSectors + currentFile.FirstBlock,
(uint)(sectors - doneSectors),
out sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors +
currentFile.FirstBlock));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.
Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors +
currentFile.FirstBlock));
return;
}
return;
}
fileTask.Description =
string.Format(UI.Hashing_blocks_0_to_2_of_file_1, doneSectors,
currentFile.File,
doneSectors + (sectors - doneSectors));
fileTask.Description =
string.Format(UI.Hashing_blocks_0_to_2_of_file_1, doneSectors,
currentFile.File,
doneSectors + (sectors - doneSectors));
doneSectors += sectors - doneSectors;
}
doneSectors += sectors - doneSectors;
}
fileTask.Value = doneSectors;
fileTask.Value = doneSectors;
if(wholeDisc)
mediaChecksum?.Update(sector);
if(wholeDisc)
mediaChecksum?.Update(sector);
if(separatedTracks)
trackChecksum?.Update(sector);
}
if(separatedTracks)
trackChecksum?.Update(sector);
}
fileTask.StopTask();
AaruConsole.WriteLine();
fileTask.StopTask();
AaruConsole.WriteLine();
if(separatedTracks)
{
if(trackChecksum != null)
{
foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_File_0_has_1,
currentFile.File, chk.Type)}[/]: {chk.Value}");
}
}
}
if(separatedTracks)
{
if(trackChecksum != null)
{
foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End())
{
AaruConsole.
WriteLine($"[bold]{string.Format(UI.Checksums_File_0_has_1,
currentFile.File, chk.Type)}[/]: {chk.Value}");
}
}
}
previousFileEnd = currentFile.LastBlock;
previousFileEnd = currentFile.LastBlock;
tapeTask.Increment(1);
}
tapeTask.Increment(1);
}
if(tapeImage.Info.Sectors - previousFileEnd == 0 ||
!wholeDisc)
return;
if(tapeImage.Info.Sectors - previousFileEnd == 0 ||
!wholeDisc)
return;
ProgressTask postFileTask = ctx.AddTask(UI.Hashing_sector);
postFileTask.MaxValue = tapeImage.Info.Sectors - previousFileEnd;
ProgressTask postFileTask = ctx.AddTask(UI.Hashing_sector);
postFileTask.MaxValue = tapeImage.Info.Sectors - previousFileEnd;
for(ulong i = previousFileEnd + 1; i < tapeImage.Info.Sectors; i++)
{
postFileTask.Description = string.Format(UI.Hashing_file_less_block_0, i);
for(ulong i = previousFileEnd + 1; i < tapeImage.Info.Sectors; i++)
{
postFileTask.Description = string.Format(UI.Hashing_file_less_block_0, i);
errno = tapeImage.ReadSector(i, out byte[] hiddenSector);
errno = tapeImage.ReadSector(i, out byte[] hiddenSector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.ErrorWriteLine(string.Format(UI.Error_0_while_reading_block_1,
errno, i));
if(errno != ErrorNumber.NoError)
{
AaruConsole.ErrorWriteLine(string.Format(UI.Error_0_while_reading_block_1,
errno, i));
return;
}
return;
}
mediaChecksum?.Update(hiddenSector);
postFileTask.Increment(1);
}
});
mediaChecksum?.Update(hiddenSector);
postFileTask.Increment(1);
}
});
if(errno != ErrorNumber.NoError)
return (int)errno;
@@ -611,68 +619,68 @@ sealed class ChecksumCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask imageTask = ctx.AddTask(UI.Hashing_image);
ulong length = byteAddressableImage.Info.Sectors;
imageTask.MaxValue = length;
ulong doneBytes = 0;
var data = new byte[BYTES_TO_READ];
{
ProgressTask imageTask = ctx.AddTask(UI.Hashing_image);
ulong length = byteAddressableImage.Info.Sectors;
imageTask.MaxValue = length;
ulong doneBytes = 0;
var data = new byte[BYTES_TO_READ];
while(doneBytes < length)
{
int bytesRead;
while(doneBytes < length)
{
int bytesRead;
if(length - doneBytes >= BYTES_TO_READ)
{
errno = byteAddressableImage.ReadBytes(data, 0, BYTES_TO_READ,
out bytesRead);
if(length - doneBytes >= BYTES_TO_READ)
{
errno = byteAddressableImage.ReadBytes(data, 0, BYTES_TO_READ,
out bytesRead);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_bytes_from_2,
errno, BYTES_TO_READ, doneBytes));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_bytes_from_2,
errno, BYTES_TO_READ, doneBytes));
return;
}
return;
}
imageTask.Description =
string.Format(UI.Hashing_bytes_0_to_1, doneBytes,
doneBytes + BYTES_TO_READ);
imageTask.Description =
string.Format(UI.Hashing_bytes_0_to_1, doneBytes,
doneBytes + BYTES_TO_READ);
doneBytes += (ulong)bytesRead;
doneBytes += (ulong)bytesRead;
if(bytesRead == 0)
break;
}
else
{
errno = byteAddressableImage.ReadBytes(data, 0, (int)(length - doneBytes),
out bytesRead);
if(bytesRead == 0)
break;
}
else
{
errno = byteAddressableImage.ReadBytes(data, 0, (int)(length - doneBytes),
out bytesRead);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_bytes_from_2,
errno, length - doneBytes,
doneBytes));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_bytes_from_2,
errno, length - doneBytes,
doneBytes));
return;
}
return;
}
imageTask.Description =
string.Format(UI.Hashing_bytes_0_to_1, doneBytes,
doneBytes + (length - doneBytes));
imageTask.Description =
string.Format(UI.Hashing_bytes_0_to_1, doneBytes,
doneBytes + (length - doneBytes));
doneBytes += length - doneBytes;
}
doneBytes += length - doneBytes;
}
mediaChecksum.Update(data);
imageTask.Value = doneBytes;
}
});
mediaChecksum.Update(data);
imageTask.Value = doneBytes;
}
});
if(errno != ErrorNumber.NoError)
return (int)errno;
@@ -693,64 +701,66 @@ sealed class ChecksumCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask diskTask = ctx.AddTask(Localization.Core.Hashing_sectors);
ulong sectors = mediaImage.Info.Sectors;
diskTask.MaxValue = sectors;
ulong doneSectors = 0;
{
ProgressTask diskTask = ctx.AddTask(Localization.Core.Hashing_sectors);
ulong sectors = mediaImage.Info.Sectors;
diskTask.MaxValue = sectors;
ulong doneSectors = 0;
while(doneSectors < sectors)
{
byte[] sector;
while(doneSectors < sectors)
{
byte[] sector;
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = mediaImage.ReadSectors(doneSectors, SECTORS_TO_READ, out sector);
if(sectors - doneSectors >= SECTORS_TO_READ)
{
errno = mediaImage.ReadSectors(doneSectors, SECTORS_TO_READ, out sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, SECTORS_TO_READ,
doneSectors));
return;
}
return;
}
diskTask.Description =
string.Format(UI.Hashing_sectors_0_to_1, doneSectors,
doneSectors + SECTORS_TO_READ);
diskTask.Description =
string.Format(UI.Hashing_sectors_0_to_1, doneSectors,
doneSectors + SECTORS_TO_READ);
doneSectors += SECTORS_TO_READ;
}
else
{
errno = mediaImage.ReadSectors(doneSectors, (uint)(sectors - doneSectors),
out sector);
doneSectors += SECTORS_TO_READ;
}
else
{
errno = mediaImage.ReadSectors(doneSectors, (uint)(sectors - doneSectors),
out sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors));
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(
UI.Error_0_while_reading_1_sectors_from_sector_2,
errno, sectors - doneSectors,
doneSectors));
return;
}
return;
}
diskTask.Description =
string.Format(UI.Hashing_sectors_0_to_1, doneSectors,
doneSectors + (sectors - doneSectors));
diskTask.Description =
string.Format(UI.Hashing_sectors_0_to_1, doneSectors,
doneSectors + (sectors - doneSectors));
doneSectors += sectors - doneSectors;
}
doneSectors += sectors - doneSectors;
}
mediaChecksum.Update(sector);
diskTask.Value = doneSectors;
}
});
mediaChecksum.Update(sector);
diskTask.Value = doneSectors;
}
});
if(errno != ErrorNumber.NoError)
return (int)errno;

View File

@@ -86,23 +86,23 @@ sealed class CompareCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("compare");
@@ -117,18 +117,18 @@ sealed class CompareCommand : Command
IFilter inputFilter2 = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_first_file_filter).IsIndeterminate();
inputFilter1 = filtersList.GetFilter(imagePath1);
});
{
ctx.AddTask(UI.Identifying_first_file_filter).IsIndeterminate();
inputFilter1 = filtersList.GetFilter(imagePath1);
});
filtersList = new FiltersList();
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_second_file_filter).IsIndeterminate();
inputFilter2 = filtersList.GetFilter(imagePath2);
});
{
ctx.AddTask(UI.Identifying_second_file_filter).IsIndeterminate();
inputFilter2 = filtersList.GetFilter(imagePath2);
});
if(inputFilter1 == null)
{
@@ -148,16 +148,16 @@ sealed class CompareCommand : Command
IBaseImage input2Format = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_first_image_format).IsIndeterminate();
input1Format = ImageFormat.Detect(inputFilter1);
});
{
ctx.AddTask(UI.Identifying_first_image_format).IsIndeterminate();
input1Format = ImageFormat.Detect(inputFilter1);
});
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_second_image_format).IsIndeterminate();
input2Format = ImageFormat.Detect(inputFilter2);
});
{
ctx.AddTask(UI.Identifying_second_image_format).IsIndeterminate();
input2Format = ImageFormat.Detect(inputFilter2);
});
if(input1Format == null)
{
@@ -193,10 +193,10 @@ sealed class CompareCommand : Command
ErrorNumber opened2 = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Opening_first_image_file).IsIndeterminate();
opened1 = input1Format.Open(inputFilter1);
});
{
ctx.AddTask(UI.Opening_first_image_file).IsIndeterminate();
opened1 = input1Format.Open(inputFilter1);
});
if(opened1 != ErrorNumber.NoError)
{
@@ -207,10 +207,10 @@ sealed class CompareCommand : Command
}
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Opening_second_image_file).IsIndeterminate();
opened2 = input2Format.Open(inputFilter2);
});
{
ctx.AddTask(UI.Opening_second_image_file).IsIndeterminate();
opened2 = input2Format.Open(inputFilter2);
});
if(opened2 != ErrorNumber.NoError)
{
@@ -355,68 +355,68 @@ sealed class CompareCommand : Command
ulong leastSectors = 0;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Comparing_media_image_characteristics).IsIndeterminate();
{
ctx.AddTask(UI.Comparing_media_image_characteristics).IsIndeterminate();
if(image1Info.HasPartitions != image2Info.HasPartitions)
{
imagesDiffer = true;
if(image1Info.HasPartitions != image2Info.HasPartitions)
{
imagesDiffer = true;
if(!verbose)
sb.AppendLine(UI.Image_partitioned_status_differ);
}
if(!verbose)
sb.AppendLine(UI.Image_partitioned_status_differ);
}
if(image1Info.HasSessions != image2Info.HasSessions)
{
imagesDiffer = true;
if(image1Info.HasSessions != image2Info.HasSessions)
{
imagesDiffer = true;
if(!verbose)
sb.AppendLine(UI.Image_session_status_differ);
}
if(!verbose)
sb.AppendLine(UI.Image_session_status_differ);
}
if(image1Info.Sectors != image2Info.Sectors)
{
imagesDiffer = true;
if(image1Info.Sectors != image2Info.Sectors)
{
imagesDiffer = true;
if(!verbose)
sb.AppendLine(UI.Image_sectors_differ);
}
if(!verbose)
sb.AppendLine(UI.Image_sectors_differ);
}
if(image1Info.SectorSize != image2Info.SectorSize)
{
imagesDiffer = true;
if(image1Info.SectorSize != image2Info.SectorSize)
{
imagesDiffer = true;
if(!verbose)
sb.AppendLine(UI.Image_sector_size_differ);
}
if(!verbose)
sb.AppendLine(UI.Image_sector_size_differ);
}
if(image1Info.MediaType != image2Info.MediaType)
{
imagesDiffer = true;
if(image1Info.MediaType != image2Info.MediaType)
{
imagesDiffer = true;
if(!verbose)
sb.AppendLine(UI.Media_type_differs);
}
if(!verbose)
sb.AppendLine(UI.Media_type_differs);
}
if(image1Info.Sectors < image2Info.Sectors)
{
imagesDiffer = true;
leastSectors = image1Info.Sectors;
if(image1Info.Sectors < image2Info.Sectors)
{
imagesDiffer = true;
leastSectors = image1Info.Sectors;
if(!verbose)
sb.AppendLine(UI.Second_image_has_more_sectors);
}
else if(image1Info.Sectors > image2Info.Sectors)
{
imagesDiffer = true;
leastSectors = image2Info.Sectors;
if(!verbose)
sb.AppendLine(UI.Second_image_has_more_sectors);
}
else if(image1Info.Sectors > image2Info.Sectors)
{
imagesDiffer = true;
leastSectors = image2Info.Sectors;
if(!verbose)
sb.AppendLine(UI.First_image_has_more_sectors);
}
else
leastSectors = image1Info.Sectors;
});
if(!verbose)
sb.AppendLine(UI.First_image_has_more_sectors);
}
else
leastSectors = image1Info.Sectors;
});
var input1ByteAddressable = input1Format as IByteAddressableImage;
var input2ByteAddressable = input2Format as IByteAddressableImage;
@@ -443,59 +443,59 @@ sealed class CompareCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask task = ctx.AddTask(UI.Comparing_sectors);
task.MaxValue = leastSectors;
{
ProgressTask task = ctx.AddTask(UI.Comparing_sectors);
task.MaxValue = leastSectors;
for(ulong sector = 0; sector < leastSectors; sector++)
{
task.Value = sector;
task.Description =
string.Format(UI.Comparing_sector_0_of_1, sector + 1, leastSectors);
for(ulong sector = 0; sector < leastSectors; sector++)
{
task.Value = sector;
task.Description =
string.Format(UI.Comparing_sector_0_of_1, sector + 1, leastSectors);
try
{
errno = input1MediaImage.ReadSector(sector, out byte[] image1Sector);
try
{
errno = input1MediaImage.ReadSector(sector, out byte[] image1Sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_reading_sector_1_from_first_image,
errno, sector));
}
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_reading_sector_1_from_first_image,
errno, sector));
}
errno = input2MediaImage.ReadSector(sector, out byte[] image2Sector);
errno = input2MediaImage.ReadSector(sector, out byte[] image2Sector);
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_reading_sector_1_from_second_image,
errno, sector));
}
if(errno != ErrorNumber.NoError)
{
AaruConsole.
ErrorWriteLine(string.
Format(UI.Error_0_reading_sector_1_from_second_image,
errno, sector));
}
ArrayHelpers.CompareBytes(out bool different, out bool sameSize, image1Sector,
image2Sector);
ArrayHelpers.CompareBytes(out bool different, out bool sameSize, image1Sector,
image2Sector);
if(different)
imagesDiffer = true;
if(different)
imagesDiffer = true;
// sb.AppendFormat("Sector {0} is different", sector).AppendLine();
else if(!sameSize)
imagesDiffer = true;
/* sb.
AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical",
sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine();*/
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch
{
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
}
});
// sb.AppendFormat("Sector {0} is different", sector).AppendLine();
else if(!sameSize)
imagesDiffer = true;
/* sb.
AppendFormat("Sector {0} has different sizes ({1} bytes in image 1, {2} in image 2) but are otherwise identical",
sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine();*/
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch
{
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
}
});
}
if(input1ByteAddressable is not null &&
@@ -504,39 +504,39 @@ sealed class CompareCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask task = ctx.AddTask(UI.Comparing_images);
task.IsIndeterminate = true;
{
ProgressTask task = ctx.AddTask(UI.Comparing_images);
task.IsIndeterminate = true;
var data1 = new byte[input1ByteAddressable.Info.Sectors];
var data2 = new byte[input2ByteAddressable.Info.Sectors];
byte[] tmp;
var data1 = new byte[input1ByteAddressable.Info.Sectors];
var data2 = new byte[input2ByteAddressable.Info.Sectors];
byte[] tmp;
input1ByteAddressable.ReadBytes(data1, 0, data1.Length, out int bytesRead);
input1ByteAddressable.ReadBytes(data1, 0, data1.Length, out int bytesRead);
if(bytesRead != data1.Length)
{
tmp = new byte[bytesRead];
Array.Copy(data1, 0, tmp, 0, bytesRead);
data1 = tmp;
}
if(bytesRead != data1.Length)
{
tmp = new byte[bytesRead];
Array.Copy(data1, 0, tmp, 0, bytesRead);
data1 = tmp;
}
input2ByteAddressable.ReadBytes(data2, 0, data2.Length, out bytesRead);
input2ByteAddressable.ReadBytes(data2, 0, data2.Length, out bytesRead);
if(bytesRead != data2.Length)
{
tmp = new byte[bytesRead];
Array.Copy(data2, 0, tmp, 0, bytesRead);
data2 = tmp;
}
if(bytesRead != data2.Length)
{
tmp = new byte[bytesRead];
Array.Copy(data2, 0, tmp, 0, bytesRead);
data2 = tmp;
}
ArrayHelpers.CompareBytes(out bool different, out bool sameSize, data1, data2);
ArrayHelpers.CompareBytes(out bool different, out bool sameSize, data1, data2);
if(different)
imagesDiffer = true;
else if(!sameSize)
imagesDiffer = true;
});
if(different)
imagesDiffer = true;
else if(!sameSize)
imagesDiffer = true;
});
}
AaruConsole.WriteLine();

File diff suppressed because it is too large Load Diff

View File

@@ -88,23 +88,23 @@ sealed class CreateSidecarCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("create-sidecar");
@@ -148,10 +148,10 @@ sealed class CreateSidecarCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -165,10 +165,10 @@ sealed class CreateSidecarCommand : Command
IBaseImage imageFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
imageFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
imageFormat = ImageFormat.Detect(inputFilter);
});
if(imageFormat == null)
{
@@ -187,10 +187,10 @@ sealed class CreateSidecarCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -219,80 +219,76 @@ sealed class CreateSidecarCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
sidecarClass.InitProgressEvent += () =>
{
_progressTask1 = ctx.AddTask("Progress");
};
{
sidecarClass.InitProgressEvent += () => { _progressTask1 = ctx.AddTask("Progress"); };
sidecarClass.InitProgressEvent2 += () =>
{
_progressTask2 = ctx.AddTask("Progress");
};
sidecarClass.InitProgressEvent2 += () => { _progressTask2 = ctx.AddTask("Progress"); };
sidecarClass.UpdateProgressEvent += (text, current, maximum) =>
{
_progressTask1 ??=
ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent += (text, current, maximum) =>
{
_progressTask1 ??=
ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent2 += (text, current, maximum) =>
{
_progressTask2 ??=
ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent2 += (text, current, maximum) =>
{
_progressTask2 ??=
ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
sidecarClass.EndProgressEvent += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
sidecarClass.EndProgressEvent += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
sidecarClass.EndProgressEvent2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
sidecarClass.EndProgressEvent2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
sidecarClass.UpdateStatusEvent += text =>
{
AaruConsole.WriteLine(Markup.Escape(text));
};
sidecarClass.UpdateStatusEvent += text =>
{
AaruConsole.WriteLine(Markup.Escape(text));
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
sidecarClass.Abort();
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
sidecarClass.Abort();
};
sidecar = sidecarClass.Create();
});
sidecar = sidecarClass.Create();
});
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(Localization.Core.Writing_metadata_sidecar).
IsIndeterminate();
{
ctx.AddTask(Localization.Core.Writing_metadata_sidecar).
IsIndeterminate();
var jsonFs =
new
FileStream(Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
FileMode.Create);
var jsonFs =
new
FileStream(
Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(),
Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
FileMode.Create);
JsonSerializer.Serialize(jsonFs, new MetadataJson
{
AaruMetadata = sidecar
}, typeof(MetadataJson), MetadataJsonContext.Default);
JsonSerializer.Serialize(jsonFs, new MetadataJson
{
AaruMetadata = sidecar
}, typeof(MetadataJson), MetadataJsonContext.Default);
jsonFs.Close();
});
jsonFs.Close();
});
}
catch(Exception ex)
{
@@ -322,75 +318,71 @@ sealed class CreateSidecarCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
sidecarClass.InitProgressEvent += () => { _progressTask1 = ctx.AddTask("Progress"); };
{
sidecarClass.InitProgressEvent += () => { _progressTask1 = ctx.AddTask("Progress"); };
sidecarClass.InitProgressEvent2 += () =>
{
_progressTask2 = ctx.AddTask("Progress");
};
sidecarClass.InitProgressEvent2 += () => { _progressTask2 = ctx.AddTask("Progress"); };
sidecarClass.UpdateProgressEvent += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent2 += (text, current, maximum) =>
{
_progressTask2 ??= ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
sidecarClass.UpdateProgressEvent2 += (text, current, maximum) =>
{
_progressTask2 ??= ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
sidecarClass.EndProgressEvent += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
sidecarClass.EndProgressEvent += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
sidecarClass.EndProgressEvent2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
sidecarClass.EndProgressEvent2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
sidecarClass.UpdateStatusEvent += text =>
{
AaruConsole.WriteLine(Markup.Escape(text));
};
sidecarClass.UpdateStatusEvent += text => { AaruConsole.WriteLine(Markup.Escape(text)); };
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
sidecarClass.Abort();
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
sidecarClass.Abort();
};
sidecar = sidecarClass.BlockTape(Path.GetFileName(imagePath), files, blockSize);
});
sidecar = sidecarClass.BlockTape(Path.GetFileName(imagePath), files, blockSize);
});
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(Localization.Core.Writing_metadata_sidecar).
IsIndeterminate();
{
ctx.AddTask(Localization.Core.Writing_metadata_sidecar).
IsIndeterminate();
var jsonFs =
new
FileStream(Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
FileMode.Create);
var jsonFs =
new
FileStream(
Path.Combine(Path.GetDirectoryName(imagePath) ?? throw new InvalidOperationException(),
Path.GetFileNameWithoutExtension(imagePath) + ".metadata.json"),
FileMode.Create);
JsonSerializer.Serialize(jsonFs, new MetadataJson
{
AaruMetadata = sidecar
}, typeof(MetadataJson), MetadataJsonContext.Default);
JsonSerializer.Serialize(jsonFs, new MetadataJson
{
AaruMetadata = sidecar
}, typeof(MetadataJson), MetadataJsonContext.Default);
jsonFs.Close();
});
jsonFs.Close();
});
}
else
AaruConsole.ErrorWriteLine(UI.The_specified_input_file_cannot_be_found);

View File

@@ -84,23 +84,23 @@ sealed class DecodeCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("decode");
@@ -117,10 +117,10 @@ sealed class DecodeCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -133,11 +133,11 @@ sealed class DecodeCommand : Command
IBaseImage baseImage = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
inputFormat = baseImage as IMediaImage;
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
baseImage = ImageFormat.Detect(inputFilter);
inputFormat = baseImage as IMediaImage;
});
if(baseImage == null)
{
@@ -156,10 +156,10 @@ sealed class DecodeCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -195,12 +195,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.SCSI_INQUIRY_command_response}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(Inquiry.Prettify(inquiry));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -219,12 +221,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.ATA_IDENTIFY_DEVICE_command_response}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(Identify.Prettify(identify));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -244,12 +248,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.ATA_IDENTIFY_PACKET_DEVICE_command_response}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(Identify.Prettify(identify));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -265,12 +271,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.CD_ATIP}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(ATIP.Prettify(atip));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -286,12 +294,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.CD_full_TOC}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(FullTOC.Prettify(fullToc));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -307,12 +317,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{"CD PMA:"}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(PMA.Prettify(pma));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -328,12 +340,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.CD_session_information}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(Session.Prettify(sessionInfo));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -349,12 +363,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.CD_TEXT}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(CDTextOnLeadIn.Prettify(cdText));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;
@@ -371,12 +387,14 @@ sealed class DecodeCommand : Command
AaruConsole.WriteLine($"[bold]{UI.CD_TOC}[/]");
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
AaruConsole.WriteLine(TOC.Prettify(toc));
AaruConsole.
WriteLine("================================================================================");
WriteLine(
"================================================================================");
}
break;

View File

@@ -81,23 +81,23 @@ sealed class EntropyCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("entropy");
@@ -113,10 +113,10 @@ sealed class EntropyCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -128,10 +128,10 @@ sealed class EntropyCommand : Command
IBaseImage inputFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
if(inputFormat == null)
{
@@ -143,10 +143,10 @@ sealed class EntropyCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -166,48 +166,48 @@ sealed class EntropyCommand : Command
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).Start(ctx =>
{
entropyCalculator.InitProgressEvent += () =>
{
_progressTask1 =
ctx.AddTask("Progress");
};
{
_progressTask1 =
ctx.AddTask("Progress");
};
entropyCalculator.InitProgress2Event += () =>
{
_progressTask2 =
ctx.AddTask("Progress");
};
{
_progressTask2 =
ctx.AddTask("Progress");
};
entropyCalculator.UpdateProgressEvent += (text, current, maximum) =>
{
_progressTask1 ??=
ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
{
_progressTask1 ??=
ctx.AddTask("Progress");
_progressTask1.Description =
Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
entropyCalculator.UpdateProgress2Event += (text, current, maximum) =>
{
_progressTask2 ??=
ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
{
_progressTask2 ??=
ctx.AddTask("Progress");
_progressTask2.Description =
Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
entropyCalculator.EndProgressEvent += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
entropyCalculator.EndProgress2Event += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
if(wholeDisc && inputFormat is IOpticalMediaImage opticalFormat)
{

View File

@@ -71,23 +71,23 @@ sealed class ImageInfoCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("image-info");
@@ -100,10 +100,10 @@ sealed class ImageInfoCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -117,10 +117,10 @@ sealed class ImageInfoCommand : Command
IBaseImage imageFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
imageFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
imageFormat = ImageFormat.Detect(inputFilter);
});
if(imageFormat == null)
{
@@ -137,10 +137,10 @@ sealed class ImageInfoCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = imageFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{

View File

@@ -64,23 +64,23 @@ sealed class ListOptionsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);

View File

@@ -81,23 +81,23 @@ sealed class PrintHexCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("print-hex");
@@ -114,10 +114,10 @@ sealed class PrintHexCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -129,10 +129,10 @@ sealed class PrintHexCommand : Command
IBaseImage inputFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
if(inputFormat == null)
{
@@ -144,10 +144,10 @@ sealed class PrintHexCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -168,13 +168,13 @@ sealed class PrintHexCommand : Command
var bytesRead = 0;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Reading_data).IsIndeterminate();
{
ctx.AddTask(UI.Reading_data).IsIndeterminate();
errno = byteAddressableImage?.ReadBytesAt((long)start, data, 0,
(int)length, out bytesRead) ??
ErrorNumber.InvalidArgument;
});
errno = byteAddressableImage?.ReadBytesAt((long)start, data, 0,
(int)length, out bytesRead) ??
ErrorNumber.InvalidArgument;
});
// TODO: Span
if(bytesRead != (int)length)
@@ -223,13 +223,13 @@ sealed class PrintHexCommand : Command
ErrorNumber errno = ErrorNumber.NoError;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Reading_sector).IsIndeterminate();
{
ctx.AddTask(UI.Reading_sector).IsIndeterminate();
errno = longSectors
? blockImage.ReadSectorLong(start + i, out sector)
: blockImage.ReadSector(start + i, out sector);
});
errno = longSectors
? blockImage.ReadSectorLong(start + i, out sector)
: blockImage.ReadSector(start + i, out sector);
});
if(errno == ErrorNumber.NoError)
AaruConsole.WriteLine(Markup.Escape(PrintHex.ByteArrayToHexArrayString(sector, width, true)));

View File

@@ -86,23 +86,23 @@ sealed class VerifyCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("verify");
@@ -119,10 +119,10 @@ sealed class VerifyCommand : Command
IFilter inputFilter = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
{
ctx.AddTask(UI.Identifying_file_filter).IsIndeterminate();
inputFilter = filtersList.GetFilter(imagePath);
});
if(inputFilter == null)
{
@@ -134,10 +134,10 @@ sealed class VerifyCommand : Command
IBaseImage inputFormat = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
{
ctx.AddTask(UI.Identifying_image_format).IsIndeterminate();
inputFormat = ImageFormat.Detect(inputFilter);
});
if(inputFormat == null)
{
@@ -149,10 +149,10 @@ sealed class VerifyCommand : Command
ErrorNumber opened = ErrorNumber.NoData;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
{
ctx.AddTask(UI.Invoke_Opening_image_file).IsIndeterminate();
opened = inputFormat.Open(inputFilter);
});
if(opened != ErrorNumber.NoError)
{
@@ -187,13 +187,13 @@ sealed class VerifyCommand : Command
bool? discCheckStatus = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Verifying_image_checksums).IsIndeterminate();
{
ctx.AddTask(UI.Verifying_image_checksums).IsIndeterminate();
chkWatch.Start();
discCheckStatus = verifiableImage.VerifyMediaImage();
chkWatch.Stop();
});
chkWatch.Start();
discCheckStatus = verifiableImage.VerifyMediaImage();
chkWatch.Stop();
});
switch(discCheckStatus)
{
@@ -255,96 +255,96 @@ sealed class VerifyCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask discTask = ctx.AddTask(UI.Checking_tracks);
discTask.MaxValue = inputTracks.Count;
{
ProgressTask discTask = ctx.AddTask(UI.Checking_tracks);
discTask.MaxValue = inputTracks.Count;
foreach(Track currentTrack in inputTracks)
{
discTask.Description =
string.Format(UI.Checking_track_0_of_1, discTask.Value + 1,
inputTracks.Count);
foreach(Track currentTrack in inputTracks)
{
discTask.Description =
string.Format(UI.Checking_track_0_of_1, discTask.Value + 1,
inputTracks.Count);
ulong remainingSectors = currentTrack.EndSector - currentTrack.StartSector + 1;
ulong remainingSectors = currentTrack.EndSector - currentTrack.StartSector + 1;
ulong currentSector = 0;
ulong currentSector = 0;
ProgressTask trackTask = ctx.AddTask(UI.Checking_sector);
trackTask.MaxValue = remainingSectors;
ProgressTask trackTask = ctx.AddTask(UI.Checking_sector);
trackTask.MaxValue = remainingSectors;
while(remainingSectors > 0)
{
trackTask.Description =
string.Format(UI.Checking_sector_0_of_1_on_track_2, currentSectorAll,
inputFormat.Info.Sectors, currentTrack.Sequence);
while(remainingSectors > 0)
{
trackTask.Description =
string.Format(UI.Checking_sector_0_of_1_on_track_2, currentSectorAll,
inputFormat.Info.Sectors, currentTrack.Sequence);
List<ulong> tempFailingLbas;
List<ulong> tempUnknownLbas;
List<ulong> tempFailingLbas;
List<ulong> tempUnknownLbas;
if(remainingSectors < 512)
{
opticalMediaImage.VerifySectors(currentSector, (uint)remainingSectors,
currentTrack.Sequence,
out tempFailingLbas,
out tempUnknownLbas);
}
else
{
opticalMediaImage.VerifySectors(currentSector, 512, currentTrack.Sequence,
out tempFailingLbas, out tempUnknownLbas);
}
if(remainingSectors < 512)
{
opticalMediaImage.VerifySectors(currentSector, (uint)remainingSectors,
currentTrack.Sequence,
out tempFailingLbas,
out tempUnknownLbas);
}
else
{
opticalMediaImage.VerifySectors(currentSector, 512, currentTrack.Sequence,
out tempFailingLbas, out tempUnknownLbas);
}
if(mediaGraph != null)
{
List<ulong> tempCorrectLbas = new();
if(mediaGraph != null)
{
List<ulong> tempCorrectLbas = new();
for(ulong l = 0;
l < (remainingSectors < 512 ? remainingSectors : 512);
l++)
tempCorrectLbas.Add(currentSector + l);
for(ulong l = 0;
l < (remainingSectors < 512 ? remainingSectors : 512);
l++)
tempCorrectLbas.Add(currentSector + l);
foreach(ulong f in tempFailingLbas)
tempCorrectLbas.Remove(f);
foreach(ulong f in tempFailingLbas)
tempCorrectLbas.Remove(f);
foreach(ulong u in tempUnknownLbas)
{
tempCorrectLbas.Remove(u);
mediaGraph.PaintSectorUnknown(currentTrack.StartSector + u);
}
foreach(ulong u in tempUnknownLbas)
{
tempCorrectLbas.Remove(u);
mediaGraph.PaintSectorUnknown(currentTrack.StartSector + u);
}
foreach(ulong lba in tempCorrectLbas)
mediaGraph.PaintSectorGood(currentTrack.StartSector + lba);
foreach(ulong lba in tempCorrectLbas)
mediaGraph.PaintSectorGood(currentTrack.StartSector + lba);
foreach(ulong f in tempFailingLbas)
mediaGraph.PaintSectorBad(currentTrack.StartSector + f);
}
foreach(ulong f in tempFailingLbas)
mediaGraph.PaintSectorBad(currentTrack.StartSector + f);
}
failingLbas.AddRange(tempFailingLbas);
failingLbas.AddRange(tempFailingLbas);
unknownLbas.AddRange(tempUnknownLbas);
unknownLbas.AddRange(tempUnknownLbas);
if(remainingSectors < 512)
{
currentSector += remainingSectors;
currentSectorAll += remainingSectors;
trackTask.Value += remainingSectors;
remainingSectors = 0;
}
else
{
currentSector += 512;
currentSectorAll += 512;
trackTask.Value += 512;
remainingSectors -= 512;
}
}
if(remainingSectors < 512)
{
currentSector += remainingSectors;
currentSectorAll += remainingSectors;
trackTask.Value += remainingSectors;
remainingSectors = 0;
}
else
{
currentSector += 512;
currentSectorAll += 512;
trackTask.Value += 512;
remainingSectors -= 512;
}
}
trackTask.StopTask();
discTask.Increment(1);
}
trackTask.StopTask();
discTask.Increment(1);
}
stopwatch.Stop();
});
stopwatch.Stop();
});
}
else if(verifiableSectorsImage != null)
{
@@ -354,71 +354,71 @@ sealed class VerifyCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
ProgressTask diskTask = ctx.AddTask(UI.Checking_sectors);
diskTask.MaxValue = inputFormat.Info.Sectors;
{
ProgressTask diskTask = ctx.AddTask(UI.Checking_sectors);
diskTask.MaxValue = inputFormat.Info.Sectors;
stopwatch.Restart();
stopwatch.Restart();
while(remainingSectors > 0)
{
diskTask.Description =
string.Format(UI.Checking_sector_0_of_1, currentSector,
inputFormat.Info.Sectors);
while(remainingSectors > 0)
{
diskTask.Description =
string.Format(UI.Checking_sector_0_of_1, currentSector,
inputFormat.Info.Sectors);
List<ulong> tempFailingLbas;
List<ulong> tempUnknownLbas;
List<ulong> tempFailingLbas;
List<ulong> tempUnknownLbas;
if(remainingSectors < 512)
{
verifiableSectorsImage.VerifySectors(currentSector, (uint)remainingSectors,
out tempFailingLbas,
out tempUnknownLbas);
}
else
{
verifiableSectorsImage.VerifySectors(currentSector, 512, out tempFailingLbas,
out tempUnknownLbas);
}
if(remainingSectors < 512)
{
verifiableSectorsImage.VerifySectors(currentSector, (uint)remainingSectors,
out tempFailingLbas,
out tempUnknownLbas);
}
else
{
verifiableSectorsImage.VerifySectors(currentSector, 512, out tempFailingLbas,
out tempUnknownLbas);
}
failingLbas.AddRange(tempFailingLbas);
failingLbas.AddRange(tempFailingLbas);
unknownLbas.AddRange(tempUnknownLbas);
unknownLbas.AddRange(tempUnknownLbas);
if(mediaGraph != null)
{
List<ulong> tempCorrectLbas = new();
if(mediaGraph != null)
{
List<ulong> tempCorrectLbas = new();
for(ulong l = 0; l < (remainingSectors < 512 ? remainingSectors : 512); l++)
tempCorrectLbas.Add(currentSector + l);
for(ulong l = 0; l < (remainingSectors < 512 ? remainingSectors : 512); l++)
tempCorrectLbas.Add(currentSector + l);
foreach(ulong f in tempFailingLbas)
tempCorrectLbas.Remove(f);
foreach(ulong f in tempFailingLbas)
tempCorrectLbas.Remove(f);
foreach(ulong u in tempUnknownLbas)
tempCorrectLbas.Remove(u);
foreach(ulong u in tempUnknownLbas)
tempCorrectLbas.Remove(u);
mediaGraph.PaintSectorsUnknown(tempUnknownLbas);
mediaGraph.PaintSectorsGood(tempCorrectLbas);
mediaGraph.PaintSectorsBad(tempFailingLbas);
}
mediaGraph.PaintSectorsUnknown(tempUnknownLbas);
mediaGraph.PaintSectorsGood(tempCorrectLbas);
mediaGraph.PaintSectorsBad(tempFailingLbas);
}
if(remainingSectors < 512)
{
currentSector += remainingSectors;
diskTask.Value += remainingSectors;
remainingSectors = 0;
}
else
{
currentSector += 512;
diskTask.Value += 512;
remainingSectors -= 512;
}
}
if(remainingSectors < 512)
{
currentSector += remainingSectors;
diskTask.Value += remainingSectors;
remainingSectors = 0;
}
else
{
currentSector += 512;
diskTask.Value += 512;
remainingSectors -= 512;
}
}
stopwatch.Stop();
});
stopwatch.Stop();
});
}
if(unknownLbas.Count > 0)

View File

@@ -61,23 +61,23 @@ sealed class ListEncodingsCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("list-encodings");

View File

@@ -63,23 +63,23 @@ sealed class ListNamespacesCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);

View File

@@ -178,23 +178,23 @@ sealed class DumpMediaCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
fixSubchannel |= fixSubchannelCrc;
@@ -395,10 +395,10 @@ sealed class DumpMediaCommand : Command
ErrorNumber devErrno = ErrorNumber.NoError;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
switch(dev)
{
@@ -635,119 +635,119 @@ sealed class DumpMediaCommand : Command
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).
Start(ctx =>
{
dumper.UpdateStatus += text => { AaruConsole.WriteLine(Markup.Escape(text)); };
{
dumper.UpdateStatus += text => { AaruConsole.WriteLine(Markup.Escape(text)); };
dumper.ErrorMessage += text =>
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
dumper.ErrorMessage += text =>
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
dumper.StoppingErrorMessage += text =>
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
dumper.StoppingErrorMessage += text =>
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
dumper.UpdateProgress += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
dumper.UpdateProgress += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
dumper.PulseProgress += text =>
{
if(_progressTask1 is null)
ctx.AddTask(Markup.Escape(text)).IsIndeterminate();
else
{
_progressTask1.Description = Markup.Escape(text);
_progressTask1.IsIndeterminate = true;
}
};
dumper.PulseProgress += text =>
{
if(_progressTask1 is null)
ctx.AddTask(Markup.Escape(text)).IsIndeterminate();
else
{
_progressTask1.Description = Markup.Escape(text);
_progressTask1.IsIndeterminate = true;
}
};
dumper.InitProgress += () => { _progressTask1 = ctx.AddTask("Progress"); };
dumper.InitProgress += () => { _progressTask1 = ctx.AddTask("Progress"); };
dumper.EndProgress += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
dumper.EndProgress += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
dumper.InitProgress2 += () => { _progressTask2 = ctx.AddTask("Progress"); };
dumper.InitProgress2 += () => { _progressTask2 = ctx.AddTask("Progress"); };
dumper.EndProgress2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
dumper.EndProgress2 += () =>
{
_progressTask2?.StopTask();
_progressTask2 = null;
};
dumper.UpdateProgress2 += (text, current, maximum) =>
{
_progressTask2 ??= ctx.AddTask("Progress");
_progressTask2.Description = Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
dumper.UpdateProgress2 += (text, current, maximum) =>
{
_progressTask2 ??= ctx.AddTask("Progress");
_progressTask2.Description = Markup.Escape(text);
_progressTask2.Value = current;
_progressTask2.MaxValue = maximum;
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
dumper.Abort();
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
dumper.Abort();
};
dumper.Start();
});
dumper.Start();
});
if(eject && dev.IsRemovable)
{
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Ejecting_media).IsIndeterminate();
{
ctx.AddTask(UI.Ejecting_media).IsIndeterminate();
switch(dev.Type)
{
case DeviceType.ATA:
dev.DoorUnlock(out _, dev.Timeout, out _);
dev.MediaEject(out _, dev.Timeout, out _);
switch(dev.Type)
{
case DeviceType.ATA:
dev.DoorUnlock(out _, dev.Timeout, out _);
dev.MediaEject(out _, dev.Timeout, out _);
break;
case DeviceType.ATAPI:
case DeviceType.SCSI:
switch(dev.ScsiType)
{
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.SimplifiedDevice:
case PeripheralDeviceTypes.SCSIZonedBlockDevice:
case PeripheralDeviceTypes.WriteOnceDevice:
case PeripheralDeviceTypes.OpticalDevice:
case PeripheralDeviceTypes.OCRWDevice:
dev.SpcAllowMediumRemoval(out _, dev.Timeout,
out _);
dev.EjectTray(out _, dev.Timeout, out _);
break;
case DeviceType.ATAPI:
case DeviceType.SCSI:
switch(dev.ScsiType)
{
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.SimplifiedDevice:
case PeripheralDeviceTypes.SCSIZonedBlockDevice:
case PeripheralDeviceTypes.WriteOnceDevice:
case PeripheralDeviceTypes.OpticalDevice:
case PeripheralDeviceTypes.OCRWDevice:
dev.SpcAllowMediumRemoval(out _, dev.Timeout,
out _);
dev.EjectTray(out _, dev.Timeout, out _);
break;
case PeripheralDeviceTypes.MultiMediaDevice:
dev.AllowMediumRemoval(out _, dev.Timeout,
out _);
dev.EjectTray(out _, dev.Timeout, out _);
break;
case PeripheralDeviceTypes.MultiMediaDevice:
dev.AllowMediumRemoval(out _, dev.Timeout,
out _);
dev.EjectTray(out _, dev.Timeout, out _);
break;
case PeripheralDeviceTypes.SequentialAccess:
dev.SpcAllowMediumRemoval(out _, dev.Timeout,
out _);
dev.LoadUnload(out _, true, false, false, false,
false, dev.Timeout, out _);
break;
case PeripheralDeviceTypes.SequentialAccess:
dev.SpcAllowMediumRemoval(out _, dev.Timeout,
out _);
dev.LoadUnload(out _, true, false, false, false,
false, dev.Timeout, out _);
break;
}
break;
}
break;
}
});
break;
}
});
}
dev.Close();

View File

@@ -93,23 +93,23 @@ sealed class MediaInfoCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("media-info");
@@ -129,10 +129,10 @@ sealed class MediaInfoCommand : Command
ErrorNumber devErrno = ErrorNumber.NoError;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
switch(dev)
{
@@ -196,10 +196,10 @@ sealed class MediaInfoCommand : Command
ScsiInfo scsiInfo = null;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Retrieving_SCSI_information).IsIndeterminate();
scsiInfo = new ScsiInfo(dev);
});
{
ctx.AddTask(UI.Retrieving_SCSI_information).IsIndeterminate();
scsiInfo = new ScsiInfo(dev);
});
if(!scsiInfo.MediaInserted)
return;
@@ -519,7 +519,7 @@ sealed class MediaInfoCommand : Command
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Cartridge_Status}:[/]",
$"\n{Markup.Escape(Decoders.Bluray.Cartridge.Prettify(scsiInfo.
BlurayCartridgeStatus))}");
BlurayCartridgeStatus))}");
}
if(scsiInfo.BluraySpareAreaInformation != null)
@@ -529,7 +529,7 @@ sealed class MediaInfoCommand : Command
AaruConsole.WriteLine($"[bold]{Localization.Core.Bluray_Spare_Area_Information}:[/]",
$"\n{Markup.Escape(Decoders.Bluray.Spare.Prettify(scsiInfo.
BluraySpareAreaInformation))}");
BluraySpareAreaInformation))}");
}
if(scsiInfo.BlurayRawDfl != null)
@@ -589,7 +589,7 @@ sealed class MediaInfoCommand : Command
{
AaruConsole.WriteLine($"[bold]{Localization.Core.Standard_Disc_Information}:[/]",
$"\n{Markup.Escape(DiscInformation.Prettify000b(scsiInfo.
DecodedDiscInformation))}");
DecodedDiscInformation))}");
}
}

View File

@@ -82,23 +82,23 @@ sealed class MediaScanCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("media-scan");
@@ -120,10 +120,10 @@ sealed class MediaScanCommand : Command
ErrorNumber devErrno = ErrorNumber.NoError;
Core.Spectre.ProgressSingleSpinner(ctx =>
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
{
ctx.AddTask(UI.Opening_device).IsIndeterminate();
dev = Devices.Device.Create(devicePath, out devErrno);
});
switch(dev)
{
@@ -157,44 +157,46 @@ sealed class MediaScanCommand : Command
scanner.UpdateStatus += text => { AaruConsole.WriteLine(Markup.Escape(text)); };
scanner.StoppingErrorMessage += text =>
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
{
AaruConsole.
ErrorWriteLine($"[red]{Markup.Escape(text)}[/]");
};
scanner.UpdateProgress += (text, current, maximum) =>
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
{
_progressTask1 ??= ctx.AddTask("Progress");
_progressTask1.Description = Markup.Escape(text);
_progressTask1.Value = current;
_progressTask1.MaxValue = maximum;
};
scanner.PulseProgress += text =>
{
if(_progressTask1 is null)
ctx.AddTask(Markup.Escape(text)).
IsIndeterminate();
else
{
_progressTask1.Description = Markup.Escape(text);
_progressTask1.IsIndeterminate = true;
}
};
{
if(_progressTask1 is null)
{
ctx.AddTask(Markup.Escape(text)).
IsIndeterminate();
}
else
{
_progressTask1.Description = Markup.Escape(text);
_progressTask1.IsIndeterminate = true;
}
};
scanner.InitProgress += () => { _progressTask1 = ctx.AddTask("Progress"); };
scanner.EndProgress += () =>
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
{
_progressTask1?.StopTask();
_progressTask1 = null;
};
System.Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
scanner.Abort();
};
{
e.Cancel = true;
scanner.Abort();
};
results = scanner.Scan();
});

View File

@@ -72,23 +72,23 @@ sealed class RemoteCommand : Command
});
AaruConsole.DebugWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
}
if(verbose)
{
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
}
Statistics.AddCommand("remote");

View File

@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
<string>© Natalia Portillo</string>
<key>CFBundleIconFile</key>
<string>MacIcon.icns</string>
<key>CFBundleName</key>
<string>Aaru</string>
<key>CFBundleIdentifier</key>
<string>app.aaru</string>
<key>CFBundleShortVersionString</key>
<string>6.0.0-alpha9</string>
<key>CFBundleExecutable</key>
<string>aaru</string>
<key>LSExecutableArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
<string>© Natalia Portillo</string>
<key>CFBundleIconFile</key>
<string>MacIcon.icns</string>
<key>CFBundleName</key>
<string>Aaru</string>
<key>CFBundleIdentifier</key>
<string>app.aaru</string>
<key>CFBundleShortVersionString</key>
<string>6.0.0-alpha9</string>
<key>CFBundleExecutable</key>
<string>aaru</string>
<key>LSExecutableArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

View File

@@ -84,28 +84,28 @@ class MainClass
return Gui.Main.Start(args);
AaruConsole.WriteLineEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.MarkupLine(format);
else
AnsiConsole.MarkupLine(format, objects);
};
{
if(objects is null)
AnsiConsole.MarkupLine(format);
else
AnsiConsole.MarkupLine(format, objects);
};
AaruConsole.WriteEvent += (format, objects) =>
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
{
if(objects is null)
AnsiConsole.Markup(format);
else
AnsiConsole.Markup(format, objects);
};
AaruConsole.ErrorWriteLineEvent += (format, objects) =>
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
{
if(objects is null)
stderrConsole.MarkupLine(format);
else
stderrConsole.MarkupLine(format, objects);
};
Settings.Settings.LoadSettings();
@@ -133,7 +133,8 @@ class MainClass
ctx.Database.EnsureCreated();
ctx.Database.
ExecuteSqlRaw("CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)");
ExecuteSqlRaw(
"CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)");
foreach(string migration in ctx.Database.GetPendingMigrations())
{

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/vnd.aaruformat">
<comment>Aaru Image Format</comment>
<glob pattern="*.dicf"/>
<glob pattern="*.dicformat"/>
<glob pattern="*.aaruf"/>
<glob pattern="*.aaruformat"/>
<glob pattern="*.aif"/>
<alias type="application/x-aaru"/>
<alias type="application/aaru"/>
<magic>
<match type="string" offset="0" value="DICMFRMT"/>
<match type="string" offset="0" value="AARUFRMT"/>
</magic>
</mime-type>
<mime-type type="application/vnd.aaruformat">
<comment>Aaru Image Format</comment>
<glob pattern="*.dicf"/>
<glob pattern="*.dicformat"/>
<glob pattern="*.aaruf"/>
<glob pattern="*.aaruformat"/>
<glob pattern="*.aif"/>
<alias type="application/x-aaru"/>
<alias type="application/aaru"/>
<magic>
<match type="string" offset="0" value="DICMFRMT"/>
<match type="string" offset="0" value="AARUFRMT"/>
</magic>
</mime-type>
</mime-info>