mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Update to new Spectre.Console.Cli API surface.
This commit is contained in:
@@ -36,6 +36,8 @@ using System.ComponentModel;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -50,12 +52,13 @@ using Spectre.Console.Cli;
|
|||||||
|
|
||||||
namespace Aaru.Commands.Archive;
|
namespace Aaru.Commands.Archive;
|
||||||
|
|
||||||
sealed class ArchiveExtractCommand : Command<ArchiveExtractCommand.Settings>
|
sealed class ArchiveExtractCommand : AsyncCommand<ArchiveExtractCommand.Settings>
|
||||||
{
|
{
|
||||||
const int BUFFER_SIZE = 16777216;
|
const int BUFFER_SIZE = 16777216;
|
||||||
const string MODULE_NAME = "Extract-Files command";
|
const string MODULE_NAME = "Extract-Files command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
@@ -223,47 +226,49 @@ sealed class ArchiveExtractCommand : Command<ArchiveExtractCommand.Settings>
|
|||||||
|
|
||||||
if(!File.Exists(outputPath) && !Directory.Exists(outputPath))
|
if(!File.Exists(outputPath) && !Directory.Exists(outputPath))
|
||||||
{
|
{
|
||||||
AnsiConsole.Progress()
|
await AnsiConsole.Progress()
|
||||||
.AutoClear(true)
|
.AutoClear(true)
|
||||||
.HideCompleted(true)
|
.HideCompleted(true)
|
||||||
.Columns(new TaskDescriptionColumn(), new ProgressBarColumn(), new PercentageColumn())
|
.Columns(new TaskDescriptionColumn(),
|
||||||
.Start(ctx =>
|
new ProgressBarColumn(),
|
||||||
{
|
new PercentageColumn())
|
||||||
var position = 0;
|
.Start(async ctx =>
|
||||||
|
{
|
||||||
|
var position = 0;
|
||||||
|
|
||||||
var outputFile =
|
var outputFile =
|
||||||
new FileStream(outputPath,
|
new FileStream(outputPath,
|
||||||
FileMode.CreateNew,
|
FileMode.CreateNew,
|
||||||
FileAccess.ReadWrite,
|
FileAccess.ReadWrite,
|
||||||
FileShare.None);
|
FileShare.None);
|
||||||
|
|
||||||
ProgressTask task =
|
ProgressTask task =
|
||||||
ctx.AddTask(string.Format(UI.Reading_file_0, Markup.Escape(fileName)));
|
ctx.AddTask(string.Format(UI.Reading_file_0, Markup.Escape(fileName)));
|
||||||
|
|
||||||
task.MaxValue = uncompressedSize;
|
task.MaxValue = uncompressedSize;
|
||||||
var outBuf = new byte[BUFFER_SIZE];
|
var outBuf = new byte[BUFFER_SIZE];
|
||||||
Stream inputFile = filter.GetDataForkStream();
|
Stream inputFile = filter.GetDataForkStream();
|
||||||
|
|
||||||
while(position < stat.Length)
|
while(position < stat.Length)
|
||||||
{
|
{
|
||||||
int bytesToRead;
|
int bytesToRead;
|
||||||
|
|
||||||
if(stat.Length - position > BUFFER_SIZE)
|
if(stat.Length - position > BUFFER_SIZE)
|
||||||
bytesToRead = BUFFER_SIZE;
|
bytesToRead = BUFFER_SIZE;
|
||||||
else
|
else
|
||||||
bytesToRead = (int)(stat.Length - position);
|
bytesToRead = (int)(stat.Length - position);
|
||||||
|
|
||||||
int bytesRead = inputFile.EnsureRead(outBuf, 0, bytesToRead);
|
int bytesRead = inputFile.EnsureRead(outBuf, 0, bytesToRead);
|
||||||
|
|
||||||
outputFile.Write(outBuf, 0, bytesRead);
|
await outputFile.WriteAsync(outBuf, 0, bytesRead);
|
||||||
|
|
||||||
position += bytesToRead;
|
position += bytesToRead;
|
||||||
task.Increment(bytesToRead);
|
task.Increment(bytesToRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
inputFile.Close();
|
inputFile.Close();
|
||||||
outputFile.Close();
|
outputFile.Close();
|
||||||
});
|
});
|
||||||
|
|
||||||
var fi = new FileInfo(outputPath);
|
var fi = new FileInfo(outputPath);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -49,7 +50,7 @@ sealed class ArchiveInfoCommand : Command<ArchiveInfoCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Analyze command";
|
const string MODULE_NAME = "Analyze command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -52,7 +53,7 @@ sealed class ArchiveListCommand : Command<ArchiveListCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Archive list command";
|
const string MODULE_NAME = "Archive list command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
// Copyright © 2011-2025 Natalia Portillo
|
// Copyright © 2011-2025 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Localization;
|
using Aaru.Localization;
|
||||||
using Aaru.Logging;
|
using Aaru.Logging;
|
||||||
@@ -41,7 +42,7 @@ namespace Aaru.Commands;
|
|||||||
|
|
||||||
sealed class ConfigureCommand : Command<ConfigureCommand.Settings>
|
sealed class ConfigureCommand : Command<ConfigureCommand.Settings>
|
||||||
{
|
{
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Database;
|
using Aaru.Database;
|
||||||
using Aaru.Database.Models;
|
using Aaru.Database.Models;
|
||||||
@@ -42,9 +44,10 @@ using Command = Aaru.Database.Models.Command;
|
|||||||
|
|
||||||
namespace Aaru.Commands.Database;
|
namespace Aaru.Commands.Database;
|
||||||
|
|
||||||
sealed class StatisticsCommand : Command<StatisticsCommand.Settings>
|
sealed class StatisticsCommand : AsyncCommand<StatisticsCommand.Settings>
|
||||||
{
|
{
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
@@ -67,7 +70,7 @@ sealed class StatisticsCommand : Command<StatisticsCommand.Settings>
|
|||||||
return (int)ErrorNumber.NothingFound;
|
return (int)ErrorNumber.NothingFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool thereAreStats = false;
|
var thereAreStats = false;
|
||||||
Table table;
|
Table table;
|
||||||
|
|
||||||
if(ctx.Commands.Any())
|
if(ctx.Commands.Any())
|
||||||
@@ -111,7 +114,7 @@ sealed class StatisticsCommand : Command<StatisticsCommand.Settings>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SaveChanges();
|
await ctx.SaveChangesAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(string command in ctx.Commands.Select(c => c.Name).Distinct().OrderBy(c => c))
|
foreach(string command in ctx.Commands.Select(c => c.Name).Distinct().OrderBy(c => c))
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
@@ -51,7 +52,8 @@ sealed class UpdateCommand : AsyncCommand<UpdateCommand.Settings>
|
|||||||
const string MODULE_NAME = "Update command";
|
const string MODULE_NAME = "Update command";
|
||||||
readonly bool _mainDbUpdate;
|
readonly bool _mainDbUpdate;
|
||||||
|
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
@@ -65,8 +67,8 @@ sealed class UpdateCommand : AsyncCommand<UpdateCommand.Settings>
|
|||||||
File.Delete(Aaru.Settings.Settings.LocalDbPath);
|
File.Delete(Aaru.Settings.Settings.LocalDbPath);
|
||||||
|
|
||||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||||
await ctx.Database.MigrateAsync();
|
await ctx.Database.MigrateAsync(cancellationToken);
|
||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
catch(Exception) when(!Debugger.IsAttached)
|
catch(Exception) when(!Debugger.IsAttached)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
@@ -61,7 +62,8 @@ sealed class DeviceReportCommand : AsyncCommand<DeviceReportCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Device-Report command";
|
const string MODULE_NAME = "Device-Report command";
|
||||||
|
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||||
@@ -66,7 +67,7 @@ sealed class DeviceInfoCommand : Command<DeviceInfoCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Device-Info command";
|
const string MODULE_NAME = "Device-Info command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
@@ -48,7 +49,7 @@ sealed class ListDevicesCommand : Command<ListDevicesCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "List-Devices command";
|
const string MODULE_NAME = "List-Devices command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ using System.ComponentModel;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -56,7 +57,7 @@ sealed class ExtractFilesCommand : Command<ExtractFilesCommand.Settings>
|
|||||||
const long BUFFER_SIZE = 16777216;
|
const long BUFFER_SIZE = 16777216;
|
||||||
const string MODULE_NAME = "Extract-Files command";
|
const string MODULE_NAME = "Extract-Files command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
@@ -51,7 +52,7 @@ sealed class FilesystemInfoCommand : Command<FilesystemInfoCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Fs-info command";
|
const string MODULE_NAME = "Fs-info command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ using System.ComponentModel;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -55,7 +56,7 @@ sealed class LsCommand : Command<LsCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Ls command";
|
const string MODULE_NAME = "Ls command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -39,7 +40,6 @@ using Aaru.Core;
|
|||||||
using Aaru.Localization;
|
using Aaru.Localization;
|
||||||
using Aaru.Logging;
|
using Aaru.Logging;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Serilog;
|
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
using Spectre.Console.Cli;
|
using Spectre.Console.Cli;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "List-Options command";
|
const string MODULE_NAME = "List-Options command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
@@ -73,8 +73,7 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
|||||||
|
|
||||||
var table = new Table
|
var table = new Table
|
||||||
{
|
{
|
||||||
Title = new TableTitle(string.Format(UI.Options_for_0,
|
Title = new TableTitle(string.Format(UI.Options_for_0, fs.Name))
|
||||||
fs.Name))
|
|
||||||
};
|
};
|
||||||
|
|
||||||
table.AddColumn(new TableColumn(new Markup(UI.Title_Name).Centered()));
|
table.AddColumn(new TableColumn(new Markup(UI.Title_Name).Centered()));
|
||||||
@@ -90,9 +89,9 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
|||||||
$"[slateblue1]{Markup.Escape(option.description)}[/]");
|
$"[slateblue1]{Markup.Escape(option.description)}[/]");
|
||||||
|
|
||||||
AaruLogging.Information("({Name}) - {Type} - {Description}",
|
AaruLogging.Information("({Name}) - {Type} - {Description}",
|
||||||
option.name,
|
option.name,
|
||||||
TypeToString(option.type),
|
TypeToString(option.type),
|
||||||
option.description);
|
option.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnsiConsole.Write(table);
|
AnsiConsole.Write(table);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -46,7 +47,7 @@ sealed class FormatsCommand : Command<FormatsCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Formats command";
|
const string MODULE_NAME = "Formats command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -54,7 +55,7 @@ sealed class ChecksumCommand : Command<ChecksumCommand.Settings>
|
|||||||
const int BYTES_TO_READ = 65536;
|
const int BYTES_TO_READ = 65536;
|
||||||
const string MODULE_NAME = "Checksum command";
|
const string MODULE_NAME = "Checksum command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -53,7 +54,7 @@ sealed class CompareCommand : Command<CompareCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Compare command";
|
const string MODULE_NAME = "Compare command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
@@ -67,7 +68,7 @@ sealed class ConvertImageCommand : Command<ConvertImageCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Convert-image command";
|
const string MODULE_NAME = "Convert-image command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.AaruMetadata;
|
using Aaru.CommonTypes.AaruMetadata;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
@@ -56,7 +57,7 @@ sealed class CreateSidecarCommand : Command<CreateSidecarCommand.Settings>
|
|||||||
static ProgressTask _progressTask1;
|
static ProgressTask _progressTask1;
|
||||||
static ProgressTask _progressTask2;
|
static ProgressTask _progressTask2;
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -50,7 +51,7 @@ sealed class DecodeCommand : Command<DecodeCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Decode command";
|
const string MODULE_NAME = "Decode command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -48,7 +49,7 @@ sealed class EntropyCommand : Command<EntropyCommand.Settings>
|
|||||||
static ProgressTask _progressTask1;
|
static ProgressTask _progressTask1;
|
||||||
static ProgressTask _progressTask2;
|
static ProgressTask _progressTask2;
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -46,7 +47,7 @@ sealed class ImageInfoCommand : Command<ImageInfoCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Image-info command";
|
const string MODULE_NAME = "Image-info command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -48,7 +49,7 @@ sealed class ListOptionsCommand : Command<ListOptionsCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "List-Options command";
|
const string MODULE_NAME = "List-Options command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -48,7 +49,7 @@ sealed class PrintHexCommand : Command<PrintHexCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "PrintHex command";
|
const string MODULE_NAME = "PrintHex command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
@@ -52,7 +53,7 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Verify command";
|
const string MODULE_NAME = "Verify command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
@@ -394,18 +395,16 @@ sealed class VerifyCommand : Command<VerifyCommand.Settings>
|
|||||||
if(failingLbas.Count == (int)inputFormat.Info.Sectors)
|
if(failingLbas.Count == (int)inputFormat.Info.Sectors)
|
||||||
AaruLogging.Verbose($"\t[red]{UI.all_sectors}[/]");
|
AaruLogging.Verbose($"\t[red]{UI.all_sectors}[/]");
|
||||||
else
|
else
|
||||||
{
|
foreach(ulong t in failingLbas)
|
||||||
foreach(ulong t in failingLbas) AaruLogging.Verbose("\t{0}", t);
|
AaruLogging.Verbose("\t{0}", t);
|
||||||
}
|
|
||||||
|
|
||||||
AaruLogging.WriteLine($"[yellow3_1]{UI.LBAs_without_checksum}[/]");
|
AaruLogging.WriteLine($"[yellow3_1]{UI.LBAs_without_checksum}[/]");
|
||||||
|
|
||||||
if(unknownLbas.Count == (int)inputFormat.Info.Sectors)
|
if(unknownLbas.Count == (int)inputFormat.Info.Sectors)
|
||||||
AaruLogging.Verbose($"\t[yellow3_1]{UI.all_sectors}[/]");
|
AaruLogging.Verbose($"\t[yellow3_1]{UI.all_sectors}[/]");
|
||||||
else
|
else
|
||||||
{
|
foreach(ulong t in unknownLbas)
|
||||||
foreach(ulong t in unknownLbas) AaruLogging.Verbose("\t{0}", t);
|
AaruLogging.Verbose("\t{0}", t);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var table = new Table();
|
var table = new Table();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
using Aaru.Localization;
|
using Aaru.Localization;
|
||||||
@@ -45,7 +46,7 @@ sealed class ListEncodingsCommand : Command<ListEncodingsCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "List-Encodings command";
|
const string MODULE_NAME = "List-Encodings command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -32,13 +32,13 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
using Aaru.CommonTypes.Interfaces;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
using Aaru.Localization;
|
using Aaru.Localization;
|
||||||
using Aaru.Logging;
|
using Aaru.Logging;
|
||||||
using Serilog;
|
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
using Spectre.Console.Cli;
|
using Spectre.Console.Cli;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ sealed class ListNamespacesCommand : Command<ListNamespacesCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "List-Namespaces command";
|
const string MODULE_NAME = "List-Namespaces command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
@@ -68,8 +68,7 @@ sealed class ListNamespacesCommand : Command<ListNamespacesCommand.Settings>
|
|||||||
|
|
||||||
Table table = new()
|
Table table = new()
|
||||||
{
|
{
|
||||||
Title = new TableTitle(string.Format(UI.Namespaces_for_0,
|
Title = new TableTitle(string.Format(UI.Namespaces_for_0, Markup.Escape(fs.Name)))
|
||||||
Markup.Escape(fs.Name)))
|
|
||||||
};
|
};
|
||||||
|
|
||||||
table.Border(TableBorder.Rounded);
|
table.Border(TableBorder.Rounded);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ sealed class DumpMediaCommand : Command<DumpMediaCommand.Settings>
|
|||||||
static ProgressTask _progressTask1;
|
static ProgressTask _progressTask1;
|
||||||
static ProgressTask _progressTask2;
|
static ProgressTask _progressTask2;
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
@@ -68,7 +69,7 @@ sealed class MediaInfoCommand : Command<MediaInfoCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Media-Info command";
|
const string MODULE_NAME = "Media-Info command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
|
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
@@ -50,7 +51,7 @@ sealed class MediaScanCommand : Command<MediaScanCommand.Settings>
|
|||||||
const string MODULE_NAME = "Media-Scan command";
|
const string MODULE_NAME = "Media-Scan command";
|
||||||
static ProgressTask _progressTask1;
|
static ProgressTask _progressTask1;
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
// TODO: Fix errors returned
|
// TODO: Fix errors returned
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using Aaru.CommonTypes;
|
using Aaru.CommonTypes;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.Core;
|
using Aaru.Core;
|
||||||
@@ -49,7 +50,7 @@ sealed class RemoteCommand : Command<RemoteCommand.Settings>
|
|||||||
{
|
{
|
||||||
const string MODULE_NAME = "Remote command";
|
const string MODULE_NAME = "Remote command";
|
||||||
|
|
||||||
public override int Execute(CommandContext context, Settings settings)
|
public override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
MainClass.PrintCopyright();
|
MainClass.PrintCopyright();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user