mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru] Reformat and cleanup.
This commit is contained in:
388
Aaru/Aaru.csproj
388
Aaru/Aaru.csproj
@@ -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 <claunia@claunia.com></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 <claunia@claunia.com></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>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_aarch64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="aaruformat.xml" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="0644">
|
||||
<LinuxPath>/usr/share/mime/packages/aaruformat.xml</LinuxPath>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_armhf$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_aarch64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_x86_64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-arm'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_armhf$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_arm64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_alpine_x86_64$(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-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_linux_arm64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos$(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-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos_applesilicon$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_aarch64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_macos_applesilicon$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_arm$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_aarch64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x64$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-arm'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_arm$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x86$(DebugPackage)</PackageName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x64$(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)' == 'win-x86'">
|
||||
<PackageName>$(PackagePrefix)-$(PackageVersion)_windows_x86$(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>
|
||||
|
||||
@@ -69,27 +69,29 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
/* TODO: This is just a stub for now */
|
||||
|
||||
@@ -58,22 +58,24 @@ 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);
|
||||
}
|
||||
@@ -100,7 +102,8 @@ sealed class ConfigureCommand : Command
|
||||
Settings.Settings.Current.EnableDecryption =
|
||||
AnsiConsole.Confirm($"[italic]{UI.Do_you_want_to_enable_decryption_of_copy_protected_media_Q}[/]");
|
||||
|
||||
#region Device reports
|
||||
#region Device reports
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
AaruConsole.WriteLine(UI.Configure_Device_Report_information_disclaimer);
|
||||
@@ -114,9 +117,11 @@ sealed class ConfigureCommand : Command
|
||||
|
||||
Settings.Settings.Current.ShareReports =
|
||||
AnsiConsole.Confirm($"[italic]{UI.Do_you_want_to_share_your_device_reports_with_us_Q}[/]");
|
||||
#endregion Device reports
|
||||
|
||||
#region Statistics
|
||||
#endregion Device reports
|
||||
|
||||
#region Statistics
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
AaruConsole.WriteLine(UI.Statistics_disclaimer);
|
||||
@@ -151,7 +156,8 @@ sealed class ConfigureCommand : Command
|
||||
}
|
||||
else
|
||||
Settings.Settings.Current.Stats = null;
|
||||
#endregion Statistics
|
||||
|
||||
#endregion Statistics
|
||||
|
||||
Settings.Settings.Current.GdprCompliance = DicSettings.GDPR_LEVEL;
|
||||
Settings.Settings.SaveSettings();
|
||||
|
||||
@@ -59,22 +59,24 @@ 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);
|
||||
|
||||
@@ -91,7 +93,7 @@ sealed class StatisticsCommand : Command
|
||||
return (int)ErrorNumber.NothingFound;
|
||||
}
|
||||
|
||||
bool thereAreStats = false;
|
||||
var thereAreStats = false;
|
||||
Table table;
|
||||
|
||||
if(ctx.Commands.Any())
|
||||
@@ -116,19 +118,21 @@ 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);
|
||||
}
|
||||
|
||||
if(count > 0)
|
||||
{
|
||||
ctx.Commands.Add(new Aaru.Database.Models.Command
|
||||
{
|
||||
Count = count,
|
||||
Name = "fs-info",
|
||||
Synchronized = true
|
||||
});
|
||||
}
|
||||
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
@@ -281,8 +285,10 @@ sealed class StatisticsCommand : Command
|
||||
|
||||
foreach(DeviceStat ds in ctx.SeenDevices.OrderBy(ds => ds.Manufacturer).ThenBy(ds => ds.Model).
|
||||
ThenBy(ds => ds.Revision).ThenBy(ds => ds.Bus))
|
||||
{
|
||||
table.AddRow(Markup.Escape(ds.Manufacturer ?? ""), Markup.Escape(ds.Model ?? ""),
|
||||
Markup.Escape(ds.Revision ?? ""), Markup.Escape(ds.Bus ?? ""));
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
@@ -54,7 +54,7 @@ sealed class UpdateCommand : Command
|
||||
{
|
||||
_mainDbUpdate = mainDbUpdate;
|
||||
|
||||
Add(new Option<bool>("--clear", () => false, UI.Clear_existing_main_database));
|
||||
Add(new Option<bool>("--clear", () => false, UI.Clear_existing_main_database));
|
||||
Add(new Option<bool>("--clear-all", () => false, UI.Clear_existing_main_and_local_database));
|
||||
|
||||
Handler = CommandHandler.Create((Func<bool, bool, bool, bool, int>)Invoke);
|
||||
@@ -75,27 +75,30 @@ 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);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
if(clearAll)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(Settings.Settings.LocalDbPath);
|
||||
@@ -113,8 +116,10 @@ sealed class UpdateCommand : Command
|
||||
|
||||
return (int)ErrorNumber.CannotRemoveDatabase;
|
||||
}
|
||||
}
|
||||
|
||||
if(clear || clearAll)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(Settings.Settings.MainDbPath);
|
||||
@@ -128,6 +133,7 @@ sealed class UpdateCommand : Command
|
||||
|
||||
return (int)ErrorNumber.CannotRemoveDatabase;
|
||||
}
|
||||
}
|
||||
|
||||
DoUpdate(clear || clearAll);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,10 +68,7 @@ sealed class DeviceInfoCommand : Command
|
||||
|
||||
public DeviceInfoCommand() : base("info", UI.Device_Info_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--output-prefix", "-w"
|
||||
}, () => null, UI.Prefix_for_saving_binary_information));
|
||||
Add(new Option<string>(new[] { "--output-prefix", "-w" }, () => null, UI.Prefix_for_saving_binary_information));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -95,29 +92,31 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
if(devicePath.Length == 2 &&
|
||||
devicePath[1] == ':' &&
|
||||
@@ -167,11 +166,11 @@ sealed class DeviceInfoCommand : Command
|
||||
if(dev.UsbDescriptors != null)
|
||||
table.AddRow(UI.Title_Descriptor_size, $"{dev.UsbDescriptors.Length}");
|
||||
|
||||
table.AddRow(UI.Title_Vendor_ID, $"{dev.UsbVendorId:X4}");
|
||||
table.AddRow(UI.Title_Product_ID, $"{dev.UsbProductId:X4}");
|
||||
table.AddRow(UI.Title_Manufacturer, Markup.Escape(dev.UsbManufacturerString ?? ""));
|
||||
table.AddRow(UI.Title_Product, Markup.Escape(dev.UsbProductString ?? ""));
|
||||
table.AddRow(UI.Title_Serial_number, Markup.Escape(dev.UsbSerialString ?? ""));
|
||||
table.AddRow(UI.Title_Vendor_ID, $"{dev.UsbVendorId:X4}");
|
||||
table.AddRow(UI.Title_Product_ID, $"{dev.UsbProductId:X4}");
|
||||
table.AddRow(UI.Title_Manufacturer, Markup.Escape(dev.UsbManufacturerString ?? ""));
|
||||
table.AddRow(UI.Title_Product, Markup.Escape(dev.UsbProductString ?? ""));
|
||||
table.AddRow(UI.Title_Serial_number, Markup.Escape(dev.UsbSerialString ?? ""));
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AaruConsole.WriteLine();
|
||||
@@ -190,10 +189,10 @@ sealed class DeviceInfoCommand : Command
|
||||
table.Columns[0].RightAligned();
|
||||
|
||||
table.AddRow(UI.Title_Vendor_ID, $"{dev.FireWireVendor:X6}");
|
||||
table.AddRow(UI.Title_Model_ID, $"{dev.FireWireModel:X6}");
|
||||
table.AddRow(UI.Title_Vendor, $"{Markup.Escape(dev.FireWireVendorName ?? "")}");
|
||||
table.AddRow(UI.Title_Model, $"{Markup.Escape(dev.FireWireModelName ?? "")}");
|
||||
table.AddRow(UI.Title_GUID, $"{dev.FireWireGuid:X16}");
|
||||
table.AddRow(UI.Title_Model_ID, $"{dev.FireWireModel:X6}");
|
||||
table.AddRow(UI.Title_Vendor, $"{Markup.Escape(dev.FireWireVendorName ?? "")}");
|
||||
table.AddRow(UI.Title_Model, $"{Markup.Escape(dev.FireWireModelName ?? "")}");
|
||||
table.AddRow(UI.Title_GUID, $"{dev.FireWireGuid:X16}");
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AaruConsole.WriteLine();
|
||||
@@ -206,11 +205,14 @@ sealed class DeviceInfoCommand : Command
|
||||
Tuple[] tuples = CIS.GetTuples(dev.Cis);
|
||||
|
||||
if(tuples != null)
|
||||
{
|
||||
foreach(Tuple tuple in tuples)
|
||||
{
|
||||
switch(tuple.Code)
|
||||
{
|
||||
case TupleCodes.CISTPL_NULL:
|
||||
case TupleCodes.CISTPL_END: break;
|
||||
case TupleCodes.CISTPL_END:
|
||||
break;
|
||||
case TupleCodes.CISTPL_DEVICEGEO:
|
||||
case TupleCodes.CISTPL_DEVICEGEO_A:
|
||||
AaruConsole.WriteLine("{0}", CIS.PrettifyDeviceGeometryTuple(tuple));
|
||||
@@ -268,6 +270,8 @@ sealed class DeviceInfoCommand : Command
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Could_not_get_tuples);
|
||||
}
|
||||
@@ -318,8 +322,8 @@ sealed class DeviceInfoCommand : Command
|
||||
if((devInfo.AtaMcptError.Value.DeviceHead & 0x08) == 0x08)
|
||||
AaruConsole.WriteLine(Localization.Core.Media_card_is_write_protected);
|
||||
|
||||
ushort specificData = (ushort)((devInfo.AtaMcptError.Value.CylinderHigh * 0x100) +
|
||||
devInfo.AtaMcptError.Value.CylinderLow);
|
||||
var specificData = (ushort)(devInfo.AtaMcptError.Value.CylinderHigh * 0x100 +
|
||||
devInfo.AtaMcptError.Value.CylinderLow);
|
||||
|
||||
if(specificData != 0)
|
||||
AaruConsole.WriteLine(Localization.Core.Card_specific_data_0, specificData);
|
||||
@@ -332,8 +336,10 @@ sealed class DeviceInfoCommand : Command
|
||||
ulong blocks;
|
||||
|
||||
if(ataid is { CurrentCylinders: > 0, CurrentHeads: > 0, CurrentSectorsPerTrack: > 0 })
|
||||
{
|
||||
blocks = (ulong)Math.Max(ataid.CurrentCylinders * ataid.CurrentHeads * ataid.CurrentSectorsPerTrack,
|
||||
ataid.CurrentSectors);
|
||||
}
|
||||
else
|
||||
blocks = (ulong)(ataid.Cylinders * ataid.Heads * ataid.SectorsPerTrack);
|
||||
|
||||
@@ -375,7 +381,9 @@ sealed class DeviceInfoCommand : Command
|
||||
AaruConsole.WriteLine(Inquiry.Prettify(devInfo.ScsiInquiry));
|
||||
|
||||
if(devInfo.ScsiEvpdPages != null)
|
||||
{
|
||||
foreach(KeyValuePair<byte, byte[]> page in devInfo.ScsiEvpdPages)
|
||||
{
|
||||
switch(page.Key)
|
||||
{
|
||||
case >= 0x01 and <= 0x7F:
|
||||
@@ -563,19 +571,27 @@ sealed class DeviceInfoCommand : Command
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(devInfo.ScsiModeSense6 != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE",
|
||||
devInfo.ScsiModeSense6);
|
||||
}
|
||||
|
||||
if(devInfo.ScsiModeSense10 != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE",
|
||||
devInfo.ScsiModeSense10);
|
||||
}
|
||||
|
||||
if(devInfo.ScsiMode.HasValue)
|
||||
{
|
||||
PrintScsiModePages.Print(devInfo.ScsiMode.Value,
|
||||
(PeripheralDeviceTypes)devInfo.ScsiInquiry.Value.PeripheralDeviceType,
|
||||
devInfo.ScsiInquiry.Value.VendorIdentification);
|
||||
}
|
||||
|
||||
if(devInfo.MmcConfiguration != null)
|
||||
{
|
||||
@@ -841,8 +857,10 @@ sealed class DeviceInfoCommand : Command
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Core.GET_CONFIGURATION_returned_no_feature_descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
if(devInfo.RPC != null)
|
||||
@@ -879,26 +897,34 @@ sealed class DeviceInfoCommand : Command
|
||||
if(devInfo.PlextorFeatures.PoweRecEnabled)
|
||||
{
|
||||
if(devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0)
|
||||
{
|
||||
AaruConsole.WriteLine(Localization.Core.Drive_supports_PoweRec_is_enabled_and_recommends_0,
|
||||
devInfo.PlextorFeatures.PoweRecRecommendedSpeed);
|
||||
}
|
||||
else
|
||||
AaruConsole.WriteLine(Localization.Core.Drive_supports_PoweRec_and_has_it_enabled);
|
||||
|
||||
if(devInfo.PlextorFeatures.PoweRecSelected > 0)
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(Localization.Core.Selected_PoweRec_speed_for_currently_inserted_media_is_0_1,
|
||||
devInfo.PlextorFeatures.PoweRecSelected,
|
||||
devInfo.PlextorFeatures.PoweRecSelected / 177);
|
||||
}
|
||||
|
||||
if(devInfo.PlextorFeatures.PoweRecMax > 0)
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(Localization.Core.Maximum_PoweRec_speed_for_currently_inserted_media_is_0_1,
|
||||
devInfo.PlextorFeatures.PoweRecMax, devInfo.PlextorFeatures.PoweRecMax / 177);
|
||||
}
|
||||
|
||||
if(devInfo.PlextorFeatures.PoweRecLast > 0)
|
||||
{
|
||||
AaruConsole.WriteLine(Localization.Core.Last_used_PoweRec_was_0_1,
|
||||
devInfo.PlextorFeatures.PoweRecLast,
|
||||
devInfo.PlextorFeatures.PoweRecLast / 177);
|
||||
}
|
||||
}
|
||||
else
|
||||
AaruConsole.WriteLine(Localization.Core.Drive_supports_PoweRec_and_has_it_disabled);
|
||||
@@ -917,17 +943,23 @@ sealed class DeviceInfoCommand : Command
|
||||
: Localization.Core.Access_time_is_fast));
|
||||
|
||||
if(devInfo.PlextorFeatures.CdReadSpeedLimit > 0)
|
||||
{
|
||||
AaruConsole.WriteLine("\t" + Localization.Core.CD_read_speed_limited_to_0,
|
||||
devInfo.PlextorFeatures.CdReadSpeedLimit);
|
||||
}
|
||||
|
||||
if(devInfo.PlextorFeatures.DvdReadSpeedLimit > 0 &&
|
||||
devInfo.PlextorFeatures.IsDvd)
|
||||
{
|
||||
AaruConsole.WriteLine("\t" + Localization.Core.DVD_read_speed_limited_to_0,
|
||||
devInfo.PlextorFeatures.DvdReadSpeedLimit);
|
||||
}
|
||||
|
||||
if(devInfo.PlextorFeatures.CdWriteSpeedLimit > 0)
|
||||
{
|
||||
AaruConsole.WriteLine("\t" + Localization.Core.CD_write_speed_limited_to_0,
|
||||
devInfo.PlextorFeatures.CdWriteSpeedLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,9 +970,11 @@ sealed class DeviceInfoCommand : Command
|
||||
AaruConsole.WriteLine(Localization.Core.Drive_supports_Plextor_SecuRec);
|
||||
|
||||
if(devInfo.PlextorFeatures?.SpeedRead == true)
|
||||
{
|
||||
AaruConsole.WriteLine(devInfo.PlextorFeatures.SpeedReadEnabled
|
||||
? Localization.Core.Drive_supports_Plextor_SpeedRead_and_has_it_enabled
|
||||
: Localization.Core.Drive_supports_Plextor_SpeedRead);
|
||||
}
|
||||
|
||||
if(devInfo.PlextorFeatures?.Hiding == true)
|
||||
{
|
||||
@@ -1046,7 +1080,7 @@ sealed class DeviceInfoCommand : Command
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
bool noInfo = true;
|
||||
var noInfo = true;
|
||||
|
||||
if(devInfo.CID != null)
|
||||
{
|
||||
@@ -1086,7 +1120,7 @@ sealed class DeviceInfoCommand : Command
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
bool noInfo = true;
|
||||
var noInfo = true;
|
||||
|
||||
if(devInfo.CID != null)
|
||||
{
|
||||
@@ -1166,7 +1200,8 @@ sealed class DeviceInfoCommand : Command
|
||||
d.Manufacturer == dev.Manufacturer.Replace('/', '-')) &&
|
||||
(d.Model == dev.Model || d.Model == dev.Model.Replace('/', '-')));
|
||||
|
||||
AaruConsole.WriteLine(cdOffset is null ? "CD reading offset not found in database."
|
||||
AaruConsole.WriteLine(cdOffset is null
|
||||
? "CD reading offset not found in database."
|
||||
: $"CD reading offset is {cdOffset.Offset} samples ({cdOffset.Offset * 4} bytes).");
|
||||
|
||||
return (int)ErrorNumber.NoError;
|
||||
|
||||
@@ -71,26 +71,28 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
DeviceInfo[] devices = Devices.Device.ListDevices(out bool isRemote, out string serverApplication,
|
||||
@@ -99,8 +101,10 @@ sealed class ListDevicesCommand : Command
|
||||
out string serverArchitecture, aaruRemoteHost);
|
||||
|
||||
if(isRemote)
|
||||
{
|
||||
Statistics.AddRemote(serverApplication, serverVersion, serverOperatingSystem, serverOperatingSystemVersion,
|
||||
serverArchitecture);
|
||||
}
|
||||
|
||||
if(devices == null ||
|
||||
devices.Length == 0)
|
||||
@@ -116,9 +120,11 @@ sealed class ListDevicesCommand : Command
|
||||
table.AddColumn(UI.Supported_Question);
|
||||
|
||||
foreach(DeviceInfo dev in devices.OrderBy(d => d.Path))
|
||||
{
|
||||
table.AddRow(Markup.Escape(dev.Path ?? ""), Markup.Escape(dev.Vendor ?? ""),
|
||||
Markup.Escape(dev.Model ?? ""), Markup.Escape(dev.Serial ?? ""),
|
||||
Markup.Escape(dev.Bus ?? ""), dev.Supported ? "[green]✓[/]" : "[red]✗[/]");
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
}
|
||||
|
||||
@@ -57,25 +57,14 @@ sealed class ExtractFilesCommand : Command
|
||||
|
||||
public ExtractFilesCommand() : base("extract", UI.Filesystem_Extract_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--encoding", "-e"
|
||||
}, () => null, UI.Name_of_character_encoding_to_use));
|
||||
Add(new Option<string>(new[] { "--encoding", "-e" }, () => null, UI.Name_of_character_encoding_to_use));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--options", "-O"
|
||||
}, () => null, UI.Comma_separated_name_value_pairs_of_filesystem_options));
|
||||
Add(new Option<string>(new[] { "--options", "-O" }, () => null,
|
||||
UI.Comma_separated_name_value_pairs_of_filesystem_options));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--xattrs", "-x"
|
||||
}, () => false, UI.Extract_extended_attributes_if_present));
|
||||
Add(new Option<bool>(new[] { "--xattrs", "-x" }, () => false, UI.Extract_extended_attributes_if_present));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--namespace", "-n"
|
||||
}, () => null, UI.Namespace_to_use_for_filenames));
|
||||
Add(new Option<string>(new[] { "--namespace", "-n" }, () => null, UI.Namespace_to_use_for_filenames));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -94,7 +83,7 @@ sealed class ExtractFilesCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, bool xattrs, string imagePath,
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, bool xattrs, string imagePath,
|
||||
string @namespace, string outputDir, string options)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -107,41 +96,43 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputDir);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--xattrs={0}", xattrs);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputDir);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--xattrs={0}", xattrs);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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);
|
||||
@@ -161,6 +152,7 @@ sealed class ExtractFilesCommand : Command
|
||||
Encoding encodingClass = null;
|
||||
|
||||
if(encoding != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);
|
||||
@@ -174,6 +166,7 @@ sealed class ExtractFilesCommand : Command
|
||||
|
||||
return (int)ErrorNumber.EncodingUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
|
||||
@@ -183,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)
|
||||
{
|
||||
@@ -230,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)
|
||||
{
|
||||
@@ -268,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);
|
||||
|
||||
@@ -292,7 +285,7 @@ sealed class ExtractFilesCommand : Command
|
||||
|
||||
AaruConsole.WriteLine(UI._0_partitions_found, partitions.Count);
|
||||
|
||||
for(int i = 0; i < partitions.Count; i++)
|
||||
for(var i = 0; i < partitions.Count; i++)
|
||||
{
|
||||
AaruConsole.WriteLine();
|
||||
AaruConsole.WriteLine($"[bold]{string.Format(UI.Partition_0, partitions[i].Sequence)}[/]");
|
||||
@@ -300,10 +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);
|
||||
@@ -318,6 +313,7 @@ sealed class ExtractFilesCommand : Command
|
||||
}[/]");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{string.Format(UI.As_identified_by_0, pluginType.Name)
|
||||
@@ -327,16 +323,19 @@ 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)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.Metadata.VolumeName) ? "NO NAME"
|
||||
string volumeName = string.IsNullOrEmpty(fs.Metadata.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.Metadata.VolumeName;
|
||||
|
||||
ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);
|
||||
@@ -346,6 +345,7 @@ sealed class ExtractFilesCommand : Command
|
||||
else
|
||||
AaruConsole.ErrorWriteLine(UI.Unable_to_mount_volume_error_0, error.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -358,14 +358,17 @@ 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)
|
||||
{
|
||||
string volumeName = string.IsNullOrEmpty(fs.Metadata.VolumeName) ? "NO NAME"
|
||||
string volumeName = string.IsNullOrEmpty(fs.Metadata.VolumeName)
|
||||
? "NO NAME"
|
||||
: fs.Metadata.VolumeName;
|
||||
|
||||
ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs);
|
||||
@@ -390,7 +393,7 @@ sealed class ExtractFilesCommand : Command
|
||||
}
|
||||
|
||||
static void ExtractFilesInDir(string path, [NotNull] IReadOnlyFilesystem fs, string volumeName, string outputDir,
|
||||
bool doXattrs)
|
||||
bool doXattrs)
|
||||
{
|
||||
if(path.StartsWith('/'))
|
||||
path = path[1..];
|
||||
@@ -410,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)
|
||||
{
|
||||
@@ -424,9 +427,11 @@ sealed class ExtractFilesCommand : Command
|
||||
outputPath = Path.Combine(outputDir, fs.Metadata.Type, volumeName, path, entry);
|
||||
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
outputPath = outputPath.Replace('<', '\uFF1C').Replace('>', '\uFF1E').Replace(':', '\uFF1A').
|
||||
Replace('\"', '\uFF02').Replace('|', '\uFF5C').Replace('?', '\uFF1F').
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(outputPath);
|
||||
|
||||
@@ -436,7 +441,7 @@ sealed class ExtractFilesCommand : Command
|
||||
|
||||
var di = new DirectoryInfo(outputPath);
|
||||
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
try
|
||||
{
|
||||
if(stat.CreationTimeUtc.HasValue)
|
||||
@@ -466,7 +471,7 @@ sealed class ExtractFilesCommand : Command
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -478,21 +483,25 @@ 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)
|
||||
{
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
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;
|
||||
@@ -500,10 +509,12 @@ sealed class ExtractFilesCommand : Command
|
||||
outputPath = Path.Combine(outputDir, fs.Metadata.Type, volumeName, ".xattrs", path, xattr);
|
||||
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
outputPath = outputPath.Replace('<', '\uFF1C').Replace('>', '\uFF1E').
|
||||
Replace(':', '\uFF1A').Replace('\"', '\uFF02').
|
||||
Replace('|', '\uFF5C').Replace('?', '\uFF1F').
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(outputPath);
|
||||
|
||||
@@ -513,26 +524,32 @@ sealed class ExtractFilesCommand : Command
|
||||
: Path.Combine(outputPath, entry);
|
||||
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
outputPath = outputPath.Replace('<', '\uFF1C').Replace('>', '\uFF1E').
|
||||
Replace(':', '\uFF1A').Replace('\"', '\uFF02').
|
||||
Replace('|', '\uFF5C').Replace('?', '\uFF1F').
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
}
|
||||
|
||||
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
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
try
|
||||
{
|
||||
if(stat.CreationTimeUtc.HasValue)
|
||||
@@ -562,21 +579,24 @@ sealed class ExtractFilesCommand : Command
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
AaruConsole.WriteLine(UI.Written_0_bytes_of_xattr_1_from_file_2_to_3, xattrBuf.Length,
|
||||
xattr, entry, outputPath);
|
||||
}
|
||||
else
|
||||
AaruConsole.ErrorWriteLine(UI.Cannot_write_xattr_0_for_1_output_exists, xattr, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outputPath = Path.Combine(outputDir, fs.Metadata.Type, volumeName, path);
|
||||
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
outputPath = outputPath.Replace('<', '\uFF1C').Replace('>', '\uFF1E').Replace(':', '\uFF1A').
|
||||
Replace('\"', '\uFF02').Replace('|', '\uFF5C').Replace('?', '\uFF1F').
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(outputPath);
|
||||
|
||||
@@ -585,9 +605,11 @@ sealed class ExtractFilesCommand : Command
|
||||
: Path.Combine(outputPath, entry);
|
||||
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
outputPath = outputPath.Replace('<', '\uFF1C').Replace('>', '\uFF1E').Replace(':', '\uFF1A').
|
||||
Replace('\"', '\uFF02').Replace('|', '\uFF5C').Replace('?', '\uFF1F').
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
Replace('*', '\uFF0A').Replace('/', '\\');
|
||||
}
|
||||
|
||||
if(!File.Exists(outputPath))
|
||||
{
|
||||
@@ -598,50 +620,52 @@ 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;
|
||||
byte[] 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();
|
||||
|
||||
var fi = new FileInfo(outputPath);
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
try
|
||||
{
|
||||
if(stat.CreationTimeUtc.HasValue)
|
||||
@@ -671,7 +695,7 @@ sealed class ExtractFilesCommand : Command
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
AaruConsole.WriteLine(UI.Written_0_bytes_of_file_1_to_2, position, Markup.Escape(entry),
|
||||
Markup.Escape(outputPath));
|
||||
}
|
||||
|
||||
@@ -53,20 +53,12 @@ sealed class FilesystemInfoCommand : Command
|
||||
|
||||
public FilesystemInfoCommand() : base("info", UI.Filesystem_Info_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--encoding", "-e"
|
||||
}, () => null, UI.Name_of_character_encoding_to_use));
|
||||
Add(new Option<string>(new[] { "--encoding", "-e" }, () => null, UI.Name_of_character_encoding_to_use));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--filesystems", "-f"
|
||||
}, () => true, UI.Searches_and_prints_information_about_filesystems));
|
||||
Add(new Option<bool>(new[] { "--filesystems", "-f" }, () => true,
|
||||
UI.Searches_and_prints_information_about_filesystems));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--partitions", "-p"
|
||||
}, () => true, UI.Searches_and_interprets_partitions));
|
||||
Add(new Option<bool>(new[] { "--partitions", "-p" }, () => true, UI.Searches_and_interprets_partitions));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -78,7 +70,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
Handler = CommandHandler.Create(typeof(FilesystemInfoCommand).GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool verbose, bool debug, string encoding, bool filesystems, bool partitions,
|
||||
public static int Invoke(bool verbose, bool debug, string encoding, bool filesystems, bool partitions,
|
||||
string imagePath)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -91,40 +83,42 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--filesystems={0}", filesystems);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--partitions={0}", partitions);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--partitions={0}", partitions);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -136,6 +130,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
Encoding encodingClass = null;
|
||||
|
||||
if(encoding != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);
|
||||
@@ -149,10 +144,11 @@ sealed class FilesystemInfoCommand : Command
|
||||
|
||||
return (int)ErrorNumber.EncodingUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
|
||||
bool checkRaw = false;
|
||||
var checkRaw = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -160,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)
|
||||
{
|
||||
@@ -192,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)
|
||||
{
|
||||
@@ -233,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);
|
||||
|
||||
@@ -257,7 +253,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
{
|
||||
AaruConsole.WriteLine(UI._0_partitions_found, partitionsList.Count);
|
||||
|
||||
for(int i = 0; i < partitionsList.Count; i++)
|
||||
for(var i = 0; i < partitionsList.Count; i++)
|
||||
{
|
||||
Table table = new()
|
||||
{
|
||||
@@ -279,7 +275,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
string.Format(UI._0_sectors_1_bytes, partitionsList[i].Length,
|
||||
partitionsList[i].Size));
|
||||
|
||||
table.AddRow(UI.Title_Scheme, Markup.Escape(partitionsList[i].Scheme ?? ""));
|
||||
table.AddRow(UI.Title_Scheme, Markup.Escape(partitionsList[i].Scheme ?? ""));
|
||||
table.AddRow(UI.Title_Description, Markup.Escape(partitionsList[i].Description ?? ""));
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
@@ -288,10 +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)
|
||||
{
|
||||
@@ -305,6 +303,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
idPlugins.Count)}[/]");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
@@ -319,6 +318,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
AaruConsole.Write(information);
|
||||
Statistics.AddFilesystem(fsMetadata.Type);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
@@ -374,6 +374,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
}[/]");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.Filesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IFilesystem fs)
|
||||
@@ -387,6 +388,7 @@ sealed class FilesystemInfoCommand : Command
|
||||
AaruConsole.Write(information);
|
||||
Statistics.AddFilesystem(fsMetadata.Type);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -56,25 +56,14 @@ sealed class LsCommand : Command
|
||||
{
|
||||
AddAlias("ls");
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--encoding", "-e"
|
||||
}, () => null, UI.Name_of_character_encoding_to_use));
|
||||
Add(new Option<string>(new[] { "--encoding", "-e" }, () => null, UI.Name_of_character_encoding_to_use));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--long-format", "-l"
|
||||
}, () => true, UI.Use_long_format));
|
||||
Add(new Option<bool>(new[] { "--long-format", "-l" }, () => true, UI.Use_long_format));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--options", "-O"
|
||||
}, () => null, UI.Comma_separated_name_value_pairs_of_filesystem_options));
|
||||
Add(new Option<string>(new[] { "--options", "-O" }, () => null,
|
||||
UI.Comma_separated_name_value_pairs_of_filesystem_options));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--namespace", "-n"
|
||||
}, () => null, UI.Namespace_to_use_for_filenames));
|
||||
Add(new Option<string>(new[] { "--namespace", "-n" }, () => null, UI.Namespace_to_use_for_filenames));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -86,7 +75,7 @@ sealed class LsCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, string imagePath, bool longFormat,
|
||||
public static int Invoke(bool debug, bool verbose, string encoding, string imagePath, bool longFormat,
|
||||
string @namespace, string options)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -99,38 +88,40 @@ 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);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("ls");
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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);
|
||||
@@ -150,6 +141,7 @@ sealed class LsCommand : Command
|
||||
Encoding encodingClass = null;
|
||||
|
||||
if(encoding != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);
|
||||
@@ -163,6 +155,7 @@ sealed class LsCommand : Command
|
||||
|
||||
return (int)ErrorNumber.EncodingUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
|
||||
@@ -172,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)
|
||||
{
|
||||
@@ -202,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)
|
||||
{
|
||||
@@ -240,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);
|
||||
|
||||
@@ -264,7 +257,7 @@ sealed class LsCommand : Command
|
||||
|
||||
AaruConsole.WriteLine(UI._0_partitions_found, partitions.Count);
|
||||
|
||||
for(int i = 0; i < partitions.Count; i++)
|
||||
for(var i = 0; i < partitions.Count; i++)
|
||||
{
|
||||
AaruConsole.WriteLine();
|
||||
AaruConsole.WriteLine($"[bold]{string.Format(UI.Partition_0, partitions[i].Sequence)}[/]");
|
||||
@@ -272,10 +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);
|
||||
@@ -290,6 +285,7 @@ sealed class LsCommand : Command
|
||||
}[/]");
|
||||
|
||||
foreach(string pluginName in idPlugins)
|
||||
{
|
||||
if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out pluginType))
|
||||
{
|
||||
if(Activator.CreateInstance(pluginType) is not IReadOnlyFilesystem fs)
|
||||
@@ -298,12 +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)
|
||||
{
|
||||
@@ -314,6 +312,7 @@ sealed class LsCommand : Command
|
||||
else
|
||||
AaruConsole.ErrorWriteLine(UI.Unable_to_mount_volume_error_0, error.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,10 +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)
|
||||
{
|
||||
@@ -361,14 +362,15 @@ sealed class LsCommand : Command
|
||||
if(path.StartsWith('/'))
|
||||
path = path[1..];
|
||||
|
||||
AaruConsole.WriteLine(string.IsNullOrEmpty(path) ? UI.Root_directory
|
||||
AaruConsole.WriteLine(string.IsNullOrEmpty(path)
|
||||
? UI.Root_directory
|
||||
: 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)
|
||||
{
|
||||
@@ -380,32 +382,37 @@ 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))
|
||||
{
|
||||
if(longFormat)
|
||||
{
|
||||
if(entry.Value != null)
|
||||
{
|
||||
if(entry.Value.Attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
AaruConsole.WriteLine("{0, 10:d} {0, 12:T} {1, -20} {2}", entry.Value.CreationTimeUtc,
|
||||
UI.Directory_abbreviation, Markup.Escape(entry.Key));
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.WriteLine("{0, 10:d} {0, 12:T} {1, 6}{2, 14:N0} {3}", entry.Value.CreationTimeUtc,
|
||||
entry.Value.Inode, entry.Value.Length, Markup.Escape(entry.Key));
|
||||
}
|
||||
|
||||
error = fs.ListXAttr(path + "/" + entry.Key, out List<string> xattrs);
|
||||
|
||||
@@ -425,9 +432,12 @@ sealed class LsCommand : Command
|
||||
AaruConsole.WriteLine("{0, 47}{1}", string.Empty, Markup.Escape(entry.Key));
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(entry.Value?.Attributes.HasFlag(FileAttributes.Directory) == true ? "{0}/" : "{0}",
|
||||
entry.Key);
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
|
||||
@@ -64,24 +64,26 @@ 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);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-options");
|
||||
|
||||
@@ -94,7 +96,7 @@ sealed class ListOptionsCommand : Command
|
||||
if(Activator.CreateInstance(kvp.Value) is not IReadOnlyFilesystem fs)
|
||||
continue;
|
||||
|
||||
List<(string name, Type type, string description)> options = fs.SupportedOptions.ToList();
|
||||
var options = fs.SupportedOptions.ToList();
|
||||
|
||||
if(options.Count == 0)
|
||||
continue;
|
||||
@@ -109,8 +111,10 @@ sealed class ListOptionsCommand : Command
|
||||
table.AddColumn(UI.Title_Description);
|
||||
|
||||
foreach((string name, Type type, string description) option in options.OrderBy(t => t.name))
|
||||
{
|
||||
table.AddRow(Markup.Escape(option.name), $"[italic]{TypeToString(option.type)}[/]",
|
||||
Markup.Escape(option.description));
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
@@ -64,26 +64,28 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
PluginBase plugins = PluginBase.Singleton;
|
||||
@@ -100,10 +102,12 @@ sealed class FormatsCommand : Command
|
||||
table.AddColumn(UI.Title_Filter);
|
||||
|
||||
foreach(KeyValuePair<string, IFilter> kvp in filtersList.Filters)
|
||||
{
|
||||
if(verbose)
|
||||
table.AddRow(kvp.Value.Id.ToString(), Markup.Escape(kvp.Value.Name));
|
||||
else
|
||||
table.AddRow(Markup.Escape(kvp.Value.Name));
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
|
||||
@@ -113,7 +117,7 @@ sealed class FormatsCommand : Command
|
||||
{
|
||||
Title = new TableTitle(string.Format(UI.Read_only_media_image_formats_0,
|
||||
plugins.MediaImages.Count(t => !t.Value.GetInterfaces().
|
||||
Contains(typeof(IWritableImage)))))
|
||||
Contains(typeof(IWritableImage)))))
|
||||
};
|
||||
|
||||
if(verbose)
|
||||
@@ -122,7 +126,7 @@ sealed class FormatsCommand : Command
|
||||
table.AddColumn(UI.Title_Media_image_format);
|
||||
|
||||
foreach(KeyValuePair<string, Type> kvp in plugins.MediaImages.Where(t => !t.Value.GetInterfaces().
|
||||
Contains(typeof(IWritableImage))))
|
||||
Contains(typeof(IWritableImage))))
|
||||
{
|
||||
if(Activator.CreateInstance(kvp.Value) is not IMediaImage imagePlugin)
|
||||
continue;
|
||||
@@ -166,8 +170,8 @@ 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)))))
|
||||
Contains(typeof(
|
||||
IReadOnlyFilesystem)))))
|
||||
};
|
||||
|
||||
if(verbose)
|
||||
@@ -176,8 +180,8 @@ sealed class FormatsCommand : Command
|
||||
table.AddColumn(UI.Title_Filesystem);
|
||||
|
||||
foreach(KeyValuePair<string, Type> kvp in plugins.Filesystems.Where(t => !t.Value.GetInterfaces().
|
||||
Contains(typeof(
|
||||
IReadOnlyFilesystem))))
|
||||
Contains(typeof(
|
||||
IReadOnlyFilesystem))))
|
||||
{
|
||||
if(Activator.CreateInstance(kvp.Value) is not IFilesystem fs)
|
||||
continue;
|
||||
|
||||
@@ -58,50 +58,29 @@ sealed class ChecksumCommand : Command
|
||||
{
|
||||
AddAlias("chk");
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--adler32", "-a"
|
||||
}, () => false, UI.Calculates_Adler_32));
|
||||
Add(new Option<bool>(new[] { "--adler32", "-a" }, () => false, UI.Calculates_Adler_32));
|
||||
|
||||
Add(new Option<bool>("--crc16", () => true, UI.Calculates_CRC16));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--crc32", "-c"
|
||||
}, () => true, UI.Calculates_CRC32));
|
||||
Add(new Option<bool>(new[] { "--crc32", "-c" }, () => true, UI.Calculates_CRC32));
|
||||
|
||||
Add(new Option<bool>("--crc64", () => true, UI.Calculates_CRC64_ECMA));
|
||||
Add(new Option<bool>("--crc64", () => true, UI.Calculates_CRC64_ECMA));
|
||||
Add(new Option<bool>("--fletcher16", () => false, UI.Calculates_Fletcher_16));
|
||||
Add(new Option<bool>("--fletcher32", () => false, UI.Calculates_Fletcher_32));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--md5", "-m"
|
||||
}, () => true, UI.Calculates_MD5));
|
||||
Add(new Option<bool>(new[] { "--md5", "-m" }, () => true, UI.Calculates_MD5));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--separated-tracks", "-t"
|
||||
}, () => true, UI.Checksums_each_track_separately));
|
||||
Add(new Option<bool>(new[] { "--separated-tracks", "-t" }, () => true, UI.Checksums_each_track_separately));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--sha1", "-s"
|
||||
}, () => true, UI.Calculates_SHA1));
|
||||
Add(new Option<bool>(new[] { "--sha1", "-s" }, () => true, UI.Calculates_SHA1));
|
||||
|
||||
Add(new Option<bool>("--sha256", () => false, UI.Calculates_SHA256));
|
||||
Add(new Option<bool>("--sha384", () => false, UI.Calculates_SHA384));
|
||||
Add(new Option<bool>("--sha512", () => true, UI.Calculates_SHA512));
|
||||
Add(new Option<bool>("--sha512", () => true, UI.Calculates_SHA512));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--spamsum", "-f"
|
||||
}, () => true, UI.Calculates_SpamSum_fuzzy_hash));
|
||||
Add(new Option<bool>(new[] { "--spamsum", "-f" }, () => true, UI.Calculates_SpamSum_fuzzy_hash));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--whole-disc", "-w"
|
||||
}, () => true, UI.Checksums_the_whole_disc));
|
||||
Add(new Option<bool>(new[] { "--whole-disc", "-w" }, () => true, UI.Checksums_the_whole_disc));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -113,9 +92,9 @@ sealed class ChecksumCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, bool adler32, bool crc16, bool crc32, bool crc64,
|
||||
bool fletcher16, bool fletcher32, bool md5, bool sha1, bool sha256, bool sha384,
|
||||
bool sha512, bool spamSum, string imagePath, bool separatedTracks, bool wholeDisc)
|
||||
public static int Invoke(bool debug, bool verbose, bool adler32, bool crc16, bool crc32, bool crc64,
|
||||
bool fletcher16, bool fletcher32, bool md5, bool sha1, bool sha256, bool sha384,
|
||||
bool sha512, bool spamSum, string imagePath, bool separatedTracks, bool wholeDisc)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
|
||||
@@ -127,51 +106,53 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--adler32={0}", adler32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc16={0}", crc16);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc32={0}", crc32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc64={0}", crc64);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher16={0}", fletcher16);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher32={0}", fletcher32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--md5={0}", md5);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--adler32={0}", adler32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc16={0}", crc16);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc32={0}", crc32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--crc64={0}", crc64);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher16={0}", fletcher16);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fletcher32={0}", fletcher32);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--md5={0}", md5);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha1={0}", sha1);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha256={0}", sha256);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha384={0}", sha384);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha512={0}", sha512);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--spamsum={0}", spamSum);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha1={0}", sha1);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha256={0}", sha256);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha384={0}", sha384);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sha512={0}", sha512);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--spamsum={0}", spamSum);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -183,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)
|
||||
{
|
||||
@@ -198,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)
|
||||
{
|
||||
@@ -258,7 +239,7 @@ sealed class ChecksumCommand : Command
|
||||
|
||||
switch(inputFormat)
|
||||
{
|
||||
case IOpticalMediaImage { Tracks: {} } opticalInput:
|
||||
case IOpticalMediaImage { Tracks: not null } opticalInput:
|
||||
try
|
||||
{
|
||||
Checksum trackChecksum = null;
|
||||
@@ -271,143 +252,154 @@ 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;
|
||||
@@ -434,153 +426,166 @@ 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;
|
||||
@@ -590,8 +595,10 @@ sealed class ChecksumCommand : Command
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End())
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{string.Format(UI.Checksums_Tape_has_0, chk.Type)}[/] {chk.Value
|
||||
}");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -604,64 +611,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;
|
||||
byte[] 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;
|
||||
@@ -682,62 +693,64 @@ 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;
|
||||
|
||||
@@ -86,28 +86,30 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input1={0}", imagePath1);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input2={0}", imagePath2);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input1={0}", imagePath1);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input2={0}", imagePath2);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
@@ -115,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)
|
||||
{
|
||||
@@ -146,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)
|
||||
{
|
||||
@@ -165,8 +167,10 @@ sealed class CompareCommand : Command
|
||||
}
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
AaruConsole.VerboseWriteLine(UI.First_input_file_format_identified_by_0_1, input1Format.Name,
|
||||
input1Format.Id);
|
||||
}
|
||||
else
|
||||
AaruConsole.WriteLine(UI.First_input_file_format_identified_by_0, input1Format.Name);
|
||||
|
||||
@@ -178,8 +182,10 @@ sealed class CompareCommand : Command
|
||||
}
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
AaruConsole.VerboseWriteLine(UI.Second_input_file_format_identified_by_0_1, input2Format.Name,
|
||||
input2Format.Id);
|
||||
}
|
||||
else
|
||||
AaruConsole.WriteLine(UI.Second_input_file_format_identified_by_0, input2Format.Name);
|
||||
|
||||
@@ -187,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)
|
||||
{
|
||||
@@ -201,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)
|
||||
{
|
||||
@@ -230,8 +236,8 @@ sealed class CompareCommand : Command
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
table.AddRow(UI.Title_File, Markup.Escape(imagePath1), Markup.Escape(imagePath2));
|
||||
table.AddRow(UI.Title_Media_image_format, input1Format.Name, input2Format.Name);
|
||||
table.AddRow(UI.Title_File, Markup.Escape(imagePath1), Markup.Escape(imagePath2));
|
||||
table.AddRow(UI.Title_Media_image_format, input1Format.Name, input2Format.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +245,7 @@ sealed class CompareCommand : Command
|
||||
sb.AppendFormat($"[bold]{UI.Title_Second_Media_image}:[/] {imagePath2}").AppendLine();
|
||||
}
|
||||
|
||||
bool imagesDiffer = false;
|
||||
var imagesDiffer = false;
|
||||
ErrorNumber errno;
|
||||
|
||||
ImageInfo image1Info = input1Format.Info;
|
||||
@@ -250,6 +256,7 @@ sealed class CompareCommand : Command
|
||||
var input2MediaImage = input2Format as IMediaImage;
|
||||
|
||||
if(input1MediaImage != null)
|
||||
{
|
||||
foreach(MediaTagType diskTag in Enum.GetValues(typeof(MediaTagType)))
|
||||
{
|
||||
errno = input1MediaImage.ReadMediaTag(diskTag, out byte[] tempArray);
|
||||
@@ -257,8 +264,10 @@ sealed class CompareCommand : Command
|
||||
if(errno == ErrorNumber.NoError)
|
||||
image1DiskTags.Add(diskTag, tempArray);
|
||||
}
|
||||
}
|
||||
|
||||
if(input2MediaImage != null)
|
||||
{
|
||||
foreach(MediaTagType diskTag in Enum.GetValues(typeof(MediaTagType)))
|
||||
{
|
||||
errno = input2MediaImage.ReadMediaTag(diskTag, out byte[] tempArray);
|
||||
@@ -266,6 +275,7 @@ sealed class CompareCommand : Command
|
||||
if(errno == ErrorNumber.NoError)
|
||||
image2DiskTags.Add(diskTag, tempArray);
|
||||
}
|
||||
}
|
||||
|
||||
if(verbose)
|
||||
{
|
||||
@@ -335,76 +345,78 @@ sealed class CompareCommand : Command
|
||||
|
||||
foreach(MediaTagType diskTag in
|
||||
(Enum.GetValues(typeof(MediaTagType)) as MediaTagType[]).OrderBy(e => e.ToString()))
|
||||
{
|
||||
table.AddRow(string.Format(UI.Has_tag_0_Question, diskTag),
|
||||
image1DiskTags.ContainsKey(diskTag).ToString(),
|
||||
image2DiskTags.ContainsKey(diskTag).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -427,94 +439,105 @@ sealed class CompareCommand : Command
|
||||
|
||||
if(input1MediaImage is not null &&
|
||||
input2MediaImage is not null)
|
||||
{
|
||||
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.
|
||||
// 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
|
||||
}
|
||||
});
|
||||
}
|
||||
#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 &&
|
||||
input2ByteAddressable is not null)
|
||||
{
|
||||
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;
|
||||
|
||||
byte[] data1 = new byte[input1ByteAddressable.Info.Sectors];
|
||||
byte[] 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
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.IO;
|
||||
@@ -60,20 +59,11 @@ sealed class CreateSidecarCommand : Command
|
||||
|
||||
public CreateSidecarCommand() : base("create-sidecar", UI.Image_Create_Sidecar_Command_Description)
|
||||
{
|
||||
Add(new Option<int>(new[]
|
||||
{
|
||||
"--block-size", "-b"
|
||||
}, () => 512, UI.Tape_block_size_argument_help));
|
||||
Add(new Option<int>(new[] { "--block-size", "-b" }, () => 512, UI.Tape_block_size_argument_help));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--encoding", "-e"
|
||||
}, () => null, UI.Name_of_character_encoding_to_use));
|
||||
Add(new Option<string>(new[] { "--encoding", "-e" }, () => null, UI.Name_of_character_encoding_to_use));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--tape", "-t"
|
||||
}, () => false, UI.Tape_argument_input_help));
|
||||
Add(new Option<bool>(new[] { "--tape", "-t" }, () => false, UI.Tape_argument_input_help));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -85,7 +75,7 @@ sealed class CreateSidecarCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, uint blockSize, [CanBeNull] string encodingName,
|
||||
public static int Invoke(bool debug, bool verbose, uint blockSize, [CanBeNull] string encodingName,
|
||||
string imagePath, bool tape)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -98,35 +88,38 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--block-size={0}", blockSize);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encodingName);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--tape={0}", tape);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encodingName);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--tape={0}", tape);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
Encoding encodingClass = null;
|
||||
|
||||
if(encodingName != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(encodingName);
|
||||
@@ -140,6 +133,7 @@ sealed class CreateSidecarCommand : Command
|
||||
|
||||
return (int)ErrorNumber.EncodingUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
if(File.Exists(imagePath))
|
||||
{
|
||||
@@ -154,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)
|
||||
{
|
||||
@@ -171,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)
|
||||
{
|
||||
@@ -193,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)
|
||||
{
|
||||
@@ -225,75 +219,80 @@ 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)
|
||||
{
|
||||
@@ -312,8 +311,8 @@ sealed class CreateSidecarCommand : Command
|
||||
return (int)ErrorNumber.IsDirectory;
|
||||
}
|
||||
|
||||
string[] contents = Directory.GetFiles(imagePath, "*", SearchOption.TopDirectoryOnly);
|
||||
List<string> files = contents.Where(file => new FileInfo(file).Length % blockSize == 0).ToList();
|
||||
string[] contents = Directory.GetFiles(imagePath, "*", SearchOption.TopDirectoryOnly);
|
||||
var files = contents.Where(file => new FileInfo(file).Length % blockSize == 0).ToList();
|
||||
|
||||
files.Sort(StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
@@ -323,75 +322,75 @@ 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);
|
||||
|
||||
@@ -52,25 +52,14 @@ sealed class DecodeCommand : Command
|
||||
|
||||
public DecodeCommand() : base("decode", UI.Image_Decode_Command_Description)
|
||||
{
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--disk-tags", "-f"
|
||||
}, () => true, UI.Decode_media_tags));
|
||||
Add(new Option<bool>(new[] { "--disk-tags", "-f" }, () => true, UI.Decode_media_tags));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--length", "-l"
|
||||
}, () => UI.Parameter_response_all_sectors, UI.How_many_sectors_to_decode_or_all));
|
||||
Add(new Option<string>(new[] { "--length", "-l" }, () => UI.Parameter_response_all_sectors,
|
||||
UI.How_many_sectors_to_decode_or_all));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--sector-tags", "-p"
|
||||
}, () => true, UI.Decode_sector_tags));
|
||||
Add(new Option<bool>(new[] { "--sector-tags", "-p" }, () => true, UI.Decode_sector_tags));
|
||||
|
||||
Add(new Option<ulong>(new[]
|
||||
{
|
||||
"--start", "-s"
|
||||
}, () => 0, UI.Sector_to_start_decoding_from));
|
||||
Add(new Option<ulong>(new[] { "--start", "-s" }, () => 0, UI.Sector_to_start_decoding_from));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -82,7 +71,7 @@ sealed class DecodeCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool verbose, bool debug, bool diskTags, string imagePath, string length, bool sectorTags,
|
||||
public static int Invoke(bool verbose, bool debug, bool diskTags, string imagePath, string length, bool sectorTags,
|
||||
ulong startSector)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -95,41 +84,43 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--disk-tags={0}", diskTags);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--disk-tags={0}", diskTags);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--sector-tags={0}", sectorTags);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", startSector);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", startSector);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -142,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)
|
||||
{
|
||||
@@ -165,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)
|
||||
{
|
||||
@@ -184,10 +175,13 @@ sealed class DecodeCommand : Command
|
||||
ErrorNumber errno;
|
||||
|
||||
if(diskTags)
|
||||
{
|
||||
if(inputFormat.Info.ReadableMediaTags.Count == 0)
|
||||
AaruConsole.WriteLine(UI.There_are_no_media_tags_in_chosen_disc_image);
|
||||
else
|
||||
{
|
||||
foreach(MediaTagType tag in inputFormat.Info.ReadableMediaTags)
|
||||
{
|
||||
switch(tag)
|
||||
{
|
||||
case MediaTagType.SCSI_INQUIRY:
|
||||
@@ -216,8 +210,10 @@ sealed class DecodeCommand : Command
|
||||
errno = inputFormat.ReadMediaTag(MediaTagType.ATA_IDENTIFY, out byte[] identify);
|
||||
|
||||
if(errno != ErrorNumber.NoError)
|
||||
{
|
||||
AaruConsole.WriteLine(UI.Error_0_reading_ATA_IDENTIFY_DEVICE_response_from_disc_image,
|
||||
errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{UI.ATA_IDENTIFY_DEVICE_command_response}[/]");
|
||||
@@ -238,9 +234,11 @@ sealed class DecodeCommand : Command
|
||||
errno = inputFormat.ReadMediaTag(MediaTagType.ATAPI_IDENTIFY, out byte[] identify);
|
||||
|
||||
if(identify == null)
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(UI.Error_0_reading_ATA_IDENTIFY_PACKET_DEVICE_response_from_disc_image,
|
||||
errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{UI.ATA_IDENTIFY_PACKET_DEVICE_command_response}[/]");
|
||||
@@ -388,6 +386,9 @@ sealed class DecodeCommand : Command
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!sectorTags)
|
||||
return (int)ErrorNumber.NoError;
|
||||
@@ -407,7 +408,9 @@ sealed class DecodeCommand : Command
|
||||
if(inputFormat.Info.ReadableSectorTags.Count == 0)
|
||||
AaruConsole.WriteLine(UI.There_are_no_sector_tags_in_chosen_disc_image);
|
||||
else
|
||||
{
|
||||
foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags)
|
||||
{
|
||||
switch(tag)
|
||||
{
|
||||
default:
|
||||
@@ -415,6 +418,8 @@ sealed class DecodeCommand : Command
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Not implemented
|
||||
|
||||
|
||||
@@ -50,20 +50,13 @@ sealed class EntropyCommand : Command
|
||||
|
||||
public EntropyCommand() : base("entropy", UI.Image_Entropy_Command_Description)
|
||||
{
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--duplicated-sectors", "-p"
|
||||
}, () => true, UI.Calculates_how_many_sectors_are_duplicated));
|
||||
Add(new Option<bool>(new[] { "--duplicated-sectors", "-p" }, () => true,
|
||||
UI.Calculates_how_many_sectors_are_duplicated));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--separated-tracks", "-t"
|
||||
}, () => true, UI.Calculates_entropy_for_each_track_separately));
|
||||
Add(new Option<bool>(new[] { "--separated-tracks", "-t" }, () => true,
|
||||
UI.Calculates_entropy_for_each_track_separately));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--whole-disc", "-w"
|
||||
}, () => true, UI.Calculates_entropy_for_the_whole_disc));
|
||||
Add(new Option<bool>(new[] { "--whole-disc", "-w" }, () => true, UI.Calculates_entropy_for_the_whole_disc));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -88,40 +81,42 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--duplicated-sectors={0}", duplicatedSectors);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--separated-tracks={0}", separatedTracks);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--whole-disc={0}", wholeDisc);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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,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)
|
||||
{
|
||||
@@ -148,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)
|
||||
{
|
||||
@@ -171,42 +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)
|
||||
{
|
||||
@@ -233,24 +234,31 @@ sealed class EntropyCommand : Command
|
||||
trackEntropy.Entropy);
|
||||
|
||||
if(trackEntropy.UniqueSectors != null)
|
||||
AaruConsole.WriteLine(UI.Track_0_has_1_unique_sectors_2, trackEntropy.Track,
|
||||
{
|
||||
AaruConsole.WriteLine(UI.Track_0_has_1_unique_sectors_2,
|
||||
trackEntropy.Track,
|
||||
trackEntropy.UniqueSectors,
|
||||
(double)trackEntropy.UniqueSectors / trackEntropy.Sectors);
|
||||
(double)trackEntropy.UniqueSectors /
|
||||
trackEntropy.Sectors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!wholeDisc)
|
||||
return;
|
||||
|
||||
EntropyResults entropy = inputFormat.Info.MetadataMediaType == MetadataMediaType.LinearMedia
|
||||
? entropyCalculator.CalculateLinearMediaEntropy()
|
||||
: entropyCalculator.CalculateMediaEntropy(duplicatedSectors);
|
||||
EntropyResults entropy =
|
||||
inputFormat.Info.MetadataMediaType == MetadataMediaType.LinearMedia
|
||||
? entropyCalculator.CalculateLinearMediaEntropy()
|
||||
: entropyCalculator.CalculateMediaEntropy(duplicatedSectors);
|
||||
|
||||
AaruConsole.WriteLine(UI.Entropy_for_disk_is_0, entropy.Entropy);
|
||||
|
||||
if(entropy.UniqueSectors != null)
|
||||
{
|
||||
AaruConsole.WriteLine(UI.Disk_has_0_unique_sectors_1, entropy.UniqueSectors,
|
||||
(double)entropy.UniqueSectors / entropy.Sectors);
|
||||
}
|
||||
});
|
||||
|
||||
return (int)ErrorNumber.NoError;
|
||||
|
||||
@@ -71,37 +71,39 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -115,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)
|
||||
{
|
||||
@@ -135,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)
|
||||
{
|
||||
|
||||
@@ -64,24 +64,26 @@ 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);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-options");
|
||||
|
||||
@@ -94,7 +96,7 @@ sealed class ListOptionsCommand : Command
|
||||
if(Activator.CreateInstance(kvp.Value) is not IBaseWritableImage plugin)
|
||||
continue;
|
||||
|
||||
List<(string name, Type type, string description, object @default)> options =
|
||||
var options =
|
||||
plugin.SupportedOptions.ToList();
|
||||
|
||||
if(options.Count == 0)
|
||||
@@ -112,8 +114,10 @@ sealed class ListOptionsCommand : Command
|
||||
|
||||
foreach((string name, Type type, string description, object @default) option in
|
||||
options.OrderBy(t => t.name))
|
||||
{
|
||||
table.AddRow(Markup.Escape(option.name), TypeToString(option.type), option.@default?.ToString() ?? "",
|
||||
Markup.Escape(option.description));
|
||||
}
|
||||
|
||||
AnsiConsole.Write(table);
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
@@ -50,25 +50,13 @@ sealed class PrintHexCommand : Command
|
||||
|
||||
public PrintHexCommand() : base("print", UI.Image_Print_Command_Description)
|
||||
{
|
||||
Add(new Option<ulong>(new[]
|
||||
{
|
||||
"--length", "-l"
|
||||
}, () => 1, UI.How_many_sectors_to_print));
|
||||
Add(new Option<ulong>(new[] { "--length", "-l" }, () => 1, UI.How_many_sectors_to_print));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--long-sectors", "-r"
|
||||
}, () => false, UI.Print_sectors_with_tags_included));
|
||||
Add(new Option<bool>(new[] { "--long-sectors", "-r" }, () => false, UI.Print_sectors_with_tags_included));
|
||||
|
||||
Add(new Option<ulong>(new[]
|
||||
{
|
||||
"--start", "-s"
|
||||
}, UI.Starting_sector));
|
||||
Add(new Option<ulong>(new[] { "--start", "-s" }, UI.Starting_sector));
|
||||
|
||||
Add(new Option<ushort>(new[]
|
||||
{
|
||||
"--width", "-w"
|
||||
}, () => 32, UI.How_many_bytes_to_print_per_line));
|
||||
Add(new Option<ushort>(new[] { "--width", "-w" }, () => 32, UI.How_many_bytes_to_print_per_line));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -80,7 +68,7 @@ sealed class PrintHexCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, ulong length, bool longSectors, ulong start,
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, ulong length, bool longSectors, ulong start,
|
||||
ushort width)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -93,41 +81,43 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--length={0}", length);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--long-sectors={0}", longSectors);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", start);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--width={0}", width);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--start={0}", start);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--width={0}", width);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -139,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)
|
||||
{
|
||||
@@ -154,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)
|
||||
{
|
||||
@@ -173,22 +163,23 @@ sealed class PrintHexCommand : Command
|
||||
|
||||
AaruConsole.WriteLine($"[bold][italic]{string.Format(UI.Start_0_as_in_sector_start, start)}[/][/]");
|
||||
|
||||
byte[] data = new byte[length];
|
||||
var data = new byte[length];
|
||||
ErrorNumber errno = ErrorNumber.NoError;
|
||||
int bytesRead = 0;
|
||||
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)
|
||||
{
|
||||
byte[] tmp = new byte[bytesRead];
|
||||
var tmp = new byte[bytesRead];
|
||||
Array.Copy(data, 0, tmp, 0, bytesRead);
|
||||
data = tmp;
|
||||
}
|
||||
@@ -199,6 +190,7 @@ sealed class PrintHexCommand : Command
|
||||
AaruConsole.ErrorWriteLine(string.Format(UI.Error_0_reading_data_from_1, errno, start));
|
||||
}
|
||||
else
|
||||
{
|
||||
for(ulong i = 0; i < length; i++)
|
||||
{
|
||||
if(inputFormat is not IMediaImage blockImage)
|
||||
@@ -231,18 +223,20 @@ 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)));
|
||||
else
|
||||
AaruConsole.ErrorWriteLine(string.Format(UI.Error_0_reading_sector_1, errno, start + i));
|
||||
}
|
||||
}
|
||||
|
||||
return (int)ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
@@ -55,25 +55,13 @@ sealed class VerifyCommand : Command
|
||||
|
||||
public VerifyCommand() : base("verify", UI.Image_Verify_Command_Description)
|
||||
{
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--verify-disc", "-w"
|
||||
}, () => true, UI.Verify_media_image_if_supported));
|
||||
Add(new Option<bool>(new[] { "--verify-disc", "-w" }, () => true, UI.Verify_media_image_if_supported));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--verify-sectors", "-s"
|
||||
}, () => true, UI.Verify_all_sectors_if_supported));
|
||||
Add(new Option<bool>(new[] { "--verify-sectors", "-s" }, () => true, UI.Verify_all_sectors_if_supported));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--create-graph", "-g"
|
||||
}, () => true, UI.Create_graph_of_verified_disc));
|
||||
Add(new Option<bool>(new[] { "--create-graph", "-g" }, () => true, UI.Create_graph_of_verified_disc));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--dimensions"
|
||||
}, () => 1080, UI.Verify_dimensions_paramater_help));
|
||||
Add(new Option<uint>(new[] { "--dimensions" }, () => 1080, UI.Verify_dimensions_paramater_help));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -85,7 +73,7 @@ sealed class VerifyCommand : Command
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, bool verifyDisc, bool verifySectors,
|
||||
public static int Invoke(bool debug, bool verbose, string imagePath, bool verifyDisc, bool verifySectors,
|
||||
bool createGraph, uint dimensions)
|
||||
{
|
||||
MainClass.PrintCopyright();
|
||||
@@ -98,41 +86,43 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-disc={0}", verifyDisc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--input={0}", imagePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-disc={0}", verifyDisc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verify-sectors={0}", verifySectors);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
|
||||
|
||||
var filtersList = new FiltersList();
|
||||
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)
|
||||
{
|
||||
@@ -144,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)
|
||||
{
|
||||
@@ -159,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)
|
||||
{
|
||||
@@ -197,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)
|
||||
{
|
||||
@@ -228,19 +218,21 @@ sealed class VerifyCommand : Command
|
||||
}
|
||||
|
||||
if(!verifySectors)
|
||||
{
|
||||
return correctImage switch
|
||||
{
|
||||
null => (int)ErrorNumber.NotVerifiable,
|
||||
false => (int)ErrorNumber.BadImageSectorsNotVerified,
|
||||
true => (int)ErrorNumber.CorrectImageSectorsNotVerified
|
||||
};
|
||||
{
|
||||
null => (int)ErrorNumber.NotVerifiable,
|
||||
false => (int)ErrorNumber.BadImageSectorsNotVerified,
|
||||
true => (int)ErrorNumber.CorrectImageSectorsNotVerified
|
||||
};
|
||||
}
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
List<ulong> failingLbas = new();
|
||||
List<ulong> unknownLbas = new();
|
||||
IMediaGraph mediaGraph = null;
|
||||
|
||||
if(verifiableSectorsImage is IOpticalMediaImage { Tracks: {} } opticalMediaImage)
|
||||
if(verifiableSectorsImage is IOpticalMediaImage { Tracks: not null } opticalMediaImage)
|
||||
{
|
||||
Spiral.DiscParameters spiralParameters = null;
|
||||
|
||||
@@ -248,8 +240,10 @@ sealed class VerifyCommand : Command
|
||||
spiralParameters = Spiral.DiscParametersFromMediaType(opticalMediaImage.Info.MediaType);
|
||||
|
||||
if(spiralParameters is not null)
|
||||
{
|
||||
mediaGraph = new Spiral((int)dimensions, (int)dimensions, spiralParameters,
|
||||
opticalMediaImage.Info.Sectors);
|
||||
}
|
||||
else if(createGraph)
|
||||
mediaGraph = new BlockMap((int)dimensions, (int)dimensions, opticalMediaImage.Info.Sectors);
|
||||
|
||||
@@ -261,88 +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)
|
||||
{
|
||||
@@ -352,65 +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)
|
||||
@@ -433,16 +441,20 @@ sealed class VerifyCommand : Command
|
||||
if(failingLbas.Count == (int)inputFormat.Info.Sectors)
|
||||
AaruConsole.VerboseWriteLine($"\t[red]{UI.all_sectors}[/]");
|
||||
else
|
||||
{
|
||||
foreach(ulong t in failingLbas)
|
||||
AaruConsole.VerboseWriteLine("\t{0}", t);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine($"[yellow3_1]{UI.LBAs_without_checksum}[/]");
|
||||
|
||||
if(unknownLbas.Count == (int)inputFormat.Info.Sectors)
|
||||
AaruConsole.VerboseWriteLine($"\t[yellow3_1]{UI.all_sectors}[/]");
|
||||
else
|
||||
{
|
||||
foreach(ulong t in unknownLbas)
|
||||
AaruConsole.VerboseWriteLine("\t{0}", t);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Convert to table
|
||||
@@ -459,16 +471,16 @@ sealed class VerifyCommand : Command
|
||||
correctSectors = true;
|
||||
|
||||
return correctImage switch
|
||||
{
|
||||
null when correctSectors is null => (int)ErrorNumber.NotVerifiable,
|
||||
null when correctSectors == false => (int)ErrorNumber.BadSectorsImageNotVerified,
|
||||
null => (int)ErrorNumber.CorrectSectorsImageNotVerified,
|
||||
false when correctSectors is null => (int)ErrorNumber.BadImageSectorsNotVerified,
|
||||
false when correctSectors == false => (int)ErrorNumber.BadImageBadSectors,
|
||||
false => (int)ErrorNumber.CorrectSectorsBadImage,
|
||||
true when correctSectors is null => (int)ErrorNumber.CorrectImageSectorsNotVerified,
|
||||
true when correctSectors == false => (int)ErrorNumber.CorrectImageBadSectors,
|
||||
true => (int)ErrorNumber.NoError
|
||||
};
|
||||
{
|
||||
null when correctSectors is null => (int)ErrorNumber.NotVerifiable,
|
||||
null when correctSectors == false => (int)ErrorNumber.BadSectorsImageNotVerified,
|
||||
null => (int)ErrorNumber.CorrectSectorsImageNotVerified,
|
||||
false when correctSectors is null => (int)ErrorNumber.BadImageSectorsNotVerified,
|
||||
false when correctSectors == false => (int)ErrorNumber.BadImageBadSectors,
|
||||
false => (int)ErrorNumber.CorrectSectorsBadImage,
|
||||
true when correctSectors is null => (int)ErrorNumber.CorrectImageSectorsNotVerified,
|
||||
true when correctSectors == false => (int)ErrorNumber.CorrectImageBadSectors,
|
||||
true => (int)ErrorNumber.NoError
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Linq;
|
||||
@@ -62,29 +61,31 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
List<CommonEncodingInfo> encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo
|
||||
var encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo
|
||||
{
|
||||
Name = info.Name,
|
||||
DisplayName = info.GetEncoding().EncodingName
|
||||
@@ -108,9 +109,13 @@ sealed class ListEncodingsCommand : Command
|
||||
return (int)ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
#region Nested type: CommonEncodingInfo
|
||||
|
||||
struct CommonEncodingInfo
|
||||
{
|
||||
public string Name;
|
||||
public string DisplayName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -63,24 +63,26 @@ 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);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
Statistics.AddCommand("list-namespaces");
|
||||
|
||||
|
||||
@@ -71,60 +71,37 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
public DumpMediaCommand() : base("dump", UI.Media_Dump_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--cicm-xml", "-x"
|
||||
}, () => null, UI.Take_metadata_from_existing_CICM_XML_sidecar));
|
||||
Add(new Option<string>(new[] { "--cicm-xml", "-x" }, () => null,
|
||||
UI.Take_metadata_from_existing_CICM_XML_sidecar));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--encoding", "-e"
|
||||
}, () => null, UI.Name_of_character_encoding_to_use));
|
||||
Add(new Option<string>(new[] { "--encoding", "-e" }, () => null, UI.Name_of_character_encoding_to_use));
|
||||
|
||||
Add(new Option<bool>("--first-pregap", () => false, UI.Try_to_read_first_track_pregap));
|
||||
|
||||
Add(new Option<bool>("--fix-offset", () => true, UI.Fix_audio_tracks_offset));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--force", "-f"
|
||||
}, () => false, UI.Continue_dumping_whatever_happens));
|
||||
Add(new Option<bool>(new[] { "--force", "-f" }, () => false, UI.Continue_dumping_whatever_happens));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--format", "-t"
|
||||
}, () => null, UI.Format_of_the_output_image_as_plugin_name_or_plugin_id));
|
||||
Add(new Option<string>(new[] { "--format", "-t" }, () => null,
|
||||
UI.Format_of_the_output_image_as_plugin_name_or_plugin_id));
|
||||
|
||||
Add(new Option<bool>("--metadata", () => true, UI.Enables_creating_Aaru_Metadata_sidecar));
|
||||
|
||||
Add(new Option<bool>("--trim", () => true, UI.Enables_trimming_errored_from_skipped_sectors));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--options", "-O"
|
||||
}, () => null, UI.Comma_separated_name_value_pairs_of_image_options));
|
||||
Add(new Option<string>(new[] { "--options", "-O" }, () => null,
|
||||
UI.Comma_separated_name_value_pairs_of_image_options));
|
||||
|
||||
Add(new Option<bool>("--persistent", () => false, UI.Try_to_recover_partial_or_incorrect_data));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--resume", "-r"
|
||||
}, () => true, UI.Create_or_use_resume_mapfile));
|
||||
Add(new Option<bool>(new[] { "--resume", "-r" }, () => true, UI.Create_or_use_resume_mapfile));
|
||||
|
||||
Add(new Option<ushort>(new[]
|
||||
{
|
||||
"--retry-passes", "-p"
|
||||
}, () => 5, UI.How_many_retry_passes_to_do));
|
||||
Add(new Option<ushort>(new[] { "--retry-passes", "-p" }, () => 5, UI.How_many_retry_passes_to_do));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--skip", "-k"
|
||||
}, () => 512, UI.When_an_unreadable_sector_is_found_skip_this_many_sectors));
|
||||
Add(new Option<uint>(new[] { "--skip", "-k" }, () => 512,
|
||||
UI.When_an_unreadable_sector_is_found_skip_this_many_sectors));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--stop-on-error", "-s"
|
||||
}, () => false, UI.Stop_media_dump_on_first_error));
|
||||
Add(new Option<bool>(new[] { "--stop-on-error", "-s" }, () => false, UI.Stop_media_dump_on_first_error));
|
||||
|
||||
Add(new Option<string>("--subchannel", () => UI.Subchannel_name_any, UI.Subchannel_to_dump_help));
|
||||
|
||||
@@ -144,85 +121,40 @@ sealed class DumpMediaCommand : Command
|
||||
Name = "output-path"
|
||||
});
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--private"
|
||||
}, () => false, UI.Do_not_store_paths_and_serial_numbers_in_log_or_metadata));
|
||||
Add(new Option<bool>(new[] { "--private" }, () => false,
|
||||
UI.Do_not_store_paths_and_serial_numbers_in_log_or_metadata));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--fix-subchannel-position"
|
||||
}, () => true, UI.Fix_subchannel_position_help));
|
||||
Add(new Option<bool>(new[] { "--fix-subchannel-position" }, () => true, UI.Fix_subchannel_position_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--retry-subchannel"
|
||||
}, () => true, UI.Retry_subchannel_help));
|
||||
Add(new Option<bool>(new[] { "--retry-subchannel" }, () => true, UI.Retry_subchannel_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--fix-subchannel"
|
||||
}, () => false, UI.Fix_subchannel_help));
|
||||
Add(new Option<bool>(new[] { "--fix-subchannel" }, () => false, UI.Fix_subchannel_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--fix-subchannel-crc"
|
||||
}, () => false, UI.Fix_subchannel_crc_help));
|
||||
Add(new Option<bool>(new[] { "--fix-subchannel-crc" }, () => false, UI.Fix_subchannel_crc_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--generate-subchannels"
|
||||
}, () => false, UI.Generate_subchannels_dump_help));
|
||||
Add(new Option<bool>(new[] { "--generate-subchannels" }, () => false, UI.Generate_subchannels_dump_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--skip-cdiready-hole"
|
||||
}, () => true, UI.Skip_CDi_Ready_hole_help));
|
||||
Add(new Option<bool>(new[] { "--skip-cdiready-hole" }, () => true, UI.Skip_CDi_Ready_hole_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--eject"
|
||||
}, () => false, UI.Eject_media_after_dump_finishes));
|
||||
Add(new Option<bool>(new[] { "--eject" }, () => false, UI.Eject_media_after_dump_finishes));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--max-blocks"
|
||||
}, () => 64, UI.Maximum_number_of_blocks_to_read_at_once));
|
||||
Add(new Option<uint>(new[] { "--max-blocks" }, () => 64, UI.Maximum_number_of_blocks_to_read_at_once));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--use-buffered-reads"
|
||||
}, () => true, UI.OS_buffered_reads_help));
|
||||
Add(new Option<bool>(new[] { "--use-buffered-reads" }, () => true, UI.OS_buffered_reads_help));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--store-encrypted"
|
||||
}, () => true, UI.Store_encrypted_data_as_is));
|
||||
Add(new Option<bool>(new[] { "--store-encrypted" }, () => true, UI.Store_encrypted_data_as_is));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--title-keys"
|
||||
}, () => true, UI.Try_to_read_the_title_keys_from_CSS_DVDs));
|
||||
Add(new Option<bool>(new[] { "--title-keys" }, () => true, UI.Try_to_read_the_title_keys_from_CSS_DVDs));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--ignore-cdr-runouts"
|
||||
}, () => 10, UI.How_many_CDRW_run_out_sectors_to_ignore_and_regenerate));
|
||||
Add(new Option<uint>(new[] { "--ignore-cdr-runouts" }, () => 10,
|
||||
UI.How_many_CDRW_run_out_sectors_to_ignore_and_regenerate));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--create-graph", "-g"
|
||||
}, () => true, UI.Create_graph_of_dumped_media));
|
||||
Add(new Option<bool>(new[] { "--create-graph", "-g" }, () => true, UI.Create_graph_of_dumped_media));
|
||||
|
||||
Add(new Option<uint>(new[]
|
||||
{
|
||||
"--dimensions"
|
||||
}, () => 1080, UI.Dump_graph_dimensions_argument_help));
|
||||
Add(new Option<uint>(new[] { "--dimensions" }, () => 1080, UI.Dump_graph_dimensions_argument_help));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--aaru-metadata", "-m"
|
||||
}, () => null, "Take metadata from existing Aaru Metadata sidecar."));
|
||||
Add(new Option<string>(new[] { "--aaru-metadata", "-m" }, () => null,
|
||||
"Take metadata from existing Aaru Metadata sidecar."));
|
||||
|
||||
Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke)));
|
||||
}
|
||||
@@ -246,22 +178,24 @@ 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;
|
||||
fixSubchannelPosition |= retrySubchannel || fixSubchannel;
|
||||
@@ -271,41 +205,41 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
Statistics.AddCommand("dump-media");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--first-pregap={0}", firstPregap);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-offset={0}", fixOffset);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--metadata={0}", metadata);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--persistent={0}", persistent);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--resume={0}", resume);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-passes={0}", retryPasses);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--skip={0}", skip);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--stop-on-error={0}", stopOnError);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--trim={0}", trim);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--subchannel={0}", subchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--private={0}", @private);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--cicm-xml={0}", cicmXml);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--encoding={0}", encoding);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--first-pregap={0}", firstPregap);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-offset={0}", fixOffset);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--force={0}", force);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--format={0}", format);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--metadata={0}", metadata);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--options={0}", options);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output={0}", outputPath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--persistent={0}", persistent);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--resume={0}", resume);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-passes={0}", retryPasses);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--skip={0}", skip);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--stop-on-error={0}", stopOnError);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--trim={0}", trim);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--subchannel={0}", subchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--private={0}", @private);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-position={0}", fixSubchannelPosition);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-subchannel={0}", retrySubchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--skip-cdiready-hole={0}", skipCdiReadyHole);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--eject={0}", eject);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--max-blocks={0}", maxBlocks);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--store-encrypted={0}", storeEncrypted);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--title-keys={0}", titleKeys);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--ignore-cdr-runouts={0}", ignoreCdrRunOuts);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--retry-subchannel={0}", retrySubchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel={0}", fixSubchannel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--fix-subchannel-crc={0}", fixSubchannelCrc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--generate-subchannels={0}", generateSubchannels);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--skip-cdiready-hole={0}", skipCdiReadyHole);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--eject={0}", eject);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--max-blocks={0}", maxBlocks);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--store-encrypted={0}", storeEncrypted);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--title-keys={0}", titleKeys);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--ignore-cdr-runouts={0}", ignoreCdrRunOuts);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--create-graph={0}", createGraph);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--dimensions={0}", dimensions);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--aaru-metadata={0}", aaruMetadata);
|
||||
|
||||
// TODO: Disabled temporarily
|
||||
//AaruConsole.DebugWriteLine(MODULE_NAME, "--raw={0}", raw);
|
||||
@@ -319,6 +253,7 @@ sealed class DumpMediaCommand : Command
|
||||
Encoding encodingClass = null;
|
||||
|
||||
if(encoding != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
encodingClass = Claunia.Encoding.Encoding.GetEncoding(encoding);
|
||||
@@ -332,6 +267,7 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
return (int)ErrorNumber.EncodingUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
DumpSubchannel wantedSubchannel = DumpSubchannel.Any;
|
||||
|
||||
@@ -358,8 +294,10 @@ sealed class DumpMediaCommand : Command
|
||||
TextReader resReader;
|
||||
|
||||
if(isResponse)
|
||||
{
|
||||
resReader = new StreamReader(Path.Combine(Path.GetDirectoryName(outputPath),
|
||||
Path.GetFileNameWithoutExtension(outputPath)));
|
||||
}
|
||||
else
|
||||
resReader = new StringReader(Path.GetFileNameWithoutExtension(outputPath));
|
||||
|
||||
@@ -372,24 +310,36 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
// Try extension
|
||||
if(string.IsNullOrEmpty(format))
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
where plugin is not null where plugin.KnownExtensions.Contains(extension)
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.KnownExtensions.Contains(extension)
|
||||
select plugin);
|
||||
}
|
||||
|
||||
// Try Id
|
||||
else if(Guid.TryParse(format, out Guid outId))
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
where plugin is not null where plugin.Id.Equals(outId) select plugin);
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.Id.Equals(outId)
|
||||
select plugin);
|
||||
}
|
||||
|
||||
// Try name
|
||||
else
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.Name.Equals(format, StringComparison.InvariantCultureIgnoreCase)
|
||||
select plugin);
|
||||
}
|
||||
|
||||
switch(candidates.Count)
|
||||
{
|
||||
@@ -429,9 +379,11 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
// Replace Windows forbidden filename characters with Japanese equivalents that are visually the same, but bigger.
|
||||
if(DetectOS.IsWindows)
|
||||
{
|
||||
responseLine = responseLine.Replace('<', '\uFF1C').Replace('>', '\uFF1E').Replace(':', '\uFF1A').
|
||||
Replace('"', '\u2033').Replace('\\', '\').Replace('|', '|').
|
||||
Replace('?', '?').Replace('*', '*');
|
||||
}
|
||||
|
||||
if(devicePath.Length == 2 &&
|
||||
devicePath[1] == ':' &&
|
||||
@@ -443,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)
|
||||
{
|
||||
@@ -502,16 +454,16 @@ sealed class DumpMediaCommand : Command
|
||||
else if(File.Exists(outputPrefix + ".resume.xml") && resume)
|
||||
{
|
||||
// Should be covered by virtue of being the same exact class as the JSON above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
var xs = new XmlSerializer(typeof(Resume));
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
var sr = new StreamReader(outputPrefix + ".resume.xml");
|
||||
|
||||
// Should be covered by virtue of being the same exact class as the JSON above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
resumeClass = (Resume)xs.Deserialize(sr);
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
sr.Close();
|
||||
}
|
||||
@@ -545,7 +497,9 @@ sealed class DumpMediaCommand : Command
|
||||
Metadata sidecar = null;
|
||||
|
||||
if(aaruMetadata != null)
|
||||
{
|
||||
if(File.Exists(aaruMetadata))
|
||||
{
|
||||
try
|
||||
{
|
||||
var fs = new FileStream(aaruMetadata, FileMode.Open);
|
||||
@@ -565,6 +519,7 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
return (int)ErrorNumber.InvalidSidecar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.ErrorWriteLine(UI.Could_not_find_metadata_sidecar);
|
||||
@@ -574,21 +529,24 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
return (int)ErrorNumber.NoSuchFile;
|
||||
}
|
||||
}
|
||||
else if(cicmXml != null)
|
||||
{
|
||||
if(File.Exists(cicmXml))
|
||||
{
|
||||
try
|
||||
{
|
||||
var sr = new StreamReader(cicmXml);
|
||||
|
||||
// Bypassed by JSON source generator used above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
var sidecarXs = new XmlSerializer(typeof(CICMMetadataType));
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
// Bypassed by JSON source generator used above
|
||||
#pragma warning disable IL2026
|
||||
#pragma warning disable IL2026
|
||||
sidecar = (CICMMetadataType)sidecarXs.Deserialize(sr);
|
||||
#pragma warning restore IL2026
|
||||
#pragma warning restore IL2026
|
||||
|
||||
sr.Close();
|
||||
}
|
||||
@@ -601,6 +559,7 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
return (int)ErrorNumber.InvalidSidecar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AaruConsole.ErrorWriteLine(UI.Could_not_find_metadata_sidecar);
|
||||
@@ -610,30 +569,43 @@ sealed class DumpMediaCommand : Command
|
||||
|
||||
return (int)ErrorNumber.NoSuchFile;
|
||||
}
|
||||
}
|
||||
|
||||
plugins = PluginBase.Singleton;
|
||||
candidates = new List<IBaseWritableImage>();
|
||||
|
||||
// Try extension
|
||||
if(string.IsNullOrEmpty(format))
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.KnownExtensions.Contains(Path.GetExtension(outputPath)) select plugin);
|
||||
where plugin.KnownExtensions.Contains(Path.GetExtension(outputPath))
|
||||
select plugin);
|
||||
}
|
||||
|
||||
// Try Id
|
||||
else if(Guid.TryParse(format, out Guid outId))
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
where plugin is not null where plugin.Id.Equals(outId) select plugin);
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.Id.Equals(outId)
|
||||
select plugin);
|
||||
}
|
||||
|
||||
// Try name
|
||||
else
|
||||
{
|
||||
candidates.AddRange(from pluginType in plugins.WritableImages.Values
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage into plugin
|
||||
select Activator.CreateInstance(pluginType) as IBaseWritableImage
|
||||
into plugin
|
||||
where plugin is not null
|
||||
where plugin.Name.Equals(format, StringComparison.InvariantCultureIgnoreCase)
|
||||
select plugin);
|
||||
}
|
||||
|
||||
IBaseWritableImage outputFormat = candidates[0];
|
||||
|
||||
@@ -663,121 +635,120 @@ 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();
|
||||
}
|
||||
|
||||
@@ -69,10 +69,7 @@ sealed class MediaInfoCommand : Command
|
||||
|
||||
public MediaInfoCommand() : base("info", UI.Media_Info_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--output-prefix", "-w"
|
||||
}, () => null, UI.Prefix_for_saving_binary_information));
|
||||
Add(new Option<string>(new[] { "--output-prefix", "-w" }, () => null, UI.Prefix_for_saving_binary_information));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -96,29 +93,31 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--output-prefix={0}", outputPrefix);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
if(devicePath.Length == 2 &&
|
||||
devicePath[1] == ':' &&
|
||||
@@ -130,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)
|
||||
{
|
||||
@@ -178,7 +177,8 @@ sealed class MediaInfoCommand : Command
|
||||
DoScsiMediaInfo(debug, outputPrefix, dev);
|
||||
|
||||
break;
|
||||
default: throw new NotSupportedException(Localization.Core.Unknown_device_type);
|
||||
default:
|
||||
throw new NotSupportedException(Localization.Core.Unknown_device_type);
|
||||
}
|
||||
|
||||
return (int)ErrorNumber.NoError;
|
||||
@@ -196,21 +196,25 @@ 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;
|
||||
|
||||
if(scsiInfo.DeviceInfo.ScsiModeSense6 != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)",
|
||||
scsiInfo.DeviceInfo.ScsiModeSense6);
|
||||
}
|
||||
|
||||
if(scsiInfo.DeviceInfo.ScsiModeSense10 != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)",
|
||||
scsiInfo.DeviceInfo.ScsiModeSense10);
|
||||
}
|
||||
|
||||
switch(dev.ScsiType)
|
||||
{
|
||||
@@ -223,18 +227,24 @@ sealed class MediaInfoCommand : Command
|
||||
case PeripheralDeviceTypes.BridgingExpander when dev.Model.StartsWith("MDM", StringComparison.Ordinal) ||
|
||||
dev.Model.StartsWith("MDH", StringComparison.Ordinal):
|
||||
if(scsiInfo.ReadCapacity != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY",
|
||||
scsiInfo.ReadCapacity);
|
||||
}
|
||||
|
||||
if(scsiInfo.ReadCapacity16 != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readcapacity16.bin",
|
||||
"SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16);
|
||||
}
|
||||
|
||||
if(scsiInfo.Blocks != 0 &&
|
||||
scsiInfo.BlockSize != 0)
|
||||
{
|
||||
AaruConsole.WriteLine(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2,
|
||||
scsiInfo.Blocks, scsiInfo.BlockSize,
|
||||
ByteSize.FromBytes(scsiInfo.Blocks * scsiInfo.BlockSize).ToString("0.000"));
|
||||
}
|
||||
|
||||
break;
|
||||
case PeripheralDeviceTypes.SequentialAccess:
|
||||
@@ -270,16 +280,22 @@ sealed class MediaInfoCommand : Command
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
if(scsiInfo.MmcConfiguration != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_getconfiguration_current.bin",
|
||||
"SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration);
|
||||
}
|
||||
|
||||
if(scsiInfo.RecognizedFormatLayers != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_formatlayers.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers);
|
||||
}
|
||||
|
||||
if(scsiInfo.WriteProtectionStatus != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_writeprotection.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdPfi != null)
|
||||
{
|
||||
@@ -296,11 +312,15 @@ sealed class MediaInfoCommand : Command
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi);
|
||||
|
||||
if(DMI.IsXbox(scsiInfo.DvdDmi))
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Xbox_DMI}:[/]",
|
||||
$"\n{Markup.Escape(DMI.PrettifyXbox(scsiInfo.DvdDmi))}");
|
||||
}
|
||||
else if(DMI.IsXbox360(scsiInfo.DvdDmi))
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Xbox_360_DMI}:[/]",
|
||||
$"\n{Markup.Escape(DMI.PrettifyXbox360(scsiInfo.DvdDmi))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdCmi != null)
|
||||
@@ -313,20 +333,28 @@ sealed class MediaInfoCommand : Command
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdDiscKey != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_disckey.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdDiscKey);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdSectorCmi != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdSectorCmi);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdBca != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_bca.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdBca);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdAacs != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_aacs.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdRamDds != null)
|
||||
{
|
||||
@@ -356,8 +384,10 @@ sealed class MediaInfoCommand : Command
|
||||
}
|
||||
|
||||
if(scsiInfo.LastBorderOutRmd != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_lastrmd.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdPreRecordedInfo != null)
|
||||
{
|
||||
@@ -365,13 +395,17 @@ sealed class MediaInfoCommand : Command
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo);
|
||||
|
||||
if(scsiInfo.DecodedDvdPrePitInformation.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.DVD_RW_Pre_Recorded_Information}:[/]",
|
||||
$"\n{Markup.Escape(PRI.Prettify(scsiInfo.DecodedDvdPrePitInformation))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrMediaIdentifier != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdr_mediaid.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrPhysicalInformation != null)
|
||||
{
|
||||
@@ -379,49 +413,71 @@ sealed class MediaInfoCommand : Command
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation);
|
||||
|
||||
if(scsiInfo.DecodedDvdrPfi.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.DVD_RW_PFI}:[/]",
|
||||
$"\n{Markup.Escape(PFI.Prettify(scsiInfo.DecodedDvdrPfi))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdPlusAdip != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd+_adip.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdPlusDcb != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd+_dcb.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb);
|
||||
}
|
||||
|
||||
if(scsiInfo.HddvdCopyrightInformation != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvd_cmi.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation);
|
||||
}
|
||||
|
||||
if(scsiInfo.HddvdrMediumStatus != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvdr_status.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus);
|
||||
}
|
||||
|
||||
if(scsiInfo.HddvdrLastRmd != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrLayerCapacity != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvdr_layercap.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrDlMiddleZoneStart != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_mzs.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrDlJumpIntervalSize != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_jis.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrDlManualLayerJumpStartLba != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_manuallj.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba);
|
||||
}
|
||||
|
||||
if(scsiInfo.DvdrDlRemapAnchorPoint != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_dvd_remapanchor.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint);
|
||||
}
|
||||
|
||||
if(scsiInfo.BlurayDiscInformation != null)
|
||||
{
|
||||
@@ -433,8 +489,10 @@ sealed class MediaInfoCommand : Command
|
||||
}
|
||||
|
||||
if(scsiInfo.BlurayPac != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_pac.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac);
|
||||
}
|
||||
|
||||
if(scsiInfo.BlurayBurstCuttingArea != null)
|
||||
{
|
||||
@@ -461,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)
|
||||
@@ -471,12 +529,14 @@ 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)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_readdiscstructure_bd_dfl.bin",
|
||||
"SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl);
|
||||
}
|
||||
|
||||
if(scsiInfo.BlurayTrackResources != null)
|
||||
{
|
||||
@@ -502,8 +562,10 @@ sealed class MediaInfoCommand : Command
|
||||
scsiInfo.Toc);
|
||||
|
||||
if(scsiInfo.DecodedToc.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{UI.Title_TOC}:[/]",
|
||||
$"\n{Markup.Escape(TOC.Prettify(scsiInfo.DecodedToc))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.Atip != null)
|
||||
@@ -512,8 +574,10 @@ sealed class MediaInfoCommand : Command
|
||||
scsiInfo.Atip);
|
||||
|
||||
if(scsiInfo.DecodedAtip != null)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{UI.Title_ATIP}:[/]",
|
||||
$"\n{Markup.Escape(ATIP.Prettify(scsiInfo.DecodedAtip))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.DiscInformation != null)
|
||||
@@ -522,9 +586,11 @@ sealed class MediaInfoCommand : Command
|
||||
"SCSI READ DISC INFORMATION", scsiInfo.DiscInformation);
|
||||
|
||||
if(scsiInfo.DecodedDiscInformation.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Standard_Disc_Information}:[/]",
|
||||
$"\n{Markup.Escape(DiscInformation.Prettify000b(scsiInfo.
|
||||
DecodedDiscInformation))}");
|
||||
DecodedDiscInformation))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.Session != null)
|
||||
@@ -533,8 +599,10 @@ sealed class MediaInfoCommand : Command
|
||||
scsiInfo.Session);
|
||||
|
||||
if(scsiInfo.DecodedSession.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Session_information}:[/]",
|
||||
$"\n{Markup.Escape(Session.Prettify(scsiInfo.DecodedSession))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.RawToc != null)
|
||||
@@ -543,8 +611,10 @@ sealed class MediaInfoCommand : Command
|
||||
scsiInfo.RawToc);
|
||||
|
||||
if(scsiInfo.FullToc.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Raw_TOC}:[/]",
|
||||
$"\n{Markup.Escape(FullTOC.Prettify(scsiInfo.RawToc))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.Pma != null)
|
||||
@@ -562,25 +632,35 @@ sealed class MediaInfoCommand : Command
|
||||
scsiInfo.CdTextLeadIn);
|
||||
|
||||
if(scsiInfo.DecodedCdTextLeadIn.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.CD_TEXT_on_Lead_In}:[/]",
|
||||
$"\n{Markup.Escape(CDTextOnLeadIn.Prettify(scsiInfo.DecodedCdTextLeadIn))}");
|
||||
}
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(scsiInfo.Mcn))
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.MCN}:[/]", $" {Markup.Escape(scsiInfo.Mcn)}");
|
||||
|
||||
if(scsiInfo.Isrcs != null)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in scsiInfo.Isrcs)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{string.Format(Localization.Core.Tracks_0_ISRC, isrc.Key)}:[/] {
|
||||
Markup.Escape(isrc.Value)}");
|
||||
}
|
||||
}
|
||||
|
||||
if(scsiInfo.XboxSecuritySector != null)
|
||||
{
|
||||
DataFile.WriteTo(MODULE_NAME, outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS",
|
||||
scsiInfo.XboxSecuritySector);
|
||||
}
|
||||
|
||||
if(scsiInfo.DecodedXboxSecuritySector.HasValue)
|
||||
{
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Xbox_Security_Sector}:[/]",
|
||||
$"\n{Markup.Escape(SS.Prettify(scsiInfo.DecodedXboxSecuritySector))}");
|
||||
}
|
||||
|
||||
if(scsiInfo.XgdInfo != null)
|
||||
{
|
||||
@@ -612,7 +692,7 @@ sealed class MediaInfoCommand : Command
|
||||
|
||||
AaruConsole.Write($"[bold]{Localization.Core.Media_Serial_Number}:[/] ");
|
||||
|
||||
for(int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++)
|
||||
for(var i = 4; i < scsiInfo.MediaSerialNumber.Length; i++)
|
||||
AaruConsole.Write("{0:X2}", scsiInfo.MediaSerialNumber[i]);
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
@@ -629,7 +709,7 @@ sealed class MediaInfoCommand : Command
|
||||
|
||||
if(tracks != null)
|
||||
{
|
||||
uint firstLba = (uint)tracks.Min(t => t.StartSector);
|
||||
var firstLba = (uint)tracks.Min(t => t.StartSector);
|
||||
|
||||
bool supportsPqSubchannel = Dump.SupportsPqSubchannel(dev, null, null, firstLba);
|
||||
bool supportsRwSubchannel = Dump.SupportsRwSubchannel(dev, null, null, firstLba);
|
||||
@@ -645,7 +725,7 @@ sealed class MediaInfoCommand : Command
|
||||
Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev,
|
||||
out bool inexactPositioning, false);
|
||||
|
||||
for(int t = 1; t < tracks.Length; t++)
|
||||
for(var t = 1; t < tracks.Length; t++)
|
||||
tracks[t - 1].EndSector = tracks[t].StartSector - 1;
|
||||
|
||||
tracks[^1].EndSector = (ulong)lastSector;
|
||||
@@ -654,17 +734,21 @@ sealed class MediaInfoCommand : Command
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Track_calculations}:[/]");
|
||||
|
||||
if(inexactPositioning)
|
||||
{
|
||||
AaruConsole.WriteLine($"[yellow]{Localization.Core.
|
||||
The_drive_has_returned_incorrect_Q_positioning_calculating_pregaps
|
||||
}[/]");
|
||||
}
|
||||
|
||||
if(firstLba > 0)
|
||||
AaruConsole.WriteLine(UI.Hidden_track_starts_at_LBA_0_ends_at_LBA_1, 0, firstLba - 1);
|
||||
|
||||
foreach(Track track in tracks)
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(UI.Track_0_starts_at_LBA_1_ends_at_LBA_2_has_a_pregap_of_3_sectors_and_is_of_type_4,
|
||||
track.Sequence, track.StartSector, track.EndSector, track.Pregap, track.Type);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Offsets}:[/]");
|
||||
@@ -728,4 +812,4 @@ sealed class MediaInfoCommand : Command
|
||||
|
||||
dev.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,20 +51,13 @@ sealed class MediaScanCommand : Command
|
||||
|
||||
public MediaScanCommand() : base("scan", UI.Media_Scan_Command_Description)
|
||||
{
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--mhdd-log", "-m"
|
||||
}, () => null, UI.Write_a_log_of_the_scan_in_the_format_used_by_MHDD));
|
||||
Add(new Option<string>(new[] { "--mhdd-log", "-m" }, () => null,
|
||||
UI.Write_a_log_of_the_scan_in_the_format_used_by_MHDD));
|
||||
|
||||
Add(new Option<string>(new[]
|
||||
{
|
||||
"--ibg-log", "-b"
|
||||
}, () => null, UI.Write_a_log_of_the_scan_in_the_format_used_by_ImgBurn));
|
||||
Add(new Option<string>(new[] { "--ibg-log", "-b" }, () => null,
|
||||
UI.Write_a_log_of_the_scan_in_the_format_used_by_ImgBurn));
|
||||
|
||||
Add(new Option<bool>(new[]
|
||||
{
|
||||
"--use-buffered-reads"
|
||||
}, () => true, UI.OS_buffered_reads_help));
|
||||
Add(new Option<bool>(new[] { "--use-buffered-reads" }, () => true, UI.OS_buffered_reads_help));
|
||||
|
||||
AddArgument(new Argument<string>
|
||||
{
|
||||
@@ -89,30 +82,32 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--ibg-log={0}", ibgLog);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--mhdd-log={0}", mhddLog);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--device={0}", devicePath);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--ibg-log={0}", ibgLog);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--mhdd-log={0}", mhddLog);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--use-buffered-reads={0}", useBufferedReads);
|
||||
|
||||
if(devicePath.Length == 2 &&
|
||||
@@ -125,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)
|
||||
{
|
||||
@@ -159,51 +154,47 @@ sealed class MediaScanCommand : Command
|
||||
AnsiConsole.Progress().AutoClear(true).HideCompleted(true).
|
||||
Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn()).Start(ctx =>
|
||||
{
|
||||
scanner.UpdateStatus += text =>
|
||||
{
|
||||
AaruConsole.WriteLine(Markup.Escape(text));
|
||||
};
|
||||
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.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();
|
||||
});
|
||||
@@ -244,8 +235,10 @@ sealed class MediaScanCommand : Command
|
||||
results.UnreadableSectors.Count)}[/]");
|
||||
|
||||
if(results.UnreadableSectors.Count > 0)
|
||||
{
|
||||
foreach(ulong bad in results.UnreadableSectors)
|
||||
AaruConsole.WriteLine(Localization.Core.Sector_0_could_not_be_read, bad);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
@@ -253,9 +246,11 @@ sealed class MediaScanCommand : Command
|
||||
results.SeekMin < double.MaxValue ||
|
||||
results.SeekMax > double.MinValue)
|
||||
|
||||
{
|
||||
AaruConsole.
|
||||
WriteLine(Localization.Core.Testing_0_seeks_longest_seek_took_1_ms_fastest_one_took_2_ms_3_ms_average,
|
||||
results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000);
|
||||
}
|
||||
|
||||
dev.Close();
|
||||
|
||||
|
||||
@@ -72,27 +72,29 @@ 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");
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--host={0}", host);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--debug={0}", debug);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--host={0}", host);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "--verbose={0}", verbose);
|
||||
|
||||
try
|
||||
|
||||
63
Aaru/Main.cs
63
Aaru/Main.cs
@@ -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();
|
||||
|
||||
@@ -136,9 +136,11 @@ class MainClass
|
||||
ExecuteSqlRaw("CREATE TABLE IF NOT EXISTS \"__EFMigrationsHistory\" (\"MigrationId\" TEXT PRIMARY KEY, \"ProductVersion\" TEXT)");
|
||||
|
||||
foreach(string migration in ctx.Database.GetPendingMigrations())
|
||||
{
|
||||
ctx.Database.
|
||||
ExecuteSqlRaw($"INSERT INTO \"__EFMigrationsHistory\" (MigrationId, ProductVersion) VALUES ('{
|
||||
migration}', '0.0.0')");
|
||||
}
|
||||
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
@@ -151,16 +153,18 @@ class MainClass
|
||||
a.Revision,
|
||||
a.Bus
|
||||
}).Where(a => a.Count() > 1).Distinct().Select(a => a.Key))
|
||||
{
|
||||
ctx.RemoveRange(ctx.SeenDevices.
|
||||
Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model &&
|
||||
d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1));
|
||||
}
|
||||
|
||||
// Remove nulls
|
||||
ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null && d.Revision == null));
|
||||
|
||||
ctx.SaveChanges();
|
||||
|
||||
bool mainDbUpdate = false;
|
||||
var mainDbUpdate = false;
|
||||
|
||||
if(!File.Exists(Settings.Settings.MainDbPath))
|
||||
{
|
||||
@@ -193,8 +197,8 @@ class MainClass
|
||||
|
||||
// GDPR level compliance does not match and there are no arguments or the arguments are neither GUI neither configure.
|
||||
if(Settings.Settings.Current.GdprCompliance < DicSettings.GDPR_LEVEL &&
|
||||
(args.Length < 1 || (args.Length >= 1 && args[0].ToLowerInvariant() != "gui" &&
|
||||
args[0].ToLowerInvariant() != "configure")))
|
||||
(args.Length < 1 || args.Length >= 1 && args[0].ToLowerInvariant() != "gui" &&
|
||||
args[0].ToLowerInvariant() != "configure"))
|
||||
new ConfigureCommand().DoConfigure(true);
|
||||
|
||||
Statistics.LoadStats();
|
||||
@@ -203,20 +207,13 @@ class MainClass
|
||||
|
||||
var rootCommand = new RootCommand();
|
||||
|
||||
rootCommand.AddGlobalOption(new Option<bool>(new[]
|
||||
{
|
||||
"--verbose", "-v"
|
||||
}, () => false, UI.Shows_verbose_output));
|
||||
rootCommand.AddGlobalOption(new Option<bool>(new[] { "--verbose", "-v" }, () => false,
|
||||
UI.Shows_verbose_output));
|
||||
|
||||
rootCommand.AddGlobalOption(new Option<bool>(new[]
|
||||
{
|
||||
"--debug", "-d"
|
||||
}, () => false, UI.Shows_debug_output_from_plugins));
|
||||
rootCommand.AddGlobalOption(new Option<bool>(new[] { "--debug", "-d" }, () => false,
|
||||
UI.Shows_debug_output_from_plugins));
|
||||
|
||||
Option<bool> pauseOption = new(new[]
|
||||
{
|
||||
"--pause"
|
||||
}, () => false, UI.Pauses_before_exiting);
|
||||
Option<bool> pauseOption = new(new[] { "--pause" }, () => false, UI.Pauses_before_exiting);
|
||||
|
||||
rootCommand.AddGlobalOption(pauseOption);
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"Aaru": {
|
||||
"commandName": "Project"
|
||||
},
|
||||
"GUI" : {
|
||||
"commandName" : "Project",
|
||||
"GUI": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "gui -d"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
48
Changelog.md
48
Changelog.md
@@ -3,76 +3,96 @@
|
||||
## Added
|
||||
|
||||
### - Adler checksum
|
||||
|
||||
- SSSE3 implementation if supported by running host.
|
||||
|
||||
### - Apple Data Compression algorithm
|
||||
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - Apple RLE compression algorithm
|
||||
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - Apple Universal Disk Image Format
|
||||
|
||||
- Support for LZFSE compressed images (ULFO).
|
||||
- Support for XZ compressed images (ULMO).
|
||||
|
||||
### - Atari Lynx cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
|
||||
### - BZIP2 compression algorithm
|
||||
|
||||
- Faster non-native implementation.
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - Console
|
||||
|
||||
- Use new console system that allows to show colors, tables and progress bars in command line.
|
||||
|
||||
### - CRC32 checksum
|
||||
|
||||
- ARM specific instructions if supported by running host.
|
||||
- PCLMUL implementation if supported by running host.
|
||||
|
||||
### - CRC64 checksum
|
||||
|
||||
- PCLMUL implementation if supported by running host.
|
||||
|
||||
### - Dumping
|
||||
|
||||
- Draw the MHDD log as an image.
|
||||
- For most spiral media (CD/DVD/BD) draw a graph with the dump status.
|
||||
- For non-spiral media draw a block map.
|
||||
|
||||
### - FLAC compression algorithm
|
||||
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - LZFSE compression algorithm
|
||||
|
||||
- Now available if native library is supported by running host.
|
||||
|
||||
### - LZMA compression algorithm
|
||||
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - LZIP compression algorithm
|
||||
|
||||
- Use faster native library if supported by running host.
|
||||
|
||||
### - NES / Famicom cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Support for iNES and NES 2.0 formats
|
||||
|
||||
### - Nintendo 64 cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Support for `z64` and `n64` formats.
|
||||
|
||||
### - Nintendo Game Boy cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
|
||||
### - Nintendo Game Boy Advance cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
|
||||
### - Nintendo Game Boy Color cartridge dumps
|
||||
|
||||
- Dumping by supported hardware.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
|
||||
### - Retrode cartridge dumping hardware
|
||||
|
||||
- Dumping Nintendo 64 cartridges.
|
||||
- Dumping Nintendo Game Boy cartridges.
|
||||
- Dumping Nintendo Game Boy Advance cartridges.
|
||||
@@ -83,34 +103,42 @@
|
||||
- Dumping Super Nintendo / Super Famicom cartridges.
|
||||
|
||||
### - Sega 32X cartridge dumps
|
||||
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - Sega Game Gear cartridge dumps
|
||||
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - Sega Master System / Mark III cartridge dumps
|
||||
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - Sega Mega Drive / Genesis cartridge dumps
|
||||
|
||||
- Full support for converting between `smd` and `bin` formats.
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - Sega Pico cartridge dumps
|
||||
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - Super Nintendo / Super Famicom cartridge dumps
|
||||
|
||||
- Support by `print`, `convert`, `info`, `entropy`, `checksum`, `compare` and `create sidecar` commands.
|
||||
- Dumping by supported hardware.
|
||||
|
||||
### - ZSTD compression algorithm
|
||||
|
||||
- Now available if native library is supported by running host.
|
||||
|
||||
## Changes
|
||||
|
||||
- All used checksums now call a much faster native library if supported.
|
||||
- CICM metadata XML sidecars are deprecated, new more complete JSON format is used instead.
|
||||
- Remove FreeBSD support code. Use `aaruremote` for dumping devices connected to FreeBSD systems.
|
||||
@@ -122,45 +150,57 @@
|
||||
## Fixed
|
||||
|
||||
### - Aaru Image Format
|
||||
|
||||
- DDT verification when its size on-image is bigger than 1MiB.
|
||||
- Parent block identifier in AaruFormat.
|
||||
- Track indexes in when a disc contains a hidden track.
|
||||
|
||||
### - Apple DOS filesystem
|
||||
|
||||
- Calculation of file sizes
|
||||
|
||||
### - Apple Macintosh filesystem
|
||||
|
||||
- Calculation of file sizes
|
||||
|
||||
### - BlindWrite 5/6/7 disc images
|
||||
|
||||
- Opening split images in Windows
|
||||
|
||||
### - CDRWin cuesheet disc images
|
||||
|
||||
- Do not report ISRC as present if no tracks contain ISRC data.
|
||||
|
||||
### - Device report
|
||||
|
||||
- Add workaround for device report the AccessTek/Optorite DD0203 drive.
|
||||
|
||||
### - Devices
|
||||
|
||||
- Add transfer size to ATA(PI) IDENTIFY (PACKET) DEVICE commands as required by a recent change in the Linux kernel API.
|
||||
|
||||
### - Dumping
|
||||
|
||||
- Correct offset fixing when trimming or re-reading errored audio sectors.
|
||||
- Do not set INDEX 1 to a value higher than what the TOC already said.
|
||||
|
||||
### - FAT filesystem
|
||||
|
||||
- Fix that first 2 FAT entries are not considered part of the allocation ones, allocating two more.
|
||||
- Return current clusters when a file overflows the FAT.
|
||||
|
||||
### - ISO9660 filesystem
|
||||
|
||||
- Do not try to interpret an 0-length Continuation Area.
|
||||
|
||||
### - SGI Volume Header
|
||||
|
||||
- Partition types not properly interpreted.
|
||||
|
||||
## Changes
|
||||
|
||||
- Do not allow dumping or converting to image formats that do not properly support hidden tracks when there is a hidden track in the media.
|
||||
- Do not allow dumping or converting to image formats that do not properly support hidden tracks when there is a hidden
|
||||
track in the media.
|
||||
- Update Newtonson.Json dependency due to security issues.
|
||||
|
||||
# [5.3.1] - 2022-03-06
|
||||
@@ -192,11 +232,13 @@
|
||||
### - Dumping
|
||||
|
||||
- Fix detecting errors from OS buffered reads in Linux.
|
||||
- When dumping an SD/MMC card try to detect if OS buffered reads are failing, and max readable blocks using sequential commands, and downgrade accordingly. Now also detects cards that are totally unreadable.
|
||||
- When dumping an SD/MMC card try to detect if OS buffered reads are failing, and max readable blocks using sequential
|
||||
commands, and downgrade accordingly. Now also detects cards that are totally unreadable.
|
||||
|
||||
### - ISO9660 filesystem
|
||||
|
||||
- Do not break when an ISO9660/HighSierra/CD-i directory spans several sectors if we only have a partial last sector read.
|
||||
- Do not break when an ISO9660/HighSierra/CD-i directory spans several sectors if we only have a partial last sector
|
||||
read.
|
||||
- Do not try to decode empty path table in ISO9660/CD-i/HighSierra.
|
||||
|
||||
### - Media detection
|
||||
|
||||
Reference in New Issue
Block a user