mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Humanize other usages of media type.
This commit is contained in:
@@ -116,7 +116,7 @@ public static class ImageInfo
|
|||||||
AaruLogging.WriteLine(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime);
|
AaruLogging.WriteLine(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime);
|
||||||
|
|
||||||
AaruLogging.WriteLine(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1_WithMarkup,
|
AaruLogging.WriteLine(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1_WithMarkup,
|
||||||
imageFormat.Info.MediaType,
|
imageFormat.Info.MediaType.Humanize(),
|
||||||
imageFormat.Info.MetadataMediaType);
|
imageFormat.Info.MetadataMediaType);
|
||||||
|
|
||||||
AaruLogging.WriteLine(imageFormat.Info.HasPartitions
|
AaruLogging.WriteLine(imageFormat.Info.HasPartitions
|
||||||
@@ -444,7 +444,7 @@ public static class ImageInfo
|
|||||||
|
|
||||||
if(dataLen + 2 != toc.Length)
|
if(dataLen + 2 != toc.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[toc.Length + 2];
|
var tmp = new byte[toc.Length + 2];
|
||||||
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
||||||
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
||||||
tmp[1] = (byte)(toc.Length & 0xFF);
|
tmp[1] = (byte)(toc.Length & 0xFF);
|
||||||
@@ -467,7 +467,7 @@ public static class ImageInfo
|
|||||||
|
|
||||||
if(dataLen + 2 != pma.Length)
|
if(dataLen + 2 != pma.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[pma.Length + 2];
|
var tmp = new byte[pma.Length + 2];
|
||||||
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
||||||
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
||||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||||
@@ -492,7 +492,7 @@ public static class ImageInfo
|
|||||||
|
|
||||||
if(dataLen + 4 != atip.Length)
|
if(dataLen + 4 != atip.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[atip.Length + 4];
|
var tmp = new byte[atip.Length + 4];
|
||||||
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
||||||
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
||||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||||
@@ -519,7 +519,7 @@ public static class ImageInfo
|
|||||||
|
|
||||||
if(dataLen + 4 != cdtext.Length)
|
if(dataLen + 4 != cdtext.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[cdtext.Length + 4];
|
var tmp = new byte[cdtext.Length + 4];
|
||||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
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,
|
||||||
imageFormat.Info.MediaType,
|
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 ? UI.Has_partitions : UI.Doesnt_have_partitions;
|
||||||
@@ -314,7 +314,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(dataLen + 2 != toc.Length)
|
if(dataLen + 2 != toc.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[toc.Length + 2];
|
var tmp = new byte[toc.Length + 2];
|
||||||
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
||||||
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
||||||
tmp[1] = (byte)(toc.Length & 0xFF);
|
tmp[1] = (byte)(toc.Length & 0xFF);
|
||||||
@@ -335,7 +335,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(dataLen + 2 != fullToc.Length)
|
if(dataLen + 2 != fullToc.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[fullToc.Length + 2];
|
var tmp = new byte[fullToc.Length + 2];
|
||||||
Array.Copy(fullToc, 0, tmp, 2, fullToc.Length);
|
Array.Copy(fullToc, 0, tmp, 2, fullToc.Length);
|
||||||
tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8);
|
tmp[0] = (byte)((fullToc.Length & 0xFF00) >> 8);
|
||||||
tmp[1] = (byte)(fullToc.Length & 0xFF);
|
tmp[1] = (byte)(fullToc.Length & 0xFF);
|
||||||
@@ -356,7 +356,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(dataLen + 2 != pma.Length)
|
if(dataLen + 2 != pma.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[pma.Length + 2];
|
var tmp = new byte[pma.Length + 2];
|
||||||
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
||||||
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
||||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||||
@@ -375,7 +375,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(dataLen + 4 != atip.Length)
|
if(dataLen + 4 != atip.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[atip.Length + 4];
|
var tmp = new byte[atip.Length + 4];
|
||||||
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
||||||
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
||||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||||
@@ -398,7 +398,7 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
|||||||
|
|
||||||
if(dataLen + 4 != cdtext.Length)
|
if(dataLen + 4 != cdtext.Length)
|
||||||
{
|
{
|
||||||
byte[] tmp = new byte[cdtext.Length + 4];
|
var tmp = new byte[cdtext.Length + 4];
|
||||||
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
|
||||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||||
@@ -695,9 +695,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 +706,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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ using Aaru.Decoders.DVD;
|
|||||||
using Aaru.Decoders.SCSI;
|
using Aaru.Decoders.SCSI;
|
||||||
using Aaru.Helpers;
|
using Aaru.Helpers;
|
||||||
using Aaru.Logging;
|
using Aaru.Logging;
|
||||||
|
using Humanizer;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
using Sentry;
|
using Sentry;
|
||||||
using DMI = Aaru.Decoders.Xbox.DMI;
|
using DMI = Aaru.Decoders.Xbox.DMI;
|
||||||
@@ -372,8 +373,8 @@ public sealed partial class ZZZRawImage
|
|||||||
|
|
||||||
if(_imageInfo.ImageSize % 2352 == 0 || _imageInfo.ImageSize % 2448 == 0)
|
if(_imageInfo.ImageSize % 2352 == 0 || _imageInfo.ImageSize % 2448 == 0)
|
||||||
{
|
{
|
||||||
byte[] sync = new byte[12];
|
var sync = new byte[12];
|
||||||
byte[] header = new byte[4];
|
var header = new byte[4];
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
stream.EnsureRead(sync, 0, 12);
|
stream.EnsureRead(sync, 0, 12);
|
||||||
stream.EnsureRead(header, 0, 4);
|
stream.EnsureRead(header, 0, 4);
|
||||||
@@ -419,7 +420,7 @@ public sealed partial class ZZZRawImage
|
|||||||
if(filter is null) continue;
|
if(filter is null) continue;
|
||||||
|
|
||||||
AaruLogging.Debug(MODULE_NAME, Localization.Found_media_tag_0, sidecar.tag);
|
AaruLogging.Debug(MODULE_NAME, Localization.Found_media_tag_0, sidecar.tag);
|
||||||
byte[] data = new byte[filter.DataForkLength];
|
var data = new byte[filter.DataForkLength];
|
||||||
filter.GetDataForkStream().EnsureRead(data, 0, data.Length);
|
filter.GetDataForkStream().EnsureRead(data, 0, data.Length);
|
||||||
_mediaTags.Add(sidecar.tag, data);
|
_mediaTags.Add(sidecar.tag, data);
|
||||||
}
|
}
|
||||||
@@ -1175,7 +1176,7 @@ public sealed partial class ZZZRawImage
|
|||||||
_imageInfo.HasPartitions = true;
|
_imageInfo.HasPartitions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AaruLogging.Verbose(Localization.Raw_disk_image_contains_a_disk_of_type_0, _imageInfo.MediaType);
|
AaruLogging.Verbose(Localization.Raw_disk_image_contains_a_disk_of_type_0, _imageInfo.MediaType.Humanize());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1339,9 +1340,9 @@ public sealed partial class ZZZRawImage
|
|||||||
|
|
||||||
buffer = br.ReadBytes((int)((sectorSize + sectorSkip) * length));
|
buffer = br.ReadBytes((int)((sectorSize + sectorSkip) * length));
|
||||||
|
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
byte[] sector = new byte[sectorSize];
|
var sector = new byte[sectorSize];
|
||||||
Array.Copy(buffer, (sectorSize + sectorSkip) * i, sector, 0, sectorSize);
|
Array.Copy(buffer, (sectorSize + sectorSkip) * i, sector, 0, sectorSize);
|
||||||
sector = Sector.GetUserDataFromMode2(sector);
|
sector = Sector.GetUserDataFromMode2(sector);
|
||||||
mode2Ms.Write(sector, 0, sector.Length);
|
mode2Ms.Write(sector, 0, sector.Length);
|
||||||
@@ -1353,7 +1354,7 @@ public sealed partial class ZZZRawImage
|
|||||||
buffer = br.ReadBytes((int)(sectorSize * length));
|
buffer = br.ReadBytes((int)(sectorSize * length));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if(_rawDvd)
|
if(_rawDvd)
|
||||||
{
|
{
|
||||||
@@ -1671,7 +1672,7 @@ public sealed partial class ZZZRawImage
|
|||||||
buffer = br.ReadBytes((int)(sectorSize * length));
|
buffer = br.ReadBytes((int)(sectorSize * length));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
br.BaseStream.Seek(sectorOffset, SeekOrigin.Current);
|
br.BaseStream.Seek(sectorOffset, SeekOrigin.Current);
|
||||||
byte[] sector = br.ReadBytes((int)sectorSize);
|
byte[] sector = br.ReadBytes((int)sectorSize);
|
||||||
@@ -1699,7 +1700,7 @@ public sealed partial class ZZZRawImage
|
|||||||
|
|
||||||
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||||
|
|
||||||
uint sectorSize = 2352u;
|
var sectorSize = 2352u;
|
||||||
|
|
||||||
if(_toastXa) sectorSize = 2056u;
|
if(_toastXa) sectorSize = 2056u;
|
||||||
|
|
||||||
@@ -1720,9 +1721,9 @@ public sealed partial class ZZZRawImage
|
|||||||
{
|
{
|
||||||
buffer = new byte[2352 * length];
|
buffer = new byte[2352 * length];
|
||||||
|
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
byte[] fullSector = new byte[2352];
|
var fullSector = new byte[2352];
|
||||||
stream.EnsureRead(fullSector, 16, (int)sectorSize);
|
stream.EnsureRead(fullSector, 16, (int)sectorSize);
|
||||||
SectorBuilder sb = new();
|
SectorBuilder sb = new();
|
||||||
sb.ReconstructPrefix(ref fullSector, TrackType.CdMode2Form1, (long)(sectorAddress + length));
|
sb.ReconstructPrefix(ref fullSector, TrackType.CdMode2Form1, (long)(sectorAddress + length));
|
||||||
@@ -1732,7 +1733,7 @@ public sealed partial class ZZZRawImage
|
|||||||
}
|
}
|
||||||
else if(_rawDvd)
|
else if(_rawDvd)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
byte[] sector = br.ReadBytes((int)sectorSize);
|
byte[] sector = br.ReadBytes((int)sectorSize);
|
||||||
ErrorNumber error = _decoding.Scramble(sector, out byte[] scrambled);
|
ErrorNumber error = _decoding.Scramble(sector, out byte[] scrambled);
|
||||||
@@ -1746,7 +1747,7 @@ public sealed partial class ZZZRawImage
|
|||||||
buffer = br.ReadBytes((int)(sectorSize * length));
|
buffer = br.ReadBytes((int)(sectorSize * length));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < length; i++)
|
for(var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
byte[] sector = br.ReadBytes((int)sectorSize);
|
byte[] sector = br.ReadBytes((int)sectorSize);
|
||||||
br.BaseStream.Seek(sectorSkip, SeekOrigin.Current);
|
br.BaseStream.Seek(sectorSkip, SeekOrigin.Current);
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
if(imageFormat.Info.LastModificationTime != DateTime.MinValue)
|
if(imageFormat.Info.LastModificationTime != DateTime.MinValue)
|
||||||
sb.AppendLine($"[#875fff]Last modified on[/] [#afd700]{imageFormat.Info.LastModificationTime}[/]");
|
sb.AppendLine($"[#875fff]Last modified on[/] [#afd700]{imageFormat.Info.LastModificationTime}[/]");
|
||||||
|
|
||||||
sb.AppendLine($"[#875fff]Contains a media of type[/] [italic][fuchsia]{imageFormat.Info.MediaType}[/][/]");
|
sb.AppendLine($"[#875fff]Contains a media of type[/] [italic][fuchsia]{imageFormat.Info.MediaType.Humanize()}[/][/]");
|
||||||
sb.AppendLine($"[#875fff]XML type:[/] [italic][#af8787]{imageFormat.Info.MetadataMediaType}[/][/]");
|
sb.AppendLine($"[#875fff]XML type:[/] [italic][#af8787]{imageFormat.Info.MetadataMediaType}[/][/]");
|
||||||
|
|
||||||
sb.AppendLine(imageFormat.Info.HasPartitions
|
sb.AppendLine(imageFormat.Info.HasPartitions
|
||||||
|
|||||||
Reference in New Issue
Block a user