diff --git a/.idea/.idea.DiscImageChef/.idea/contentModel.xml b/.idea/.idea.DiscImageChef/.idea/contentModel.xml index 7662a812d..552282d5f 100644 --- a/.idea/.idea.DiscImageChef/.idea/contentModel.xml +++ b/.idea/.idea.DiscImageChef/.idea/contentModel.xml @@ -57,6 +57,7 @@ + @@ -302,10 +303,17 @@ + + + + + + + diff --git a/DiscImageChef.Core/DiscImageChef.Core.csproj b/DiscImageChef.Core/DiscImageChef.Core.csproj index 4d15b6d66..43295f53f 100644 --- a/DiscImageChef.Core/DiscImageChef.Core.csproj +++ b/DiscImageChef.Core/DiscImageChef.Core.csproj @@ -110,6 +110,7 @@ {ccaa7afe-c094-4d82-a66d-630de8a3f545} DiscImageChef.Console + {D7016DF2-5A5E-4524-B40D-BA2D59576688} DiscImageChef.Filesystems diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index 49c2b39b2..376f10679 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -39,7 +39,9 @@ using System.Threading; using System.Xml.Serialization; using DiscImageChef.CommonTypes.Interop; using DiscImageChef.CommonTypes.Metadata; -using DiscImageChef.Devices; +using DiscImageChef.Database; +using DiscImageChef.Database.Models; +using Device = DiscImageChef.Devices.Device; using MediaType = DiscImageChef.CommonTypes.MediaType; using Version = DiscImageChef.CommonTypes.Interop.Version; @@ -63,6 +65,8 @@ namespace DiscImageChef.Core /// static bool submitStatsLock; + static DicContext ctx = new DicContext(); + /// /// Loads saved statistics from disk /// @@ -126,6 +130,8 @@ namespace DiscImageChef.Core /// public static void SaveStats() { + ctx.SaveChanges(); + if(AllStats == null) return; if(AllStats.OperatingSystems != null) @@ -220,7 +226,7 @@ namespace DiscImageChef.Core System.Console.WriteLine("Uploading partial statistics file {0}", statsFile); #else DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile); - #endif + #endif FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read); XmlSerializer xs = new XmlSerializer(stats.GetType()); @@ -261,7 +267,7 @@ namespace DiscImageChef.Core throw; #else continue; - #endif + #endif } submitStatsLock = false; @@ -275,99 +281,11 @@ namespace DiscImageChef.Core /// Command public static void AddCommand(string command) { + if(string.IsNullOrWhiteSpace(command)) return; + if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.DeviceStats) return; - if(AllStats.Commands == null) AllStats.Commands = new CommandsStats(); - - if(CurrentStats.Commands == null) CurrentStats.Commands = new CommandsStats(); - - switch(command) - { - case "analyze": - AllStats.Commands.Analyze++; - CurrentStats.Commands.Analyze++; - break; - case "benchmark": - AllStats.Commands.Benchmark++; - CurrentStats.Commands.Benchmark++; - break; - case "checksum": - AllStats.Commands.Checksum++; - CurrentStats.Commands.Checksum++; - break; - case "compare": - AllStats.Commands.Compare++; - CurrentStats.Commands.Compare++; - break; - case "create-sidecar": - AllStats.Commands.CreateSidecar++; - CurrentStats.Commands.CreateSidecar++; - break; - case "decode": - AllStats.Commands.Decode++; - CurrentStats.Commands.Decode++; - break; - case "device-info": - AllStats.Commands.DeviceInfo++; - CurrentStats.Commands.DeviceInfo++; - break; - case "device-report": - AllStats.Commands.DeviceReport++; - CurrentStats.Commands.DeviceReport++; - break; - case "dump-media": - AllStats.Commands.DumpMedia++; - CurrentStats.Commands.DumpMedia++; - break; - case "entropy": - AllStats.Commands.Entropy++; - CurrentStats.Commands.Entropy++; - break; - case "extract-files": - AllStats.Commands.ExtractFiles++; - CurrentStats.Commands.ExtractFiles++; - break; - case "formats": - AllStats.Commands.Formats++; - CurrentStats.Commands.Formats++; - break; - case "ls": - AllStats.Commands.Ls++; - CurrentStats.Commands.Ls++; - break; - case "media-info": - AllStats.Commands.MediaInfo++; - CurrentStats.Commands.MediaInfo++; - break; - case "media-scan": - AllStats.Commands.MediaScan++; - CurrentStats.Commands.MediaScan++; - break; - case "print-hex": - AllStats.Commands.PrintHex++; - CurrentStats.Commands.PrintHex++; - break; - case "verify": - AllStats.Commands.Verify++; - CurrentStats.Commands.Verify++; - break; - case "list-devices": - AllStats.Commands.ListDevices++; - CurrentStats.Commands.ListDevices++; - break; - case "list-encodings": - AllStats.Commands.ListEncodings++; - CurrentStats.Commands.ListEncodings++; - break; - case "convert-image": - AllStats.Commands.ConvertImage++; - CurrentStats.Commands.ConvertImage++; - break; - case "image-info": - AllStats.Commands.ImageInfo++; - CurrentStats.Commands.ImageInfo++; - break; - } + ctx.Commands.Add(new Command {Name = command, Synchronized = false}); } /// @@ -376,44 +294,11 @@ namespace DiscImageChef.Core /// Filesystem name public static void AddFilesystem(string filesystem) { + if(string.IsNullOrWhiteSpace(filesystem)) return; + if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilesystemStats) return; - if(AllStats.Filesystems == null) AllStats.Filesystems = new List(); - if(CurrentStats.Filesystems == null) CurrentStats.Filesystems = new List(); - - NameValueStats old = AllStats.Filesystems.FirstOrDefault(nvs => nvs.name == filesystem); - - NameValueStats nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - AllStats.Filesystems.Remove(old); - } - else - { - nw.name = filesystem; - nw.Value = 1; - } - - AllStats.Filesystems.Add(nw); - - old = CurrentStats.Filesystems.FirstOrDefault(nvs => nvs.name == filesystem); - - nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - CurrentStats.Filesystems.Remove(old); - } - else - { - nw.name = filesystem; - nw.Value = 1; - } - - CurrentStats.Filesystems.Add(nw); + ctx.Filesystems.Add(new Filesystem {Name = filesystem, Synchronized = false}); } /// @@ -422,58 +307,29 @@ namespace DiscImageChef.Core /// Partition scheme name internal static void AddPartition(string partition) { + if(string.IsNullOrWhiteSpace(partition)) return; + if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.PartitionStats) return; - if(AllStats.Partitions == null) AllStats.Partitions = new List(); - if(CurrentStats.Partitions == null) CurrentStats.Partitions = new List(); - - NameValueStats old = AllStats.Partitions.FirstOrDefault(nvs => nvs.name == partition); - - NameValueStats nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - AllStats.Partitions.Remove(old); - } - else - { - nw.name = partition; - nw.Value = 1; - } - - AllStats.Partitions.Add(nw); - - old = CurrentStats.Partitions.FirstOrDefault(nvs => nvs.name == partition); - - nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - CurrentStats.Partitions.Remove(old); - } - else - { - nw.name = partition; - nw.Value = 1; - } - - CurrentStats.Partitions.Add(nw); + ctx.Partitions.Add(new Partition {Name = partition, Synchronized = false}); } /// /// Adds a new filter to statistics /// - /// Filter name - public static void AddFilter(string format) + /// Filter name + public static void AddFilter(string filter) { + if(string.IsNullOrWhiteSpace(filter)) return; + if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilterStats) return; + ctx.Filters.Add(new Filter {Name = filter, Synchronized = false}); + if(AllStats.Filters == null) AllStats.Filters = new List(); if(CurrentStats.Filters == null) CurrentStats.Filters = new List(); - NameValueStats old = AllStats.Filters.FirstOrDefault(nvs => nvs.name == format); + NameValueStats old = AllStats.Filters.FirstOrDefault(nvs => nvs.name == filter); NameValueStats nw = new NameValueStats(); if(old != null) @@ -484,13 +340,13 @@ namespace DiscImageChef.Core } else { - nw.name = format; + nw.name = filter; nw.Value = 1; } AllStats.Filters.Add(nw); - old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == format); + old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == filter); nw = new NameValueStats(); if(old != null) @@ -501,7 +357,7 @@ namespace DiscImageChef.Core } else { - nw.name = format; + nw.name = filter; nw.Value = 1; } @@ -514,44 +370,11 @@ namespace DiscImageChef.Core /// Media image name public static void AddMediaFormat(string format) { + if(string.IsNullOrWhiteSpace(format)) return; + if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaImageStats) return; - if(AllStats.MediaImages == null) AllStats.MediaImages = new List(); - if(CurrentStats.MediaImages == null) CurrentStats.MediaImages = new List(); - - NameValueStats old = AllStats.MediaImages.FirstOrDefault(nvs => nvs.name == format); - - NameValueStats nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - AllStats.MediaImages.Remove(old); - } - else - { - nw.name = format; - nw.Value = 1; - } - - AllStats.MediaImages.Add(nw); - - old = CurrentStats.MediaImages.FirstOrDefault(nvs => nvs.name == format); - - nw = new NameValueStats(); - if(old != null) - { - nw.name = old.name; - nw.Value = old.Value + 1; - CurrentStats.MediaImages.Remove(old); - } - else - { - nw.name = format; - nw.Value = 1; - } - - CurrentStats.MediaImages.Add(nw); + ctx.MediaFormats.Add(new MediaFormat {Name = format, Synchronized = false}); } /// diff --git a/DiscImageChef.Database/Context.cs b/DiscImageChef.Database/Context.cs index 1d7418aea..166324010 100644 --- a/DiscImageChef.Database/Context.cs +++ b/DiscImageChef.Database/Context.cs @@ -37,13 +37,19 @@ namespace DiscImageChef.Database { public sealed class DicContext : DbContext { + // Note: If table does not appear check that last migration has been REALLY added to the project public DicContext() { Database.Migrate(); } - public DbSet Devices { get; set; } - public DbSet Reports { get; set; } + public DbSet Devices { get; set; } + public DbSet Reports { get; set; } + public DbSet Commands { get; set; } + public DbSet Filesystems { get; set; } + public DbSet Filters { get; set; } + public DbSet MediaFormats { get; set; } + public DbSet Partitions { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { diff --git a/DiscImageChef.Database/DiscImageChef.Database.csproj b/DiscImageChef.Database/DiscImageChef.Database.csproj index 4ac4200e1..0f85a2d4a 100644 --- a/DiscImageChef.Database/DiscImageChef.Database.csproj +++ b/DiscImageChef.Database/DiscImageChef.Database.csproj @@ -64,8 +64,15 @@ + + + + + + + diff --git a/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.Designer.cs b/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.Designer.cs new file mode 100644 index 000000000..70a3c6270 --- /dev/null +++ b/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.Designer.cs @@ -0,0 +1,1329 @@ +// +using System; +using DiscImageChef.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace DiscImageChef.Database.Migrations +{ + [DbContext(typeof(DicContext))] + [Migration("20181221015906_NameValueStatistics")] + partial class NameValueStatistics + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.4-rtm-31024"); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Identify"); + + b.Property("ReadCapabilitiesId"); + + b.HasKey("Id"); + + b.HasIndex("ReadCapabilitiesId"); + + b.ToTable("Ata"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.BlockDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BlockLength"); + + b.Property("Blocks"); + + b.Property("Density"); + + b.Property("ScsiModeId"); + + b.HasKey("Id"); + + b.HasIndex("ScsiModeId"); + + b.ToTable("BlockDescriptor"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Chs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Cylinders"); + + b.Property("Heads"); + + b.Property("Sectors"); + + b.HasKey("Id"); + + b.ToTable("Chs"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b => + { + b.Property("Code") + .ValueGeneratedOnAdd(); + + b.Property("SscSupportedMediaId"); + + b.HasKey("Code"); + + b.HasIndex("SscSupportedMediaId"); + + b.ToTable("DensityCode"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.FireWire", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Manufacturer"); + + b.Property("Product"); + + b.Property("ProductID"); + + b.Property("RemovableMedia"); + + b.Property("VendorID"); + + b.HasKey("Id"); + + b.ToTable("FireWire"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Mmc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FeaturesId"); + + b.Property("ModeSense2AId"); + + b.HasKey("Id"); + + b.HasIndex("FeaturesId"); + + b.HasIndex("ModeSense2AId"); + + b.ToTable("Mmc"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.MmcFeatures", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AACSVersion"); + + b.Property("AGIDs"); + + b.Property("BindingNonceBlocks"); + + b.Property("BlocksPerReadableUnit"); + + b.Property("BufferUnderrunFreeInDVD"); + + b.Property("BufferUnderrunFreeInSAO"); + + b.Property("BufferUnderrunFreeInTAO"); + + b.Property("CPRMVersion"); + + b.Property("CSSVersion"); + + b.Property("CanAudioScan"); + + b.Property("CanEject"); + + b.Property("CanEraseSector"); + + b.Property("CanExpandBDRESpareArea"); + + b.Property("CanFormat"); + + b.Property("CanFormatBDREWithoutSpare"); + + b.Property("CanFormatCert"); + + b.Property("CanFormatFRF"); + + b.Property("CanFormatQCert"); + + b.Property("CanFormatRRM"); + + b.Property("CanGenerateBindingNonce"); + + b.Property("CanLoad"); + + b.Property("CanMuteSeparateChannels"); + + b.Property("CanOverwriteSAOTrack"); + + b.Property("CanOverwriteTAOTrack"); + + b.Property("CanPlayCDAudio"); + + b.Property("CanPseudoOverwriteBDR"); + + b.Property("CanReadAllDualR"); + + b.Property("CanReadAllDualRW"); + + b.Property("CanReadBD"); + + b.Property("CanReadBDR"); + + b.Property("CanReadBDRE1"); + + b.Property("CanReadBDRE2"); + + b.Property("CanReadBDROM"); + + b.Property("CanReadBluBCA"); + + b.Property("CanReadCD"); + + b.Property("CanReadCDMRW"); + + b.Property("CanReadCPRM_MKB"); + + b.Property("CanReadDDCD"); + + b.Property("CanReadDVD"); + + b.Property("CanReadDVDPlusMRW"); + + b.Property("CanReadDVDPlusR"); + + b.Property("CanReadDVDPlusRDL"); + + b.Property("CanReadDVDPlusRW"); + + b.Property("CanReadDVDPlusRWDL"); + + b.Property("CanReadDriveAACSCertificate"); + + b.Property("CanReadHDDVD"); + + b.Property("CanReadHDDVDR"); + + b.Property("CanReadHDDVDRAM"); + + b.Property("CanReadLeadInCDText"); + + b.Property("CanReadOldBDR"); + + b.Property("CanReadOldBDRE"); + + b.Property("CanReadOldBDROM"); + + b.Property("CanReadSpareAreaInformation"); + + b.Property("CanReportDriveSerial"); + + b.Property("CanReportMediaSerial"); + + b.Property("CanTestWriteDDCDR"); + + b.Property("CanTestWriteDVD"); + + b.Property("CanTestWriteInSAO"); + + b.Property("CanTestWriteInTAO"); + + b.Property("CanUpgradeFirmware"); + + b.Property("CanWriteBD"); + + b.Property("CanWriteBDR"); + + b.Property("CanWriteBDRE1"); + + b.Property("CanWriteBDRE2"); + + b.Property("CanWriteBusEncryptedBlocks"); + + b.Property("CanWriteCDMRW"); + + b.Property("CanWriteCDRW"); + + b.Property("CanWriteCDRWCAV"); + + b.Property("CanWriteCDSAO"); + + b.Property("CanWriteCDTAO"); + + b.Property("CanWriteCSSManagedDVD"); + + b.Property("CanWriteDDCDR"); + + b.Property("CanWriteDDCDRW"); + + b.Property("CanWriteDVDPlusMRW"); + + b.Property("CanWriteDVDPlusR"); + + b.Property("CanWriteDVDPlusRDL"); + + b.Property("CanWriteDVDPlusRW"); + + b.Property("CanWriteDVDPlusRWDL"); + + b.Property("CanWriteDVDR"); + + b.Property("CanWriteDVDRDL"); + + b.Property("CanWriteDVDRW"); + + b.Property("CanWriteHDDVDR"); + + b.Property("CanWriteHDDVDRAM"); + + b.Property("CanWriteOldBDR"); + + b.Property("CanWriteOldBDRE"); + + b.Property("CanWritePackedSubchannelInTAO"); + + b.Property("CanWriteRWSubchannelInSAO"); + + b.Property("CanWriteRWSubchannelInTAO"); + + b.Property("CanWriteRaw"); + + b.Property("CanWriteRawMultiSession"); + + b.Property("CanWriteRawSubchannelInTAO"); + + b.Property("ChangerIsSideChangeCapable"); + + b.Property("ChangerSlots"); + + b.Property("ChangerSupportsDiscPresent"); + + b.Property("DBML"); + + b.Property("DVDMultiRead"); + + b.Property("EmbeddedChanger"); + + b.Property("ErrorRecoveryPage"); + + b.Property("FirmwareDate"); + + b.Property("LoadingMechanismType"); + + b.Property("Locked"); + + b.Property("LogicalBlockSize"); + + b.Property("MultiRead"); + + b.Property("PhysicalInterfaceStandard"); + + b.Property("PhysicalInterfaceStandardNumber"); + + b.Property("PreventJumper"); + + b.Property("SupportsAACS"); + + b.Property("SupportsBusEncryption"); + + b.Property("SupportsC2"); + + b.Property("SupportsCPRM"); + + b.Property("SupportsCSS"); + + b.Property("SupportsDAP"); + + b.Property("SupportsDeviceBusyEvent"); + + b.Property("SupportsHybridDiscs"); + + b.Property("SupportsModePage1Ch"); + + b.Property("SupportsOSSC"); + + b.Property("SupportsPWP"); + + b.Property("SupportsSWPP"); + + b.Property("SupportsSecurDisc"); + + b.Property("SupportsSeparateVolume"); + + b.Property("SupportsVCPS"); + + b.Property("SupportsWriteInhibitDCB"); + + b.Property("SupportsWriteProtectPAC"); + + b.Property("VolumeLevels"); + + b.HasKey("Id"); + + b.ToTable("MmcFeatures"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.MmcSd", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CID"); + + b.Property("CSD"); + + b.Property("ExtendedCSD"); + + b.Property("OCR"); + + b.Property("SCR"); + + b.HasKey("Id"); + + b.ToTable("MmcSd"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Pcmcia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CIS"); + + b.Property("CardCode"); + + b.Property("Compliance"); + + b.Property("Manufacturer"); + + b.Property("ManufacturerCode"); + + b.Property("ProductName"); + + b.HasKey("Id"); + + b.ToTable("Pcmcia"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Scsi", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("InquiryData"); + + b.Property("ModeSense10Data"); + + b.Property("ModeSense6Data"); + + b.Property("ModeSenseId"); + + b.Property("MultiMediaDeviceId"); + + b.Property("ReadCapabilitiesId"); + + b.Property("SequentialDeviceId"); + + b.Property("SupportsModeSense10"); + + b.Property("SupportsModeSense6"); + + b.Property("SupportsModeSubpages"); + + b.HasKey("Id"); + + b.HasIndex("ModeSenseId"); + + b.HasIndex("MultiMediaDeviceId"); + + b.HasIndex("ReadCapabilitiesId"); + + b.HasIndex("SequentialDeviceId"); + + b.ToTable("Scsi"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiMode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BlankCheckEnabled"); + + b.Property("BufferedMode"); + + b.Property("DPOandFUA"); + + b.Property("MediumType"); + + b.Property("Speed"); + + b.Property("WriteProtected"); + + b.HasKey("Id"); + + b.ToTable("ScsiMode"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ScsiId"); + + b.Property("ScsiModeId"); + + b.Property("page"); + + b.Property("subpage"); + + b.Property("value"); + + b.HasKey("Id"); + + b.HasIndex("ScsiId"); + + b.HasIndex("ScsiModeId"); + + b.ToTable("ScsiPage"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ssc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BlockSizeGranularity"); + + b.Property("MaxBlockLength"); + + b.Property("MinBlockLength"); + + b.HasKey("Id"); + + b.ToTable("Ssc"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Length"); + + b.Property("MediumType"); + + b.Property("Name"); + + b.Property("Organization"); + + b.Property("SscId"); + + b.Property("TestedSequentialMediaId"); + + b.Property("Width"); + + b.HasKey("Id"); + + b.HasIndex("SscId"); + + b.HasIndex("TestedSequentialMediaId"); + + b.ToTable("SscSupportedMedia"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BitsPerMm"); + + b.Property("Capacity"); + + b.Property("DefaultDensity"); + + b.Property("Description"); + + b.Property("Duplicate"); + + b.Property("Name"); + + b.Property("Organization"); + + b.Property("PrimaryCode"); + + b.Property("SecondaryCode"); + + b.Property("SscId"); + + b.Property("TestedSequentialMediaId"); + + b.Property("Tracks"); + + b.Property("Width"); + + b.Property("Writable"); + + b.HasKey("Id"); + + b.HasIndex("SscId"); + + b.HasIndex("TestedSequentialMediaId"); + + b.ToTable("SupportedDensity"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AtaId"); + + b.Property("BlockSize"); + + b.Property("Blocks"); + + b.Property("CHSId"); + + b.Property("CanReadAACS"); + + b.Property("CanReadADIP"); + + b.Property("CanReadATIP"); + + b.Property("CanReadBCA"); + + b.Property("CanReadC2Pointers"); + + b.Property("CanReadCMI"); + + b.Property("CanReadCorrectedSubchannel"); + + b.Property("CanReadCorrectedSubchannelWithC2"); + + b.Property("CanReadDCB"); + + b.Property("CanReadDDS"); + + b.Property("CanReadDMI"); + + b.Property("CanReadDiscInformation"); + + b.Property("CanReadFirstTrackPreGap"); + + b.Property("CanReadFullTOC"); + + b.Property("CanReadHDCMI"); + + b.Property("CanReadLayerCapacity"); + + b.Property("CanReadLeadIn"); + + b.Property("CanReadLeadOut"); + + b.Property("CanReadMediaID"); + + b.Property("CanReadMediaSerial"); + + b.Property("CanReadPAC"); + + b.Property("CanReadPFI"); + + b.Property("CanReadPMA"); + + b.Property("CanReadPQSubchannel"); + + b.Property("CanReadPQSubchannelWithC2"); + + b.Property("CanReadPRI"); + + b.Property("CanReadRWSubchannel"); + + b.Property("CanReadRWSubchannelWithC2"); + + b.Property("CanReadRecordablePFI"); + + b.Property("CanReadSpareAreaInformation"); + + b.Property("CanReadTOC"); + + b.Property("CurrentCHSId"); + + b.Property("Density"); + + b.Property("IdentifyData"); + + b.Property("LBA48Sectors"); + + b.Property("LBASectors"); + + b.Property("LogicalAlignment"); + + b.Property("LongBlockSize"); + + b.Property("Manufacturer"); + + b.Property("MediaIsRecognized"); + + b.Property("MediumType"); + + b.Property("MediumTypeName"); + + b.Property("MmcId"); + + b.Property("ModeSense10Data"); + + b.Property("ModeSense6Data"); + + b.Property("Model"); + + b.Property("NominalRotationRate"); + + b.Property("PhysicalBlockSize"); + + b.Property("ScsiId"); + + b.Property("SolidStateDevice"); + + b.Property("SupportsHLDTSTReadRawDVD"); + + b.Property("SupportsNECReadCDDA"); + + b.Property("SupportsPioneerReadCDDA"); + + b.Property("SupportsPioneerReadCDDAMSF"); + + b.Property("SupportsPlextorReadCDDA"); + + b.Property("SupportsPlextorReadRawDVD"); + + b.Property("SupportsRead10"); + + b.Property("SupportsRead12"); + + b.Property("SupportsRead16"); + + b.Property("SupportsRead6"); + + b.Property("SupportsReadCapacity"); + + b.Property("SupportsReadCapacity16"); + + b.Property("SupportsReadCd"); + + b.Property("SupportsReadCdMsf"); + + b.Property("SupportsReadCdMsfRaw"); + + b.Property("SupportsReadCdRaw"); + + b.Property("SupportsReadDma"); + + b.Property("SupportsReadDmaLba"); + + b.Property("SupportsReadDmaLba48"); + + b.Property("SupportsReadDmaRetry"); + + b.Property("SupportsReadDmaRetryLba"); + + b.Property("SupportsReadLba"); + + b.Property("SupportsReadLba48"); + + b.Property("SupportsReadLong"); + + b.Property("SupportsReadLong16"); + + b.Property("SupportsReadLongLba"); + + b.Property("SupportsReadLongRetry"); + + b.Property("SupportsReadLongRetryLba"); + + b.Property("SupportsReadRetry"); + + b.Property("SupportsReadRetryLba"); + + b.Property("SupportsReadSectors"); + + b.Property("SupportsSeek"); + + b.Property("SupportsSeekLba"); + + b.Property("UnformattedBPS"); + + b.Property("UnformattedBPT"); + + b.HasKey("Id"); + + b.HasIndex("AtaId"); + + b.HasIndex("CHSId"); + + b.HasIndex("CurrentCHSId"); + + b.HasIndex("MmcId"); + + b.HasIndex("ScsiId"); + + b.ToTable("TestedMedia"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CanReadMediaSerial"); + + b.Property("Density"); + + b.Property("Manufacturer"); + + b.Property("MediaIsRecognized"); + + b.Property("MediumType"); + + b.Property("MediumTypeName"); + + b.Property("ModeSense10Data"); + + b.Property("ModeSense6Data"); + + b.Property("Model"); + + b.Property("SscId"); + + b.HasKey("Id"); + + b.HasIndex("SscId"); + + b.ToTable("TestedSequentialMedia"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Usb", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Descriptors"); + + b.Property("Manufacturer"); + + b.Property("Product"); + + b.Property("ProductID"); + + b.Property("RemovableMedia"); + + b.Property("VendorID"); + + b.HasKey("Id"); + + b.ToTable("Usb"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Command", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Commands"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ATAId"); + + b.Property("ATAPIId"); + + b.Property("CompactFlash"); + + b.Property("FireWireId"); + + b.Property("LastSynchronized"); + + b.Property("Manufacturer"); + + b.Property("Model"); + + b.Property("MultiMediaCardId"); + + b.Property("PCMCIAId"); + + b.Property("Revision"); + + b.Property("SCSIId"); + + b.Property("SecureDigitalId"); + + b.Property("Type"); + + b.Property("USBId"); + + b.HasKey("Id"); + + b.HasIndex("ATAId"); + + b.HasIndex("ATAPIId"); + + b.HasIndex("FireWireId"); + + b.HasIndex("MultiMediaCardId"); + + b.HasIndex("PCMCIAId"); + + b.HasIndex("SCSIId"); + + b.HasIndex("SecureDigitalId"); + + b.HasIndex("USBId"); + + b.ToTable("Devices"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Filesystem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Filesystems"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Filter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.MediaFormat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("MediaFormats"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Partition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Partitions"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Report", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ATAId"); + + b.Property("ATAPIId"); + + b.Property("CompactFlash"); + + b.Property("Created"); + + b.Property("FireWireId"); + + b.Property("Manufacturer"); + + b.Property("Model"); + + b.Property("MultiMediaCardId"); + + b.Property("PCMCIAId"); + + b.Property("Revision"); + + b.Property("SCSIId"); + + b.Property("SecureDigitalId"); + + b.Property("Type"); + + b.Property("USBId"); + + b.Property("Uploaded"); + + b.HasKey("Id"); + + b.HasIndex("ATAId"); + + b.HasIndex("ATAPIId"); + + b.HasIndex("FireWireId"); + + b.HasIndex("MultiMediaCardId"); + + b.HasIndex("PCMCIAId"); + + b.HasIndex("SCSIId"); + + b.HasIndex("SecureDigitalId"); + + b.HasIndex("USBId"); + + b.ToTable("Reports"); + }); + + modelBuilder.Entity("DiscImageChef.Decoders.SCSI.Modes+ModePage_2A", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccurateCDDA"); + + b.Property("AudioPlay"); + + b.Property("BCK"); + + b.Property("BUF"); + + b.Property("BufferSize"); + + b.Property("C2Pointer"); + + b.Property("CDDACommand"); + + b.Property("CMRSupported"); + + b.Property("Composite"); + + b.Property("CurrentSpeed"); + + b.Property("CurrentWriteSpeed"); + + b.Property("CurrentWriteSpeedSelected"); + + b.Property("DeinterlaveSubchannel"); + + b.Property("DigitalPort1"); + + b.Property("DigitalPort2"); + + b.Property("Eject"); + + b.Property("ISRC"); + + b.Property("LSBF"); + + b.Property("LeadInPW"); + + b.Property("Length"); + + b.Property("LoadingMechanism"); + + b.Property("Lock"); + + b.Property("LockState"); + + b.Property("MaxWriteSpeed"); + + b.Property("MaximumSpeed"); + + b.Property("Method2"); + + b.Property("Mode2Form1"); + + b.Property("Mode2Form2"); + + b.Property("MultiSession"); + + b.Property("PS"); + + b.Property("PreventJumper"); + + b.Property("RCK"); + + b.Property("ReadBarcode"); + + b.Property("ReadCDR"); + + b.Property("ReadCDRW"); + + b.Property("ReadDVDR"); + + b.Property("ReadDVDRAM"); + + b.Property("ReadDVDROM"); + + b.Property("RotationControlSelected"); + + b.Property("SCC"); + + b.Property("SDP"); + + b.Property("SSS"); + + b.Property("SeparateChannelMute"); + + b.Property("SeparateChannelVolume"); + + b.Property("Subchannel"); + + b.Property("SupportedVolumeLevels"); + + b.Property("TestWrite"); + + b.Property("UPC"); + + b.Property("WriteCDR"); + + b.Property("WriteCDRW"); + + b.Property("WriteDVDR"); + + b.Property("WriteDVDRAM"); + + b.HasKey("Id"); + + b.ToTable("ModePage_2A"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Ata", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities") + .WithMany() + .HasForeignKey("ReadCapabilitiesId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.BlockDescriptor", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode") + .WithMany("BlockDescriptors") + .HasForeignKey("ScsiModeId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.DensityCode", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia") + .WithMany("DensityCodes") + .HasForeignKey("SscSupportedMediaId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Mmc", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcFeatures", "Features") + .WithMany() + .HasForeignKey("FeaturesId"); + + b.HasOne("DiscImageChef.Decoders.SCSI.Modes+ModePage_2A", "ModeSense2A") + .WithMany() + .HasForeignKey("ModeSense2AId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.Scsi", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode", "ModeSense") + .WithMany() + .HasForeignKey("ModeSenseId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc", "MultiMediaDevice") + .WithMany() + .HasForeignKey("MultiMediaDeviceId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedMedia", "ReadCapabilities") + .WithMany() + .HasForeignKey("ReadCapabilitiesId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc", "SequentialDevice") + .WithMany() + .HasForeignKey("SequentialDeviceId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.ScsiPage", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi") + .WithMany("EVPDPages") + .HasForeignKey("ScsiId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.ScsiMode") + .WithMany("ModePages") + .HasForeignKey("ScsiModeId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SscSupportedMedia", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc") + .WithMany("SupportedMediaTypes") + .HasForeignKey("SscId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia") + .WithMany("SupportedMediaTypes") + .HasForeignKey("TestedSequentialMediaId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.SupportedDensity", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc") + .WithMany("SupportedDensities") + .HasForeignKey("SscId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia") + .WithMany("SupportedDensities") + .HasForeignKey("TestedSequentialMediaId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedMedia", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata") + .WithMany("RemovableMedias") + .HasForeignKey("AtaId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CHS") + .WithMany() + .HasForeignKey("CHSId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Chs", "CurrentCHS") + .WithMany() + .HasForeignKey("CurrentCHSId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Mmc") + .WithMany("TestedMedia") + .HasForeignKey("MmcId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi") + .WithMany("RemovableMedias") + .HasForeignKey("ScsiId"); + }); + + modelBuilder.Entity("DiscImageChef.CommonTypes.Metadata.TestedSequentialMedia", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ssc") + .WithMany("TestedMedia") + .HasForeignKey("SscId"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Device", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA") + .WithMany() + .HasForeignKey("ATAId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI") + .WithMany() + .HasForeignKey("ATAPIId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire") + .WithMany() + .HasForeignKey("FireWireId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard") + .WithMany() + .HasForeignKey("MultiMediaCardId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA") + .WithMany() + .HasForeignKey("PCMCIAId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI") + .WithMany() + .HasForeignKey("SCSIId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital") + .WithMany() + .HasForeignKey("SecureDigitalId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB") + .WithMany() + .HasForeignKey("USBId"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Report", b => + { + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATA") + .WithMany() + .HasForeignKey("ATAId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Ata", "ATAPI") + .WithMany() + .HasForeignKey("ATAPIId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.FireWire", "FireWire") + .WithMany() + .HasForeignKey("FireWireId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "MultiMediaCard") + .WithMany() + .HasForeignKey("MultiMediaCardId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Pcmcia", "PCMCIA") + .WithMany() + .HasForeignKey("PCMCIAId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Scsi", "SCSI") + .WithMany() + .HasForeignKey("SCSIId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.MmcSd", "SecureDigital") + .WithMany() + .HasForeignKey("SecureDigitalId"); + + b.HasOne("DiscImageChef.CommonTypes.Metadata.Usb", "USB") + .WithMany() + .HasForeignKey("USBId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.cs b/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.cs new file mode 100644 index 000000000..cc3f635a3 --- /dev/null +++ b/DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.cs @@ -0,0 +1,70 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DiscImageChef.Database.Migrations +{ + public partial class NameValueStatistics : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable("Commands", + table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(nullable: true), + Synchronized = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_Commands", x => x.Id); }); + + migrationBuilder.CreateTable("Filesystems", + table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(nullable: true), + Synchronized = table.Column(nullable: false) + }, + constraints: table => { table.PrimaryKey("PK_Filesystems", x => x.Id); }); + + migrationBuilder.CreateTable("Filters", + table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(nullable: true), + Synchronized = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_Filters", x => x.Id); }); + + migrationBuilder.CreateTable("MediaFormats", + table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(nullable: true), + Synchronized = table.Column(nullable: false) + }, + constraints: table => { table.PrimaryKey("PK_MediaFormats", x => x.Id); }); + + migrationBuilder.CreateTable("Partitions", + table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(nullable: true), + Synchronized = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_Partitions", x => x.Id); }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable("Commands"); + + migrationBuilder.DropTable("Filesystems"); + + migrationBuilder.DropTable("Filters"); + + migrationBuilder.DropTable("MediaFormats"); + + migrationBuilder.DropTable("Partitions"); + } + } +} \ No newline at end of file diff --git a/DiscImageChef.Database/Migrations/DicContextModelSnapshot.cs b/DiscImageChef.Database/Migrations/DicContextModelSnapshot.cs index e67e2ca3b..2750c3db3 100644 --- a/DiscImageChef.Database/Migrations/DicContextModelSnapshot.cs +++ b/DiscImageChef.Database/Migrations/DicContextModelSnapshot.cs @@ -824,6 +824,19 @@ namespace DiscImageChef.Database.Migrations b.ToTable("Usb"); }); + modelBuilder.Entity("DiscImageChef.Database.Models.Command", b => + { + b.Property("Id").ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Commands"); + }); + modelBuilder.Entity("DiscImageChef.Database.Models.Device", b => { b.Property("Id").ValueGeneratedOnAdd(); @@ -877,6 +890,58 @@ namespace DiscImageChef.Database.Migrations b.ToTable("Devices"); }); + modelBuilder.Entity("DiscImageChef.Database.Models.Filesystem", b => + { + b.Property("Id").ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Filesystems"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Filter", b => + { + b.Property("Id").ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Filters"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.MediaFormat", b => + { + b.Property("Id").ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("MediaFormats"); + }); + + modelBuilder.Entity("DiscImageChef.Database.Models.Partition", b => + { + b.Property("Id").ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Synchronized"); + + b.HasKey("Id"); + + b.ToTable("Partitions"); + }); + modelBuilder.Entity("DiscImageChef.Database.Models.Report", b => { b.Property("Id").ValueGeneratedOnAdd(); diff --git a/DiscImageChef.Database/Models/Command.cs b/DiscImageChef.Database/Models/Command.cs new file mode 100644 index 000000000..b9790d5b9 --- /dev/null +++ b/DiscImageChef.Database/Models/Command.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace DiscImageChef.Database.Models +{ + public class Command + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + public bool Synchronized { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.Database/Models/Filesystem.cs b/DiscImageChef.Database/Models/Filesystem.cs new file mode 100644 index 000000000..42572c97a --- /dev/null +++ b/DiscImageChef.Database/Models/Filesystem.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace DiscImageChef.Database.Models +{ + public class Filesystem + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + public bool Synchronized { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.Database/Models/Filter.cs b/DiscImageChef.Database/Models/Filter.cs new file mode 100644 index 000000000..68cff354c --- /dev/null +++ b/DiscImageChef.Database/Models/Filter.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace DiscImageChef.Database.Models +{ + public class Filter + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + public bool Synchronized { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.Database/Models/MediaFormat.cs b/DiscImageChef.Database/Models/MediaFormat.cs new file mode 100644 index 000000000..a20f0a105 --- /dev/null +++ b/DiscImageChef.Database/Models/MediaFormat.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace DiscImageChef.Database.Models +{ + public class MediaFormat + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + public bool Synchronized { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.Database/Models/Partition.cs b/DiscImageChef.Database/Models/Partition.cs new file mode 100644 index 000000000..0d8f9a9e0 --- /dev/null +++ b/DiscImageChef.Database/Models/Partition.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace DiscImageChef.Database.Models +{ + public class Partition + { + [Key] + public int Id { get; set; } + public string Name { get; set; } + public bool Synchronized { get; set; } + } +} \ No newline at end of file diff --git a/DiscImageChef.EntityFramework/DiscImageChef.EntityFramework.csproj b/DiscImageChef.EntityFramework/DiscImageChef.EntityFramework.csproj index 45a8e5a5c..229683c37 100644 --- a/DiscImageChef.EntityFramework/DiscImageChef.EntityFramework.csproj +++ b/DiscImageChef.EntityFramework/DiscImageChef.EntityFramework.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs index d8f8e0e51..d6b015049 100644 --- a/DiscImageChef/Main.cs +++ b/DiscImageChef/Main.cs @@ -31,15 +31,19 @@ // ****************************************************************************/ using System; +using System.Data.Entity.Migrations; using System.Reflection; using System.Threading.Tasks; using CommandLine; using DiscImageChef.Commands; using DiscImageChef.Console; +using DiscImageChef.Database; +using DiscImageChef.Database.Migrations; using DiscImageChef.Gui.Forms; using DiscImageChef.Settings; using Eto; using Eto.Forms; +using Microsoft.EntityFrameworkCore; using Statistics = DiscImageChef.Core.Statistics; namespace DiscImageChef @@ -53,6 +57,10 @@ namespace DiscImageChef DicConsole.WriteEvent += System.Console.Write; DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; + var ctx = new DicContext(); + ctx.Database.Migrate(); + ctx.SaveChanges(); + Settings.Settings.LoadSettings(); if((args.Length < 1 || args[0].ToLowerInvariant() != "gui") && Settings.Settings.Current.GdprCompliance < DicSettings.GdprLevel) Configure.DoConfigure(true);