mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move NameValue statistics to database.
This commit is contained in:
8
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
8
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -57,6 +57,7 @@
|
|||||||
<e p="Settings.StyleCop" t="Include" />
|
<e p="Settings.StyleCop" t="Include" />
|
||||||
<e p="StyleCop.Cache" t="Include" />
|
<e p="StyleCop.Cache" t="Include" />
|
||||||
<e p="bin" t="ExcludeRecursive" />
|
<e p="bin" t="ExcludeRecursive" />
|
||||||
|
<e p="discimagechef.db" t="Include" />
|
||||||
<e p="obj" t="ExcludeRecursive">
|
<e p="obj" t="ExcludeRecursive">
|
||||||
<e p="Debug" t="Include">
|
<e p="Debug" t="Include">
|
||||||
<e p="net461" t="Include">
|
<e p="net461" t="Include">
|
||||||
@@ -302,10 +303,17 @@
|
|||||||
<e p="20181127001622_AddDeviceBasicFields.cs" t="Include" />
|
<e p="20181127001622_AddDeviceBasicFields.cs" t="Include" />
|
||||||
<e p="20181127013131_CorrectReportsDbSet.Designer.cs" t="Include" />
|
<e p="20181127013131_CorrectReportsDbSet.Designer.cs" t="Include" />
|
||||||
<e p="20181127013131_CorrectReportsDbSet.cs" t="Include" />
|
<e p="20181127013131_CorrectReportsDbSet.cs" t="Include" />
|
||||||
|
<e p="20181221015906_NameValueStatistics.Designer.cs" t="Include" />
|
||||||
|
<e p="20181221015906_NameValueStatistics.cs" t="Include" />
|
||||||
<e p="DicContextModelSnapshot.cs" t="Include" />
|
<e p="DicContextModelSnapshot.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<e p="Models" t="Include">
|
<e p="Models" t="Include">
|
||||||
|
<e p="Command.cs" t="Include" />
|
||||||
<e p="Device.cs" t="Include" />
|
<e p="Device.cs" t="Include" />
|
||||||
|
<e p="Filesystem.cs" t="Include" />
|
||||||
|
<e p="Filter.cs" t="Include" />
|
||||||
|
<e p="MediaFormat.cs" t="Include" />
|
||||||
|
<e p="Partition.cs" t="Include" />
|
||||||
<e p="Report.cs" t="Include" />
|
<e p="Report.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<e p="bin" t="ExcludeRecursive" />
|
<e p="bin" t="ExcludeRecursive" />
|
||||||
|
|||||||
@@ -110,6 +110,7 @@
|
|||||||
<Project>{ccaa7afe-c094-4d82-a66d-630de8a3f545}</Project>
|
<Project>{ccaa7afe-c094-4d82-a66d-630de8a3f545}</Project>
|
||||||
<Name>DiscImageChef.Console</Name>
|
<Name>DiscImageChef.Console</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\DiscImageChef.Database\DiscImageChef.Database.csproj" />
|
||||||
<ProjectReference Include="..\DiscImageChef.Filesystems\DiscImageChef.Filesystems.csproj">
|
<ProjectReference Include="..\DiscImageChef.Filesystems\DiscImageChef.Filesystems.csproj">
|
||||||
<Project>{D7016DF2-5A5E-4524-B40D-BA2D59576688}</Project>
|
<Project>{D7016DF2-5A5E-4524-B40D-BA2D59576688}</Project>
|
||||||
<Name>DiscImageChef.Filesystems</Name>
|
<Name>DiscImageChef.Filesystems</Name>
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ using System.Threading;
|
|||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes.Interop;
|
using DiscImageChef.CommonTypes.Interop;
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
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 MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||||
using Version = DiscImageChef.CommonTypes.Interop.Version;
|
using Version = DiscImageChef.CommonTypes.Interop.Version;
|
||||||
|
|
||||||
@@ -63,6 +65,8 @@ namespace DiscImageChef.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
static bool submitStatsLock;
|
static bool submitStatsLock;
|
||||||
|
|
||||||
|
static DicContext ctx = new DicContext();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads saved statistics from disk
|
/// Loads saved statistics from disk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -126,6 +130,8 @@ namespace DiscImageChef.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SaveStats()
|
public static void SaveStats()
|
||||||
{
|
{
|
||||||
|
ctx.SaveChanges();
|
||||||
|
|
||||||
if(AllStats == null) return;
|
if(AllStats == null) return;
|
||||||
|
|
||||||
if(AllStats.OperatingSystems != null)
|
if(AllStats.OperatingSystems != null)
|
||||||
@@ -220,7 +226,7 @@ namespace DiscImageChef.Core
|
|||||||
System.Console.WriteLine("Uploading partial statistics file {0}", statsFile);
|
System.Console.WriteLine("Uploading partial statistics file {0}", statsFile);
|
||||||
#else
|
#else
|
||||||
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile);
|
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
|
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
|
||||||
XmlSerializer xs = new XmlSerializer(stats.GetType());
|
XmlSerializer xs = new XmlSerializer(stats.GetType());
|
||||||
@@ -261,7 +267,7 @@ namespace DiscImageChef.Core
|
|||||||
throw;
|
throw;
|
||||||
#else
|
#else
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
submitStatsLock = false;
|
submitStatsLock = false;
|
||||||
@@ -275,99 +281,11 @@ namespace DiscImageChef.Core
|
|||||||
/// <param name="command">Command</param>
|
/// <param name="command">Command</param>
|
||||||
public static void AddCommand(string 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(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.DeviceStats) return;
|
||||||
|
|
||||||
if(AllStats.Commands == null) AllStats.Commands = new CommandsStats();
|
ctx.Commands.Add(new Command {Name = command, Synchronized = false});
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -376,44 +294,11 @@ namespace DiscImageChef.Core
|
|||||||
/// <param name="filesystem">Filesystem name</param>
|
/// <param name="filesystem">Filesystem name</param>
|
||||||
public static void AddFilesystem(string filesystem)
|
public static void AddFilesystem(string filesystem)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(filesystem)) return;
|
||||||
|
|
||||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilesystemStats) return;
|
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilesystemStats) return;
|
||||||
|
|
||||||
if(AllStats.Filesystems == null) AllStats.Filesystems = new List<NameValueStats>();
|
ctx.Filesystems.Add(new Filesystem {Name = filesystem, Synchronized = false});
|
||||||
if(CurrentStats.Filesystems == null) CurrentStats.Filesystems = new List<NameValueStats>();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -422,58 +307,29 @@ namespace DiscImageChef.Core
|
|||||||
/// <param name="partition">Partition scheme name</param>
|
/// <param name="partition">Partition scheme name</param>
|
||||||
internal static void AddPartition(string partition)
|
internal static void AddPartition(string partition)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(partition)) return;
|
||||||
|
|
||||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.PartitionStats) return;
|
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.PartitionStats) return;
|
||||||
|
|
||||||
if(AllStats.Partitions == null) AllStats.Partitions = new List<NameValueStats>();
|
ctx.Partitions.Add(new Partition {Name = partition, Synchronized = false});
|
||||||
if(CurrentStats.Partitions == null) CurrentStats.Partitions = new List<NameValueStats>();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new filter to statistics
|
/// Adds a new filter to statistics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="format">Filter name</param>
|
/// <param name="filter">Filter name</param>
|
||||||
public static void AddFilter(string format)
|
public static void AddFilter(string filter)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(filter)) return;
|
||||||
|
|
||||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilterStats) 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<NameValueStats>();
|
if(AllStats.Filters == null) AllStats.Filters = new List<NameValueStats>();
|
||||||
if(CurrentStats.Filters == null) CurrentStats.Filters = new List<NameValueStats>();
|
if(CurrentStats.Filters == null) CurrentStats.Filters = new List<NameValueStats>();
|
||||||
|
|
||||||
NameValueStats old = AllStats.Filters.FirstOrDefault(nvs => nvs.name == format);
|
NameValueStats old = AllStats.Filters.FirstOrDefault(nvs => nvs.name == filter);
|
||||||
|
|
||||||
NameValueStats nw = new NameValueStats();
|
NameValueStats nw = new NameValueStats();
|
||||||
if(old != null)
|
if(old != null)
|
||||||
@@ -484,13 +340,13 @@ namespace DiscImageChef.Core
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nw.name = format;
|
nw.name = filter;
|
||||||
nw.Value = 1;
|
nw.Value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllStats.Filters.Add(nw);
|
AllStats.Filters.Add(nw);
|
||||||
|
|
||||||
old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == format);
|
old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == filter);
|
||||||
|
|
||||||
nw = new NameValueStats();
|
nw = new NameValueStats();
|
||||||
if(old != null)
|
if(old != null)
|
||||||
@@ -501,7 +357,7 @@ namespace DiscImageChef.Core
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nw.name = format;
|
nw.name = filter;
|
||||||
nw.Value = 1;
|
nw.Value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,44 +370,11 @@ namespace DiscImageChef.Core
|
|||||||
/// <param name="format">Media image name</param>
|
/// <param name="format">Media image name</param>
|
||||||
public static void AddMediaFormat(string format)
|
public static void AddMediaFormat(string format)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(format)) return;
|
||||||
|
|
||||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaImageStats) return;
|
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaImageStats) return;
|
||||||
|
|
||||||
if(AllStats.MediaImages == null) AllStats.MediaImages = new List<NameValueStats>();
|
ctx.MediaFormats.Add(new MediaFormat {Name = format, Synchronized = false});
|
||||||
if(CurrentStats.MediaImages == null) CurrentStats.MediaImages = new List<NameValueStats>();
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -37,13 +37,19 @@ namespace DiscImageChef.Database
|
|||||||
{
|
{
|
||||||
public sealed class DicContext : DbContext
|
public sealed class DicContext : DbContext
|
||||||
{
|
{
|
||||||
|
// Note: If table does not appear check that last migration has been REALLY added to the project
|
||||||
public DicContext()
|
public DicContext()
|
||||||
{
|
{
|
||||||
Database.Migrate();
|
Database.Migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DbSet<Device> Devices { get; set; }
|
public DbSet<Device> Devices { get; set; }
|
||||||
public DbSet<Report> Reports { get; set; }
|
public DbSet<Report> Reports { get; set; }
|
||||||
|
public DbSet<Command> Commands { get; set; }
|
||||||
|
public DbSet<Filesystem> Filesystems { get; set; }
|
||||||
|
public DbSet<Filter> Filters { get; set; }
|
||||||
|
public DbSet<MediaFormat> MediaFormats { get; set; }
|
||||||
|
public DbSet<Partition> Partitions { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,8 +64,15 @@
|
|||||||
<Compile Include="Migrations\20181127001622_AddDeviceBasicFields.Designer.cs" />
|
<Compile Include="Migrations\20181127001622_AddDeviceBasicFields.Designer.cs" />
|
||||||
<Compile Include="Migrations\20181127013131_CorrectReportsDbSet.cs" />
|
<Compile Include="Migrations\20181127013131_CorrectReportsDbSet.cs" />
|
||||||
<Compile Include="Migrations\20181127013131_CorrectReportsDbSet.Designer.cs" />
|
<Compile Include="Migrations\20181127013131_CorrectReportsDbSet.Designer.cs" />
|
||||||
|
<Compile Include="Migrations\20181221015906_NameValueStatistics.cs" />
|
||||||
|
<Compile Include="Migrations\20181221015906_NameValueStatistics.Designer.cs" />
|
||||||
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
|
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
|
||||||
|
<Compile Include="Models\Command.cs" />
|
||||||
<Compile Include="Models\Device.cs" />
|
<Compile Include="Models\Device.cs" />
|
||||||
|
<Compile Include="Models\Filesystem.cs" />
|
||||||
|
<Compile Include="Models\Filter.cs" />
|
||||||
|
<Compile Include="Models\MediaFormat.cs" />
|
||||||
|
<Compile Include="Models\Partition.cs" />
|
||||||
<Compile Include="Models\Report.cs" />
|
<Compile Include="Models\Report.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
1329
DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.Designer.cs
generated
Normal file
1329
DiscImageChef.Database/Migrations/20181221015906_NameValueStatistics.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(nullable: false)
|
||||||
|
}, constraints: table => { table.PrimaryKey("PK_Commands", x => x.Id); });
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable("Filesystems",
|
||||||
|
table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table => { table.PrimaryKey("PK_Filesystems", x => x.Id); });
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable("Filters",
|
||||||
|
table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(nullable: false)
|
||||||
|
}, constraints: table => { table.PrimaryKey("PK_Filters", x => x.Id); });
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable("MediaFormats",
|
||||||
|
table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table => { table.PrimaryKey("PK_MediaFormats", x => x.Id); });
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable("Partitions",
|
||||||
|
table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -824,6 +824,19 @@ namespace DiscImageChef.Database.Migrations
|
|||||||
b.ToTable("Usb");
|
b.ToTable("Usb");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.Command", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Commands");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DiscImageChef.Database.Models.Device", b =>
|
modelBuilder.Entity("DiscImageChef.Database.Models.Device", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
@@ -877,6 +890,58 @@ namespace DiscImageChef.Database.Migrations
|
|||||||
b.ToTable("Devices");
|
b.ToTable("Devices");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.Filesystem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Filesystems");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.Filter", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Filters");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.MediaFormat", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("MediaFormats");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.Partition", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Partitions");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DiscImageChef.Database.Models.Report", b =>
|
modelBuilder.Entity("DiscImageChef.Database.Models.Report", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|||||||
12
DiscImageChef.Database/Models/Command.cs
Normal file
12
DiscImageChef.Database/Models/Command.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
DiscImageChef.Database/Models/Filesystem.cs
Normal file
12
DiscImageChef.Database/Models/Filesystem.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
DiscImageChef.Database/Models/Filter.cs
Normal file
12
DiscImageChef.Database/Models/Filter.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
DiscImageChef.Database/Models/MediaFormat.cs
Normal file
12
DiscImageChef.Database/Models/MediaFormat.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
DiscImageChef.Database/Models/Partition.cs
Normal file
12
DiscImageChef.Database/Models/Partition.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
|||||||
@@ -31,15 +31,19 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using DiscImageChef.Commands;
|
using DiscImageChef.Commands;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
|
using DiscImageChef.Database;
|
||||||
|
using DiscImageChef.Database.Migrations;
|
||||||
using DiscImageChef.Gui.Forms;
|
using DiscImageChef.Gui.Forms;
|
||||||
using DiscImageChef.Settings;
|
using DiscImageChef.Settings;
|
||||||
using Eto;
|
using Eto;
|
||||||
using Eto.Forms;
|
using Eto.Forms;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Statistics = DiscImageChef.Core.Statistics;
|
using Statistics = DiscImageChef.Core.Statistics;
|
||||||
|
|
||||||
namespace DiscImageChef
|
namespace DiscImageChef
|
||||||
@@ -53,6 +57,10 @@ namespace DiscImageChef
|
|||||||
DicConsole.WriteEvent += System.Console.Write;
|
DicConsole.WriteEvent += System.Console.Write;
|
||||||
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
|
DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine;
|
||||||
|
|
||||||
|
var ctx = new DicContext();
|
||||||
|
ctx.Database.Migrate();
|
||||||
|
ctx.SaveChanges();
|
||||||
|
|
||||||
Settings.Settings.LoadSettings();
|
Settings.Settings.LoadSettings();
|
||||||
if((args.Length < 1 || args[0].ToLowerInvariant() != "gui") &&
|
if((args.Length < 1 || args[0].ToLowerInvariant() != "gui") &&
|
||||||
Settings.Settings.Current.GdprCompliance < DicSettings.GdprLevel) Configure.DoConfigure(true);
|
Settings.Settings.Current.GdprCompliance < DicSettings.GdprLevel) Configure.DoConfigure(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user