mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move operating system statistics to database.
This commit is contained in:
3
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
3
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -309,6 +309,8 @@
|
|||||||
<e p="20181221032605_MediaStatistics.cs" t="Include" />
|
<e p="20181221032605_MediaStatistics.cs" t="Include" />
|
||||||
<e p="20181221034941_SeenDevicesStatistics.Designer.cs" t="Include" />
|
<e p="20181221034941_SeenDevicesStatistics.Designer.cs" t="Include" />
|
||||||
<e p="20181221034941_SeenDevicesStatistics.cs" t="Include" />
|
<e p="20181221034941_SeenDevicesStatistics.cs" t="Include" />
|
||||||
|
<e p="20181221040408_OperatingSystemStatistics.Designer.cs" t="Include" />
|
||||||
|
<e p="20181221040408_OperatingSystemStatistics.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">
|
||||||
@@ -319,6 +321,7 @@
|
|||||||
<e p="Filter.cs" t="Include" />
|
<e p="Filter.cs" t="Include" />
|
||||||
<e p="Media.cs" t="Include" />
|
<e p="Media.cs" t="Include" />
|
||||||
<e p="MediaFormat.cs" t="Include" />
|
<e p="MediaFormat.cs" t="Include" />
|
||||||
|
<e p="OperatingSystem.cs" t="Include" />
|
||||||
<e p="Partition.cs" t="Include" />
|
<e p="Partition.cs" t="Include" />
|
||||||
<e p="Report.cs" t="Include" />
|
<e p="Report.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ using DiscImageChef.Database;
|
|||||||
using DiscImageChef.Database.Models;
|
using DiscImageChef.Database.Models;
|
||||||
using Device = DiscImageChef.Devices.Device;
|
using Device = DiscImageChef.Devices.Device;
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||||
|
using OperatingSystem = DiscImageChef.Database.Models.OperatingSystem;
|
||||||
using Version = DiscImageChef.CommonTypes.Interop.Version;
|
using Version = DiscImageChef.CommonTypes.Interop.Version;
|
||||||
|
|
||||||
namespace DiscImageChef.Core
|
namespace DiscImageChef.Core
|
||||||
@@ -75,18 +76,14 @@ namespace DiscImageChef.Core
|
|||||||
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
|
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
|
||||||
{
|
{
|
||||||
AllStats = new Stats();
|
AllStats = new Stats();
|
||||||
|
ctx.OperatingSystems.Add(new OperatingSystem
|
||||||
|
{
|
||||||
|
Name = DetectOS.GetRealPlatformID().ToString(),
|
||||||
|
Synchronized = false,
|
||||||
|
Version = DetectOS.GetVersion()
|
||||||
|
});
|
||||||
CurrentStats = new Stats
|
CurrentStats = new Stats
|
||||||
{
|
{
|
||||||
OperatingSystems =
|
|
||||||
new List<OsStats>
|
|
||||||
{
|
|
||||||
new OsStats
|
|
||||||
{
|
|
||||||
name = DetectOS.GetRealPlatformID().ToString(),
|
|
||||||
Value = 1,
|
|
||||||
version = DetectOS.GetVersion()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Versions = new List<NameValueStats>
|
Versions = new List<NameValueStats>
|
||||||
{
|
{
|
||||||
new NameValueStats {name = Version.GetVersion(), Value = 1}
|
new NameValueStats {name = Version.GetVersion(), Value = 1}
|
||||||
@@ -100,18 +97,14 @@ namespace DiscImageChef.Core
|
|||||||
else if(Settings.Settings.Current.Stats != null)
|
else if(Settings.Settings.Current.Stats != null)
|
||||||
{
|
{
|
||||||
AllStats = new Stats();
|
AllStats = new Stats();
|
||||||
|
ctx.OperatingSystems.Add(new OperatingSystem
|
||||||
|
{
|
||||||
|
Name = DetectOS.GetRealPlatformID().ToString(),
|
||||||
|
Synchronized = false,
|
||||||
|
Version = DetectOS.GetVersion()
|
||||||
|
});
|
||||||
CurrentStats = new Stats
|
CurrentStats = new Stats
|
||||||
{
|
{
|
||||||
OperatingSystems =
|
|
||||||
new List<OsStats>
|
|
||||||
{
|
|
||||||
new OsStats
|
|
||||||
{
|
|
||||||
name = DetectOS.GetRealPlatformID().ToString(),
|
|
||||||
Value = 1,
|
|
||||||
version = DetectOS.GetVersion()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Versions = new List<NameValueStats>
|
Versions = new List<NameValueStats>
|
||||||
{
|
{
|
||||||
new NameValueStats {name = Version.GetVersion(), Value = 1}
|
new NameValueStats {name = Version.GetVersion(), Value = 1}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ namespace DiscImageChef.Database
|
|||||||
public DbSet<Partition> Partitions { get; set; }
|
public DbSet<Partition> Partitions { get; set; }
|
||||||
public DbSet<Media> Medias { get; set; }
|
public DbSet<Media> Medias { get; set; }
|
||||||
public DbSet<DeviceStat> SeenDevices { get; set; }
|
public DbSet<DeviceStat> SeenDevices { get; set; }
|
||||||
|
public DbSet<OperatingSystem> OperatingSystems { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,8 @@
|
|||||||
<Compile Include="Migrations\20181221032605_MediaStatistics.Designer.cs" />
|
<Compile Include="Migrations\20181221032605_MediaStatistics.Designer.cs" />
|
||||||
<Compile Include="Migrations\20181221034941_SeenDevicesStatistics.cs" />
|
<Compile Include="Migrations\20181221034941_SeenDevicesStatistics.cs" />
|
||||||
<Compile Include="Migrations\20181221034941_SeenDevicesStatistics.Designer.cs" />
|
<Compile Include="Migrations\20181221034941_SeenDevicesStatistics.Designer.cs" />
|
||||||
|
<Compile Include="Migrations\20181221040408_OperatingSystemStatistics.cs" />
|
||||||
|
<Compile Include="Migrations\20181221040408_OperatingSystemStatistics.Designer.cs" />
|
||||||
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
|
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
|
||||||
<Compile Include="Models\Command.cs" />
|
<Compile Include="Models\Command.cs" />
|
||||||
<Compile Include="Models\Device.cs" />
|
<Compile Include="Models\Device.cs" />
|
||||||
@@ -78,6 +80,7 @@
|
|||||||
<Compile Include="Models\Filter.cs" />
|
<Compile Include="Models\Filter.cs" />
|
||||||
<Compile Include="Models\Media.cs" />
|
<Compile Include="Models\Media.cs" />
|
||||||
<Compile Include="Models\MediaFormat.cs" />
|
<Compile Include="Models\MediaFormat.cs" />
|
||||||
|
<Compile Include="Models\OperatingSystem.cs" />
|
||||||
<Compile Include="Models\Partition.cs" />
|
<Compile Include="Models\Partition.cs" />
|
||||||
<Compile Include="Models\Report.cs" />
|
<Compile Include="Models\Report.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
1381
DiscImageChef.Database/Migrations/20181221040408_OperatingSystemStatistics.Designer.cs
generated
Normal file
1381
DiscImageChef.Database/Migrations/20181221040408_OperatingSystemStatistics.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class OperatingSystemStatistics : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable("OperatingSystems",
|
||||||
|
table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
Name = table.Column<string>(nullable: true),
|
||||||
|
Version = table.Column<string>(nullable: true),
|
||||||
|
Synchronized = table.Column<bool>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table => { table.PrimaryKey("PK_OperatingSystems", x => x.Id); });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable("OperatingSystems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -963,6 +963,21 @@ namespace DiscImageChef.Database.Migrations
|
|||||||
b.ToTable("MediaFormats");
|
b.ToTable("MediaFormats");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscImageChef.Database.Models.OperatingSystem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<bool>("Synchronized");
|
||||||
|
|
||||||
|
b.Property<string>("Version");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("OperatingSystems");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DiscImageChef.Database.Models.Partition", b =>
|
modelBuilder.Entity("DiscImageChef.Database.Models.Partition", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id").ValueGeneratedOnAdd();
|
b.Property<int>("Id").ValueGeneratedOnAdd();
|
||||||
|
|||||||
13
DiscImageChef.Database/Models/OperatingSystem.cs
Normal file
13
DiscImageChef.Database/Models/OperatingSystem.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Database.Models
|
||||||
|
{
|
||||||
|
public class OperatingSystem
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public bool Synchronized { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user