Prettify details for MMC/SD.

This commit is contained in:
2019-11-16 01:52:17 +00:00
parent 32fc9750cb
commit 63648426a9
2 changed files with 83 additions and 30 deletions

View File

@@ -1,3 +1,5 @@
@using DiscImageChef.Decoders.SecureDigital
@using DiscImageChef.Server.Core
@model DiscImageChef.CommonTypes.Metadata.MmcSd
@{
@@ -37,36 +39,83 @@
<h4>MmcSd</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CID)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.CID)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CSD)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.CSD)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.OCR)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.OCR)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.SCR)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.SCR)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.ExtendedCSD)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.ExtendedCSD)
</dd>
@if (Model.SCR != null)
{
if (Model.CID != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CID)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyCID(Model.CID)))
</dd>
}
if (Model.CSD != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CSD)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyCSD(Model.CSD)))
</dd>
}
if (Model.OCR != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.OCR)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyOCR(Model.OCR)))
</dd>
}
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.SCR)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifySCR(Model.SCR)))
</dd>
}
else
{
if (Model.CID != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CID)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(DiscImageChef.Decoders.MMC.Decoders.PrettifyCID(Model.CID)))
</dd>
}
if (Model.CSD != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CSD)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(DiscImageChef.Decoders.MMC.Decoders.PrettifyCSD(Model.CSD)))
</dd>
}
if (Model.OCR != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.OCR)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(DiscImageChef.Decoders.MMC.Decoders.PrettifyOCR(Model.OCR)))
</dd>
}
if (Model.ExtendedCSD != null)
{
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.ExtendedCSD)
</dt>
<dd class="col-sm-10">
@Html.Raw(Html.EncodedMultiLineText(DiscImageChef.Decoders.MMC.Decoders.PrettifyExtendedCSD(Model.ExtendedCSD)))
</dd>
}
}
</dl>
</div>
<div>

View File

@@ -13,5 +13,9 @@ namespace DiscImageChef.Server.Core
public static string EncodedMultiLineText(this IHtmlHelper<Mmc> helper, string text) =>
string.IsNullOrEmpty(text) ? string.Empty
: Regex.Replace(helper.Encode(text), "&#xD;&#xA;|&#xA;|&#xD;", "<br/>");
public static string EncodedMultiLineText(this IHtmlHelper<MmcSd> helper, string text) =>
string.IsNullOrEmpty(text) ? string.Empty
: Regex.Replace(helper.Encode(text), "&#xD;&#xA;|&#xA;|&#xD;", "<br/>");
}
}