Change AnsiConsole.Render() to AnsiConsole.Write()

This commit is contained in:
2022-03-15 00:34:06 +00:00
parent 2266d8f4cf
commit 265fa4fc17
13 changed files with 31 additions and 31 deletions

View File

@@ -820,7 +820,7 @@ public static class ImageInfo
session.EndTrack.ToString(), session.StartSector.ToString(),
session.EndSector.ToString());
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
}
@@ -853,7 +853,7 @@ public static class ImageInfo
track.RawBytesPerSector.ToString(), track.SubchannelType.ToString(),
track.Pregap.ToString(), track.StartSector.ToString(), track.EndSector.ToString());
AnsiConsole.Render(table);
AnsiConsole.Write(table);
if(!opticalImage.Tracks.Any(t => t.Indexes.Any()))
return;
@@ -873,7 +873,7 @@ public static class ImageInfo
foreach(KeyValuePair<ushort, int> index in track.Indexes)
table.AddRow(track.Sequence.ToString(), index.Key.ToString(), index.Value.ToString());
AnsiConsole.Render(table);
AnsiConsole.Write(table);
}
catch
{

View File

@@ -148,7 +148,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -177,7 +177,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -206,7 +206,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -235,7 +235,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -264,7 +264,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -285,7 +285,7 @@ sealed class StatisticsCommand : Command
table.AddRow(Markup.Escape(ds.Manufacturer ?? ""), Markup.Escape(ds.Model ?? ""),
Markup.Escape(ds.Revision ?? ""), Markup.Escape(ds.Bus ?? ""));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
thereAreStats = true;
}
@@ -316,7 +316,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -346,7 +346,7 @@ sealed class StatisticsCommand : Command
thereAreStats = true;
}
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}

View File

@@ -177,7 +177,7 @@ sealed class DeviceInfoCommand : Command
table.AddRow("Product", $"{Markup.Escape(dev.UsbProductString ?? "")}");
table.AddRow("Serial number", $"{Markup.Escape(dev.UsbSerialString ?? "")}");
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}
@@ -199,7 +199,7 @@ sealed class DeviceInfoCommand : Command
table.AddRow("Model", $"{Markup.Escape(dev.FireWireModelName ?? "")}");
table.AddRow("GUID", $"{dev.FireWireGuid:X16}");
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}

View File

@@ -118,7 +118,7 @@ sealed class ListDevicesCommand : Command
Markup.Escape(dev.Model ?? ""), Markup.Escape(dev.Serial ?? ""),
Markup.Escape(dev.Bus ?? ""), dev.Supported ? "[green]✓[/]" : "[red]✗[/]");
AnsiConsole.Render(table);
AnsiConsole.Write(table);
}
return (int)ErrorNumber.NoError;

View File

@@ -282,7 +282,7 @@ sealed class FilesystemInfoCommand : Command
table.AddRow("Scheme", Markup.Escape(partitionsList[i].Scheme ?? ""));
table.AddRow("Description", Markup.Escape(partitionsList[i].Description ?? ""));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
if(!filesystems)
continue;

View File

@@ -107,7 +107,7 @@ sealed class ListOptionsCommand : Command
table.AddRow(Markup.Escape(option.name), $"[italic]{TypeToString(option.type)}[/]",
Markup.Escape(option.description));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}

View File

@@ -102,7 +102,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -126,7 +126,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -146,7 +146,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -170,7 +170,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -191,7 +191,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -212,7 +212,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
@@ -232,7 +232,7 @@ sealed class FormatsCommand : Command
else
table.AddRow(Markup.Escape(kvp.Value.Name));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
return (int)ErrorNumber.NoError;
}

View File

@@ -504,7 +504,7 @@ sealed class CompareCommand : Command
sb.AppendLine(imagesDiffer ? "Images differ" : "Images do not differ");
if(verbose)
AnsiConsole.Render(table);
AnsiConsole.Write(table);
else
AaruConsole.WriteLine(sb.ToString());

View File

@@ -109,7 +109,7 @@ sealed class ListOptionsCommand : Command
table.AddRow(Markup.Escape(option.name), TypeToString(option.type), option.@default?.ToString() ?? "",
Markup.Escape(option.description));
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}

View File

@@ -100,7 +100,7 @@ sealed class ListEncodingsCommand : Command
foreach(CommonEncodingInfo info in encodings.OrderBy(t => t.DisplayName))
table.AddRow(info.Name, info.DisplayName);
AnsiConsole.Render(table);
AnsiConsole.Write(table);
return (int)ErrorNumber.NoError;
}

View File

@@ -99,7 +99,7 @@ sealed class ListNamespacesCommand : Command
foreach(KeyValuePair<string, string> @namespace in kvp.Value.Namespaces.OrderBy(t => t.Key))
table.AddRow(@namespace.Key, @namespace.Value);
AnsiConsole.Render(table);
AnsiConsole.Write(table);
AaruConsole.WriteLine();
}

View File

@@ -115,7 +115,7 @@ sealed class RemoteCommand : Command
table.AddRow("Server maximum protocol", $"{remote.ServerProtocolVersion}");
AnsiConsole.Render(table);
AnsiConsole.Write(table);
remote.Disconnect();
}
catch(Exception)

View File

@@ -142,19 +142,19 @@ class MainClass
}
// Remove duplicates
foreach(var duplicate in ctx.SeenDevices.AsEnumerable()!.GroupBy(a => new
foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new
{
a.Manufacturer,
a.Model,
a.Revision,
a.Bus
}).Where(a => a.Count() > 1).Distinct().Select(a => a.Key))
ctx.RemoveRange(ctx.SeenDevices!.
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.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null && d.Revision == null));
ctx.SaveChanges();