mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Migrate to .NET Core 3.0.
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
https://go.microsoft.com/fwlink/?LinkId=301879
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="DicServerContext" connectionString="server=localhost;port=3306;database=discimagechef;uid=dic;password=dicpass"
|
||||
providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
|
||||
<providers>
|
||||
<provider invariantName="MySql.Data.MySqlClient"
|
||||
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework"/>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
|
||||
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
||||
@@ -1,105 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DiscImageChef.Server.Task</RootNamespace>
|
||||
<AssemblyName>DiscImageChef.Server.Task</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
<PropertyGroup>
|
||||
<ReleaseVersion>$(Version)</ReleaseVersion>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<Version>4.5.99.1693</Version>
|
||||
<Company>Claunia.com</Company>
|
||||
<Copyright>Copyright © 2011-2019 Natalia Portillo</Copyright>
|
||||
<Product>The Disc Image Chef</Product>
|
||||
<Title>DiscImageChef.Server</Title>
|
||||
<ApplicationVersion>$(Version)</ApplicationVersion>
|
||||
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
<PropertyGroup>
|
||||
<NrtRevisionFormat>$(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}</NrtRevisionFormat>
|
||||
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
|
||||
<NrtShowRevision>true</NrtShowRevision>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="DiscImageChef.CommonTypes, Version=4.5.99.1693, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\..\..\..\tmp\claunia-temp-aspnet-0\e277a754\assembly\shadow\34ef13c2\840cc539_b0e3d6fb_00000001\DiscImageChef.CommonTypes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DiscImageChef.Decoders, Version=4.5.99.1693, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\..\..\..\..\tmp\claunia-temp-aspnet-0\e277a754\assembly\shadow\3a88f867\8a6b2e9c_b0e3d6fb_00000001\DiscImageChef.Decoders.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<HintPath>..\..\..\.nuget\packages\entityframework\6.2.0\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.16" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj" />
|
||||
<ProjectReference Include="..\DiscImageChef.Server\DiscImageChef.Server.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
|
||||
<Project>{f8bdf57b-1571-4cd0-84b3-b422088d359a}</Project>
|
||||
<Name>DiscImageChef.Helpers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Server\DiscImageChef.Server.csproj">
|
||||
<Project>{911addf5-e5fa-445d-88cd-c7f8ffdbe645}</Project>
|
||||
<Name>DiscImageChef.Server</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EntityFramework" Version="6.2.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.12" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\LICENSE.LGPL">
|
||||
<Link>LICENSE.LGPL</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4')) and '$(OS)' == 'Unix'">
|
||||
<!-- When compiling .NET SDK 2.0 projects targeting .NET 4.x on Mono using 'dotnet build' you -->
|
||||
<!-- have to teach MSBuild where the Mono copy of the reference asssemblies is -->
|
||||
<!-- Look in the standard install locations -->
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND EXISTS('/Library/Frameworks/Mono.framework/Versions/Current/lib/mono')">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND EXISTS('/usr/lib/mono')">/usr/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND EXISTS('/usr/local/lib/mono')">/usr/local/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
<!-- If we found Mono reference assemblies, then use them -->
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net40'">$(BaseFrameworkPathOverrideForMono)/4.0-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net45'">$(BaseFrameworkPathOverrideForMono)/4.5-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net451'">$(BaseFrameworkPathOverrideForMono)/4.5.1-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net452'">$(BaseFrameworkPathOverrideForMono)/4.5.2-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net46'">$(BaseFrameworkPathOverrideForMono)/4.6-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net461'">$(BaseFrameworkPathOverrideForMono)/4.6.1-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net462'">$(BaseFrameworkPathOverrideForMono)/4.6.2-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net47'">$(BaseFrameworkPathOverrideForMono)/4.7-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net471'">$(BaseFrameworkPathOverrideForMono)/4.7.1-api</FrameworkPathOverride>
|
||||
<EnableFrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">true</EnableFrameworkPathOverride>
|
||||
<!-- Add the Facades directory. Not sure how else to do this. Necessary at least for .NET 4.5 -->
|
||||
<AssemblySearchPaths Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">$(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)</AssemblySearchPaths>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -31,14 +31,13 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using DiscImageChef.Server.Migrations;
|
||||
using DiscImageChef.Server.Models;
|
||||
using HtmlAgilityPack;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DiscImageChef.Server.Task
|
||||
{
|
||||
@@ -47,30 +46,29 @@ namespace DiscImageChef.Server.Task
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
DateTime start, end;
|
||||
Console.WriteLine("{0}: Migrating database to latest version...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
Configuration migratorConfig = new Configuration();
|
||||
DbMigrator dbMigrator = new DbMigrator(migratorConfig);
|
||||
dbMigrator.Update();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", DateTime.UtcNow, (end - start).TotalSeconds);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Connecting to database...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Connecting to database...", DateTime.UtcNow);
|
||||
DicServerContext ctx = new DicServerContext();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
System.Console.WriteLine("{0}: Migrating database to latest version...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
ctx.Database.Migrate();
|
||||
end = DateTime.UtcNow;
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", DateTime.UtcNow, (end - start).TotalSeconds);
|
||||
|
||||
WebClient client;
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("{0}: Retrieving USB IDs from Linux USB...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Retrieving USB IDs from Linux USB...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
client = new WebClient();
|
||||
StringReader sr = new StringReader(client.DownloadString("http://www.linux-usb.org/usb.ids"));
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
UsbVendor vendor = null;
|
||||
int newVendors = 0;
|
||||
@@ -80,16 +78,16 @@ namespace DiscImageChef.Server.Task
|
||||
int counter = 0;
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Adding and updating database entries...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Adding and updating database entries...", DateTime.UtcNow);
|
||||
do
|
||||
{
|
||||
if(counter == 1000)
|
||||
{
|
||||
DateTime start2 = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Saving changes", start2);
|
||||
System.Console.WriteLine("{0}: Saving changes", start2);
|
||||
ctx.SaveChanges();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start2).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start2).TotalSeconds);
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
@@ -118,7 +116,7 @@ namespace DiscImageChef.Server.Task
|
||||
{
|
||||
product = new UsbProduct(vendor, number, name);
|
||||
ctx.UsbProducts.Add(product);
|
||||
Console.WriteLine("{0}: Will add product {1} with ID {2:X4} and vendor {3} ({4:X4})",
|
||||
System.Console.WriteLine("{0}: Will add product {1} with ID {2:X4} and vendor {3} ({4:X4})",
|
||||
DateTime.UtcNow, product.Product, product.ProductId,
|
||||
product.Vendor?.Vendor ?? "null", product.Vendor?.VendorId ?? 0);
|
||||
newProducts++;
|
||||
@@ -126,7 +124,7 @@ namespace DiscImageChef.Server.Task
|
||||
}
|
||||
else if(name != product.Product)
|
||||
{
|
||||
Console
|
||||
System.Console
|
||||
.WriteLine("{0}: Will modify product with ID {1:X4} and vendor {2} ({3:X4}) from \"{4}\" to \"{5}\"",
|
||||
DateTime.UtcNow, product.ProductId, product.Vendor?.Vendor ?? "null",
|
||||
product.Vendor?.VendorId ?? 0,
|
||||
@@ -153,14 +151,14 @@ namespace DiscImageChef.Server.Task
|
||||
{
|
||||
vendor = new UsbVendor(number, name);
|
||||
ctx.UsbVendors.Add(vendor);
|
||||
Console.WriteLine("{0}: Will add vendor {1} with ID {2:X4}", DateTime.UtcNow, vendor.Vendor,
|
||||
System.Console.WriteLine("{0}: Will add vendor {1} with ID {2:X4}", DateTime.UtcNow, vendor.Vendor,
|
||||
vendor.VendorId);
|
||||
newVendors++;
|
||||
counter++;
|
||||
}
|
||||
else if(name != vendor.Vendor)
|
||||
{
|
||||
Console.WriteLine("{0}: Will modify vendor with ID {1:X4} from \"{2}\" to \"{3}\"",
|
||||
System.Console.WriteLine("{0}: Will modify vendor with ID {1:X4} from \"{2}\" to \"{3}\"",
|
||||
DateTime.UtcNow, vendor.VendorId, vendor.Vendor, name);
|
||||
vendor.Vendor = name;
|
||||
vendor.ModifiedWhen = DateTime.UtcNow;
|
||||
@@ -171,68 +169,68 @@ namespace DiscImageChef.Server.Task
|
||||
while(true);
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: Saving database changes...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Saving database changes...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
ctx.SaveChanges();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: {1} vendors added.", DateTime.UtcNow, newVendors);
|
||||
Console.WriteLine("{0}: {1} products added.", DateTime.UtcNow, newProducts);
|
||||
Console.WriteLine("{0}: {1} vendors modified.", DateTime.UtcNow, modifiedVendors);
|
||||
Console.WriteLine("{0}: {1} products modified.", DateTime.UtcNow, modifiedProducts);
|
||||
System.Console.WriteLine("{0}: {1} vendors added.", DateTime.UtcNow, newVendors);
|
||||
System.Console.WriteLine("{0}: {1} products added.", DateTime.UtcNow, newProducts);
|
||||
System.Console.WriteLine("{0}: {1} vendors modified.", DateTime.UtcNow, modifiedVendors);
|
||||
System.Console.WriteLine("{0}: {1} products modified.", DateTime.UtcNow, modifiedProducts);
|
||||
|
||||
Console.WriteLine("{0}: Looking up a vendor", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Looking up a vendor", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
vendor = ctx.UsbVendors.FirstOrDefault(v => v.VendorId == 0x8086);
|
||||
if(vendor is null) Console.WriteLine("{0}: Error, could not find vendor.", DateTime.UtcNow);
|
||||
if(vendor is null) System.Console.WriteLine("{0}: Error, could not find vendor.", DateTime.UtcNow);
|
||||
else
|
||||
Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow,
|
||||
System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow,
|
||||
vendor.Vendor);
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: Looking up a product", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Looking up a product", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
UsbProduct prd =
|
||||
ctx.UsbProducts.FirstOrDefault(p => p.ProductId == 0x0001 && p.Vendor.VendorId == 0x8086);
|
||||
if(prd is null) Console.WriteLine("{0}: Error, could not find product.", DateTime.UtcNow);
|
||||
else Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, prd.Product);
|
||||
if(prd is null) System.Console.WriteLine("{0}: Error, could not find product.", DateTime.UtcNow);
|
||||
else System.Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow, prd.Product);
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
Console.WriteLine("{0}: Exception {1} filling USB IDs...", DateTime.UtcNow, ex);
|
||||
System.Console.WriteLine("{0}: Exception {1} filling USB IDs...", DateTime.UtcNow, ex);
|
||||
}
|
||||
|
||||
Console.WriteLine("{0}: Fixing all devices without modification time...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Fixing all devices without modification time...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
foreach(Device device in ctx.Devices.Where(d => d.ModifiedWhen == null))
|
||||
device.ModifiedWhen = device.AddedWhen;
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: Committing changes...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Committing changes...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
ctx.SaveChanges();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("{0}: Retrieving CompactDisc read offsets from AccurateRip...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Retrieving CompactDisc read offsets from AccurateRip...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
|
||||
client = new WebClient();
|
||||
string html = client.DownloadString("http://www.accuraterip.com/driveoffsets.htm");
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
// The HTML is too malformed to process easily, so find start of table
|
||||
html = "<html><body><table><tr>" +
|
||||
@@ -247,7 +245,7 @@ namespace DiscImageChef.Server.Task
|
||||
int addedOffsets = 0;
|
||||
int modifiedOffsets = 0;
|
||||
|
||||
Console.WriteLine("{0}: Processing offsets...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Processing offsets...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
foreach(HtmlNode row in firstTable.Descendants("tr"))
|
||||
{
|
||||
@@ -255,7 +253,7 @@ namespace DiscImageChef.Server.Task
|
||||
|
||||
if(columns.Length != 4)
|
||||
{
|
||||
Console.WriteLine("{0}: Row does not have correct number of columns...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Row does not have correct number of columns...", DateTime.UtcNow);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -268,28 +266,28 @@ namespace DiscImageChef.Server.Task
|
||||
{
|
||||
if(column0.ToLowerInvariant() != "cd drive")
|
||||
{
|
||||
Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
columns[0].InnerText);
|
||||
break;
|
||||
}
|
||||
|
||||
if(column1.ToLowerInvariant() != "correction offset")
|
||||
{
|
||||
Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
columns[1].InnerText);
|
||||
break;
|
||||
}
|
||||
|
||||
if(column2.ToLowerInvariant() != "submitted by")
|
||||
{
|
||||
Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
columns[2].InnerText);
|
||||
break;
|
||||
}
|
||||
|
||||
if(column3.ToLowerInvariant() != "percentage agree")
|
||||
{
|
||||
Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
System.Console.WriteLine("{0}: Unexpected header \"{1}\" found...", DateTime.UtcNow,
|
||||
columns[3].InnerText);
|
||||
break;
|
||||
}
|
||||
@@ -412,23 +410,23 @@ namespace DiscImageChef.Server.Task
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: Committing changes...", DateTime.UtcNow);
|
||||
System.Console.WriteLine("{0}: Committing changes...", DateTime.UtcNow);
|
||||
start = DateTime.UtcNow;
|
||||
ctx.SaveChanges();
|
||||
end = DateTime.UtcNow;
|
||||
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
|
||||
|
||||
Console.WriteLine("{0}: Added {1} offsets", end, addedOffsets);
|
||||
Console.WriteLine("{0}: Modified {1} offsets", end, modifiedOffsets);
|
||||
System.Console.WriteLine("{0}: Added {1} offsets", end, addedOffsets);
|
||||
System.Console.WriteLine("{0}: Modified {1} offsets", end, modifiedOffsets);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
#if DEBUG
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
Console.WriteLine("{0}: Exception {1} filling CompactDisc read offsets...", DateTime.UtcNow, ex);
|
||||
System.Console.WriteLine("{0}: Exception {1} filling CompactDisc read offsets...", DateTime.UtcNow, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DiscImageChef.Server.Task")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DiscImageChef.Server.Task")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2011-2019 Natalia Portillo")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("4.5.99.1693")]
|
||||
[assembly: AssemblyFileVersion("4.5.99.1693")]
|
||||
Reference in New Issue
Block a user