@{ /****************************************************************************** // MARECHAI: Master repository of computing history artifacts information // ---------------------------------------------------------------------------- // // Filename : View.razor // Author(s) : Natalia Portillo // // --[ Description ] ---------------------------------------------------------- // // Shows a machine information // // --[ 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 . // // ---------------------------------------------------------------------------- // Copyright © 2003-2020 Natalia Portillo *******************************************************************************/ // TODO: Resolutions } @page "/machine/{Id:int}" @using Marechai.Database @inherits OwningComponentBase @inject IStringLocalizer L @inject IWebHostEnvironment Host @if (!_loaded) {

@L["Loading..."]

return; } @if (_machine is null) {

@L["Machine not found in database"]

return; }

@if (_machine.CompanyLogo != null && File.Exists(Path.Combine(Host.WebRootPath, "assets/logos", _machine.CompanyLogo + ".svg"))) { }

@{ var counter = 0; } @if (_machine.Introduced.HasValue && _machine.Introduced.Value.Year == 1000) {
@L["PROTOTYPE"]
} @_machine.CompanyName @_machine.Name @if (_machine.Introduced.HasValue && _machine.Introduced.Value.Year != 1000) { } @if (_machine.FamilyId != null) { } @if (_machine.Model != null) { } @if (_machine.Processors.Count > 0) { } @if (_machine.Memory != null && _machine.Memory.Count > 0) { } @if (_machine.Gpus.Count > 0) { } @if (_machine.SoundSynthesizers.Count > 0) { } @if (_machine.Storage.Count > 0) { }
@L["Introduction date"]
@_machine.Introduced.Value.ToLongDateString()
@L["Family"]
@_machine.FamilyName
@L["Model"]
@_machine.Model
@L["Processors"]
@{ counter = 0; } @foreach (var processor in _machine.Processors) { int currentCounter = counter; counter++; }
@if (processor.Speed > 0) { @(processor.GprSize > 0 ? string.Format(L["{0} @ {1}MHz ({2} bits)"], processor.Name, processor.Speed, processor.GprSize) : string.Format(L["{0} @ {1}MHz"], processor.Name, processor.Speed)) } else { @($"{processor.Name}") } @L["+info"] @if (processor.ModelCode != null && processor.ModelCode != processor.Name) { } @if (processor.Introduced != null) { } @if (processor.InstructionSet != null) { } @if (processor.Speed > 0) { } @if (processor.Gprs > 0 || processor.Fprs > 0 || processor.SimdRegisters > 0) { } @if (processor.Cores > 1) { } @if (processor.ThreadsPerCore > 1) { } @if (processor.DataBus > 0 || processor.AddrBus > 0) { } @if (processor.L1Instruction > 0 || processor.L1Data > 0 || processor.L2 > 0 || processor.L2 > 0) { } @if (processor.Package != null) { } @if (processor.Process != null || processor.ProcessNm > 0) { } @if (processor.DieSize > 0) { } @if (processor.Transistors > 0) { }
@L["Model"] @processor.ModelCode
@L["Manufacturer"] @processor.CompanyName
@L["Introduction date"] @($"{processor.Introduced:yyyy}")
@L["Instruction set"] @processor.InstructionSet
@L["Nominal speed"] @string.Format(L["{0} MHz"], processor.Speed)
@L["Registers"] @if (processor.Gprs > 0) { } @if (processor.Fprs > 0) { } @if (processor.SimdRegisters > 0) { }
@if (processor.FprSize > 0 && processor.Fprs == 0 && processor.SimdSize > 0 && processor.SimdRegisters == 0) { @(string.Format(L["{0} general purpose registers of {1} bits that can be used as floating point registers of {2} bits and SIMD registers of {3} bits."], processor.Gprs, processor.GprSize, processor.FprSize, processor.SimdSize)) } else if (processor.FprSize > 0 && processor.Fprs == 0) { @(string.Format(L["{0} general purpose registers of {1} bits that can be used as floating point registers of {2} bits."], processor.Gprs, processor.GprSize, processor.FprSize)) } else if (processor.FprSize == 0 && processor.SimdSize > 0 && processor.SimdRegisters == 0) { @(string.Format(L["{0} general purpose registers of {1} bits that can be used as SIMD registers of {2} bits."], processor.Gprs, processor.GprSize, processor.SimdSize)) } else { @(string.Format(L["{0} general purpose registers of {1} bits."], processor.Gprs, processor.GprSize)) }
@if (processor.SimdSize > 0 && processor.SimdRegisters == 0) { @(string.Format(L["{0} floating point registers of {1} bits that can be used as SIMD registers of {2} bits."], processor.Fprs, processor.FprSize, processor.SimdSize)) } else { @(string.Format(L["{0} floating point registers of {1} bits."], processor.Fprs, processor.FprSize)) }
@string.Format(L["{0} SIMD registers of {1} bits."], processor.SimdRegisters, processor.SimdSize)
@L["Multi-core"] @string.Format(L["{0} cores."], processor.Cores)
SMT @string.Format(processor.Cores > 1 ? L["{0} threads per core."] : L["{0} threads."], processor.ThreadsPerCore)
@L["Bus"] @if (processor.DataBus > 0) { } @if (processor.AddrBus > 0) { }
@string.Format(L["{0}-bit data."], processor.DataBus)
@string.Format(L["{0}-bit address."], processor.AddrBus)
@L["Cache"] @if (processor.L1Instruction > 0) { } @if (processor.L1Data > 0) { } @if (processor.L2 > 0) { } @if (processor.L3 > 0) { }
@string.Format(processor.L1Data < 0 ? L["{0}KiB combined instruction-data L1"] : L["{0}KiB instruction L1"], processor.L1Instruction)
@string.Format(L["{0}KiB data L1"], processor.L1Data)
@string.Format(L["{0}KiB L2"], processor.L2)
@string.Format(L["{0}KiB L3"], processor.L3)
@L["Package"] @processor.Package
@L["Manufacturing process"] @if (processor.Process != null && processor.ProcessNm > 0) { if (processor.ProcessNm > 100) { @(string.Format(L["{0} @ {1}µm"], processor.Process, processor.ProcessNm / 100)) } else { @(string.Format(L["{0} @ {1}nm"], processor.Process, processor.ProcessNm)) } } else if (processor.ProcessNm > 0) { if (processor.ProcessNm > 100) { @(string.Format(L["{0}µm"], processor.ProcessNm / 100)) } else { @(string.Format(L["{0}nm"], processor.ProcessNm)) } } else { @processor.Process }
@L["Die size"] @string.Format(L["{0} mm²"], processor.DieSize)
@L["Transistors"] @processor.Transistors
@L["Memory"]
@foreach (var memory in _machine.Memory) { string memValue; if (memory.Size > 1073741824) { memValue = string.Format(L["{0} GiB"], memory.Size / 1073741824); } else if (memory.Size > 1048576) { memValue = string.Format(L["{0} MiB"], memory.Size / 1048576); } else if (memory.Size > 1024) { memValue = string.Format(L["{0} KiB"], memory.Size / 1024); } else if (memory.Size > 0) { memValue = string.Format(L["{0} bytes"], memory.Size); } else { memValue = L["Unknown size"]; } string speedValue; if (memory.Speed > 1000000000) { speedValue = string.Format(L["{0} GHz"], memory.Speed / 1000000000); } else if (memory.Speed > 1000000) { speedValue = string.Format(L["{0} MHz"], memory.Speed / 1000000); } else if (memory.Speed > 1000) { speedValue = string.Format(L["{0} KHz"], memory.Speed / 1000); } else if (memory.Speed > 0) { speedValue = string.Format(L["{0} Hz"], memory.Speed); } else { speedValue = L["unknown speed"]; } }
@string.Format(L["{0} of {1} memory ({2} at {3})"], memValue, memory.Usage, memory.Type, speedValue)
@L["Graphics processing units"]
@{ counter = 0; } @foreach (var gpu in _machine.Gpus) { int currentCounter = counter; if (gpu.Id == -2) { } else { } counter++; }
@L["Framebuffer"] @L["+info"] @L["This machine directly draws pixels from software to a memory region that's converted to video output by a DAC or similar without using any specific graphics processing unit."] @($"{gpu.Name}") @L["+info"] @if (gpu.ModelCode != null && gpu.ModelCode != gpu.Name) { } @if (gpu.Introduced != null) { } @if (gpu.Package != null) { } @if (gpu.Process != null || gpu.ProcessNm > 0) { } @if (gpu.DieSize > 0) { } @if (gpu.Transistors > 0) { }
@L["Model"] @gpu.ModelCode
@L["Manufacturer"] @gpu.Company
@L["Introduction date"] @($"{gpu.Introduced:yyyy}")
@L["Package"] @gpu.Package
@L["Manufacturing process"] @if (gpu.Process != null && gpu.ProcessNm > 0) { if (gpu.ProcessNm > 100) { @(string.Format(L["{0} @ {1}µm"], gpu.Process, gpu.ProcessNm / 100)) } else { @(string.Format(L["{0} @ {1}nm"], gpu.Process, gpu.ProcessNm)) } } else if (gpu.ProcessNm > 0) { if (gpu.ProcessNm > 100) { @(string.Format(L["{0}µm"], gpu.ProcessNm / 100)) } else { @(string.Format(L["{0}nm"], gpu.ProcessNm)) } } else { @gpu.Process }
@L["Die size"] @string.Format(L["{0} mm²"], gpu.DieSize)
@L["Transistors"] @gpu.Transistors
@L["Sound synthesizers"]
@{ counter = 0; } @foreach (var sound in _machine.SoundSynthesizers) { int currentCounter = counter; @if (sound.Id == -2) { } else { } counter++; }
@L["Software"] @L["+info"] @L["This machine directly sends data to a DAC or similar connected to the audio output."] @($"{sound.Name}") @L["+info"] @if (sound.ModelCode != null && sound.ModelCode != sound.Name) { } @if (sound.CompanyId != null) { } @if (sound.Introduced != null) { } @if (sound.Voices != 0 || sound.SquareWave != 0 || sound.WhiteNoise != 0) { } @if (sound.Depth != 0 || sound.Frequency > 0) { } @if (sound.Type != 0) { }
@L["Model"] @sound.ModelCode
@L["Manufacturer"] @sound.CompanyName
@L["Introduction date"] @($"{sound.Introduced:yyyy}")
@L["Generators"] @if (sound.Voices != 0) { } @if (sound.SquareWave != 0) { } @if (sound.WhiteNoise != 0) { }
@string.Format(L["{0} voices"], sound.Voices)
@string.Format(L["{0} square wave"], sound.SquareWave)
@string.Format(L["{0} white noise"], sound.WhiteNoise)
@L["Sample rate"] @if (sound.Depth != 0 && sound.Frequency > 0) { } else if (sound.Depth != 0) { } else { }
@if (sound.Frequency > 1000) { @string.Format(L["{0} bits at {1} KHz"], sound.Depth, sound.Frequency / 1000) } else { @string.Format(L["{0} bits at {1} Hz"], sound.Depth, sound.Frequency) }
@string.Format(L["{0} bits"], sound.Depth)
@if (sound.Frequency > 1000) { @string.Format(L["{0} KHz"], sound.Frequency / 1000) } else { @string.Format(L["{0} Hz"], sound.Frequency) }
@L["Synthesizer type"] @sound.Type
@L["Storage"]
@foreach (var storage in _machine.Storage) { string capString = null; if (storage.Capacity != 0) { if (storage.Type == StorageType.CompactCassette) { capString = string.Format(L["{0} bps"], storage.Capacity); } else { if (storage.Capacity > 1073741824) { capString = string.Format(L["{0} GiB"], storage.Capacity / 1073741824); } else if (storage.Capacity > 1048576) { capString = string.Format(L["{0} MiB"], storage.Capacity / 1048576); } else if (storage.Capacity > 1024) { capString = string.Format(L["{0} KiB"], storage.Capacity / 1024); } else if (storage.Capacity > 0) { capString = string.Format(L["{0} bytes"], storage.Capacity); } else { capString = null; } } } @if (storage.Interface != StorageInterface.Unknown) { if (storage.Type == StorageType.Empty) { } else { if (capString != null) { } else { } } } else { if (capString != null) { } else { } } }
@string.Format(L["Available {0} interface."], storage.Interface)@string.Format(L["{0} connected thru a {1} interface with a nominal capacity of {2}"], storage.Type, storage.Interface, capString)@string.Format(L["{0} connected thru a {1} interface"], storage.Type, storage.Interface)@string.Format(L["{0} with a nominal capacity of {1}"], storage.Type, capString)@storage.Type
@if (File.Exists(Path.Combine(Host.WebRootPath, "assets/photos/computers", _machine.Id + ".jpg"))) { } @code { [Parameter] public int Id { get; set; } MachineViewModel _machine; bool _loaded; bool[] _processorVisible; bool[] _gpuVisible; bool[] _soundVisible; protected override async Task OnInitializedAsync() { _machine = await Service.GetMachine(Id); _processorVisible = new bool[_machine.Processors.Count]; _gpuVisible = new bool[_machine.Gpus.Count]; _soundVisible = new bool[_machine.SoundSynthesizers.Count]; _loaded = true; } }