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 @model DiscImageChef.CommonTypes.Metadata.MmcSd
@{ @{
@@ -37,36 +39,83 @@
<h4>MmcSd</h4> <h4>MmcSd</h4>
<hr /> <hr />
<dl class="row"> <dl class="row">
<dt class="col-sm-2"> @if (Model.SCR != null)
@Html.DisplayNameFor(model => model.CID) {
</dt> if (Model.CID != null)
<dd class="col-sm-10"> {
@Html.DisplayFor(model => model.CID) <dt class="col-sm-2">
</dd> @Html.DisplayNameFor(model => model.CID)
<dt class="col-sm-2"> </dt>
@Html.DisplayNameFor(model => model.CSD) <dd class="col-sm-10">
</dt> @Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyCID(Model.CID)))
<dd class="col-sm-10"> </dd>
@Html.DisplayFor(model => model.CSD) }
</dd> if (Model.CSD != null)
<dt class="col-sm-2"> {
@Html.DisplayNameFor(model => model.OCR) <dt class="col-sm-2">
</dt> @Html.DisplayNameFor(model => model.CSD)
<dd class="col-sm-10"> </dt>
@Html.DisplayFor(model => model.OCR) <dd class="col-sm-10">
</dd> @Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyCSD(Model.CSD)))
<dt class="col-sm-2"> </dd>
@Html.DisplayNameFor(model => model.SCR) }
</dt> if (Model.OCR != null)
<dd class="col-sm-10"> {
@Html.DisplayFor(model => model.SCR) <dt class="col-sm-2">
</dd> @Html.DisplayNameFor(model => model.OCR)
<dt class="col-sm-2"> </dt>
@Html.DisplayNameFor(model => model.ExtendedCSD) <dd class="col-sm-10">
</dt> @Html.Raw(Html.EncodedMultiLineText(Decoders.PrettifyOCR(Model.OCR)))
<dd class="col-sm-10"> </dd>
@Html.DisplayFor(model => model.ExtendedCSD) }
</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> </dl>
</div> </div>
<div> <div>

View File

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