Files
marechai/Marechai/Pages/Machines/View.razor

823 lines
35 KiB
Plaintext

@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
// TODO: Resolutions
}
@page "/machine/{Id:int}"
@using Marechai.Database.Models
@using Marechai.Database
@inherits OwningComponentBase<MachinesService>
@inject IStringLocalizer<MachinesService> L
@inject IWebHostEnvironment Host
@if (!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
@if (_machine is null)
{
<p align="center">@L["Machine not found in database"]</p>
return;
}
<p align="center">
@if (_machine.Company.LastLogo != null &&
File.Exists(Path.Combine(Host.WebRootPath, "assets/logos", _machine.Company.LastLogo.Guid + ".svg")))
{
<picture>
<source type="image/svg+xml" srcset="/assets/logos/@(_machine.Company.LastLogo.Guid).svg">
<source type="image/webp" srcset="/assets/logos/webp/1x/@(_machine.Company.LastLogo.Guid).webp,
/assets/logos/webp/2x/@(_machine.Company.LastLogo.Guid).webp 2x,
/assets/logos/webp/3x/@(_machine.Company.LastLogo.Guid).webp 3x">
<img srcset="/assets/logos/png/1x/@(_machine.Company.LastLogo.Guid).png,
/assets/logos/png/2x/@(_machine.Company.LastLogo.Guid).png 2x,
/assets/logos/png/3x/@(_machine.Company.LastLogo.Guid).png 3x" src="/assets/logos/png/1x/@(_machine.Company.LastLogo.Guid).png" alt="" height="auto" width="auto" style="max-height: 256px; max-width: 256px" />
</picture>
}
</p>
@{ var counter = 0; }
@if (_machine.Introduced.HasValue &&
_machine.Introduced.Value.Year == 1000)
{
<b>
<div style="text-align: center;">PROTOTYPE</div>
</b>
}
<b>
<a asp-controller="Company" asp-action="View" asp-route-id="@_machine.Company.Id">
@_machine.Company.Name</a> @_machine.Name</b>
<table width="100%">
@if (_machine.Introduced.HasValue &&
_machine.Introduced.Value.Year != 1000)
{
<tr>
<th scope=row width="37%">
<div align=right>
Introduction date
</div>
</th>
<td width="63%">
<a asp-controller="Computer" asp-action="ByYear" asp-route-id="@_machine.Introduced.Value.Year">
@_machine.Introduced.Value.ToLongDateString()</a>
</td>
</tr>
}
@if (_machine.Family != null)
{
<tr>
<th scope=row width="37%">
<div align=right>
Family
</div>
</th>
<td width="63%">
<a asp-controller="Computer" asp-action="ByFamily" asp-route-id="@_machine.Family.Id">
@_machine.Family.Name</a>
</td>
</tr>
}
@if (_machine.Model != null)
{
<tr>
<th scope=row width="37%">
<div align=right>
Model
</div>
</th>
<td width="63%">
@_machine.Model
</td>
</tr>
}
@if (_machine.Processors.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Processors
</div>
</th>
<td>
<table>
@{ counter = 0; }
@foreach (var processorByMachine in _machine.Processors)
{
<tr>
<td>
@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
{
@($"{processorByMachine.Processor.Name}")
}
<a aria-controls="@($"cpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#cpuInfo{counter}")">
+info
</a>
<div class="collapse" id="@($"cpuInfo{counter}")">
<div class="card card-body">
<table>
@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>
<a asp-controller=Company asp-action=View asp-route-id=@processorByMachine.Processor.Company.Id>
@processorByMachine.Processor.Company.Name</a>
</td>
</tr>
@if (processorByMachine.Processor.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{processorByMachine.Processor.Introduced:yyyy}")</td>
</tr>
}
@if (processorByMachine.Processor.InstructionSet != null)
{
<tr>
<td>Instruction set</td>
<td>@processorByMachine.Processor.InstructionSet.Name</td>
</tr>
}
@if (processorByMachine.Processor.Speed > 0)
{
<tr>
<td>Nominal speed</td>
<td>@processorByMachine.Processor.Speed MHz</td>
</tr>
}
@if (processorByMachine.Processor.Gprs > 0 ||
processorByMachine.Processor.Fprs > 0 ||
processorByMachine.Processor.SimdRegisters > 0)
{
<tr>
<td>Registers</td>
<td>
<table>
@if (processorByMachine.Processor.Gprs > 0)
{
<tr>
<td>
@processorByMachine.Processor.Gprs general purpose registers of @processorByMachine.Processor.GprSize bits
@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>
}
@if (processorByMachine.Processor.Fprs > 0)
{
<tr>
<td>
@processorByMachine.Processor.Fprs floating-point registers of @processorByMachine.Processor.FprSize bits
@if (processorByMachine.Processor.SimdSize > 0 &&
processorByMachine.Processor.SimdRegisters == 0)
{
@($", that can be used as SIMD registers of {processorByMachine.Processor.FprSize}")
}
</td>
</tr>
}
@if (processorByMachine.Processor.SimdRegisters > 0)
{
<tr>
<td>
@processorByMachine.Processor.SimdRegisters
<abbr title="Single instruction, multiple data">SIMD</abbr>registers of @processorByMachine.Processor.SimdSize bits
</td>
</tr>
}
</table>
</td>
</tr>
}
@if (processorByMachine.Processor.Cores > 1)
{
<tr>
<td>Multi-core</td>
<td>@processorByMachine.Processor.Cores cores</td>
</tr>
}
@if (processorByMachine.Processor.Cores > 1)
{
<tr>
<td>
<abbr title="Simultaneous multithreading">SMT</abbr>
</td>
<td>
@processorByMachine.Processor.ThreadsPerCore threads
@if (processorByMachine.Processor.Cores > 1)
{
@(" per core")
}
</td>
</tr>
}
@if (processorByMachine.Processor.DataBus > 0 ||
processorByMachine.Processor.AddrBus > 0)
{
<tr>
<td>Bus</td>
<td>
<table>
@if (processorByMachine.Processor.DataBus > 0)
{
<tr>
<td>
@processorByMachine.Processor.DataBus-bit data
</td>
</tr>
}
@if (processorByMachine.Processor.AddrBus > 0)
{
<tr>
<td>
@processorByMachine.Processor.AddrBus-bit address
</td>
</tr>
}
</table>
</td>
</tr>
}
@if (processorByMachine.Processor.L1Instruction > 0 ||
processorByMachine.Processor.L1Data > 0 ||
processorByMachine.Processor.L2 > 0 ||
processorByMachine.Processor.L2 > 0)
{
<tr>
<td>Cache</td>
<td>
<table>
@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>
}
@if (processorByMachine.Processor.L1Data > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L1Data}KiB data L1")
</td>
</tr>
}
@if (processorByMachine.Processor.L2 > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L2}KiB L2")
</td>
</tr>
}
@if (processorByMachine.Processor.L3 > 0)
{
<tr>
<td>
@($"{processorByMachine.Processor.L3}KiB L3")
</td>
</tr>
}
</table>
</td>
</tr>
}
@if (processorByMachine.Processor.Package != null)
{
<tr>
<td>Package</td>
<td>@processorByMachine.Processor.Package</td>
</tr>
}
@if (processorByMachine.Processor.Process != null ||
processorByMachine.Processor.ProcessNm > 0)
{
<tr>
<td>Manufacturing process</td>
<td>
@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")
}
else if (processorByMachine.Processor.ProcessNm > 0)
{
@(processorByMachine.Processor.ProcessNm > 100 ? $"{processorByMachine.Processor.ProcessNm / 100}µm" : $"{processorByMachine.Processor.ProcessNm}nm")
}
else
{
@processorByMachine.Processor.Process
}
</td>
</tr>
}
@if (processorByMachine.Processor.DieSize > 0)
{
<tr>
<td>Die size</td>
<td>@processorByMachine.Processor.DieSize mm&sup2;</td>
</tr>
}
@if (processorByMachine.Processor.Transistors > 0)
{
<tr>
<td>Transistors</td>
<td>@processorByMachine.Processor.Transistors</td>
</tr>
}
</table>
</div>
</div>
</td>
</tr>
counter++;
}
</table>
</td>
</tr>
}
@if (_machine.Memory != null &&
_machine.Memory.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Memory
</div>
</th>
<td>
<table>
@foreach (var memory in _machine.Memory)
{
string memValue;
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
{
memValue = "Unknown size";
}
string speedValue;
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
{
speedValue = "unknown speed";
}
<tr>
<td>@memValue of @memory.Usage memory (@memory.Type at @speedValue)</td>
</tr>
}
</table>
</td>
</tr>
}
@if (_machine.Gpus.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Graphics processing units
</div>
</th>
<td>
<table>
@{ counter = 0; }
@foreach (var gpuByMachine in _machine.Gpus)
{
if (gpuByMachine.Gpu.Id == -2)
{
<td>
Framebuffer
<a aria-controls="@($"gpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#gpuInfo{counter}")">
+info
</a>
<div class="collapse" id="@($"gpuInfo{counter}")">
<div class="card card-body">
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}")
<a aria-controls="@($"gpuInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#gpuInfo{counter}")">
+info
</a>
<div class="collapse" id="@($"gpuInfo{counter}")">
<div class="card card-body">
<table>
@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>
<a asp-controller=Company asp-action=View asp-route-id=@gpuByMachine.Gpu.Company.Id>
@gpuByMachine.Gpu.Company.Name</a>
</td>
</tr>
@if (gpuByMachine.Gpu.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{gpuByMachine.Gpu.Introduced:yyyy}")</td>
</tr>
}
@if (gpuByMachine.Gpu.Package != null)
{
<tr>
<td>Package</td>
<td>@gpuByMachine.Gpu.Package</td>
</tr>
}
@if (gpuByMachine.Gpu.Process != null ||
gpuByMachine.Gpu.ProcessNm > 0)
{
<tr>
<td>Manufacturing process</td>
<td>
@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")
}
else if (gpuByMachine.Gpu.ProcessNm > 0)
{
@(gpuByMachine.Gpu.ProcessNm > 100 ? $"{gpuByMachine.Gpu.ProcessNm / 100}µm" : $"{gpuByMachine.Gpu.ProcessNm}nm")
}
else
{
@gpuByMachine.Gpu.Process
}
</td>
</tr>
}
@if (gpuByMachine.Gpu.DieSize > 0)
{
<tr>
<td>Die size</td>
<td>@gpuByMachine.Gpu.DieSize mm&sup2;</td>
</tr>
}
@if (gpuByMachine.Gpu.Transistors > 0)
{
<tr>
<td>Transistors</td>
<td>@gpuByMachine.Gpu.Transistors</td>
</tr>
}
</table>
</div>
</div>
</td>
}
counter++;
}
</table>
</td>
</tr>
}
@if (_machine.Sound.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Sound synthetizers
</div>
</th>
<td>
<table>
@{ counter = 0; }
@foreach (var soundByMachine in _machine.Sound)
{
<tr>
@if (soundByMachine.SoundSynth.Id == -2)
{
<td>
Software
<a aria-controls="@($"synthInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#synthInfo{counter}")">
+info
</a>
<div class="collapse" id="@($"synthInfo{counter}")">
<div class="card card-body">
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}")
<a aria-controls="@($"synthInfo{counter}")" aria-expanded="false" class="btn btn-link" data-toggle="collapse" href="@($"#synthInfo{counter}")">
+info
</a>
<div class="collapse" id="@($"synthInfo{counter}")">
<div class="card card-body">
<table>
@if (soundByMachine.SoundSynth.ModelCode != null &&
soundByMachine.SoundSynth.ModelCode != soundByMachine.SoundSynth.Name)
{
<tr>
<td>Model</td>
<td>@soundByMachine.SoundSynth.ModelCode</td>
</tr>
}
@if (soundByMachine.SoundSynth.Company != null)
{
<tr>
<td>Manufacturer</td>
<td>
<a asp-controller=Company asp-action=View asp-route-id=@soundByMachine.SoundSynth.Company.Id>
@soundByMachine.SoundSynth.Company.Name</a>
</td>
</tr>
}
@if (soundByMachine.SoundSynth.Introduced != DateTime.MinValue)
{
<tr>
<td>Introduction date</td>
<td>@($"{soundByMachine.SoundSynth.Introduced:yyyy}")</td>
</tr>
}
@if (soundByMachine.SoundSynth.Voices != 0 ||
soundByMachine.SoundSynth.SquareWave != 0 ||
soundByMachine.SoundSynth.WhiteNoise != 0)
{
<tr>
<td>Generators</td>
<td>
<table>
@if (soundByMachine.SoundSynth.Voices != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.Voices voices</td>
</tr>
}
@if (soundByMachine.SoundSynth.SquareWave != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.SquareWave square wave</td>
</tr>
}
@if (soundByMachine.SoundSynth.WhiteNoise != 0)
{
<tr>
<td>@soundByMachine.SoundSynth.WhiteNoise white noise</td>
</tr>
}
</table>
</td>
</tr>
}
@if (soundByMachine.SoundSynth.Depth != 0 ||
soundByMachine.SoundSynth.Frequency > 0)
{
<tr>
<td>Sample rate</td>
<td>
<table>
@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>
}
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>
}
@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>
}
@if (_machine.Storage.Count > 0)
{
<tr>
<th scope=row>
<div align=right>
Storage
</div>
</th>
<td>
<table>
@foreach (var storage in _machine.Storage)
{
string capString = null;
if (storage.Capacity != 0)
{
if (storage.Type == StorageType.CompactCassette)
{
capString = $"{storage.Capacity} bps";
}
else
{
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
{
capString = null;
}
}
}
<tr>
@if (storage.Interface != StorageInterface.Unknown)
{
if (storage.Type == StorageType.Empty)
{
<td>Available @storage.Interface interface.</td>
}
else
{
if (capString != null)
{
<td>@storage.Type connected thru a @storage.Interface interface with a nominal capacity of @capString</td>
}
else
{
<td>@storage.Type connected thru a @storage.Interface interface</td>
}
}
}
else
{
if (capString != null)
{
<td>@storage.Type with a nominal capacity of @capString</td>
}
else
{
<td>@storage.Type</td>
}
}
</tr>
}
</table>
</td>
</tr>
}
</table>
@if (File.Exists(Path.Combine(Host.WebRootPath, "assets/photos/computers", _machine.Id + ".jpg")))
{
<img src="@Path.Combine("/assets/photos/computers", _machine.Id + ".jpg")" alt="">
}
@code
{
[Parameter]
public int Id { get; set; }
Machine _machine;
bool _loaded;
protected override async Task OnInitializedAsync()
{
_machine = await Service.GetMachine(Id);
_loaded = true;
}
}