Files
marechai/Marechai/Views/Machine/View.cshtml

788 lines
35 KiB
Plaintext
Raw Normal View History

2018-04-14 07:13:11 +01:00
@{
/******************************************************************************
2020-02-10 01:52:56 +00:00
// MARECHAI: Master repository of computing history artifacts information
2018-04-14 07:13:11 +01:00
// ----------------------------------------------------------------------------
//
// Filename : Index.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Index page (and news)
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
2020-02-10 03:05:39 +00:00
// Copyright © 2003-2020 Natalia Portillo
2018-04-14 07:13:11 +01:00
*******************************************************************************/
// TODO: Resolutions
2018-04-14 07:13:11 +01:00
ViewData["Title"] = "Computer";
}
@using System.IO
2020-02-10 02:10:18 +00:00
@using Marechai.Database
@model Marechai.Database.Models.Machine
2018-08-06 21:07:23 +01:00
<p align="center">
2020-02-10 22:44:18 +00:00
@if (Model.Company.LastLogo != null &&
File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg")))
{
<picture>
2020-02-10 22:44:18 +00:00
<source type="image/svg+xml" srcset="/assets/logos/@(Model.Company.LastLogo.Guid).svg">
<source type="image/webp" srcset="/assets/logos/webp/1x/@(Model.Company.LastLogo.Guid).webp,
/assets/logos/webp/2x/@(Model.Company.LastLogo.Guid).webp 2x,
/assets/logos/webp/3x/@(Model.Company.LastLogo.Guid).webp 3x">
<img srcset="/assets/logos/png/1x/@(Model.Company.LastLogo.Guid).png,
/assets/logos/png/2x/@(Model.Company.LastLogo.Guid).png 2x,
2020-05-21 23:32:21 +01:00
/assets/logos/png/3x/@(Model.Company.LastLogo.Guid).png 3x" src="/assets/logos/png/1x/@(Model.Company.LastLogo.Guid).png" alt="" height="auto" width="auto" style="max-height: 256px; max-width: 256px" />
</picture>
}
</p>
2020-02-10 22:44:18 +00:00
@{ var counter = 0; }
2020-02-10 22:44:18 +00:00
@if (Model.Introduced.HasValue &&
Model.Introduced.Value.Year == 1000)
2018-04-14 07:13:11 +01:00
{
<b>
<div style="text-align: center;">PROTOTYPE</div>
2018-04-14 07:13:11 +01:00
</b>
}
<b>
2020-02-10 22:44:18 +00:00
<a asp-controller="Company" asp-action="View" asp-route-id="@Model.Company.Id">
@Model.Company.Name</a> @Model.Name</b>
2018-08-06 21:07:23 +01:00
<table width="100%">
2018-04-14 07:13:11 +01:00
2020-02-10 22:44:18 +00:00
@if (Model.Introduced.HasValue &&
Model.Introduced.Value.Year != 1000)
2018-04-14 07:13:11 +01:00
{
<tr>
2020-02-10 22:44:18 +00:00
<th scope=row width="37%">
2018-04-14 07:13:11 +01:00
<div align=right>
Introduction date
2018-04-14 07:13:11 +01:00
</div>
</th>
<td width="63%">
2020-02-10 22:44:18 +00:00
<a asp-controller="Computer" asp-action="ByYear" asp-route-id="@Model.Introduced.Value.Year">
@Model.Introduced.Value.ToLongDateString()</a>
2018-04-14 07:13:11 +01:00
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Family != null)
{
<tr>
2020-02-10 22:44:18 +00:00
<th scope=row width="37%">
<div align=right>
Family
</div>
</th>
<td width="63%">
2020-02-10 22:44:18 +00:00
<a asp-controller="Computer" asp-action="ByFamily" asp-route-id="@Model.Family.Id">
@Model.Family.Name</a>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Model != null)
{
<tr>
2020-02-10 22:44:18 +00:00
<th scope=row width="37%">
<div align=right>
Model
</div>
</th>
<td width="63%">
@Model.Model
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Processors.Count > 0)
2018-04-14 07:13:11 +01:00
{
<tr>
<th scope=row>
<div align=right>
Processors
</div>
</th>
<td>
<table>
@{ counter = 0; }
2020-02-10 22:44:18 +00:00
@foreach (var processorByMachine in Model.Processors)
{
<tr>
<td>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Speed > 0)
{
@(processorByMachine.Processor.GprSize > 0 ? $"{processorByMachine.Processor.Name} @ {processorByMachine.Speed}Mhz ({processorByMachine.Processor.GprSize} bits)" : $"{processorByMachine.Processor.Name} @ {processorByMachine.Speed}Mhz")
}
else
2020-02-10 22:44:18 +00:00
{
@($"{processorByMachine.Processor.Name}")
}
<a aria-controls="@($"cpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#cpuInfo{counter}")">
+info
</a>
2020-02-10 22:44:18 +00:00
<div class="collapse" id="@($"cpuInfo{counter}")">
<div class="card card-body">
<table>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.ModelCode != null &&
processorByMachine.Processor.ModelCode != processorByMachine.Processor.Name)
{
<tr>
<td>Model</td>
<td>@processorByMachine.Processor.ModelCode</td>
</tr>
}
<tr>
<td>Manufacturer</td>
<td>
2020-02-10 22:44:18 +00:00
<a asp-controller=Company asp-action=View asp-route-id=@processorByMachine.Processor.Company.Id>
@processorByMachine.Processor.Company.Name</a>
</td>
</tr>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{processorByMachine.Processor.Introduced:yyyy}")</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.InstructionSet != null)
{
<tr>
<td>Instruction set</td>
<td>@processorByMachine.Processor.InstructionSet.Name</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Speed > 0)
{
<tr>
<td>Nominal speed</td>
<td>@processorByMachine.Processor.Speed MHz</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Gprs > 0 ||
processorByMachine.Processor.Fprs > 0 ||
processorByMachine.Processor.SimdRegisters > 0)
{
<tr>
<td>Registers</td>
<td>
<table>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Gprs > 0)
{
<tr>
<td>
@processorByMachine.Processor.Gprs general purpose registers of @processorByMachine.Processor.GprSize bits
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.FprSize > 0 &&
processorByMachine.Processor.Fprs == 0)
{
@($", that can be used as floating point registers of {processorByMachine.Processor.FprSize}")
}
@if (processorByMachine.Processor.SimdSize > 0 &&
processorByMachine.Processor.SimdRegisters == 0)
{
@($", that can be used as SIMD registers of {processorByMachine.Processor.FprSize}")
}
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Fprs > 0)
{
<tr>
<td>
@processorByMachine.Processor.Fprs floating-point registers of @processorByMachine.Processor.FprSize bits
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.SimdSize > 0 &&
processorByMachine.Processor.SimdRegisters == 0)
{
@($", that can be used as SIMD registers of {processorByMachine.Processor.FprSize}")
}
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.SimdRegisters > 0)
{
<tr>
<td>
2020-02-10 22:44:18 +00:00
@processorByMachine.Processor.SimdRegisters
<abbr title="Single instruction, multiple data">SIMD</abbr>registers of @processorByMachine.Processor.SimdSize bits
</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Cores > 1)
{
<tr>
<td>Multi-core</td>
<td>@processorByMachine.Processor.Cores cores</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Cores > 1)
{
<tr>
<td>
<abbr title="Simultanoeus multithreading">SMT</abbr>
</td>
<td>
@processorByMachine.Processor.ThreadsPerCore threads
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Cores > 1)
{
@(" per core")
}
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.DataBus > 0 ||
processorByMachine.Processor.AddrBus > 0)
{
<tr>
<td>Bus</td>
<td>
<table>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.DataBus > 0)
{
<tr>
<td>
@processorByMachine.Processor.DataBus-bit data
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.AddrBus > 0)
{
<tr>
<td>
@processorByMachine.Processor.AddrBus-bit address
</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.L1Instruction > 0 ||
processorByMachine.Processor.L1Data > 0 ||
processorByMachine.Processor.L2 > 0 ||
processorByMachine.Processor.L2 > 0)
{
<tr>
<td>Cache</td>
<td>
<table>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.L1Instruction > 0)
{
<tr>
<td>
@(processorByMachine.Processor.L1Data < 0 ? $"{processorByMachine.Processor.L1Instruction}KiB combined instruction-data L1" : $"{processorByMachine.Processor.L1Instruction}KiB instruction L1")
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.L1Data > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L1Data}KiB data L1")
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.L2 > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L2}KiB L2")
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.L3 > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L3}KiB L3")
</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Package != null)
{
<tr>
<td>Package</td>
<td>@processorByMachine.Processor.Package</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Process != null ||
processorByMachine.Processor.ProcessNm > 0)
{
<tr>
<td>Manufacturing process</td>
<td>
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Process != null &&
processorByMachine.Processor.ProcessNm > 0)
{
@processorByMachine.Processor.Process
@("@")
@(processorByMachine.Processor.ProcessNm > 100 ? $"{processorByMachine.Processor.ProcessNm / 100}µm" : $"{processorByMachine.Processor.ProcessNm}nm")
}
2020-02-10 22:44:18 +00:00
else if (processorByMachine.Processor.ProcessNm > 0)
{
@(processorByMachine.Processor.ProcessNm > 100 ? $"{processorByMachine.Processor.ProcessNm / 100}µm" : $"{processorByMachine.Processor.ProcessNm}nm")
}
else
2020-02-10 22:44:18 +00:00
{
@processorByMachine.Processor.Process
}
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.DieSize > 0)
{
<tr>
<td>Die size</td>
<td>@processorByMachine.Processor.DieSize mm&sup2;</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (processorByMachine.Processor.Transistors > 0)
{
<tr>
<td>Transistors</td>
<td>@processorByMachine.Processor.Transistors</td>
</tr>
}
</table>
</div>
</div>
</td>
</tr>
counter++;
}
</table>
</td>
2018-04-14 07:13:11 +01:00
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Memory != null &&
Model.Memory.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Memory
</div>
</th>
<td>
<table>
2020-02-10 22:44:18 +00:00
@foreach (var memory in Model.Memory)
{
string memValue;
2020-02-10 22:44:18 +00:00
if (memory.Size > 1073741824)
{
memValue = $"{memory.Size / 1073741824} GiB";
}
else if (memory.Size > 1048576)
{
memValue = $"{memory.Size / 1048576} MiB";
}
else if (memory.Size > 1024)
{
memValue = $"{memory.Size / 1024} KiB";
}
else if (memory.Size > 0)
{
memValue = $"{memory.Size} bytes";
}
else
2020-02-10 22:44:18 +00:00
{
memValue = "Unknown size";
}
string speedValue;
2020-02-10 22:44:18 +00:00
if (memory.Speed > 1000000000)
{
speedValue = $"{memory.Speed / 1000000000} GHz";
}
else if (memory.Speed > 1000000)
{
speedValue = $"{memory.Speed / 1000000} MHz";
}
else if (memory.Speed > 1000)
{
speedValue = $"{memory.Speed / 1000} KHz";
}
else if (memory.Speed > 0)
{
speedValue = $"{memory.Speed} Hz";
}
else
2020-02-10 22:44:18 +00:00
{
speedValue = "unknown speed";
}
<tr>
<td>@memValue of @memory.Usage memory (@memory.Type at @speedValue)</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Gpus.Count > 0)
2018-04-27 15:29:53 +01:00
{
<tr>
<th scope=row>
<div align=right>
Graphics processing units
2018-04-27 15:29:53 +01:00
</div>
</th>
<td>
<table>
@{ counter = 0; }
2020-02-10 22:44:18 +00:00
@foreach (var gpuByMachine in Model.Gpus)
{
2020-02-10 22:44:18 +00:00
if (gpuByMachine.Gpu.Id == -2)
{
<td>
Framebuffer
2020-02-10 22:44:18 +00:00
<a aria-controls="@($"gpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#gpuInfo{counter}")">
+info
</a>
2020-02-10 22:44:18 +00:00
<div class="collapse" id="@($"gpuInfo{counter}")">
<div class="card card-body">
2020-02-10 22:44:18 +00:00
This computer directly draws pixels from software to a memory region that's converted to video output by a
<abbr title="Digital to Analog Converter">DAC</abbr> or similar without using any specific graphics processing unit.
</div>
</div>
</td>
}
else
{
<td>
@($"{gpuByMachine.Gpu.Name}")
2020-02-10 22:44:18 +00:00
<a aria-controls="@($"gpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#gpuInfo{counter}")">
+info
</a>
2020-02-10 22:44:18 +00:00
<div class="collapse" id="@($"gpuInfo{counter}")">
<div class="card card-body">
<table>
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.ModelCode != null &&
gpuByMachine.Gpu.ModelCode != gpuByMachine.Gpu.Name)
{
<tr>
<td>Model</td>
<td>@gpuByMachine.Gpu.ModelCode</td>
</tr>
}
<tr>
<td>Manufacturer</td>
<td>
2020-02-10 22:44:18 +00:00
<a asp-controller=Company asp-action=View asp-route-id=@gpuByMachine.Gpu.Company.Id>
@gpuByMachine.Gpu.Company.Name</a>
</td>
</tr>
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{gpuByMachine.Gpu.Introduced:yyyy}")</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.Package != null)
{
<tr>
<td>Package</td>
<td>@gpuByMachine.Gpu.Package</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.Process != null ||
gpuByMachine.Gpu.ProcessNm > 0)
{
<tr>
<td>Manufacturing process</td>
<td>
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.Process != null &&
gpuByMachine.Gpu.ProcessNm > 0)
{
@gpuByMachine.Gpu.Process
@("@")
@(gpuByMachine.Gpu.ProcessNm > 100 ? $"{gpuByMachine.Gpu.ProcessNm / 100}µm" : $"{gpuByMachine.Gpu.ProcessNm}nm")
}
2020-02-10 22:44:18 +00:00
else if (gpuByMachine.Gpu.ProcessNm > 0)
{
@(gpuByMachine.Gpu.ProcessNm > 100 ? $"{gpuByMachine.Gpu.ProcessNm / 100}µm" : $"{gpuByMachine.Gpu.ProcessNm}nm")
}
else
2020-02-10 22:44:18 +00:00
{
@gpuByMachine.Gpu.Process
}
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.DieSize > 0)
{
<tr>
<td>Die size</td>
<td>@gpuByMachine.Gpu.DieSize mm&sup2;</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (gpuByMachine.Gpu.Transistors > 0)
{
<tr>
<td>Transistors</td>
<td>@gpuByMachine.Gpu.Transistors</td>
</tr>
}
</table>
</div>
</div>
</td>
}
counter++;
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Sound.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Sound synthetizers
</div>
</th>
<td>
<table>
@{ counter = 0; }
2020-02-10 22:44:18 +00:00
@foreach (var soundByMachine in Model.Sound)
{
<tr>
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Id == -2)
{
<td>
Software
2020-02-10 22:44:18 +00:00
<a aria-controls="@($"synthInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#synthInfo{counter}")">
+info
</a>
2020-02-10 22:44:18 +00:00
<div class="collapse" id="@($"synthInfo{counter}")">
<div class="card card-body">
2020-02-10 22:44:18 +00:00
This computer directly sends data to a
<abbr title="Digital to Analog Converter">DAC</abbr> or similar connected to the audio output.
</div>
</div>
</td>
}
else
{
<td>
@($"{soundByMachine.SoundSynth.Name}")
2020-02-10 22:44:18 +00:00
<a aria-controls="@($"synthInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#synthInfo{counter}")">
+info
</a>
2020-02-10 22:44:18 +00:00
<div class="collapse" id="@($"synthInfo{counter}")">
<div class="card card-body">
<table>
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.ModelCode != null &&
soundByMachine.SoundSynth.ModelCode != soundByMachine.SoundSynth.Name)
2018-04-27 15:29:53 +01:00
{
<tr>
<td>Model</td>
<td>@soundByMachine.SoundSynth.ModelCode</td>
</tr>
2018-04-27 15:29:53 +01:00
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Company != null)
{
<tr>
<td>Manufacturer</td>
<td>
2020-02-10 22:44:18 +00:00
<a asp-controller=Company asp-action=View asp-route-id=@soundByMachine.SoundSynth.Company.Id>
@soundByMachine.SoundSynth.Company.Name</a>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{soundByMachine.SoundSynth.Introduced:yyyy}")</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Voices != 0 ||
soundByMachine.SoundSynth.SquareWave != 0 ||
soundByMachine.SoundSynth.WhiteNoise != 0)
{
<tr>
<td>Generators</td>
<td>
<table>
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Voices != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.Voices voices</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.SquareWave != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.SquareWave square wave</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.WhiteNoise != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.WhiteNoise white noise</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Depth != 0 ||
soundByMachine.SoundSynth.Frequency > 0)
{
<tr>
<td>Sample rate</td>
<td>
<table>
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Depth != 0 &&
soundByMachine.SoundSynth.Frequency > 0)
{
<tr>
<td>@soundByMachine.SoundSynth.Depth bits at @(soundByMachine.SoundSynth.Frequency > 1000 ? $"{soundByMachine.SoundSynth.Frequency / 1000}KHz" : $"{soundByMachine.SoundSynth.Frequency}Hz")</td>
</tr>
}
2020-02-10 22:44:18 +00:00
else if (soundByMachine.SoundSynth.Depth != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.Depth bits</td>
</tr>
}
else
{
<tr>
<td>@(soundByMachine.SoundSynth.Frequency > 1000 ? $"{soundByMachine.SoundSynth.Frequency / 1000}KHz" : $"{soundByMachine.SoundSynth.Frequency}Hz")</td>
</tr>
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (soundByMachine.SoundSynth.Type != 0)
{
<tr>
<td>Synthetizer type</td>
<td>
@soundByMachine.SoundSynth.Type
</td>
</tr>
}
</table>
</div>
</div>
</td>
}
</tr>
counter++;
}
</table>
</td>
</tr>
}
2020-02-10 22:44:18 +00:00
@if (Model.Storage.Count > 0)
2018-04-14 07:13:11 +01:00
{
<tr>
<th scope=row>
<div align=right>
Storage
2018-04-14 07:13:11 +01:00
</div>
</th>
<td>
<table>
2020-02-10 22:44:18 +00:00
@foreach (var storage in Model.Storage)
2018-04-14 07:13:11 +01:00
{
string capString = null;
2018-04-14 07:13:11 +01:00
2020-02-10 22:44:18 +00:00
if (storage.Capacity != 0)
2018-04-14 07:13:11 +01:00
{
2020-02-10 22:44:18 +00:00
if (storage.Type == StorageType.CompactCassette)
{
capString = $"{storage.Capacity} bps";
}
2018-04-14 07:13:11 +01:00
else
{
2020-02-10 22:44:18 +00:00
if (storage.Capacity > 1073741824)
{
capString = $"{storage.Capacity / 1073741824} GiB";
}
else if (storage.Capacity > 1048576)
{
capString = $"{storage.Capacity / 1048576} MiB";
}
else if (storage.Capacity > 1024)
{
capString = $"{storage.Capacity / 1024} KiB";
}
else if (storage.Capacity > 0)
{
capString = $"{storage.Capacity} bytes";
}
else
2020-02-10 22:44:18 +00:00
{
capString = null;
}
2018-04-14 07:13:11 +01:00
}
}
<tr>
2020-02-10 22:44:18 +00:00
@if (storage.Interface != StorageInterface.Unknown)
2018-04-14 07:13:11 +01:00
{
2020-02-10 22:44:18 +00:00
if (storage.Type == StorageType.Empty)
{
<td>Available @storage.Interface interface.</td>
}
else
2018-04-14 07:13:11 +01:00
{
2020-02-10 22:44:18 +00:00
if (capString != null)
2018-04-14 07:13:11 +01:00
{
<td>@storage.Type connected thru a @storage.Interface interface with a nominal capacity of @capString</td>
2018-04-14 07:13:11 +01:00
}
else
{
<td>@storage.Type connected thru a @storage.Interface interface</td>
2018-04-14 07:13:11 +01:00
}
}
}
else
{
2020-02-10 22:44:18 +00:00
if (capString != null)
{
<td>@storage.Type with a nominal capacity of @capString</td>
}
else
{
<td>@storage.Type</td>
}
2018-04-14 07:13:11 +01:00
}
</tr>
2018-04-14 07:13:11 +01:00
}
</table>
</td>
2018-04-14 07:13:11 +01:00
</tr>
}
</table>
2020-02-10 22:44:18 +00:00
@if (File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/photos/computers", Model.Id + ".jpg")))
2018-04-14 07:13:11 +01:00
{
2020-02-10 22:44:18 +00:00
<img src="@System.IO.Path.Combine("/assets/photos/computers", Model.Id + ".jpg")" alt="">
2018-04-14 07:13:11 +01:00
}