diff --git a/Cicm.Database/Cicm.Database.csproj b/Cicm.Database/Cicm.Database.csproj new file mode 100644 index 00000000..7102c44a --- /dev/null +++ b/Cicm.Database/Cicm.Database.csproj @@ -0,0 +1,11 @@ + + + netcoreapp2.0 + + + + + + + + \ No newline at end of file diff --git a/cicm_web/Database/Mysql.cs b/Cicm.Database/Mysql.cs similarity index 94% rename from cicm_web/Database/Mysql.cs rename to Cicm.Database/Mysql.cs index baf01f8e..8373dde8 100644 --- a/cicm_web/Database/Mysql.cs +++ b/Cicm.Database/Mysql.cs @@ -1,6 +1,6 @@ using MySql.Data.MySqlClient; -namespace cicm_web.Database +namespace Cicm.Database { public class Mysql { diff --git a/Cicm.Database/Schemas/Admin.cs b/Cicm.Database/Schemas/Admin.cs new file mode 100644 index 00000000..a07e582d --- /dev/null +++ b/Cicm.Database/Schemas/Admin.cs @@ -0,0 +1,9 @@ +namespace Cicm.Database.Schemas +{ + public class Admin + { + public int id; + public string password; + public string user; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/BrowserTest.cs b/Cicm.Database/Schemas/BrowserTest.cs new file mode 100644 index 00000000..4ba6c57a --- /dev/null +++ b/Cicm.Database/Schemas/BrowserTest.cs @@ -0,0 +1,23 @@ +namespace Cicm.Database.Schemas +{ + public class BrowserTest + { + public ushort id; + public string idstring; + public string browser; + public string version; + public string os; + public string platform; + public bool gif87; + public bool gif89; + public bool jpeg; + public bool png; + public bool pngt; + public bool agif; + public bool table; + public bool colors; + public bool js; + public bool frames; + public bool flash; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Company.cs b/Cicm.Database/Schemas/Company.cs new file mode 100644 index 00000000..d6eed28a --- /dev/null +++ b/Cicm.Database/Schemas/Company.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class Company + { + public int id; + public string Compania; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Computer.cs b/Cicm.Database/Schemas/Computer.cs new file mode 100644 index 00000000..6e90edaf --- /dev/null +++ b/Cicm.Database/Schemas/Computer.cs @@ -0,0 +1,33 @@ +namespace Cicm.Database.Schemas +{ + public class Computer + { + public int id; + public int company; + public int year; + public string model; + public int cpu1; + public float mhz1; + public int cpu2; + public float mhz2; + public int bits; + public int ram; + public int rom; + public int gpu; + public int vram; + public int colors; + public string res; + public int spu; + public int mpu; + public int sound_channels; + public int music_channels; + public int hdd1; + public int hdd2; + public int hdd3; + public int disk1; + public string cap1; + public int disk2; + public string cap2; + public string comment; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Console.cs b/Cicm.Database/Schemas/Console.cs new file mode 100644 index 00000000..d54b19e5 --- /dev/null +++ b/Cicm.Database/Schemas/Console.cs @@ -0,0 +1,29 @@ +namespace Cicm.Database.Schemas +{ + public class Console + { + public int id; + public int company; + public string name; + public int year; + public int cpu1; + public float mhz1; + public int cpu2; + public float mhz2; + public int bits; + public int ram; + public int rom; + public int gpu; + public int vram; + public string res; + public int colors; + public int palette; + public int spu; + public int schannels; + public int mpu; + public int mchannels; + public int format; + public int cap; + public string comments; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/ConsoleCompany.cs b/Cicm.Database/Schemas/ConsoleCompany.cs new file mode 100644 index 00000000..1bea5810 --- /dev/null +++ b/Cicm.Database/Schemas/ConsoleCompany.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class ConsoleCompany + { + public int id; + public string company; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Cpu.cs b/Cicm.Database/Schemas/Cpu.cs new file mode 100644 index 00000000..b897fee7 --- /dev/null +++ b/Cicm.Database/Schemas/Cpu.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class Cpu + { + public int id; + public string cpu; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/DiskFormats.cs b/Cicm.Database/Schemas/DiskFormats.cs new file mode 100644 index 00000000..2061a228 --- /dev/null +++ b/Cicm.Database/Schemas/DiskFormats.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class DiskFormats + { + public int id; + public string Format; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Dsp.cs b/Cicm.Database/Schemas/Dsp.cs new file mode 100644 index 00000000..17a0f091 --- /dev/null +++ b/Cicm.Database/Schemas/Dsp.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class Dsp + { + public int id; + public string DSP; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Forbidden.cs b/Cicm.Database/Schemas/Forbidden.cs new file mode 100644 index 00000000..2d9041ca --- /dev/null +++ b/Cicm.Database/Schemas/Forbidden.cs @@ -0,0 +1,11 @@ +namespace Cicm.Database.Schemas +{ + public class Forbidden + { + public int id; + public string browser; + public string date; + public string ip; + public string referer; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Gpu.cs b/Cicm.Database/Schemas/Gpu.cs new file mode 100644 index 00000000..c06ac88e --- /dev/null +++ b/Cicm.Database/Schemas/Gpu.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class Gpu + { + public int id; + public string gpu; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Log.cs b/Cicm.Database/Schemas/Log.cs new file mode 100644 index 00000000..1228355b --- /dev/null +++ b/Cicm.Database/Schemas/Log.cs @@ -0,0 +1,11 @@ +namespace Cicm.Database.Schemas +{ + public class Log + { + public int id; + public string browser; + public string ip; + public string date; + public string referer; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/MoneyDonation.cs b/Cicm.Database/Schemas/MoneyDonation.cs new file mode 100644 index 00000000..b80737b8 --- /dev/null +++ b/Cicm.Database/Schemas/MoneyDonation.cs @@ -0,0 +1,9 @@ +namespace Cicm.Database.Schemas +{ + public class MoneyDonation + { + public int id; + public string donator; + public float quantity; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Mpu.cs b/Cicm.Database/Schemas/Mpu.cs new file mode 100644 index 00000000..d496e24f --- /dev/null +++ b/Cicm.Database/Schemas/Mpu.cs @@ -0,0 +1,8 @@ +namespace Cicm.Database.Schemas +{ + public class Mpu + { + public int id; + public string mpu; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/News.cs b/Cicm.Database/Schemas/News.cs new file mode 100644 index 00000000..be694668 --- /dev/null +++ b/Cicm.Database/Schemas/News.cs @@ -0,0 +1,10 @@ +namespace Cicm.Database.Schemas +{ + public class News + { + public int id; + public string date; + public int type; + public int added_id; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/OwnComputer.cs b/Cicm.Database/Schemas/OwnComputer.cs new file mode 100644 index 00000000..d005fae9 --- /dev/null +++ b/Cicm.Database/Schemas/OwnComputer.cs @@ -0,0 +1,24 @@ +namespace Cicm.Database.Schemas +{ + public class OwnComputer + { + public int id; + public int db_id; + public string date; + public int status; + public bool trade; + public bool boxed; + public bool manuals; + public int cpu1; + public float mhz1; + public int cpu2; + public float mhz2; + public int ram; + public int vram; + public string rigid; + public int disk1; + public int cap1; + public int disk2; + public int cap2; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/OwnConsole.cs b/Cicm.Database/Schemas/OwnConsole.cs new file mode 100644 index 00000000..2c9ac378 --- /dev/null +++ b/Cicm.Database/Schemas/OwnConsole.cs @@ -0,0 +1,13 @@ +namespace Cicm.Database.Schemas +{ + public class OwnConsole + { + public int id; + public int db_id; + public string date; + public int status; + public bool trade; + public bool boxed; + public bool manuals; + } +} \ No newline at end of file diff --git a/Cicm.Database/Schemas/Sql/V2.cs b/Cicm.Database/Schemas/Sql/V2.cs new file mode 100644 index 00000000..4b870196 --- /dev/null +++ b/Cicm.Database/Schemas/Sql/V2.cs @@ -0,0 +1,205 @@ +namespace Cicm.Database.Schemas.Sql +{ + public static class V2 + { + static readonly string Admins = @"CREATE TABLE IF NOT EXISTS `admin` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user` char(50) NOT NULL DEFAULT '', + `password` char(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string BrowserTests = @"CREATE TABLE IF NOT EXISTS `browser_test` ( + `id` smallint(5) unsigned zerofill NOT NULL AUTO_INCREMENT, + `idstring` varchar(128) NOT NULL DEFAULT '', + `browser` varchar(64) NOT NULL DEFAULT '', + `version` varchar(16) NOT NULL DEFAULT '', + `os` varchar(32) NOT NULL DEFAULT '', + `platform` varchar(8) NOT NULL DEFAULT '', + `gif87` tinyint(1) NOT NULL DEFAULT '0', + `gif89` tinyint(1) NOT NULL DEFAULT '0', + `jpeg` tinyint(1) NOT NULL DEFAULT '0', + `png` tinyint(1) NOT NULL DEFAULT '0', + `pngt` tinyint(1) NOT NULL DEFAULT '0', + `agif` tinyint(1) NOT NULL DEFAULT '0', + `table` tinyint(1) NOT NULL DEFAULT '0', + `colors` tinyint(1) NOT NULL DEFAULT '0', + `js` tinyint(1) NOT NULL DEFAULT '0', + `frames` tinyint(1) NOT NULL DEFAULT '0', + `flash` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + );"; + + static readonly string Companies = @"CREATE TABLE IF NOT EXISTS `Companias` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `Compania` char(128) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string Computers = @"CREATE TABLE IF NOT EXISTS `computers` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `company` int(11) NOT NULL DEFAULT '0', + `year` int(11) NOT NULL DEFAULT '0', + `model` char(50) NOT NULL DEFAULT '', + `cpu1` int(11) NOT NULL DEFAULT '0', + `mhz1` decimal(11,2) NOT NULL DEFAULT '0.00', + `cpu2` int(11) DEFAULT NULL, + `mhz2` decimal(11,2) DEFAULT NULL, + `bits` int(11) NOT NULL DEFAULT '0', + `ram` int(11) NOT NULL DEFAULT '0', + `rom` int(11) NOT NULL DEFAULT '0', + `gpu` int(11) NOT NULL DEFAULT '0', + `vram` int(11) NOT NULL DEFAULT '0', + `colors` int(11) NOT NULL DEFAULT '0', + `res` char(10) NOT NULL DEFAULT '', + `spu` int(11) NOT NULL DEFAULT '0', + `mpu` int(11) NOT NULL DEFAULT '0', + `sound_channels` int(11) NOT NULL DEFAULT '0', + `music_channels` int(11) NOT NULL DEFAULT '0', + `hdd1` int(11) NOT NULL DEFAULT '0', + `hdd2` int(11) DEFAULT NULL, + `hdd3` int(11) DEFAULT NULL, + `disk1` int(11) NOT NULL DEFAULT '0', + `cap1` char(25) NOT NULL DEFAULT '0', + `disk2` int(11) DEFAULT NULL, + `cap2` char(25) DEFAULT NULL, + `comment` char(255) DEFAULT NULL, + PRIMARY KEY (`id`) + );"; + + static readonly string Consoles = @"CREATE TABLE IF NOT EXISTS `consoles` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `company` int(11) NOT NULL DEFAULT '0', + `name` char(50) NOT NULL DEFAULT '', + `year` int(11) NOT NULL DEFAULT '0', + `cpu1` int(11) NOT NULL DEFAULT '0', + `mhz1` decimal(11,2) NOT NULL DEFAULT '0.00', + `cpu2` int(11) DEFAULT NULL, + `mhz2` decimal(11,2) DEFAULT NULL, + `bits` int(11) NOT NULL DEFAULT '0', + `ram` int(11) NOT NULL DEFAULT '0', + `rom` int(11) NOT NULL DEFAULT '0', + `gpu` int(11) NOT NULL DEFAULT '0', + `vram` int(11) NOT NULL DEFAULT '0', + `res` char(11) NOT NULL DEFAULT '', + `colors` int(11) NOT NULL DEFAULT '0', + `palette` int(11) NOT NULL DEFAULT '0', + `spu` int(11) NOT NULL DEFAULT '0', + `schannels` int(11) NOT NULL DEFAULT '0', + `mpu` int(11) NOT NULL DEFAULT '0', + `mchannels` int(11) NOT NULL DEFAULT '0', + `format` int(11) NOT NULL DEFAULT '0', + `cap` int(11) NOT NULL DEFAULT '0', + `comments` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string ConsoleCompanies = @"CREATE TABLE IF NOT EXISTS `console_company` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `company` char(128) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string Cpus = @"CREATE TABLE IF NOT EXISTS `cpu` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cpu` char(50) NOT NULL DEFAULT '', + KEY `id` (`id`) + );"; + + static readonly string Dsps = @"CREATE TABLE IF NOT EXISTS `DSPs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `DSP` char(50) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string Forbidden = @"CREATE TABLE IF NOT EXISTS `forbidden` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `browser` char(128) NOT NULL DEFAULT '', + `date` char(20) NOT NULL DEFAULT '', + `ip` char(16) NOT NULL DEFAULT '', + `referer` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string DiskFormats = @"CREATE TABLE IF NOT EXISTS `Formatos_de_disco` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `Format` char(50) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string Gpus = @"CREATE TABLE IF NOT EXISTS `gpus` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `gpu` char(128) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string Logs = @"CREATE TABLE IF NOT EXISTS `log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `browser` char(128) NOT NULL DEFAULT '', + `ip` char(16) NOT NULL DEFAULT '', + `date` char(20) NOT NULL DEFAULT '', + `referer` char(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string MoneyDonations = @"CREATE TABLE IF NOT EXISTS `money_donation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `donator` char(128) NOT NULL DEFAULT '', + `quantity` decimal(11,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`id`) + );"; + + static readonly string Mpus = @"CREATE TABLE IF NOT EXISTS `mpus` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `mpu` char(50) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + + static readonly string News = @"CREATE TABLE IF NOT EXISTS `news` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` char(20) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `added_id` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + );"; + + static readonly string OwnComputers = @"CREATE TABLE IF NOT EXISTS `own_computer` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `db_id` int(11) NOT NULL DEFAULT '0', + `date` varchar(20) NOT NULL DEFAULT '', + `status` int(11) NOT NULL DEFAULT '0', + `trade` int(11) NOT NULL DEFAULT '0', + `boxed` int(11) NOT NULL DEFAULT '0', + `manuals` int(11) NOT NULL DEFAULT '0', + `cpu1` int(11) NOT NULL DEFAULT '0', + `mhz1` decimal(10,0) NOT NULL DEFAULT '0', + `cpu2` int(11) NOT NULL DEFAULT '0', + `mhz2` decimal(10,0) NOT NULL DEFAULT '0', + `ram` int(11) NOT NULL DEFAULT '0', + `vram` int(11) NOT NULL DEFAULT '0', + `rigid` varchar(64) NOT NULL DEFAULT '', + `disk1` int(11) NOT NULL DEFAULT '0', + `cap1` int(11) NOT NULL DEFAULT '0', + `disk2` int(11) NOT NULL DEFAULT '0', + `cap2` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + );"; + + static readonly string OwnConsoles = @"CREATE TABLE IF NOT EXISTS `own_consoles` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `db_id` int(11) NOT NULL DEFAULT '0', + `date` char(20) NOT NULL DEFAULT '', + `status` int(11) NOT NULL DEFAULT '0', + `trade` int(11) NOT NULL DEFAULT '0', + `boxed` int(11) NOT NULL DEFAULT '0', + `manuals` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + );"; + + static readonly string ProcesadoresPrincipales = @"CREATE TABLE IF NOT EXISTS `procesadores_principales` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `CPU` char(50) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) + );"; + } +} \ No newline at end of file diff --git a/cicm_web.sln b/cicm_web.sln index 67e4aa30..1ac00451 100644 --- a/cicm_web.sln +++ b/cicm_web.sln @@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cicm_web", "cicm_web\cicm_web.csproj", "{EB95B2DA-41CF-456F-B5E6-33B353F84258}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cicm.Database", "Cicm.Database\Cicm.Database.csproj", "{F914D5B9-0C7F-4A40-B187-269B83497AF8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +14,9 @@ Global {EB95B2DA-41CF-456F-B5E6-33B353F84258}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB95B2DA-41CF-456F-B5E6-33B353F84258}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB95B2DA-41CF-456F-B5E6-33B353F84258}.Release|Any CPU.Build.0 = Release|Any CPU + {F914D5B9-0C7F-4A40-B187-269B83497AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F914D5B9-0C7F-4A40-B187-269B83497AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F914D5B9-0C7F-4A40-B187-269B83497AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F914D5B9-0C7F-4A40-B187-269B83497AF8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/cicm_web/Program.cs b/cicm_web/Program.cs index ab4cf586..c6537cdd 100644 --- a/cicm_web/Program.cs +++ b/cicm_web/Program.cs @@ -29,7 +29,6 @@ *******************************************************************************/ using System; -using cicm_web.Database; using DiscImageChef.Interop; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; @@ -39,7 +38,7 @@ namespace cicm_web { public static class Program { - static cicm_web.Database.Mysql database; + static Cicm.Database.Mysql database; public static void Main(string[] args) { @@ -107,7 +106,7 @@ namespace cicm_web DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion()); Console.WriteLine("\u001b[31;1mConnecting to MySQL database...\u001b[0m"); - database = new Mysql("localhost", "cicm", "cicm", 3306, "cicmpass"); + database = new Cicm.Database.Mysql("localhost", "cicm", "cicm", 3306, "cicmpass"); Console.WriteLine("\u001b[31;1mStarting web server...\u001b[0m"); BuildWebHost(args).Run(); diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 97e2bfac..426a8c76 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -24,6 +24,10 @@ + + + + \ No newline at end of file