mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Update DB to version 15: Machines can have an arbitrary number of processors,
so use an interconnection table, `processors_by_machine`.
This commit is contained in:
@@ -49,99 +49,103 @@ namespace Cicm.Database
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
Console.WriteLine("Creating table `admins`");
|
||||
dbCmd.CommandText = V14.Admins;
|
||||
dbCmd.CommandText = V15.Admins;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `browser_tests`");
|
||||
dbCmd.CommandText = V14.BrowserTests;
|
||||
dbCmd.CommandText = V15.BrowserTests;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `cicm_db`");
|
||||
dbCmd.CommandText = V14.CicmDb;
|
||||
dbCmd.CommandText = V15.CicmDb;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `companies`");
|
||||
dbCmd.CommandText = V14.Companies;
|
||||
dbCmd.CommandText = V15.Companies;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `machines`");
|
||||
dbCmd.CommandText = V14.Machines;
|
||||
dbCmd.CommandText = V15.Machines;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `disk_formats`");
|
||||
dbCmd.CommandText = V14.DiskFormats;
|
||||
dbCmd.CommandText = V15.DiskFormats;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `forbidden`");
|
||||
dbCmd.CommandText = V14.Forbidden;
|
||||
dbCmd.CommandText = V15.Forbidden;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `gpus`");
|
||||
dbCmd.CommandText = V14.Gpus;
|
||||
dbCmd.CommandText = V15.Gpus;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `log`");
|
||||
dbCmd.CommandText = V14.Logs;
|
||||
dbCmd.CommandText = V15.Logs;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `money_donations`");
|
||||
dbCmd.CommandText = V14.MoneyDonations;
|
||||
dbCmd.CommandText = V15.MoneyDonations;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `news`");
|
||||
dbCmd.CommandText = V14.News;
|
||||
dbCmd.CommandText = V15.News;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_computers`");
|
||||
dbCmd.CommandText = V14.OwnedComputers;
|
||||
dbCmd.CommandText = V15.OwnedComputers;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_consoles`");
|
||||
dbCmd.CommandText = V14.OwnedConsoles;
|
||||
dbCmd.CommandText = V15.OwnedConsoles;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_sets`");
|
||||
dbCmd.CommandText = V14.InstructionSets;
|
||||
dbCmd.CommandText = V15.InstructionSets;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions`");
|
||||
dbCmd.CommandText = V14.InstructionSetExtensions;
|
||||
dbCmd.CommandText = V15.InstructionSetExtensions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `processors`");
|
||||
dbCmd.CommandText = V14.Processors;
|
||||
dbCmd.CommandText = V15.Processors;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
|
||||
dbCmd.CommandText = V14.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.CommandText = V15.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `sound_synths`");
|
||||
dbCmd.CommandText = V14.SoundSynths;
|
||||
dbCmd.CommandText = V15.SoundSynths;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V14.Iso3166Numeric;
|
||||
dbCmd.CommandText = V15.Iso3166Numeric;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Filling table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V14.Iso3166NumericValues;
|
||||
dbCmd.CommandText = V15.Iso3166NumericValues;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `companies`");
|
||||
dbCmd.CommandText = V14.CompaniesForeignKeys;
|
||||
dbCmd.CommandText = V15.CompaniesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `machines`");
|
||||
dbCmd.CommandText = V14.MachinesForeignKeys;
|
||||
dbCmd.CommandText = V15.MachinesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_logos`");
|
||||
dbCmd.CommandText = V14.CompanyLogos;
|
||||
dbCmd.CommandText = V15.CompanyLogos;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_descriptions`");
|
||||
dbCmd.CommandText = V14.CompanyDescriptions;
|
||||
dbCmd.CommandText = V15.CompanyDescriptions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `processors_by_machine`");
|
||||
dbCmd.CommandText = V15.ProcessorsByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -86,11 +86,11 @@ namespace Cicm.Database
|
||||
|
||||
try
|
||||
{
|
||||
const string SQL = "SELECT * from machines WHERE company = '{id}'";
|
||||
string sql = $"SELECT * from machines WHERE company = '{company}'";
|
||||
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = SQL;
|
||||
dbCmd.CommandText = sql;
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
@@ -214,8 +214,10 @@ namespace Cicm.Database
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
const string SQL =
|
||||
"INSERT INTO machines (company, year, model, cpu1, mhz1, cpu2, mhz2, ram, rom, gpu, vram, colors, res, sound_synth, music_synth, sound_channels, music_channels, hdd1, hdd2, hdd3, disk1, cap1, disk2, cap2, type)" +
|
||||
" VALUES (@company, @year, @model, @cpu1, @mhz1, @cpu2, @mhz2, @ram, @rom, @gpu, @vram, @colors, @res, @sound_synth, @music_synth, @sound_channels, @music_channels, @hdd1, @hdd2, @hdd3, @disk1, @cap1, @disk2, @cap2, @type)";
|
||||
"INSERT INTO machines (company, year, model, ram, rom, gpu, vram, colors, res, sound_synth, music_synth, " +
|
||||
"sound_channels, music_channels, hdd1, hdd2, hdd3, disk1, cap1, disk2, cap2, type)" +
|
||||
" VALUES (@company, @year, @model, @ram, @rom, @gpu, @vram, @colors, @res, @sound_synth, @music_synth, " +
|
||||
"@sound_channels, @music_channels, @hdd1, @hdd2, @hdd3, @disk1, @cap1, @disk2, @cap2, @type)";
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
@@ -248,9 +250,11 @@ namespace Cicm.Database
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
string sql =
|
||||
"UPDATE machines SET company = @company, year = @year, model = @model, cpu1 = @cpu1, mhz1 = @mhz1, cpu2 = @cpu2, " +
|
||||
"mhz2 = @mhz2, ram = @ram, rom = @rom, gpu = @gpu, vram = @vram, colors = @colors, res = @res, sound_synth = @sound_synth, music_synth = @music_synth " +
|
||||
"sound_channels = @sound_channels, music_channels = @music_channels, hdd1 = @hdd1, hdd2 = @hdd2, hdd3 = @hdd3, disk1 = @disk1, cap1 = @cap1, disk2 = @disk2, cap2 = @cap2, type = @type " +
|
||||
"UPDATE machines SET company = @company, year = @year, model = @model, ram = @ram, rom = @rom, " +
|
||||
"gpu = @gpu, vram = @vram, colors = @colors, res = @res, sound_synth = @sound_synth, " +
|
||||
"music_synth = @music_synth, sound_channels = @sound_channels, music_channels = @music_channels, " +
|
||||
"hdd1 = @hdd1, hdd2 = @hdd2, hdd3 = @hdd3, disk1 = @disk1, cap1 = @cap1, disk2 = @disk2, cap2 = @cap2, " +
|
||||
"type = @type " +
|
||||
$"WHERE id = {entry.Id}";
|
||||
|
||||
dbcmd.CommandText = sql;
|
||||
@@ -313,88 +317,72 @@ namespace Cicm.Database
|
||||
IDbDataParameter param19 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param20 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param21 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param22 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param23 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param24 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param25 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@company";
|
||||
param2.ParameterName = "@year";
|
||||
param3.ParameterName = "@model";
|
||||
param4.ParameterName = "@cpu1";
|
||||
param5.ParameterName = "@mhz1";
|
||||
param6.ParameterName = "@cpu2";
|
||||
param7.ParameterName = "@mhz2";
|
||||
param8.ParameterName = "@ram";
|
||||
param9.ParameterName = "@rom";
|
||||
param10.ParameterName = "@gpu";
|
||||
param11.ParameterName = "@vram";
|
||||
param12.ParameterName = "@colors";
|
||||
param13.ParameterName = "@res";
|
||||
param14.ParameterName = "@sound_synth";
|
||||
param15.ParameterName = "@music_synth";
|
||||
param16.ParameterName = "@sound_channels";
|
||||
param17.ParameterName = "@music_channels";
|
||||
param18.ParameterName = "@hdd1";
|
||||
param19.ParameterName = "@hdd2";
|
||||
param20.ParameterName = "@hdd3";
|
||||
param21.ParameterName = "@disk1";
|
||||
param22.ParameterName = "@cap1";
|
||||
param23.ParameterName = "@disk2";
|
||||
param24.ParameterName = "@cap2";
|
||||
param25.ParameterName = "@type";
|
||||
param4.ParameterName = "@ram";
|
||||
param5.ParameterName = "@rom";
|
||||
param6.ParameterName = "@gpu";
|
||||
param7.ParameterName = "@vram";
|
||||
param8.ParameterName = "@colors";
|
||||
param9.ParameterName = "@res";
|
||||
param10.ParameterName = "@sound_synth";
|
||||
param11.ParameterName = "@music_synth";
|
||||
param12.ParameterName = "@sound_channels";
|
||||
param13.ParameterName = "@music_channels";
|
||||
param14.ParameterName = "@hdd1";
|
||||
param15.ParameterName = "@hdd2";
|
||||
param16.ParameterName = "@hdd3";
|
||||
param17.ParameterName = "@disk1";
|
||||
param17.ParameterName = "@cap1";
|
||||
param19.ParameterName = "@disk2";
|
||||
param20.ParameterName = "@cap2";
|
||||
param21.ParameterName = "@type";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
param3.DbType = DbType.String;
|
||||
param4.DbType = DbType.Int32;
|
||||
param5.DbType = DbType.Double;
|
||||
param5.DbType = DbType.Int32;
|
||||
param6.DbType = DbType.Int32;
|
||||
param7.DbType = DbType.Double;
|
||||
param7.DbType = DbType.Int32;
|
||||
param8.DbType = DbType.Int32;
|
||||
param9.DbType = DbType.Int32;
|
||||
param9.DbType = DbType.String;
|
||||
param10.DbType = DbType.Int32;
|
||||
param11.DbType = DbType.Int32;
|
||||
param12.DbType = DbType.Int32;
|
||||
param13.DbType = DbType.String;
|
||||
param13.DbType = DbType.Int32;
|
||||
param14.DbType = DbType.Int32;
|
||||
param15.DbType = DbType.Int32;
|
||||
param16.DbType = DbType.Int32;
|
||||
param17.DbType = DbType.Int32;
|
||||
param18.DbType = DbType.Int32;
|
||||
param18.DbType = DbType.String;
|
||||
param19.DbType = DbType.Int32;
|
||||
param20.DbType = DbType.Int32;
|
||||
param20.DbType = DbType.String;
|
||||
param21.DbType = DbType.Int32;
|
||||
param22.DbType = DbType.String;
|
||||
param23.DbType = DbType.Int32;
|
||||
param24.DbType = DbType.String;
|
||||
param25.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = entry.Company;
|
||||
param2.Value = entry.Year;
|
||||
param3.Value = entry.Model;
|
||||
param4.Value = entry.Cpu1;
|
||||
param5.Value = entry.Mhz1;
|
||||
param6.Value = entry.Cpu2;
|
||||
param7.Value = entry.Mhz2;
|
||||
param8.Value = entry.Ram;
|
||||
param9.Value = entry.Rom;
|
||||
param10.Value = entry.Gpu;
|
||||
param11.Value = entry.Vram;
|
||||
param12.Value = entry.Colors;
|
||||
param13.Value = entry.Resolution;
|
||||
param14.Value = entry.SoundSynth;
|
||||
param15.Value = entry.MusicSynth;
|
||||
param16.Value = entry.SoundChannels;
|
||||
param17.Value = entry.MusicChannels;
|
||||
param18.Value = entry.Hdd1;
|
||||
param19.Value = entry.Hdd2;
|
||||
param20.Value = entry.Hdd3;
|
||||
param21.Value = entry.Disk1;
|
||||
param22.Value = entry.Cap1;
|
||||
param23.Value = entry.Disk2;
|
||||
param24.Value = entry.Cap2;
|
||||
param25.Value = entry.Type;
|
||||
param4.Value = entry.Ram;
|
||||
param5.Value = entry.Rom;
|
||||
param6.Value = entry.Gpu;
|
||||
param7.Value = entry.Vram;
|
||||
param8.Value = entry.Colors;
|
||||
param9.Value = entry.Resolution;
|
||||
param10.Value = entry.SoundSynth;
|
||||
param11.Value = entry.MusicSynth;
|
||||
param12.Value = entry.SoundChannels;
|
||||
param13.Value = entry.MusicChannels;
|
||||
param14.Value = entry.Hdd1;
|
||||
param15.Value = entry.Hdd2;
|
||||
param16.Value = entry.Hdd3;
|
||||
param17.Value = entry.Disk1;
|
||||
param18.Value = entry.Cap1;
|
||||
param19.Value = entry.Disk2;
|
||||
param20.Value = entry.Cap2;
|
||||
param21.Value = entry.Type;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
@@ -417,10 +405,6 @@ namespace Cicm.Database
|
||||
dbcmd.Parameters.Add(param19);
|
||||
dbcmd.Parameters.Add(param20);
|
||||
dbcmd.Parameters.Add(param21);
|
||||
dbcmd.Parameters.Add(param22);
|
||||
dbcmd.Parameters.Add(param23);
|
||||
dbcmd.Parameters.Add(param24);
|
||||
dbcmd.Parameters.Add(param25);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
@@ -437,10 +421,6 @@ namespace Cicm.Database
|
||||
Company = (int)dataRow["company"],
|
||||
Year = (int)dataRow["year"],
|
||||
Model = (string)dataRow["model"],
|
||||
Cpu1 = dataRow["cpu1"] == DBNull.Value ? 0 : (int)dataRow["cpu1"],
|
||||
Mhz1 = dataRow["mhz1"] == DBNull.Value ? 0 : float.Parse(dataRow["mhz1"].ToString()),
|
||||
Cpu2 = dataRow["cpu2"] == DBNull.Value ? 0 : (int)dataRow["cpu2"],
|
||||
Mhz2 = dataRow["mhz2"] == DBNull.Value ? 0 : float.Parse(dataRow["mhz2"].ToString()),
|
||||
Ram = (int)dataRow["ram"],
|
||||
Rom = (int)dataRow["rom"],
|
||||
Gpu = dataRow["gpu"] == DBNull.Value ? 0 : (int)dataRow["gpu"],
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Cicm.Database
|
||||
public partial class Operations
|
||||
{
|
||||
/// <summary>Last known database version</summary>
|
||||
const int DB_VERSION = 14;
|
||||
const int DB_VERSION = 15;
|
||||
/// <summary>The column with this value indicates there is no item of this type.</summary>
|
||||
public const int DB_NONE = -1;
|
||||
/// <summary>This value indicates there's no GPU, but a direct memory->display connection (a framebuffer).</summary>
|
||||
|
||||
154
Cicm.Database/Operations/ProcessorByMachine.cs
Normal file
154
Cicm.Database/Operations/ProcessorByMachine.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ProcessorByMachine.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains operations to manage processors.
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Cicm.Database.Schemas;
|
||||
|
||||
namespace Cicm.Database
|
||||
{
|
||||
public partial class Operations
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all processors in machine
|
||||
/// </summary>
|
||||
/// <param name="entries">All CPUs</param>
|
||||
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||
public bool GetProcessorsByMachines(out List<ProcessorByMachine> entries, int machineId)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("Getting all processors for machine {0}...", machineId);
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
string sql = $"SELECT * FROM processors_by_machine WHERE machine = {machineId}";
|
||||
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = sql;
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
entries = ProcessorByMachinesFromDataTable(dataSet.Tables[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error getting processors by machine.");
|
||||
Console.WriteLine(ex);
|
||||
entries = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all machines with specified processor
|
||||
/// </summary>
|
||||
/// <param name="entries">All CPUs</param>
|
||||
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||
public bool GetMachinesByProcessor(out List<ProcessorByMachine> entries, int processorId)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("Getting all machines with processor {0}...", processorId);
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
string sql = $"SELECT * FROM processors_by_machine WHERE processor = {processorId}";
|
||||
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = sql;
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
entries = ProcessorByMachinesFromDataTable(dataSet.Tables[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error getting machines by processor.");
|
||||
Console.WriteLine(ex);
|
||||
entries = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IDbCommand GetCommandProcessorByMachine(ProcessorByMachine entry)
|
||||
{
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param3 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@processor";
|
||||
param2.ParameterName = "@machine";
|
||||
param3.ParameterName = "@speed";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
param3.DbType = DbType.Single;
|
||||
|
||||
param1.Value = entry.Processor;
|
||||
param2.Value = entry.Machine;
|
||||
param3.Value = entry.Speed <= 0 ? (object)null : entry.Speed;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
|
||||
static List<ProcessorByMachine> ProcessorByMachinesFromDataTable(DataTable dataTable)
|
||||
{
|
||||
List<ProcessorByMachine> entries = new List<ProcessorByMachine>();
|
||||
|
||||
foreach(DataRow dataRow in dataTable.Rows)
|
||||
{
|
||||
ProcessorByMachine entry = new ProcessorByMachine
|
||||
{
|
||||
Machine = (int)dataRow["machine"],
|
||||
Processor = (int)dataRow["processor"],
|
||||
Speed = dataRow["speed"] == DBNull.Value ? 0 : (float)dataRow["speed"]
|
||||
};
|
||||
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,11 @@ namespace Cicm.Database
|
||||
UpdateDatabaseToV14();
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
UpdateDatabaseToV15();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OptimizeDatabase();
|
||||
@@ -1495,13 +1500,17 @@ namespace Cicm.Database
|
||||
param20.DbType = DbType.Int32;
|
||||
param21.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = (int)dataRow["company"];
|
||||
param2.Value = (int)dataRow["year"];
|
||||
param3.Value = (string)dataRow["model"];
|
||||
param4.Value = dataRow["cpu1"] == DBNull.Value ? (object)null : (int)dataRow["cpu1"];
|
||||
param5.Value = dataRow["mhz1"] == DBNull.Value ? (object)null : float.Parse(dataRow["mhz1"].ToString());
|
||||
param6.Value = dataRow["cpu2"] == DBNull.Value ? (object)null : (int)dataRow["cpu2"];
|
||||
param7.Value = dataRow["mhz2"] == DBNull.Value ? (object)null : float.Parse(dataRow["mhz2"].ToString());
|
||||
param1.Value = (int)dataRow["company"];
|
||||
param2.Value = (int)dataRow["year"];
|
||||
param3.Value = (string)dataRow["model"];
|
||||
param4.Value = dataRow["cpu1"] == DBNull.Value ? (object)null : (int)dataRow["cpu1"];
|
||||
param5.Value = dataRow["mhz1"] == DBNull.Value
|
||||
? (object)null
|
||||
: float.Parse(dataRow["mhz1"].ToString());
|
||||
param6.Value = dataRow["cpu2"] == DBNull.Value ? (object)null : (int)dataRow["cpu2"];
|
||||
param7.Value = dataRow["mhz2"] == DBNull.Value
|
||||
? (object)null
|
||||
: float.Parse(dataRow["mhz2"].ToString());
|
||||
param8.Value = (int)dataRow["ram"];
|
||||
param9.Value = (int)dataRow["rom"];
|
||||
param10.Value = dataRow["gpu"] == DBNull.Value ? (object)null : (int)dataRow["gpu"];
|
||||
@@ -1571,6 +1580,113 @@ namespace Cicm.Database
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void UpdateDatabaseToV15()
|
||||
{
|
||||
Console.WriteLine("Updating database to version 15");
|
||||
|
||||
Console.WriteLine("Creating table `processors_by_machine`");
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = V15.ProcessorsByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Getting all items from `machines`");
|
||||
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = "SELECT * from machines";
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
foreach(DataRow dataRow in dataSet.Tables[0].Rows)
|
||||
{
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param3 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@machine";
|
||||
param2.ParameterName = "@processor";
|
||||
param3.ParameterName = "@speed";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
param3.DbType = DbType.Double;
|
||||
|
||||
param1.Value = (int)dataRow["id"];
|
||||
|
||||
const string SQL =
|
||||
"INSERT INTO processors_by_machine (machine, processor, speed) VALUES (@machine, @processor, @speed)";
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
dbcmd.Parameters.Add(param3);
|
||||
|
||||
if(dataRow["cpu1"] != DBNull.Value)
|
||||
{
|
||||
param2.Value = (int)dataRow["cpu1"];
|
||||
param3.Value = dataRow["mhz1"] == DBNull.Value
|
||||
? (object)null
|
||||
: float.Parse(dataRow["mhz1"].ToString());
|
||||
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
Console.WriteLine("Adding processor {0} to machine {1}", (int)param2.Value, (int)param1.Value);
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
dbcmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
if(dataRow["cpu2"] != DBNull.Value)
|
||||
{
|
||||
param2.Value = (int)dataRow["cpu2"];
|
||||
param3.Value = dataRow["mhz2"] == DBNull.Value
|
||||
? (object)null
|
||||
: float.Parse(dataRow["mhz2"].ToString());
|
||||
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
Console.WriteLine("Adding processor {0} to machine {1}", (int)param2.Value, (int)param1.Value);
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
dbcmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
dbcmd.Dispose();
|
||||
}
|
||||
|
||||
Console.WriteLine("Removing processor columns from table `machines`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = "ALTER TABLE `machines` DROP FOREIGN KEY `fk_machines_cpu1`;\n" +
|
||||
"ALTER TABLE `machines` DROP FOREIGN KEY `fk_machines_cpu2`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `cpu1`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `cpu2`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `mhz1`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `mhz2`;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Setting new database version to 15...");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
dbCmd.CommandText = "INSERT INTO cicm_db (version) VALUES ('15')";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void OptimizeDatabase()
|
||||
{
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
@@ -41,10 +41,6 @@ namespace Cicm.Database.Schemas
|
||||
public int Colors;
|
||||
/// <summary>Manufacturer's company ID</summary>
|
||||
public int Company;
|
||||
/// <summary>Primary CPU</summary>
|
||||
public int Cpu1;
|
||||
/// <summary>Secondary CPU</summary>
|
||||
public int Cpu2;
|
||||
/// <summary>ID of first removable disk format</summary>
|
||||
public int Disk1;
|
||||
/// <summary>ID of second removable disk format</summary>
|
||||
@@ -59,10 +55,6 @@ namespace Cicm.Database.Schemas
|
||||
public int Hdd3;
|
||||
/// <summary>ID</summary>
|
||||
public int Id;
|
||||
/// <summary>Frequency in MHz of primary CPU</summary>
|
||||
public float Mhz1;
|
||||
/// <summary>Frequency in MHz of secondary CPU</summary>
|
||||
public float Mhz2;
|
||||
/// <summary>Model name</summary>
|
||||
public string Model;
|
||||
/// <summary>Audio channels supported by the MPU</summary>
|
||||
|
||||
43
Cicm.Database/Schemas/ProcessorByMachine.cs
Normal file
43
Cicm.Database/Schemas/ProcessorByMachine.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Computer.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// High level representation of a computer.
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace Cicm.Database.Schemas
|
||||
{
|
||||
/// <summary>Computer</summary>
|
||||
public class ProcessorByMachine
|
||||
{
|
||||
/// <summary>Machine ID</summary>
|
||||
public int Machine;
|
||||
/// <summary>Processor ID</summary>
|
||||
public int Processor;
|
||||
/// <summary>Processor speed in MHz</summary>
|
||||
public float Speed;
|
||||
}
|
||||
}
|
||||
141
Cicm.Database/Schemas/Sql/V15.cs
Normal file
141
Cicm.Database/Schemas/Sql/V15.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : V15.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains SQL queries to create the database version 7.
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace Cicm.Database.Schemas.Sql
|
||||
{
|
||||
public static class V15
|
||||
{
|
||||
public static readonly string Admins = V14.Admins;
|
||||
|
||||
public static readonly string BrowserTests = V14.BrowserTests;
|
||||
|
||||
public static readonly string CicmDb = "CREATE TABLE `cicm_db` (\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||
"`version` int(11) NOT NULL,\n" +
|
||||
"`updated` datetime DEFAULT CURRENT_TIMESTAMP,\n" +
|
||||
"PRIMARY KEY (`id`)\n" + ");\n" +
|
||||
"INSERT INTO cicm_db (version) VALUES ('15');";
|
||||
|
||||
public static readonly string Companies = V14.Companies;
|
||||
|
||||
public static readonly string Machines = "CREATE TABLE `machines` (;\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,;\n" +
|
||||
"`company` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`year` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`model` char(50) NOT NULL DEFAULT '',;\n" +
|
||||
"`ram` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`rom` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`gpu` int(11) DEFAULT NULL,;\n" +
|
||||
"`vram` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`colors` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`res` char(10) NOT NULL DEFAULT '',;\n" +
|
||||
"`sound_synth` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`music_synth` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`sound_channels` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`music_channels` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`hdd1` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`hdd2` int(11) DEFAULT NULL,;\n" +
|
||||
"`hdd3` int(11) DEFAULT NULL,;\n" +
|
||||
"`disk1` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`cap1` char(25) NOT NULL DEFAULT '0',;\n" +
|
||||
"`disk2` int(11) DEFAULT NULL,;\n" +
|
||||
"`cap2` char(25) DEFAULT NULL,;\n" +
|
||||
"`type` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"PRIMARY KEY (`id`),;\n" +
|
||||
"KEY `idx_machines_company` (`company`),;\n" +
|
||||
"KEY `idx_machines_year` (`year`),;\n" +
|
||||
"KEY `idx_machines_model` (`model`),;\n" +
|
||||
"KEY `idx_machines_ram` (`ram`),;\n" +
|
||||
"KEY `idx_machines_rom` (`rom`),;\n" +
|
||||
"KEY `idx_machines_gpu` (`gpu`),;\n" +
|
||||
"KEY `idx_machines_vram` (`vram`),;\n" +
|
||||
"KEY `idx_machines_colors` (`colors`),;\n" +
|
||||
"KEY `idx_machines_res` (`res`),;\n" +
|
||||
"KEY `idx_machines_sound_synth` (`sound_synth`),;\n" +
|
||||
"KEY `idx_machines_music_synth` (`music_synth`),;\n" +
|
||||
"KEY `idx_machines_hdd1` (`hdd1`),;\n" +
|
||||
"KEY `idx_machines_hdd2` (`hdd2`),;\n" +
|
||||
"KEY `idx_machines_hdd3` (`hdd3`),;\n" +
|
||||
"KEY `idx_machines_disk1` (`disk1`),;\n" +
|
||||
"KEY `idx_machines_disk2` (`disk2`),;\n" +
|
||||
"KEY `idx_machines_cap1` (`cap1`),;\n" +
|
||||
"KEY `idx_machines_cap2` (`cap2`),;\n" +
|
||||
"KEY `idx_machines_type` (`type`));";
|
||||
|
||||
public static readonly string DiskFormats = V14.DiskFormats;
|
||||
|
||||
public static readonly string Forbidden = V14.Forbidden;
|
||||
|
||||
public static readonly string Gpus = V14.Gpus;
|
||||
|
||||
public static readonly string Logs = V14.Logs;
|
||||
|
||||
public static readonly string MoneyDonations = V14.MoneyDonations;
|
||||
|
||||
public static readonly string News = V14.News;
|
||||
|
||||
public static readonly string OwnedComputers = V14.OwnedComputers;
|
||||
|
||||
public static readonly string OwnedConsoles = V14.OwnedConsoles;
|
||||
|
||||
public static readonly string Processors = V14.Processors;
|
||||
|
||||
public static readonly string SoundSynths = V14.SoundSynths;
|
||||
|
||||
public static readonly string MachinesForeignKeys = V14.MachinesForeignKeys;
|
||||
|
||||
public static readonly string Iso3166Numeric = V14.Iso3166Numeric;
|
||||
|
||||
public static readonly string Iso3166NumericValues = V14.Iso3166NumericValues;
|
||||
|
||||
public static readonly string CompaniesForeignKeys = V14.CompaniesForeignKeys;
|
||||
|
||||
public static readonly string CompanyLogos = V14.CompanyLogos;
|
||||
|
||||
public static readonly string CompanyDescriptions = V14.CompanyDescriptions;
|
||||
|
||||
public static readonly string InstructionSets = V14.InstructionSets;
|
||||
|
||||
public static readonly string InstructionSetExtensions = V14.InstructionSetExtensions;
|
||||
|
||||
public static readonly string InstructionSetExtensionsByProcessor = V14.InstructionSetExtensionsByProcessor;
|
||||
|
||||
public static readonly string ProcessorsByMachine =
|
||||
"CREATE TABLE `processors_by_machine` (\n" +
|
||||
"`processor` INT NOT NULL, \n" +
|
||||
"`machine` INT NOT NULL,\n" +
|
||||
"`speed` FLOAT DEFAULT NULL, \n" +
|
||||
"KEY `idx_processors_by_machine_processor` (`processor`),\n" +
|
||||
"KEY `idx_processors_by_machine_machine` (`machine`),\n" +
|
||||
"KEY `idx_processors_by_machine_speed` (`speed`),\n" +
|
||||
"CONSTRAINT `fk_processors_by_machine_machine` FOREIGN KEY (`machine`) REFERENCES `machines` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,\n" +
|
||||
"CONSTRAINT `fk_processors_by_machine_processor` FOREIGN KEY (`processor`) REFERENCES `processors` (`id`) ON UPDATE CASCADE ON DELETE CASCADE);";
|
||||
}
|
||||
}
|
||||
@@ -37,32 +37,29 @@ namespace cicm_web.Models
|
||||
{
|
||||
public class Machine
|
||||
{
|
||||
public string Cap1;
|
||||
public string Cap2;
|
||||
public int Colors;
|
||||
public Company Company;
|
||||
public Processor Cpu1;
|
||||
public Processor Cpu2;
|
||||
public DiskFormat Disk1;
|
||||
public DiskFormat Disk2;
|
||||
public Gpu Gpu;
|
||||
public DiskFormat Hdd1;
|
||||
public DiskFormat Hdd2;
|
||||
public DiskFormat Hdd3;
|
||||
public int Id;
|
||||
public float Mhz1;
|
||||
public float Mhz2;
|
||||
public string Model;
|
||||
public int MusicChannels;
|
||||
public SoundSynth MusicSynth;
|
||||
public int Ram;
|
||||
public string Resolution;
|
||||
public int Rom;
|
||||
public int SoundChannels;
|
||||
public SoundSynth SoundSynth;
|
||||
public MachineType Type;
|
||||
public int Vram;
|
||||
public int Year;
|
||||
public string Cap1;
|
||||
public string Cap2;
|
||||
public int Colors;
|
||||
public Company Company;
|
||||
public DiskFormat Disk1;
|
||||
public DiskFormat Disk2;
|
||||
public Gpu Gpu;
|
||||
public DiskFormat Hdd1;
|
||||
public DiskFormat Hdd2;
|
||||
public DiskFormat Hdd3;
|
||||
public int Id;
|
||||
public string Model;
|
||||
public int MusicChannels;
|
||||
public SoundSynth MusicSynth;
|
||||
public ProcessorByMachine[] Processors;
|
||||
public int Ram;
|
||||
public string Resolution;
|
||||
public int Rom;
|
||||
public int SoundChannels;
|
||||
public SoundSynth SoundSynth;
|
||||
public MachineType Type;
|
||||
public int Vram;
|
||||
public int Year;
|
||||
|
||||
public static Machine[] GetAllItems()
|
||||
{
|
||||
@@ -108,7 +105,8 @@ namespace cicm_web.Models
|
||||
Rom = dbItem.Rom,
|
||||
Vram = dbItem.Vram,
|
||||
Year = dbItem.Year,
|
||||
Type = dbItem.Type
|
||||
Type = dbItem.Type,
|
||||
Processors = ProcessorByMachine.GetAllItems(dbItem.Id)
|
||||
};
|
||||
|
||||
if(dbItem.Disk1 > 0)
|
||||
@@ -123,18 +121,6 @@ namespace cicm_web.Models
|
||||
item.Disk2 = DiskFormat.GetItem(dbItem.Disk2);
|
||||
}
|
||||
|
||||
if(dbItem.Cpu1 > 0)
|
||||
{
|
||||
item.Cpu1 = Processor.GetItem(dbItem.Cpu1);
|
||||
item.Mhz1 = dbItem.Mhz1;
|
||||
}
|
||||
|
||||
if(dbItem.Cpu2 > 0)
|
||||
{
|
||||
item.Cpu2 = Processor.GetItem(dbItem.Cpu2);
|
||||
item.Mhz2 = dbItem.Mhz2;
|
||||
}
|
||||
|
||||
if(dbItem.MusicSynth > 0)
|
||||
{
|
||||
item.MusicSynth = SoundSynth.GetItem(dbItem.MusicSynth);
|
||||
|
||||
59
cicm_web/Models/ProcessorByMachine.cs
Normal file
59
cicm_web/Models/ProcessorByMachine.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ProcessorByMachine.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Processor by machine model
|
||||
//
|
||||
// --[ 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-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace cicm_web.Models
|
||||
{
|
||||
public class ProcessorByMachine
|
||||
{
|
||||
public Processor Processor;
|
||||
public float Speed;
|
||||
|
||||
public static ProcessorByMachine[] GetAllItems(int machineId)
|
||||
{
|
||||
List<Cicm.Database.Schemas.ProcessorByMachine> dbItems = null;
|
||||
bool? result =
|
||||
Program.Database?.Operations.GetProcessorsByMachines(out dbItems, machineId);
|
||||
if(result == null || result.Value == false || dbItems == null) return null;
|
||||
|
||||
List<ProcessorByMachine> items = new List<ProcessorByMachine>();
|
||||
|
||||
foreach(Cicm.Database.Schemas.ProcessorByMachine dbItem in dbItems)
|
||||
items.Add(new ProcessorByMachine
|
||||
{
|
||||
Processor = Processor.GetItem(dbItem.Processor),
|
||||
Speed = dbItem.Speed
|
||||
});
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,466 +87,245 @@
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<th scope=row>
|
||||
<div align=right>
|
||||
Primary processor
|
||||
</div>
|
||||
</th>
|
||||
@if(Model.Cpu1 != null)
|
||||
{
|
||||
<td>
|
||||
@if(Model.Mhz1 > 0) { @(Model.Cpu1.GprSize > 0 ? $"{Model.Cpu1.Name} @ {Model.Mhz1}Mhz ({Model.Cpu1.GprSize} bits)" : $"{Model.Cpu1.Name} @ {Model.Mhz1}Mhz") }
|
||||
else
|
||||
{ @($"{Model.Cpu1.Name}") }
|
||||
<a aria-controls="cpuInfo"
|
||||
aria-expanded="false"
|
||||
class="btn btn-link"
|
||||
data-toggle="collapse"
|
||||
href="#cpuInfo">
|
||||
+info
|
||||
</a>
|
||||
<div class="collapse"
|
||||
id="cpuInfo">
|
||||
<div class="card card-body">
|
||||
<table>
|
||||
@if(Model.Cpu1.ModelCode != null && Model.Cpu1.ModelCode != Model.Cpu1.Name)
|
||||
{
|
||||
<tr>
|
||||
<td>Model</td>
|
||||
<td>@Model.Cpu1.ModelCode</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>Manufacturer</td>
|
||||
<td>
|
||||
<a asp-controller=Company
|
||||
asp-action=View
|
||||
asp-route-id=@Model.Cpu1.Company.Id>
|
||||
@Model.Cpu1.Company.Name</a>
|
||||
</td>
|
||||
</tr>
|
||||
@if(Model.Cpu1.Introduced != DateTime.MinValue)
|
||||
{
|
||||
<tr>
|
||||
<td>Introduction date</td>
|
||||
<td>@($"{Model.Cpu1.Introduced:yyyy}")</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.InstructionSet != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Instruction set</td>
|
||||
<td>@Model.Cpu1.InstructionSet.Name</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Speed > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Nominal speed</td>
|
||||
<td>@Model.Cpu1.Speed MHz</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Gpr > 0 || Model.Cpu1.Fpr > 0 || Model.Cpu1.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Registers</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu1.Gpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu1.Gpr general purpose registers of @Model.Cpu1.GprSize bits
|
||||
@if(Model.Cpu1.FprSize > 0 && Model.Cpu1.Fpr == 0) { @($", that can be used as floating point registers of {Model.Cpu1.FprSize}") }
|
||||
@if(Model.Cpu1.SimdSize > 0 && Model.Cpu1.Simd == 0) { @($", that can be used as SIMD registers of {Model.Cpu1.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Fpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu1.Fpr floating-point registers of @Model.Cpu1.FprSize bits
|
||||
@if(Model.Cpu1.SimdSize > 0 && Model.Cpu1.Simd == 0) { @($", that can be used as SIMD registers of {Model.Cpu1.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu1.Simd <abbr title="Single instruction, multiple data">SIMD</abbr>registers of @Model.Cpu1.SimdSize bits
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>Multi-core</td>
|
||||
<td>@Model.Cpu1.Cores cores</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<abbr title="Simultanoeus multithreading">SMT</abbr>
|
||||
</td>
|
||||
<td>
|
||||
@Model.Cpu1.ThreadsPerCore threads
|
||||
@if(Model.Cpu1.Cores > 1) { @(" per core") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.DataBus > 0 || Model.Cpu1.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Bus</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu1.DataBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu1.DataBus-bit data
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu1.AddressBus-bit address
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@if(Model.Cpu1.L1Instruction > 0 || Model.Cpu1.L1Data > 0 || Model.Cpu1.L2 > 0 || Model.Cpu1.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Cache</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu1.L1Instruction > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@(Model.Cpu1.L1Data < 0 ? $"{Model.Cpu1.L1Instruction}KiB combined instruction-data L1" : $"{Model.Cpu1.L1Instruction}KiB instruction L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.L1Data > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu1.L1Data}KiB data L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu1.L2}KiB L2")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.L3 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu1.L3}KiB L3")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Package != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Package</td>
|
||||
<td>@Model.Cpu1.Package</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Process != null || Model.Cpu1.ProcessNm > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Manufacturing process</td>
|
||||
<td>
|
||||
@if(Model.Cpu1.Process != null && Model.Cpu1.ProcessNm > 0)
|
||||
{
|
||||
@Model.Cpu1.Process
|
||||
@("@")
|
||||
@(Model.Cpu1.ProcessNm > 100 ? $"{Model.Cpu1.ProcessNm / 100}µm" : $"{Model.Cpu1.ProcessNm}nm")
|
||||
}
|
||||
else if(Model.Cpu1.ProcessNm > 0) { @(Model.Cpu1.ProcessNm > 100 ? $"{Model.Cpu1.ProcessNm / 100}µm" : $"{Model.Cpu1.ProcessNm}nm") }
|
||||
else
|
||||
{ @Model.Cpu1.Process }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.DieSize > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Die size</td>
|
||||
<td>@Model.Cpu1.DieSize mm²</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu1.Transistors > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Transistors</td>
|
||||
<td>@Model.Cpu1.Transistors</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Unknown data</td>
|
||||
}
|
||||
</tr>
|
||||
|
||||
@if(Model.Cpu2 != null)
|
||||
@if(Model.Processors != null && Model.Processors.Length > 0)
|
||||
{
|
||||
<tr>
|
||||
<th scope=row>
|
||||
<div align=right>
|
||||
Secondary processor
|
||||
Processors
|
||||
</div>
|
||||
</th>
|
||||
<td>
|
||||
@if(Model.Mhz1 > 0) { @(Model.Cpu2.GprSize > 0 ? $"{Model.Cpu2.Name} @ {Model.Mhz1}Mhz ({Model.Cpu2.GprSize} bits)" : $"{Model.Cpu2.Name} @ {Model.Mhz1}Mhz") }
|
||||
else
|
||||
{ @($"{Model.Cpu2.Name}") }
|
||||
<a aria-controls="cpuInfo"
|
||||
aria-expanded="false"
|
||||
class="btn btn-link"
|
||||
data-toggle="collapse"
|
||||
href="#cpu2Info">
|
||||
+info
|
||||
</a>
|
||||
<div class="collapse"
|
||||
id="cpu2Info">
|
||||
<div class="card card-body">
|
||||
<table>
|
||||
@if(Model.Cpu2.ModelCode != null && Model.Cpu2.ModelCode != Model.Cpu2.Name)
|
||||
@for(int i = 0; i < Model.Processors.Length; i++)
|
||||
{
|
||||
<tr>
|
||||
<td>Model</td>
|
||||
<td>@Model.Cpu2.ModelCode</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>Manufacturer</td>
|
||||
<td>
|
||||
<a asp-controller=Company
|
||||
asp-action=View
|
||||
asp-route-id=@Model.Cpu2.Company.Id>
|
||||
@Model.Cpu2.Company.Name</a>
|
||||
</td>
|
||||
</tr>
|
||||
@if(Model.Cpu2.Introduced != DateTime.MinValue)
|
||||
{
|
||||
<tr>
|
||||
<td>Introduction date</td>
|
||||
<td>@($"{Model.Cpu2.Introduced:yyyy}")</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.InstructionSet != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Instruction set</td>
|
||||
<td>@Model.Cpu2.InstructionSet.Name</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Speed > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Nominal speed</td>
|
||||
<td>@Model.Cpu2.Speed MHz</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Gpr > 0 || Model.Cpu2.Fpr > 0 || Model.Cpu2.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Registers</td>
|
||||
if(Model.Processors[i] != null)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu2.Gpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu2.Gpr general purpose registers of @Model.Cpu2.GprSize bits
|
||||
@if(Model.Cpu2.FprSize > 0 && Model.Cpu2.Fpr == 0) { @($", that can be used as floating point registers of {Model.Cpu2.FprSize}") }
|
||||
@if(Model.Cpu2.SimdSize > 0 && Model.Cpu2.Simd == 0) { @($", that can be used as SIMD registers of {Model.Cpu2.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Fpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu2.Fpr floating-point registers of @Model.Cpu2.FprSize bits
|
||||
@if(Model.Cpu2.SimdSize > 0 && Model.Cpu2.Simd == 0) { @($", that can be used as SIMD registers of {Model.Cpu2.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu2.Simd <abbr title="Single instruction, multiple data">SIMD</abbr>registers of @Model.Cpu2.SimdSize bits
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>Multi-core</td>
|
||||
<td>@Model.Cpu2.Cores cores</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<abbr title="Simultanoeus multithreading">SMT</abbr>
|
||||
</td>
|
||||
<td>
|
||||
@Model.Cpu2.ThreadsPerCore threads
|
||||
@if(Model.Cpu2.Cores > 1) { @(" per core") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.DataBus > 0 || Model.Cpu2.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Bus</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu2.DataBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu2.DataBus-bit data
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Cpu2.AddressBus-bit address
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Speed > 0) { @(Model.Processors[i].Processor.GprSize > 0 ? $"{Model.Processors[i].Processor.Name} @ {Model.Processors[i].Speed}Mhz ({Model.Processors[i].Processor.GprSize} bits)" : $"{Model.Processors[i].Processor.Name} @ {Model.Processors[i].Speed}Mhz") }
|
||||
else
|
||||
{ @($"{Model.Processors[i].Processor.Name}") }
|
||||
<a aria-controls="@($"cpuInfo{i}")"
|
||||
aria-expanded="false"
|
||||
class="btn btn-link"
|
||||
data-toggle="collapse"
|
||||
href="@($"#cpuInfo{i}")">
|
||||
+info
|
||||
</a>
|
||||
<div class="collapse"
|
||||
id="@($"cpuInfo{i}")">
|
||||
<div class="card card-body">
|
||||
<table>
|
||||
@if(Model.Processors[i].Processor.ModelCode != null && Model.Processors[i].Processor.ModelCode != Model.Processors[i].Processor.Name)
|
||||
{
|
||||
<tr>
|
||||
<td>Model</td>
|
||||
<td>@Model.Processors[i].Processor.ModelCode</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>Manufacturer</td>
|
||||
<td>
|
||||
<a asp-controller=Company
|
||||
asp-action=View
|
||||
asp-route-id=@Model.Processors[i].Processor.Company.Id>
|
||||
@Model.Processors[i].Processor.Company.Name</a>
|
||||
</td>
|
||||
</tr>
|
||||
@if(Model.Processors[i].Processor.Introduced != DateTime.MinValue)
|
||||
{
|
||||
<tr>
|
||||
<td>Introduction date</td>
|
||||
<td>@($"{Model.Processors[i].Processor.Introduced:yyyy}")</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.InstructionSet != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Instruction set</td>
|
||||
<td>@Model.Processors[i].Processor.InstructionSet.Name</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Speed > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Nominal speed</td>
|
||||
<td>@Model.Processors[i].Processor.Speed MHz</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Gpr > 0 || Model.Processors[i].Processor.Fpr > 0 || Model.Processors[i].Processor.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Registers</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Processors[i].Processor.Gpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.Gpr general purpose registers of @Model.Processors[i].Processor.GprSize bits
|
||||
@if(Model.Processors[i].Processor.FprSize > 0 && Model.Processors[i].Processor.Fpr == 0) { @($", that can be used as floating point registers of {Model.Processors[i].Processor.FprSize}") }
|
||||
@if(Model.Processors[i].Processor.SimdSize > 0 && Model.Processors[i].Processor.Simd == 0) { @($", that can be used as SIMD registers of {Model.Processors[i].Processor.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Fpr > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.Fpr floating-point registers of @Model.Processors[i].Processor.FprSize bits
|
||||
@if(Model.Processors[i].Processor.SimdSize > 0 && Model.Processors[i].Processor.Simd == 0) { @($", that can be used as SIMD registers of {Model.Processors[i].Processor.FprSize}") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Simd > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.Simd <abbr title="Single instruction, multiple data">SIMD</abbr>registers of @Model.Processors[i].Processor.SimdSize bits
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>Multi-core</td>
|
||||
<td>@Model.Processors[i].Processor.Cores cores</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Cores > 1)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<abbr title="Simultanoeus multithreading">SMT</abbr>
|
||||
</td>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.ThreadsPerCore threads
|
||||
@if(Model.Processors[i].Processor.Cores > 1) { @(" per core") }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.DataBus > 0 || Model.Processors[i].Processor.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Bus</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Processors[i].Processor.DataBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.DataBus-bit data
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.AddressBus > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Model.Processors[i].Processor.AddressBus-bit address
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@if(Model.Cpu2.L1Instruction > 0 || Model.Cpu2.L1Data > 0 || Model.Cpu2.L2 > 0 || Model.Cpu2.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Cache</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Cpu2.L1Instruction > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@(Model.Cpu2.L1Data < 0 ? $"{Model.Cpu2.L1Instruction}KiB combined instruction-data L1" : $"{Model.Cpu2.L1Instruction}KiB instruction L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.L1Data > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu2.L1Data}KiB data L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu2.L2}KiB L2")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.L3 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Cpu2.L3}KiB L3")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
@if(Model.Processors[i].Processor.L1Instruction > 0 || Model.Processors[i].Processor.L1Data > 0 || Model.Processors[i].Processor.L2 > 0 || Model.Processors[i].Processor.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Cache</td>
|
||||
<td>
|
||||
<table>
|
||||
@if(Model.Processors[i].Processor.L1Instruction > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@(Model.Processors[i].Processor.L1Data < 0 ? $"{Model.Processors[i].Processor.L1Instruction}KiB combined instruction-data L1" : $"{Model.Processors[i].Processor.L1Instruction}KiB instruction L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.L1Data > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Processors[i].Processor.L1Data}KiB data L1")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.L2 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Processors[i].Processor.L2}KiB L2")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.L3 > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@($"{Model.Processors[i].Processor.L3}KiB L3")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Package != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Package</td>
|
||||
<td>@Model.Processors[i].Processor.Package</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Process != null || Model.Processors[i].Processor.ProcessNm > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Manufacturing process</td>
|
||||
<td>
|
||||
@if(Model.Processors[i].Processor.Process != null && Model.Processors[i].Processor.ProcessNm > 0)
|
||||
{
|
||||
@Model.Processors[i].Processor.Process
|
||||
@("@")
|
||||
@(Model.Processors[i].Processor.ProcessNm > 100 ? $"{Model.Processors[i].Processor.ProcessNm / 100}µm" : $"{Model.Processors[i].Processor.ProcessNm}nm")
|
||||
}
|
||||
else if(Model.Processors[i].Processor.ProcessNm > 0) { @(Model.Processors[i].Processor.ProcessNm > 100 ? $"{Model.Processors[i].Processor.ProcessNm / 100}µm" : $"{Model.Processors[i].Processor.ProcessNm}nm") }
|
||||
else
|
||||
{ @Model.Processors[i].Processor.Process }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.DieSize > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Die size</td>
|
||||
<td>@Model.Processors[i].Processor.DieSize mm²</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Processors[i].Processor.Transistors > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Transistors</td>
|
||||
<td>@Model.Processors[i].Processor.Transistors</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Package != null)
|
||||
{
|
||||
<tr>
|
||||
<td>Package</td>
|
||||
<td>@Model.Cpu2.Package</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Process != null || Model.Cpu2.ProcessNm > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Manufacturing process</td>
|
||||
<td>
|
||||
@if(Model.Cpu2.Process != null && Model.Cpu2.ProcessNm > 0)
|
||||
{
|
||||
@Model.Cpu2.Process
|
||||
@("@")
|
||||
@(Model.Cpu2.ProcessNm > 100 ? $"{Model.Cpu2.ProcessNm / 100}µm" : $"{Model.Cpu2.ProcessNm}nm")
|
||||
}
|
||||
else if(Model.Cpu2.ProcessNm > 0) { @(Model.Cpu2.ProcessNm > 100 ? $"{Model.Cpu2.ProcessNm / 100}µm" : $"{Model.Cpu2.ProcessNm}nm") }
|
||||
else
|
||||
{ @Model.Cpu2.Process }
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.DieSize > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Die size</td>
|
||||
<td>@Model.Cpu2.DieSize mm²</td>
|
||||
</tr>
|
||||
}
|
||||
@if(Model.Cpu2.Transistors > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>Transistors</td>
|
||||
<td>@Model.Cpu2.Transistors</td>
|
||||
</tr>
|
||||
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<Version>3.0.99.202</Version>
|
||||
<Version>3.0.99.206</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user