mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Update ImageInfoViewModel to use localized formatting with markup for image metadata
This commit is contained in:
@@ -119,8 +119,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
ImageIdentifiedText = string.Format(UI.Image_format_identified_by_0_1, imageFormat.Name, imageFormat.Id);
|
ImageIdentifiedText = string.Format(UI.Image_format_identified_by_0_1, imageFormat.Name, imageFormat.Id);
|
||||||
|
|
||||||
ImageFormatText = !string.IsNullOrWhiteSpace(imageFormat.Info.Version)
|
ImageFormatText = !string.IsNullOrWhiteSpace(imageFormat.Info.Version)
|
||||||
? string.Format(UI.Format_0_version_1, imageFormat.Format, imageFormat.Info.Version)
|
? string.Format(Localization.Core.Format_0_version_1_WithMarkup,
|
||||||
: string.Format(UI.Format_0, imageFormat.Format);
|
imageFormat.Format,
|
||||||
|
imageFormat.Info.Version)
|
||||||
|
: string.Format(Localization.Core.Format_0_WithMarkup, imageFormat.Format);
|
||||||
|
|
||||||
ImageSizeText = string.Format(Localization.Core.Image_without_headers_is_0_bytes_long,
|
ImageSizeText = string.Format(Localization.Core.Image_without_headers_is_0_bytes_long,
|
||||||
imageFormat.Info.ImageSize);
|
imageFormat.Info.ImageSize);
|
||||||
@@ -131,24 +133,30 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
imageFormat.Info.SectorSize,
|
imageFormat.Info.SectorSize,
|
||||||
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize).Humanize());
|
ByteSize.FromBytes(imageFormat.Info.Sectors * imageFormat.Info.SectorSize).Humanize());
|
||||||
|
|
||||||
MediaTypeText = string.Format(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1,
|
MediaTypeText = string.Format(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1_WithMarkup,
|
||||||
imageFormat.Info.MediaType.Humanize(),
|
imageFormat.Info.MediaType.Humanize(),
|
||||||
imageFormat.Info.MetadataMediaType);
|
imageFormat.Info.MetadataMediaType);
|
||||||
|
|
||||||
HasPartitionsText = imageFormat.Info.HasPartitions ? UI.Has_partitions : UI.Doesnt_have_partitions;
|
HasPartitionsText = imageFormat.Info.HasPartitions
|
||||||
HasSessionsText = imageFormat.Info.HasSessions ? UI.Has_sessions : UI.Doesnt_have_sessions;
|
? Localization.Core.Has_partitions
|
||||||
|
: Localization.Core.Doesnt_have_partitions;
|
||||||
|
|
||||||
|
HasSessionsText = imageFormat.Info.HasSessions
|
||||||
|
? Localization.Core.Has_sessions
|
||||||
|
: Localization.Core.Doesnt_have_sessions;
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
||||||
{
|
{
|
||||||
ApplicationText = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)
|
ApplicationText = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)
|
||||||
? string.Format(Localization.Core.Was_created_with_0_version_1,
|
? string.Format(Localization.Core.Was_created_with_0_version_1_WithMarkup,
|
||||||
imageFormat.Info.Application,
|
imageFormat.Info.Application,
|
||||||
imageFormat.Info.ApplicationVersion)
|
imageFormat.Info.ApplicationVersion)
|
||||||
: string.Format(Localization.Core.Was_created_with_0, imageFormat.Info.Application);
|
: string.Format(Localization.Core.Was_created_with_0_WithMarkup,
|
||||||
|
imageFormat.Info.Application);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
|
||||||
CreatorText = string.Format(Localization.Core.Created_by_0, imageFormat.Info.Creator);
|
CreatorText = string.Format(Localization.Core.Created_by_0_WithMarkup, imageFormat.Info.Creator);
|
||||||
|
|
||||||
if(imageFormat.Info.CreationTime != DateTime.MinValue)
|
if(imageFormat.Info.CreationTime != DateTime.MinValue)
|
||||||
CreationTimeText = string.Format(Localization.Core.Created_on_0, imageFormat.Info.CreationTime);
|
CreationTimeText = string.Format(Localization.Core.Created_on_0, imageFormat.Info.CreationTime);
|
||||||
@@ -167,43 +175,47 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
||||||
MediaTitleText = string.Format(UI.Media_title_0, imageFormat.Info.MediaTitle);
|
MediaTitleText = string.Format(Localization.Core.Media_title_0_WithMarkup, imageFormat.Info.MediaTitle);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
|
||||||
{
|
{
|
||||||
MediaManufacturerText =
|
MediaManufacturerText = string.Format(Localization.Core.Media_manufacturer_0_WithMarkup,
|
||||||
string.Format(Localization.Core.Media_manufacturer_0, imageFormat.Info.MediaManufacturer);
|
imageFormat.Info.MediaManufacturer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
|
||||||
MediaModelText = string.Format(UI.Media_model_0, imageFormat.Info.MediaModel);
|
MediaModelText = string.Format(Localization.Core.Media_model_0_WithMarkup, imageFormat.Info.MediaModel);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
|
||||||
{
|
{
|
||||||
MediaSerialNumberText =
|
MediaSerialNumberText = string.Format(Localization.Core.Media_serial_number_0_WithMarkup,
|
||||||
string.Format(Localization.Core.Media_serial_number_0, imageFormat.Info.MediaSerialNumber);
|
imageFormat.Info.MediaSerialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode))
|
||||||
MediaBarcodeText = string.Format(UI.Media_barcode_0, imageFormat.Info.MediaBarcode);
|
MediaBarcodeText =
|
||||||
|
string.Format(Localization.Core.Media_barcode_0_WithMarkup, imageFormat.Info.MediaBarcode);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber))
|
||||||
MediaPartNumberText = string.Format(UI.Media_part_number_0, imageFormat.Info.MediaPartNumber);
|
MediaPartNumberText = string.Format(Localization.Core.Media_part_number_0_WithMarkup,
|
||||||
|
imageFormat.Info.MediaPartNumber);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer))
|
||||||
DriveManufacturerText = string.Format(UI.Drive_manufacturer_0, imageFormat.Info.DriveManufacturer);
|
DriveManufacturerText = string.Format(Localization.Core.Drive_manufacturer_0_WithMarkup,
|
||||||
|
imageFormat.Info.DriveManufacturer);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel))
|
||||||
DriveModelText = string.Format(UI.Drive_model_0, imageFormat.Info.DriveModel);
|
DriveModelText = string.Format(Localization.Core.Drive_model_0_WithMarkup, imageFormat.Info.DriveModel);
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
|
||||||
{
|
{
|
||||||
DriveSerialNumberText =
|
DriveSerialNumberText = string.Format(Localization.Core.Drive_serial_number_0_WithMarkup,
|
||||||
string.Format(Localization.Core.Drive_serial_number_0, imageFormat.Info.DriveSerialNumber);
|
imageFormat.Info.DriveSerialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision))
|
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision))
|
||||||
DriveFirmwareRevisionText = string.Format(UI.Drive_firmware_info_0, imageFormat.Info.DriveFirmwareRevision);
|
DriveFirmwareRevisionText = string.Format(Localization.Core.Drive_firmware_info_0_WithMarkup,
|
||||||
|
imageFormat.Info.DriveFirmwareRevision);
|
||||||
|
|
||||||
if(imageFormat.Info.Cylinders > 0 &&
|
if(imageFormat.Info.Cylinders > 0 &&
|
||||||
imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } &&
|
imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } &&
|
||||||
@@ -218,13 +230,12 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||||
{
|
{
|
||||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t))
|
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.Order()) MediaTagsList.Add(tag.ToString());
|
||||||
MediaTagsList.Add(tag.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||||
{
|
{
|
||||||
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t))
|
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.Order())
|
||||||
SectorTagsList.Add(tag.ToString());
|
SectorTagsList.Add(tag.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,9 +706,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(opticalMediaImage.Sessions is { Count: > 0 })
|
if(opticalMediaImage.Sessions is { Count: > 0 })
|
||||||
{
|
foreach(Session session in opticalMediaImage.Sessions)
|
||||||
foreach(Session session in opticalMediaImage.Sessions) Sessions.Add(session);
|
Sessions.Add(session);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -707,9 +717,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(opticalMediaImage.Tracks is { Count: > 0 })
|
if(opticalMediaImage.Tracks is { Count: > 0 })
|
||||||
{
|
foreach(Track track in opticalMediaImage.Tracks)
|
||||||
foreach(Track track in opticalMediaImage.Tracks) Tracks.Add(track);
|
Tracks.Add(track);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user