Rename analyze command to fs-info.

This commit is contained in:
2021-03-05 14:17:07 +00:00
parent 90d2dbd31c
commit 122c77b9c2
15 changed files with 130 additions and 75 deletions

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/netcoreapp3.1/aaru.dll" />
<option name="PROGRAM_PARAMETERS" value="image convert &quot;Nonstop-UX System V Release 4 B32 (Boot Tape).cptp.lz&quot; &quot;Nonstop-UX System V Release 4 B32 (Boot Tape).aif&quot;" />
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/netcoreapp3.1/aaru" />
<option name="PROGRAM_PARAMETERS" value="db stats" />
<option name="WORKING_DIRECTORY" value="/mnt/DiscImageChef/Media image formats/copytape" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />

View File

@@ -80,10 +80,10 @@ namespace Aaru.Core
if(allStats.Commands?.Analyze > 0)
{
Command command = ctx.Commands.FirstOrDefault(c => c.Name == "analyze" && c.Synchronized) ??
Command command = ctx.Commands.FirstOrDefault(c => c.Name == "fs-info" && c.Synchronized) ??
new Command
{
Name = "analyze",
Name = "fs-info",
Synchronized = true
};

View File

@@ -46,34 +46,34 @@ namespace Aaru.Gui.ViewModels.Dialogs
public sealed class StatisticsViewModel : ViewModelBase
{
readonly StatisticsDialog _view;
string _checksumText;
bool _checksumVisible;
bool _commandsVisible;
string _compareText;
bool _compareVisible;
string _convertImageText;
bool _convertImageVisible;
string _createSidecarText;
bool _createSidecarVisible;
string _decodeText;
bool _decodeVisible;
string _deviceInfoText;
bool _deviceInfoVisible;
string _deviceReportText;
bool _deviceReportVisible;
bool _devicesVisible;
string _dumpMediaText;
bool _dumpMediaVisible;
string _entropyText;
bool _entropyVisible;
bool _filesystemsVisible;
bool _filtersVisible;
bool _formatsCommandVisible;
string _formatsText;
bool _formatsVisible;
string _analyzeText;
bool _analyzeVisible;
string _checksumText;
bool _checksumVisible;
bool _commandsVisible;
string _compareText;
bool _compareVisible;
string _convertImageText;
bool _convertImageVisible;
string _createSidecarText;
bool _createSidecarVisible;
string _decodeText;
bool _decodeVisible;
string _deviceInfoText;
bool _deviceInfoVisible;
string _deviceReportText;
bool _deviceReportVisible;
bool _devicesVisible;
string _dumpMediaText;
bool _dumpMediaVisible;
string _entropyText;
bool _entropyVisible;
bool _filesystemsVisible;
bool _filtersVisible;
bool _formatsCommandVisible;
string _formatsText;
bool _formatsVisible;
string _fsinfoText;
bool _fsinfoVisible;
string _imageInfoText;
bool _imageInfoVisible;
string _mediaInfoText;
@@ -103,13 +103,40 @@ namespace Aaru.Gui.ViewModels.Dialogs
{
if(ctx.Commands.Any(c => c.Name == "analyze"))
{
ulong count = ctx.Commands.Where(c => c.Name == "analyze" && c.Synchronized).Select(c => c.Count).
foreach(Command oldAnalyze in ctx.Commands.Where(c => c.Name == "analyze"))
{
oldAnalyze.Name = "fs-info";
ctx.Commands.Update(oldAnalyze);
}
ulong count = 0;
foreach(Command fsInfo in ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized))
{
count += fsInfo.Count;
ctx.Remove(fsInfo);
}
if(count > 0)
ctx.Commands.Add(new Command
{
Count = count,
Name = "fs-info",
Synchronized = true
});
ctx.SaveChanges();
}
if(ctx.Commands.Any(c => c.Name == "fs-info"))
{
ulong count = ctx.Commands.Where(c => c.Name == "fs-info" && c.Synchronized).Select(c => c.Count).
FirstOrDefault();
count += (ulong)ctx.Commands.LongCount(c => c.Name == "analyze" && !c.Synchronized);
count += (ulong)ctx.Commands.LongCount(c => c.Name == "fs-info" && !c.Synchronized);
AnalyzeVisible = true;
AnalyzeText = $"You have called the Analyze command {count} times";
FsInfoVisible = true;
FsInfoText = $"You have called the Filesystem Info command {count} times";
}
if(ctx.Commands.Any(c => c.Name == "checksum"))
@@ -277,7 +304,7 @@ namespace Aaru.Gui.ViewModels.Dialogs
VerifyText = $"You have called the Verify command {count} times";
}
CommandsVisible = AnalyzeVisible || ChecksumVisible || CompareVisible || ConvertImageVisible ||
CommandsVisible = FsInfoVisible || ChecksumVisible || CompareVisible || ConvertImageVisible ||
CreateSidecarVisible || DecodeVisible || DeviceInfoVisible || DeviceReportVisible ||
DumpMediaVisible || EntropyVisible || FormatsCommandVisible || ImageInfoVisible ||
MediaInfoVisible || MediaScanVisible || PrintHexVisible || VerifyVisible;
@@ -411,16 +438,16 @@ namespace Aaru.Gui.ViewModels.Dialogs
}
}
public string AnalyzeText
public string FsInfoText
{
get => _analyzeText;
set => this.RaiseAndSetIfChanged(ref _analyzeText, value);
get => _fsinfoText;
set => this.RaiseAndSetIfChanged(ref _fsinfoText, value);
}
public bool AnalyzeVisible
public bool FsInfoVisible
{
get => _analyzeVisible;
set => this.RaiseAndSetIfChanged(ref _analyzeVisible, value);
get => _fsinfoVisible;
set => this.RaiseAndSetIfChanged(ref _fsinfoVisible, value);
}
public string ChecksumText

View File

@@ -578,7 +578,7 @@ namespace Aaru.Gui.ViewModels.Windows
if(partitions.Count == 0)
{
AaruConsole.DebugWriteLine("Analyze command", "No partitions found");
AaruConsole.DebugWriteLine("Fs-info command", "No partitions found");
checkRaw = true;
}

View File

@@ -51,7 +51,7 @@
<TextBlock Text="{Binding CommandsLabel}" />
</TabItem.Header>
<StackPanel VerticalAlignment="Top" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding AnalyzeText}" IsVisible="{Binding AnalyzeVisible}" />
<TextBlock Text="{Binding FsInfoText}" IsVisible="{Binding FsInfoVisible}" />
<TextBlock Text="{Binding ChecksumText}" IsVisible="{Binding ChecksumVisible}" />
<TextBlock Text="{Binding CompareText}" IsVisible="{Binding CompareVisible}" />
<TextBlock Text="{Binding ConvertImageText}" IsVisible="{Binding ConvertImageVisible}" />

View File

@@ -62,12 +62,12 @@
<Compile Include="Commands\Device\Info.cs" />
<Compile Include="Commands\Device\DeviceReport.cs" />
<Compile Include="Commands\Device\List.cs" />
<Compile Include="Commands\Filesystem\Info.cs" />
<Compile Include="Commands\Filesystem\ExtractFiles.cs" />
<Compile Include="Commands\Filesystem\FilesystemFamily.cs" />
<Compile Include="Commands\Filesystem\Options.cs" />
<Compile Include="Commands\Filesystem\Ls.cs" />
<Compile Include="Commands\Formats.cs" />
<Compile Include="Commands\Image\Analyze.cs" />
<Compile Include="Commands\Image\Checksum.cs" />
<Compile Include="Commands\Image\Compare.cs" />
<Compile Include="Commands\Image\Convert.cs" />

View File

@@ -77,6 +77,34 @@ namespace Aaru.Commands.Database
AaruConsole.WriteLine("Commands statistics");
AaruConsole.WriteLine("===================");
if(ctx.Commands.Any(c => c.Name == "analyze"))
{
foreach(Aaru.Database.Models.Command oldAnalyze in ctx.Commands.Where(c => c.Name == "analyze"))
{
oldAnalyze.Name = "fs-info";
ctx.Commands.Update(oldAnalyze);
}
ulong count = 0;
foreach(Aaru.Database.Models.Command fsInfo in ctx.Commands.Where(c => c.Name == "fs-info" &&
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();
}
foreach(string command in ctx.Commands.OrderBy(c => c.Name).Select(c => c.Name).Distinct())
{
ulong count = ctx.Commands.Where(c => c.Name == command && c.Synchronized).Select(c => c.Count).

View File

@@ -41,6 +41,7 @@ namespace Aaru.Commands.Filesystem
AddAlias("fi");
AddAlias("fs");
AddCommand(new FilesystemInfoCommand());
AddCommand(new ListOptionsCommand());
AddCommand(new ExtractFilesCommand());
AddCommand(new LsCommand());

View File

@@ -2,14 +2,14 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Analyze.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commands.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements the 'analyze' command.
// Implements the 'fs-info' command.
//
// --[ License ] --------------------------------------------------------------
//
@@ -41,12 +41,12 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core;
namespace Aaru.Commands.Image
namespace Aaru.Commands.Filesystem
{
internal sealed class AnalyzeCommand : Command
internal sealed class FilesystemInfoCommand : Command
{
public AnalyzeCommand() : base("analyze",
"Analyzes a disc image and searches for partitions and/or filesystems.")
public FilesystemInfoCommand() : base("info",
"Opens a disc image and prints info on the found partitions and/or filesystems.")
{
Add(new Option(new[]
{
@@ -60,7 +60,7 @@ namespace Aaru.Commands.Image
Add(new Option(new[]
{
"--filesystems", "-f"
}, "Searches and analyzes filesystems.")
}, "Searches and prints information about filesystems.")
{
Argument = new Argument<bool>(() => true),
Required = false
@@ -78,11 +78,11 @@ namespace Aaru.Commands.Image
AddArgument(new Argument<string>
{
Arity = ArgumentArity.ExactlyOne,
Description = "Disc image path",
Description = "Media image path",
Name = "image-path"
});
Handler = CommandHandler.Create(typeof(AnalyzeCommand).GetMethod(nameof(Invoke)));
Handler = CommandHandler.Create(typeof(FilesystemInfoCommand).GetMethod(nameof(Invoke)));
}
public static int Invoke(bool verbose, bool debug, string encoding, bool filesystems, bool partitions,
@@ -96,14 +96,14 @@ namespace Aaru.Commands.Image
if(verbose)
AaruConsole.VerboseWriteLineEvent += System.Console.WriteLine;
Statistics.AddCommand("analyze");
Statistics.AddCommand("fs-info");
AaruConsole.DebugWriteLine("Analyze command", "--debug={0}", debug);
AaruConsole.DebugWriteLine("Analyze command", "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Analyze command", "--filesystems={0}", filesystems);
AaruConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Analyze command", "--partitions={0}", partitions);
AaruConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Fs-info command", "--debug={0}", debug);
AaruConsole.DebugWriteLine("Fs-info command", "--encoding={0}", encoding);
AaruConsole.DebugWriteLine("Fs-info command", "--filesystems={0}", filesystems);
AaruConsole.DebugWriteLine("Fs-info command", "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Fs-info command", "--partitions={0}", partitions);
AaruConsole.DebugWriteLine("Fs-info command", "--verbose={0}", verbose);
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(imagePath);
@@ -179,7 +179,7 @@ namespace Aaru.Commands.Image
{
AaruConsole.ErrorWriteLine("Unable to open image format");
AaruConsole.ErrorWriteLine("Error: {0}", ex.Message);
AaruConsole.DebugWriteLine("Analyze command", "Stack trace: {0}", ex.StackTrace);
AaruConsole.DebugWriteLine("Fs-info command", "Stack trace: {0}", ex.StackTrace);
return (int)ErrorNumber.CannotOpenFormat;
}
@@ -195,7 +195,7 @@ namespace Aaru.Commands.Image
if(partitionsList.Count == 0)
{
AaruConsole.DebugWriteLine("Analyze command", "No partitions found");
AaruConsole.DebugWriteLine("Fs-info command", "No partitions found");
if(!filesystems)
{
@@ -311,7 +311,7 @@ namespace Aaru.Commands.Image
catch(Exception ex)
{
AaruConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
AaruConsole.DebugWriteLine("Analyze command", ex.StackTrace);
AaruConsole.DebugWriteLine("Fs-info command", ex.StackTrace);
return (int)ErrorNumber.UnexpectedException;
}

View File

@@ -319,10 +319,10 @@ namespace Aaru.Commands.Image
AaruConsole.DebugWriteLine("Image convert command", "--generate-subchannels={0}", generateSubchannels);
Dictionary<string, string> parsedOptions = Core.Options.Parse(options);
AaruConsole.DebugWriteLine("Analyze command", "Parsed options:");
AaruConsole.DebugWriteLine("Image convert command", "Parsed options:");
foreach(KeyValuePair<string, string> parsedOption in parsedOptions)
AaruConsole.DebugWriteLine("Analyze command", "{0} = {1}", parsedOption.Key, parsedOption.Value);
AaruConsole.DebugWriteLine("Image convert command", "{0} = {1}", parsedOption.Key, parsedOption.Value);
if(count == 0)
{

View File

@@ -173,7 +173,7 @@ namespace Aaru.Commands.Image
return (int)ErrorNumber.CannotOpenFormat;
}
AaruConsole.DebugWriteLine("Analyze command", "Correctly opened image file.");
AaruConsole.DebugWriteLine("Create sidecar command", "Correctly opened image file.");
}
catch(Exception ex)
{
@@ -217,7 +217,7 @@ namespace Aaru.Commands.Image
catch(Exception ex)
{
AaruConsole.ErrorWriteLine($"Error reading file: {ex.Message}");
AaruConsole.DebugWriteLine("Analyze command", ex.StackTrace);
AaruConsole.DebugWriteLine("Create sidecar command", ex.StackTrace);
return (int)ErrorNumber.UnexpectedException;
}

View File

@@ -40,7 +40,6 @@ namespace Aaru.Commands.Image
{
AddAlias("i");
AddCommand(new AnalyzeCommand());
AddCommand(new ChecksumCommand());
AddCommand(new CompareCommand());
AddCommand(new ConvertImageCommand());

View File

@@ -68,9 +68,9 @@ namespace Aaru.Commands.Image
Statistics.AddCommand("image-info");
AaruConsole.DebugWriteLine("Analyze command", "--debug={0}", debug);
AaruConsole.DebugWriteLine("Analyze command", "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Analyze command", "--verbose={0}", verbose);
AaruConsole.DebugWriteLine("Image-info command", "--debug={0}", debug);
AaruConsole.DebugWriteLine("Image-info command", "--input={0}", imagePath);
AaruConsole.DebugWriteLine("Image-info command", "--verbose={0}", verbose);
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(imagePath);

View File

@@ -1433,7 +1433,7 @@ Aaru.Server (previously DiscImageChef.Server), aaruformat (previously dicformat)
# [2.0] - 2014-07-03
## Added
### - Commands
- analyze: Gives informatio about disk image contents as well as detecting partitions and filesystems.
- analyze: Gives information about disk image contents as well as detecting partitions and filesystems.
- checksum: Generates CRC32, CRC64, RIPEMD160, MD5, SHA1, SHA256, SHA384 and SHA512 checksums of disk image contents.
- compare: Compares two media images.
- printhex: Prints a hexadecimal output of a sector.

View File

@@ -14,7 +14,7 @@ You can see statistics and device reports [here](https://www.aaru.app/Stats)
Aaru is a fully featured media dump management solution. You usually know media dumps
as disc images, disk images, tape images, etc.
With Aaru you can analyze a media dump, extract files from it (for supported
With Aaru you can identify a media dump, extract files from it (for supported
filesystems), compare two of them, create them from real media using the appropriate drive,
create a sidecar metadata with information about the media dump, and a lot of other features
that commonly would require you to use separate applications.
@@ -43,7 +43,7 @@ Or read the [documentation](https://github.com/aaru-dps/Aaru.Documentation/blob/
Features
========
* Analyzes a disk image getting information about the disk itself and analyzes partitions and filesystems inside them
* Identifies a disk image getting information about the disk itself and shows information about partitions and filesystems inside them
* Can checksum the disks (and if optical disc, separate tracks) user-data (tags and metadata coming soon)
* Can compare two disk images, even different formats, for different sectors and/or metadata
* Can list and extract contents from supported filesystems