Move server to separate folder.

This commit is contained in:
2019-11-02 01:40:41 +00:00
commit fd3f98384c
141 changed files with 37891 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?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>

View File

@@ -0,0 +1,105 @@
<?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')" />
<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>
</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>
<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>
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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>

View File

@@ -0,0 +1,435 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Program.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server Task.
//
// --[ Description ] ----------------------------------------------------------
//
// Runs time consuming server tasks.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
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;
namespace DiscImageChef.Server.Task
{
class Program
{
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);
DicServerContext ctx = new DicServerContext();
end = DateTime.UtcNow;
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
WebClient client;
try
{
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);
UsbVendor vendor = null;
int newVendors = 0;
int newProducts = 0;
int modifiedVendors = 0;
int modifiedProducts = 0;
int counter = 0;
start = DateTime.UtcNow;
Console.WriteLine("{0}: Adding and updating database entries...", DateTime.UtcNow);
do
{
if(counter == 1000)
{
DateTime start2 = DateTime.UtcNow;
Console.WriteLine("{0}: Saving changes", start2);
ctx.SaveChanges();
end = DateTime.UtcNow;
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start2).TotalSeconds);
counter = 0;
}
string line = sr.ReadLine();
if(line is null) break;
if(line.Length == 0 || line[0] == '#') continue;
ushort number;
string name;
if(line[0] == '\t')
{
try { number = Convert.ToUInt16(line.Substring(1, 4), 16); }
catch(FormatException) { continue; }
if(number == 0) continue;
name = line.Substring(7);
UsbProduct product =
ctx.UsbProducts.FirstOrDefault(p => p.ProductId == number && p.Vendor != null &&
p.Vendor.VendorId == vendor.VendorId);
if(product is null)
{
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})",
DateTime.UtcNow, product.Product, product.ProductId,
product.Vendor?.Vendor ?? "null", product.Vendor?.VendorId ?? 0);
newProducts++;
counter++;
}
else if(name != product.Product)
{
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,
product.Product, name);
product.Product = name;
product.ModifiedWhen = DateTime.UtcNow;
modifiedProducts++;
counter++;
}
continue;
}
try { number = Convert.ToUInt16(line.Substring(0, 4), 16); }
catch(FormatException) { continue; }
if(number == 0) continue;
name = line.Substring(6);
vendor = ctx.UsbVendors.FirstOrDefault(v => v.VendorId == number);
if(vendor is null)
{
vendor = new UsbVendor(number, name);
ctx.UsbVendors.Add(vendor);
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}\"",
DateTime.UtcNow, vendor.VendorId, vendor.Vendor, name);
vendor.Vendor = name;
vendor.ModifiedWhen = DateTime.UtcNow;
modifiedVendors++;
counter++;
}
}
while(true);
end = DateTime.UtcNow;
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
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);
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);
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);
else
Console.WriteLine("{0}: Found {1}.", DateTime.UtcNow,
vendor.Vendor);
end = DateTime.UtcNow;
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
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);
end = DateTime.UtcNow;
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);
}
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);
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);
try
{
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);
// The HTML is too malformed to process easily, so find start of table
html = "<html><body><table><tr>" +
html.Substring(html.IndexOf("<td bgcolor=\"#000000\">", StringComparison.Ordinal));
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
HtmlNode firstTable = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]");
bool firstRow = true;
int addedOffsets = 0;
int modifiedOffsets = 0;
Console.WriteLine("{0}: Processing offsets...", DateTime.UtcNow);
start = DateTime.UtcNow;
foreach(HtmlNode row in firstTable.Descendants("tr"))
{
HtmlNode[] columns = row.Descendants("td").ToArray();
if(columns.Length != 4)
{
Console.WriteLine("{0}: Row does not have correct number of columns...", DateTime.UtcNow);
continue;
}
string column0 = columns[0].InnerText;
string column1 = columns[1].InnerText;
string column2 = columns[2].InnerText;
string column3 = columns[3].InnerText;
if(firstRow)
{
if(column0.ToLowerInvariant() != "cd drive")
{
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,
columns[1].InnerText);
break;
}
if(column2.ToLowerInvariant() != "submitted by")
{
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,
columns[3].InnerText);
break;
}
firstRow = false;
continue;
}
string manufacturer;
string model;
if(column0[0] == '-' && column0[1] == ' ')
{
manufacturer = null;
model = column0.Substring(2).Trim();
}
else
{
int cutOffset = column0.IndexOf(" - ", StringComparison.Ordinal);
if(cutOffset == -1)
{
manufacturer = null;
model = column0;
}
else
{
manufacturer = column0.Substring(0, cutOffset).Trim();
model = column0.Substring(cutOffset + 3).Trim();
}
}
switch(manufacturer)
{
case "Lite-ON":
manufacturer = "JLMS";
break;
case "LG Electronics":
manufacturer = "HL-DT-ST";
break;
case "Panasonic":
manufacturer = "MATSHITA";
break;
}
CompactDiscOffset cdOffset =
ctx.CdOffsets.FirstOrDefault(o => o.Manufacturer == manufacturer && o.Model == model);
if(column1.ToLowerInvariant() == "[purged]")
{
if(cdOffset != null) ctx.CdOffsets.Remove(cdOffset);
continue;
}
if(!short.TryParse(column1, out short offset)) continue;
if(!int.TryParse(column2, out int submissions)) continue;
if(column3[column3.Length - 1] != '%') continue;
column3 = column3.Substring(0, column3.Length - 1);
if(!float.TryParse(column3, out float percentage)) continue;
percentage /= 100;
if(cdOffset is null)
{
cdOffset = new CompactDiscOffset
{
AddedWhen = DateTime.UtcNow,
ModifiedWhen = DateTime.UtcNow,
Agreement = percentage,
Manufacturer = manufacturer,
Model = model,
Offset = offset,
Submissions = submissions
};
ctx.CdOffsets.Add(cdOffset);
addedOffsets++;
}
else
{
if(Math.Abs(cdOffset.Agreement - percentage) > 0)
{
cdOffset.Agreement = percentage;
cdOffset.ModifiedWhen = DateTime.UtcNow;
}
if(cdOffset.Offset != offset)
{
cdOffset.Offset = offset;
cdOffset.ModifiedWhen = DateTime.UtcNow;
}
if(cdOffset.Submissions != submissions)
{
cdOffset.Submissions = submissions;
cdOffset.ModifiedWhen = DateTime.UtcNow;
}
if(Math.Abs(cdOffset.Agreement - percentage) > 0 || cdOffset.Offset != offset ||
cdOffset.Submissions != submissions) modifiedOffsets++;
}
foreach(Device device in ctx
.Devices
.Where(d => d.Manufacturer == null && d.Model != null &&
d.Model.Trim() == model)
.Union(ctx.Devices.Where(d => d.Manufacturer != null &&
d.Manufacturer.Trim() == manufacturer &&
d.Model != null &&
d.Model == model)))
{
if(device.CdOffset == cdOffset && device.ModifiedWhen == cdOffset.ModifiedWhen) continue;
device.CdOffset = cdOffset;
device.ModifiedWhen = cdOffset.ModifiedWhen;
}
}
end = DateTime.UtcNow;
Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
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);
Console.WriteLine("{0}: Added {1} offsets", end, addedOffsets);
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);
}
}
}
}

View File

@@ -0,0 +1,35 @@
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")]

61
DiscImageChef.Server.sln Normal file
View File

@@ -0,0 +1,61 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Server", "DiscImageChef.Server\DiscImageChef.Server.csproj", "{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.CommonTypes", "DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj", "{F2B84194-26EB-4227-B1C5-6602517E85AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Decoders", "DiscImageChef.Decoders\DiscImageChef.Decoders.csproj", "{0BEB3088-B634-4289-AE17-CDF2D25D00D5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Dto", "DiscImageChef.Dto\DiscImageChef.Dto.csproj", "{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Helpers", "DiscImageChef.Helpers\DiscImageChef.Helpers.csproj", "{F8BDF57B-1571-4CD0-84B3-B422088D359A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Console", "DiscImageChef.Console\DiscImageChef.Console.csproj", "{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Server.Task", "DiscImageChef.Server.Task\DiscImageChef.Server.Task.csproj", "{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}.Debug|Any CPU.Build.0 = Debug|Any CPU
{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}.Release|Any CPU.ActiveCfg = Release|Any CPU
{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}.Release|Any CPU.Build.0 = Release|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Release|Any CPU.Build.0 = Release|Any CPU
{0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Release|Any CPU.Build.0 = Release|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}.Release|Any CPU.Build.0 = Release|Any CPU
{F8BDF57B-1571-4CD0-84B3-B422088D359A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8BDF57B-1571-4CD0-84B3-B422088D359A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8BDF57B-1571-4CD0-84B3-B422088D359A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8BDF57B-1571-4CD0-84B3-B422088D359A}.Release|Any CPU.Build.0 = Release|Any CPU
{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Release|Any CPU.Build.0 = Release|Any CPU
{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79D6A54E-47B6-4D0A-ABEB-4FA7B5ADF4B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8A988A8F-0588-4935-AAB6-64E34A68CE30}
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : RouteConfig.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Sets ASP.NET routing information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Web.Mvc;
using System.Web.Routing;
namespace DiscImageChef.Server
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
routes.MapRoute("Default", "{controller}/{action}/{id}",
new {controller = "Home", action = "Index", id = UrlParameter.Optional});
}
}
}

View File

@@ -0,0 +1,93 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ScsiEvpd.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes SCSI EVPDs from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server
{
public static class ScsiEvpd
{
/// <summary>
/// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET in
/// the rendering
/// </summary>
/// <param name="pages">EVPD pages</param>
/// <param name="vendor">SCSI vendor string</param>
/// <param name="evpdPages">List to put the key=value pairs on</param>
public static void Report(IEnumerable<ScsiPage> pages, string vendor, ref Dictionary<string, string> evpdPages)
{
foreach(ScsiPage evpd in pages)
{
string decoded;
if(evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value);
else if(evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value);
else if(evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value);
else if(evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value);
else if(evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value);
else if(evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value);
else if(evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value);
else if(evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value);
else if(evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value);
else if(evpd.page == 0xB2)
decoded =
$"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}<br/>";
else if(evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value);
else if(evpd.page == 0xC0 && vendor.Trim() == "quantum")
decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value);
else if(evpd.page == 0xC0 && vendor.Trim() == "seagate")
decoded =
EVPD.PrettifyPage_C0_Seagate(evpd.value);
else if(evpd.page == 0xC0 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C0_IBM(evpd.value);
else if(evpd.page == 0xC1 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C1_IBM(evpd.value);
else if((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value);
else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
evpd.page == 0xC6) &&
vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
evpd.page == 0xC4 || evpd.page == 0xC5) &&
vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);
else if(evpd.page == 0xDF && vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_DF_Certance(evpd.value);
else decoded = "Undecoded";
if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "<br/>");
evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,290 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ScsiMmcFeatures.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes SCSI MMC features from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI.MMC;
namespace DiscImageChef.Server
{
public static class ScsiMmcFeatures
{
/// <summary>
/// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// </summary>
/// <param name="ftr">FEATURES part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(MmcFeatures ftr, ref List<string> mmcOneValue)
{
if(ftr.SupportsAACS && ftr.AACSVersion.HasValue)
mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}");
else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
if(ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if(ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
if(ftr.BindingNonceBlocks.HasValue)
mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce");
}
if(ftr.BlocksPerReadableUnit > 1)
mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit");
if(ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
if(ftr.BufferUnderrunFreeInSAO) mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
if(ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
if(ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command");
if(ftr.CanEject) mmcOneValue.Add("Drive can eject media");
if(ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing");
if(ftr.CanExpandBDRESpareArea) mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
if(ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks");
if(ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
if(ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
if(ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification");
if(ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs");
if(ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format");
if(ftr.CanLoad) mmcOneValue.Add("Drive can load media");
if(ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately");
if(ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
if(ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
if(ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output");
if(ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
if(ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
if(ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
if(ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM");
if(ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1");
if(ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1");
if(ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2");
if(ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1");
if(ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
if(ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM");
if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW");
else if(ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write DVD+MRW");
else if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW");
else if(ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW");
else if(ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
else if(ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW");
if(ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
if(ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs");
if(ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD");
if(ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW");
else if(ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW");
if(ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R");
else if(ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R");
if(ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL");
else if(ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL");
if(ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate");
if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R");
else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM");
else if(ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
if(ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In");
if(ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0");
if(ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0");
if(ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
if(ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information");
if(ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number");
if(ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number");
if(ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R");
if(ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs");
if(ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
if(ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
if(ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade");
if(ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
if(ftr.Locked) mmcOneValue.Add("Drive can lock media");
if(ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
if(ftr.MultiRead)
mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
if(ftr.PhysicalInterfaceStandard.HasValue)
switch(ftr.PhysicalInterfaceStandard)
{
case PhysicalInterfaces.Unspecified:
mmcOneValue.Add("Drive uses an unspecified physical interface");
break;
case PhysicalInterfaces.SCSI:
mmcOneValue.Add("Drive uses SCSI interface");
break;
case PhysicalInterfaces.ATAPI:
mmcOneValue.Add("Drive uses ATAPI interface");
break;
case PhysicalInterfaces.IEEE1394:
mmcOneValue.Add("Drive uses IEEE-1394 interface");
break;
case PhysicalInterfaces.IEEE1394A:
mmcOneValue.Add("Drive uses IEEE-1394A interface");
break;
case PhysicalInterfaces.FC:
mmcOneValue.Add("Drive uses Fibre Channel interface");
break;
case PhysicalInterfaces.IEEE1394B:
mmcOneValue.Add("Drive uses IEEE-1394B interface");
break;
case PhysicalInterfaces.SerialATAPI:
mmcOneValue.Add("Drive uses Serial ATAPI interface");
break;
case PhysicalInterfaces.USB:
mmcOneValue.Add("Drive uses USB interface");
break;
case PhysicalInterfaces.Vendor:
mmcOneValue.Add("Drive uses a vendor unique interface");
break;
default:
mmcOneValue
.Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
break;
}
if(ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked");
if(ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption");
if(ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE");
if(ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1");
if(ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1");
if(ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2");
if(ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption");
if(ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW");
if(ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW");
if(ftr.CanWriteCDSAO && !ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once Mode:");
else if(!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:");
else if(ftr.CanWriteCDSAO && ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:");
if(ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
if(ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs");
if(ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R");
if(ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW");
if(ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL");
else if(ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL");
if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL");
else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL");
else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
else if(ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R");
if(ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if(ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
else if(ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
// TODO: Write HD DVD-RW
/*
else
mmcOneValue.Add("Drive can write HD DVD-RW");
*/
if(ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0");
if(ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0");
if(ftr.CanWriteRWSubchannelInTAO)
{
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode");
if(ftr.CanWriteRawSubchannelInTAO)
mmcOneValue.Add("Drive accepts RAW R-W subchannel data in Track at Once Mode");
if(ftr.CanWritePackedSubchannelInTAO)
mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode");
}
if(ftr.CanWriteRWSubchannelInSAO)
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode");
if(ftr.CanWriteRaw && ftr.CanWriteRawMultiSession)
mmcOneValue.Add("Drive can write multi-session CDs in raw mode");
if(ftr.EmbeddedChanger)
{
mmcOneValue.Add("Drive contains an embedded changer");
if(ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side");
if(ftr.ChangerSupportsDiscPresent)
mmcOneValue.Add("Drive is able to report slots contents after a reset or change");
mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots");
}
if(ftr.SupportsCSS && ftr.CSSVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}");
else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM");
if(ftr.SupportsCPRM && ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM");
if(ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
if(ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
if(ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers");
if(ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
if(ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
if(ftr.LoadingMechanismType.HasValue)
switch(ftr.LoadingMechanismType)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
break;
case 1:
mmcOneValue.Add("Drive uses a tray");
break;
case 2:
mmcOneValue.Add("Drive is pop-up");
break;
case 4:
mmcOneValue.Add("Drive is a changer with individually changeable discs");
break;
case 5:
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add($"Drive uses unknown loading mechanism type {ftr.LoadingMechanismType}");
break;
}
if(ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs");
if(ftr.SupportsModePage1Ch)
mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch");
if(ftr.SupportsOSSC)
mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class");
if(ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status");
if(ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
if(ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if(ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
if(ftr.SupportsWriteInhibitDCB)
mmcOneValue.Add("Drive supports writing the Write Inhibit DCB on DVD+RW media");
mmcOneValue.Sort();
mmcOneValue.Add("");
}
}
}

View File

@@ -0,0 +1,172 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ScsiMmcMode.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes SCSI MODE PAGE 2Ah from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.Linq;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server
{
public static class ScsiMmcMode
{
/// <summary>
/// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// </summary>
/// <param name="mode">MODE PAGE 2Ah part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(Modes.ModePage_2A mode, ref List<string> mmcOneValue)
{
if(mode.AudioPlay) mmcOneValue.Add("Drive can play audio");
if(mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
if(mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
if(mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
if(mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
if(mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
if(mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
if(mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
if(mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers");
if(mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
if(mode.ISRC) mmcOneValue.Add("Drive can read ISRC");
switch(mode.LoadingMechanism)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
break;
case 1:
mmcOneValue.Add("Drive uses a tray");
break;
case 2:
mmcOneValue.Add("Drive is pop-up");
break;
case 4:
mmcOneValue.Add("Drive is a changer with individually changeable discs");
break;
case 5:
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanism}");
break;
}
if(mode.Lock) mmcOneValue.Add("Drive can lock media");
if(mode.PreventJumper)
{
mmcOneValue.Add("Drive power ups locked");
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected or inserted"
: "Drive is not locked, media can be ejected and inserted");
}
else
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
: "Drive is not locked, media can be ejected and inserted");
if(mode.Eject) mmcOneValue.Add("Drive can eject media");
if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
if(mode.SupportedVolumeLevels > 0)
mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels");
if(mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
if(mode.MaximumSpeed > 0)
mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec.");
if(mode.CurrentSpeed > 0)
mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
if(mode.ReadCDR)
{
mmcOneValue.Add(mode.WriteCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
if(mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media");
}
if(mode.ReadCDRW)
mmcOneValue.Add(mode.WriteCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
if(mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
if(mode.ReadDVDR)
mmcOneValue.Add(mode.WriteDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
if(mode.ReadDVDRAM)
mmcOneValue.Add(mode.WriteDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
if(mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
if(mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
if(mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
if(mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
if(mode.CurrentWriteSpeedSelected > 0)
{
if(mode.RotationControlSelected == 0)
mmcOneValue
.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
else if(mode.RotationControlSelected == 1)
mmcOneValue
.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
}
else
{
if(mode.MaxWriteSpeed > 0)
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaxWriteSpeed} Kbyte/sec.");
if(mode.CurrentWriteSpeed > 0)
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
}
if(mode.WriteSpeedPerformanceDescriptors != null)
foreach(Modes.ModePage_2A_WriteDescriptor descriptor in
mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
if(descriptor.RotationControl == 0)
mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
else if(descriptor.RotationControl == 1)
mmcOneValue
.Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
if(mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode");
if(mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc");
if(mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
if(mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
if(mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording");
mmcOneValue.Sort();
mmcOneValue.Add("");
}
}
}

View File

@@ -0,0 +1,381 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ScsiModeSense.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes SCSI MODE PAGEs from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server
{
public static class ScsiModeSense
{
/// <summary>
/// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value pairs
/// to be sequenced by ASP.NET in the rendering
/// </summary>
/// <param name="modeSense">MODE PAGEs part of a device report</param>
/// <param name="vendor">SCSI vendor string</param>
/// <param name="deviceType">SCSI peripheral device type</param>
/// <param name="scsiOneValue">List to put values on</param>
/// <param name="modePages">List to put key=value pairs on</param>
public static void Report(ScsiMode modeSense, string vendor,
PeripheralDeviceTypes deviceType,
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{
if(modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null)
foreach(BlockDescriptor descriptor in modeSense.BlockDescriptors)
if(descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue)
scsiOneValue
.Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
else
scsiOneValue.Add($"Density code {descriptor.Density:X2}h");
if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled");
if(modeSense.BufferedMode.HasValue)
switch(modeSense.BufferedMode)
{
case 0:
scsiOneValue.Add("Device writes directly to media");
break;
case 1:
scsiOneValue.Add("Device uses a write cache");
break;
case 2:
scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed");
break;
default:
scsiOneValue.Add($"Unknown buffered mode code 0x{modeSense.BufferedMode:X2}");
break;
}
if(modeSense.ModePages == null) return;
foreach(ScsiPage page in modeSense.ModePages)
switch(page.page)
{
case 0x00:
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value));
else
modePages
.Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
"Unknown vendor mode page");
break;
}
case 0x01:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_01_MMC(page.value)
: Modes.PrettifyModePage_01(page.value));
else goto default;
break;
}
case 0x02:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value));
else goto default;
break;
}
case 0x03:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value));
else goto default;
break;
}
case 0x04:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value));
else goto default;
break;
}
case 0x05:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value));
else goto default;
break;
}
case 0x06:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value));
else goto default;
break;
}
case 0x07:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_07_MMC(page.value)
: Modes.PrettifyModePage_07(page.value));
else goto default;
break;
}
case 0x08:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value));
else goto default;
break;
}
case 0x0A:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_0A_S01(page.value));
else goto default;
break;
}
case 0x0B:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value));
else goto default;
break;
}
case 0x0D:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value));
else goto default;
break;
}
case 0x0E:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value));
else goto default;
break;
}
case 0x0F:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value));
else goto default;
break;
}
case 0x10:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.SequentialAccess
? Modes.PrettifyModePage_10_SSC(page.value)
: Modes.PrettifyModePage_10(page.value));
else goto default;
break;
}
case 0x11:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value));
else goto default;
break;
}
case 0x12:
case 0x13:
case 0x14:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value));
else goto default;
break;
}
case 0x1A:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1A_S01(page.value));
else goto default;
break;
}
case 0x1B:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value));
else goto default;
break;
}
case 0x1C:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_1C_SFF(page.value)
: Modes.PrettifyModePage_1C(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1C_S01(page.value));
else goto default;
break;
}
case 0x1D:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value));
else goto default;
break;
}
case 0x21:
{
if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value));
else goto default;
break;
}
case 0x22:
{
if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value));
else goto default;
break;
}
case 0x24:
{
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value));
else goto default;
break;
}
case 0x2A:
{
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value));
else goto default;
break;
}
case 0x2F:
{
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value));
else goto default;
break;
}
case 0x30:
{
if(Modes.IsAppleModePage_30(page.value))
modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive");
else goto default;
break;
}
case 0x3B:
{
if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value));
else goto default;
break;
}
case 0x3C:
{
if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value));
else goto default;
break;
}
case 0x3D:
{
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value));
else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value));
else goto default;
break;
}
case 0x3E:
{
if(vendor == "FUJITSU")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value));
else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value));
else goto default;
break;
}
default:
{
modePages.Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
"Unknown mode page");
}
break;
}
Dictionary<string, string> newModePages = new Dictionary<string, string>();
foreach(KeyValuePair<string, string> kvp in modePages)
newModePages.Add(kvp.Key,
string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "<br/>"));
modePages = newModePages;
}
}
}

View File

@@ -0,0 +1,70 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : SscTestedMedia.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes SCSI Streaming media tests from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server
{
public static class SscTestedMedia
{
/// <summary>
/// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values
/// </summary>
/// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedia">List of tested media</param>
public static void Report(IEnumerable<TestedSequentialMedia> testedMedia, ref List<string> mediaOneValue)
{
foreach(TestedSequentialMedia media in testedMedia)
{
if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>");
if(media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
}
else if(media.MediumType.HasValue)
mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
if(!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
if(media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
mediaOneValue.Add("");
}
}
}
}

View File

@@ -0,0 +1,364 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : StatsConverter.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Reads a statistics XML and stores it in the database context.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Linq;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using Version = DiscImageChef.Server.Models.Version;
namespace DiscImageChef.Server
{
public static class StatsConverter
{
public static void Convert(Stats newStats)
{
DicServerContext ctx = new DicServerContext();
if(newStats.Commands != null)
{
if(newStats.Commands.Analyze > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Analyze, Name = "analyze"});
else existing.Count += newStats.Commands.Analyze;
}
if(newStats.Commands.Benchmark > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Benchmark, Name = "benchmark"});
else existing.Count += newStats.Commands.Benchmark;
}
if(newStats.Commands.Checksum > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Checksum, Name = "checksum"});
else existing.Count += newStats.Commands.Checksum;
}
if(newStats.Commands.Compare > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Compare, Name = "compare"});
else existing.Count += newStats.Commands.Compare;
}
if(newStats.Commands.CreateSidecar > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar");
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.CreateSidecar, Name = "create-sidecar"
});
else existing.Count += newStats.Commands.CreateSidecar;
}
if(newStats.Commands.Decode > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Decode, Name = "decode"});
else existing.Count += newStats.Commands.Decode;
}
if(newStats.Commands.DeviceInfo > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceInfo, Name = "device-info"});
else existing.Count += newStats.Commands.DeviceInfo;
}
if(newStats.Commands.DeviceReport > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceReport, Name = "device-report"});
else existing.Count += newStats.Commands.DeviceReport;
}
if(newStats.Commands.DumpMedia > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DumpMedia, Name = "dump-media"});
else existing.Count += newStats.Commands.DumpMedia;
}
if(newStats.Commands.Entropy > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Entropy, Name = "entropy"});
else existing.Count += newStats.Commands.Entropy;
}
if(newStats.Commands.Formats > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Formats, Name = "formats"});
else existing.Count += newStats.Commands.Formats;
}
if(newStats.Commands.MediaInfo > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaInfo, Name = "media-info"});
else existing.Count += newStats.Commands.MediaInfo;
}
if(newStats.Commands.MediaScan > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaScan, Name = "media-scan"});
else existing.Count += newStats.Commands.MediaScan;
}
if(newStats.Commands.PrintHex > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.PrintHex, Name = "printhex"});
else existing.Count += newStats.Commands.PrintHex;
}
if(newStats.Commands.Verify > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Verify, Name = "verify"});
else existing.Count += newStats.Commands.Verify;
}
if(newStats.Commands.Ls > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls");
if(existing == null) ctx.Commands.Add(new Command {Count = newStats.Commands.Ls, Name = "ls"});
else existing.Count += newStats.Commands.Ls;
}
if(newStats.Commands.ExtractFiles > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ExtractFiles, Name = "extract-files"});
else existing.Count += newStats.Commands.ExtractFiles;
}
if(newStats.Commands.ListDevices > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ListDevices, Name = "list-devices"});
else existing.Count += newStats.Commands.ListDevices;
}
if(newStats.Commands.ListEncodings > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings");
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ListEncodings, Name = "list-encodings"
});
else existing.Count += newStats.Commands.ListEncodings;
}
if(newStats.Commands.ConvertImage > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ConvertImage, Name = "convert-image"});
else existing.Count += newStats.Commands.ConvertImage;
}
if(newStats.Commands.ImageInfo > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info");
if(existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ImageInfo, Name = "image-info"});
else existing.Count += newStats.Commands.ImageInfo;
}
}
if(newStats.OperatingSystems != null)
foreach(OsStats operatingSystem in newStats.OperatingSystems)
{
if(string.IsNullOrWhiteSpace(operatingSystem.name) ||
string.IsNullOrWhiteSpace(operatingSystem.version)) continue;
OperatingSystem existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
c.Version == operatingSystem.version);
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Count = operatingSystem.Value,
Name = operatingSystem.name,
Version = operatingSystem.version
});
else existing.Count += operatingSystem.Value;
}
else
{
OperatingSystem existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == "Linux" && c.Version == null);
if(existing == null) ctx.OperatingSystems.Add(new OperatingSystem {Count = 1, Name = "Linux"});
else existing.Count++;
}
if(newStats.Versions != null)
foreach(NameValueStats nvs in newStats.Versions)
{
if(string.IsNullOrWhiteSpace(nvs.name)) continue;
Version existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
if(existing == null) ctx.Versions.Add(new Version {Count = nvs.Value, Value = nvs.name});
else existing.Count += nvs.Value;
}
else
{
Version existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous");
if(existing == null) ctx.Versions.Add(new Version {Count = 1, Value = "previous"});
else existing.Count++;
}
if(newStats.Filesystems != null)
foreach(NameValueStats nvs in newStats.Filesystems)
{
if(string.IsNullOrWhiteSpace(nvs.name)) continue;
Filesystem existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Filesystems.Add(new Filesystem {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
if(newStats.Partitions != null)
foreach(NameValueStats nvs in newStats.Partitions)
{
if(string.IsNullOrWhiteSpace(nvs.name)) continue;
Partition existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Partitions.Add(new Partition {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
if(newStats.MediaImages != null)
foreach(NameValueStats nvs in newStats.MediaImages)
{
if(string.IsNullOrWhiteSpace(nvs.name)) continue;
MediaFormat existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.MediaFormats.Add(new MediaFormat {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
if(newStats.Filters != null)
foreach(NameValueStats nvs in newStats.Filters)
{
if(string.IsNullOrWhiteSpace(nvs.name)) continue;
Filter existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Filters.Add(new Filter {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
if(newStats.Devices != null)
foreach(DeviceStats device in newStats.Devices)
{
if(string.IsNullOrWhiteSpace(device.Model)) continue;
if(!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer &&
c.Model == device.Model && c.Revision == device.Revision))
ctx.DeviceStats.Add(new DeviceStat
{
Bus = device.Bus,
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision
});
}
if(newStats.Medias != null)
foreach(MediaStats media in newStats.Medias)
{
if(string.IsNullOrWhiteSpace(media.type)) continue;
Media existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
if(existing == null)
ctx.Medias.Add(new Media {Count = media.Value, Real = media.real, Type = media.type});
else existing.Count += media.Value;
}
ctx.SaveChanges();
}
}
}

View File

@@ -0,0 +1,306 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : TestedMedia.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Decodes media tests from reports.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.Server.App_Start
{
public static class TestedMedia
{
/// <summary>
/// Takes the tested media from a device report and prints it as a list of values
/// </summary>
/// <param name="ata"><c>true</c> if device report is from an ATA device</param>
/// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedias">List of tested media</param>
public static void Report(List<CommonTypes.Metadata.TestedMedia> testedMedias, ref List<string> mediaOneValue)
{
foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias)
{
if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{testedMedia.MediumTypeName}\"</i>");
if(testedMedia.MediumType != null)
mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h");
}
else if(testedMedia.MediumType != null)
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
mediaOneValue.Add(testedMedia.MediaIsRecognized
? "Drive recognizes this medium."
: "Drive does not recognize this medium.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
if(!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if(testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.BlockSize != null)
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
if(testedMedia.PhysicalBlockSize != null)
mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes");
if(testedMedia.LongBlockSize != null)
mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes");
if(testedMedia.Blocks != null && testedMedia.BlockSize != null)
{
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each");
if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
{
int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
testedMedia.CurrentCHS.Sectors;
mediaOneValue
.Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current");
mediaOneValue
.Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current");
mediaOneValue
.Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current");
mediaOneValue
.Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
else if(testedMedia.CHS != null)
{
int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders}");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}");
mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}");
mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}");
mediaOneValue
.Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if(testedMedia.LBASectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}");
if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if(testedMedia.LBA48Sectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}");
if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if(testedMedia.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.BlockSize != null &&
testedMedia.PhysicalBlockSize != null &&
testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue
.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if(testedMedia.SupportsReadSectors == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");
if(testedMedia.SupportsReadRetry == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadDma == true)
mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium");
if(testedMedia.SupportsReadDmaRetry == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium");
if(testedMedia.SupportsReadLongRetry == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLba == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadRetryLba == true)
mediaOneValue
.Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba == true)
mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaRetryLba == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongLba == true)
mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongRetryLba == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLba48 == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba48 == true)
mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsSeek == true)
mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium");
if(testedMedia.SupportsSeekLba == true)
mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadCapacity == true)
mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium");
if(testedMedia.SupportsReadCapacity16 == true)
mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium");
if(testedMedia.SupportsRead6 == true)
mediaOneValue.Add("Device can use the READ (6) command with this medium");
if(testedMedia.SupportsRead10 == true)
mediaOneValue.Add("Device can use the READ (10) command with this medium");
if(testedMedia.SupportsRead12 == true)
mediaOneValue.Add("Device can use the READ (12) command with this medium");
if(testedMedia.SupportsRead16 == true)
mediaOneValue.Add("Device can use the READ (16) command with this medium");
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG (10) command with this medium");
if(testedMedia.SupportsReadLong16 == true)
mediaOneValue.Add("Device can use the READ LONG (16) command with this medium");
if(testedMedia.SupportsReadCd == true)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium");
if(testedMedia.SupportsReadCdMsf == true)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
if(testedMedia.SupportsReadCdRaw == true)
mediaOneValue
.Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector");
if(testedMedia.SupportsReadCdMsfRaw == true)
mediaOneValue
.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
if(testedMedia.SupportsHLDTSTReadRawDVD == true)
mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium");
if(testedMedia.SupportsNECReadCDDA == true)
mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDA == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDAMSF == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium");
if(testedMedia.SupportsPlextorReadCDDA == true)
mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPlextorReadRawDVD == true)
mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium");
if(testedMedia.CanReadAACS == true)
mediaOneValue.Add("Device can read the Advanced Access Content System from this medium");
if(testedMedia.CanReadADIP == true)
mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium");
if(testedMedia.CanReadATIP == true)
mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium");
if(testedMedia.CanReadBCA == true)
mediaOneValue.Add("Device can read the Burst Cutting Area from this medium");
if(testedMedia.CanReadC2Pointers == true)
mediaOneValue.Add("Device can report the C2 pointers when reading from this medium");
if(testedMedia.CanReadCMI == true)
mediaOneValue.Add("Device can read the Copyright Management Information from this medium");
if(testedMedia.CanReadCorrectedSubchannel == true)
mediaOneValue.Add("Device can correct subchannels when reading from this medium");
if(testedMedia.CanReadCorrectedSubchannelWithC2 == true)
mediaOneValue
.Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
if(testedMedia.CanReadDCB == true)
mediaOneValue.Add("Device can read the Disc Control Blocks from this medium");
if(testedMedia.CanReadDDS == true)
mediaOneValue.Add("Device can read the Disc Definition Structure from this medium");
if(testedMedia.CanReadDMI == true)
mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium");
if(testedMedia.CanReadDiscInformation == true)
mediaOneValue.Add("Device can read the Disc Information from this medium");
if(testedMedia.CanReadFullTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it");
if(testedMedia.CanReadHDCMI == true)
mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium");
if(testedMedia.CanReadLayerCapacity == true)
mediaOneValue.Add("Device can read the layer capacity from this medium");
if(testedMedia.CanReadFirstTrackPreGap == true)
mediaOneValue.Add("Device can read the first track's pregap data");
if(testedMedia.CanReadLeadIn == true) mediaOneValue.Add("Device can read the Lead-In from this medium");
if(testedMedia.CanReadLeadOut == true)
mediaOneValue.Add("Device can read the Lead-Out from this medium");
if(testedMedia.CanReadMediaID == true)
mediaOneValue.Add("Device can read the Media ID from this medium");
if(testedMedia.CanReadMediaSerial == true)
mediaOneValue.Add("Device can read the Media Serial Number from this medium");
if(testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium");
if(testedMedia.CanReadPFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from this medium");
if(testedMedia.CanReadPMA == true)
mediaOneValue.Add("Device can read the Power Management Area from this medium");
if(testedMedia.CanReadPQSubchannel == true)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium");
if(testedMedia.CanReadPQSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadPRI == true)
mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium");
if(testedMedia.CanReadRWSubchannel == true)
mediaOneValue.Add("Device can read the R to W subchannels from this medium");
if(testedMedia.CanReadRWSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadRecordablePFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium");
if(testedMedia.CanReadSpareAreaInformation == true)
mediaOneValue.Add("Device can read the Spare Area Information from this medium");
if(testedMedia.CanReadTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium");
mediaOneValue.Add("");
}
}
}
}

View File

@@ -0,0 +1,61 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : WebApiConfig.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Configures Web API
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
// This is verbatim from ASP.NET so left as is
// ReSharper disable All
using System.Data.Entity.Migrations;
using System.Web.Http;
using DiscImageChef.Server.Migrations;
using DiscImageChef.Server.Models;
namespace DiscImageChef.Server
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{id}",
defaults: new {id = RouteParameter.Optional});
//DicServerContext ctx = new DicServerContext();
Configuration migratorConfig = new Migrations.Configuration();
DbMigrator dbMigrator = new DbMigrator(migratorConfig);
dbMigrator.Update();
}
}
}

View File

@@ -0,0 +1,199 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : HomeController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Provides documentation data for razor views.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Reflection;
using System.Web.Hosting;
using System.Web.Mvc;
using Markdig;
namespace DiscImageChef.Server.Controllers
{
[RoutePrefix("Home")]
public class HomeController : Controller
{
[Route("")]
[Route("~/")]
[Route("README")]
[Route("~/README")]
public ActionResult Index()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "README.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("Changelog")]
[Route("~/Changelog")]
public ActionResult Changelog()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "Changelog.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("CODE_OF_CONDUCT")]
[Route("~/CODE_OF_CONDUCT")]
public ActionResult CODE_OF_CONDUCT()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "CODE_OF_CONDUCT.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("PULL_REQUEST_TEMPLATE")]
[Route("~/PULL_REQUEST_TEMPLATE")]
public ActionResult PULL_REQUEST_TEMPLATE()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "PULL_REQUEST_TEMPLATE.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("ISSUE_TEMPLATE")]
[Route("~/ISSUE_TEMPLATE")]
public ActionResult ISSUE_TEMPLATE()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "ISSUE_TEMPLATE.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("CONTRIBUTING")]
[Route("~/CONTRIBUTING")]
public ActionResult CONTRIBUTING()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "CONTRIBUTING.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("DONATING")]
[Route("~/DONATING")]
public ActionResult DONATING()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "DONATING.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
[Route("TODO")]
[Route("~/TODO")]
public ActionResult TODO()
{
StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "TODO.md"));
string mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
return View();
}
}
}

View File

@@ -0,0 +1,474 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ReportController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Fetches reports from database for Razor views.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.Models;
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Server.Controllers
{
public class ReportController : Controller
{
public ActionResult Index() => RedirectToAction("View", "Report", new RouteValueDictionary {{"id", 1}});
public ActionResult View(int? id)
{
if(id == null || id <= 0) return Content("Incorrect device report request");
try
{
DicServerContext ctx = new DicServerContext();
Device report = ctx.Devices.FirstOrDefault(d => d.Id == id);
if(report is null) return Content("Cannot find requested report");
ViewBag.lblManufacturer = report.Manufacturer;
ViewBag.lblModel = report.Model;
ViewBag.lblRevision = report.Revision;
if(report.USB != null)
{
string usbVendorDescription = null;
string usbProductDescription = null;
UsbProduct dbProduct =
ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID &&
p.Vendor != null &&
p.Vendor.VendorId == report.USB.VendorID);
if(dbProduct is null)
{
UsbVendor dbVendor = ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID);
if(!(dbVendor is null)) usbVendorDescription = dbVendor.Vendor;
}
else
{
usbProductDescription = dbProduct.Product;
usbVendorDescription = dbProduct.Vendor.Vendor;
}
ViewBag.UsbItem = new Item
{
Manufacturer = report.USB.Manufacturer,
Product = report.USB.Product,
VendorDescription =
usbVendorDescription != null
? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})"
: $"0x{report.USB.VendorID:x4}",
ProductDescription = usbProductDescription != null
? $"0x{report.USB.ProductID:x4} ({usbProductDescription})"
: $"0x{report.USB.ProductID:x4}"
};
}
if(report.FireWire != null)
ViewBag.FireWireItem = new Item
{
Manufacturer = report.FireWire.Manufacturer,
Product = report.FireWire.Product,
VendorDescription = $"0x{report.FireWire.VendorID:x8}",
ProductDescription = $"0x{report.FireWire.ProductID:x8}"
};
if(report.PCMCIA != null)
{
ViewBag.PcmciaItem = new PcmciaItem
{
Manufacturer = report.PCMCIA.Manufacturer,
Product = report.PCMCIA.ProductName,
VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}",
ProductDescription = $"0x{report.PCMCIA.CardCode:x4}",
Compliance = report.PCMCIA.Compliance
};
Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS);
if(tuples != null)
{
Dictionary<string, string> decodedTuples = new Dictionary<string, string>();
foreach(Tuple tuple in tuples)
switch(tuple.Code)
{
case TupleCodes.CISTPL_NULL:
case TupleCodes.CISTPL_END:
case TupleCodes.CISTPL_MANFID:
case TupleCodes.CISTPL_VERS_1: break;
case TupleCodes.CISTPL_DEVICEGEO:
case TupleCodes.CISTPL_DEVICEGEO_A:
DeviceGeometryTuple geom = CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom?.Geometries != null)
foreach(DeviceGeometry geometry in geom.Geometries)
{
decodedTuples.Add("Device width",
$"{(1 << (geometry.CardInterface - 1)) * 8} bits");
decodedTuples.Add("Erase block",
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Read block",
$"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Write block",
$"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Partition alignment",
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes");
}
break;
case TupleCodes.CISTPL_ALTSTR:
case TupleCodes.CISTPL_BAR:
case TupleCodes.CISTPL_BATTERY:
case TupleCodes.CISTPL_BYTEORDER:
case TupleCodes.CISTPL_CFTABLE_ENTRY:
case TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
case TupleCodes.CISTPL_CHECKSUM:
case TupleCodes.CISTPL_CONFIG:
case TupleCodes.CISTPL_CONFIG_CB:
case TupleCodes.CISTPL_DATE:
case TupleCodes.CISTPL_DEVICE:
case TupleCodes.CISTPL_DEVICE_A:
case TupleCodes.CISTPL_DEVICE_OA:
case TupleCodes.CISTPL_DEVICE_OC:
case TupleCodes.CISTPL_EXTDEVIC:
case TupleCodes.CISTPL_FORMAT:
case TupleCodes.CISTPL_FORMAT_A:
case TupleCodes.CISTPL_FUNCE:
case TupleCodes.CISTPL_FUNCID:
case TupleCodes.CISTPL_GEOMETRY:
case TupleCodes.CISTPL_INDIRECT:
case TupleCodes.CISTPL_JEDEC_A:
case TupleCodes.CISTPL_JEDEC_C:
case TupleCodes.CISTPL_LINKTARGET:
case TupleCodes.CISTPL_LONGLINK_A:
case TupleCodes.CISTPL_LONGLINK_C:
case TupleCodes.CISTPL_LONGLINK_CB:
case TupleCodes.CISTPL_LONGLINK_MFC:
case TupleCodes.CISTPL_NO_LINK:
case TupleCodes.CISTPL_ORG:
case TupleCodes.CISTPL_PWR_MGMNT:
case TupleCodes.CISTPL_SPCL:
case TupleCodes.CISTPL_SWIL:
case TupleCodes.CISTPL_VERS_2:
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
break;
default:
decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}");
break;
}
if(decodedTuples.Count > 0) ViewBag.repPcmciaTuples = decodedTuples;
}
}
bool removable = true;
List<TestedMedia> testedMedia = null;
bool ata = false;
bool atapi = false;
bool sscMedia = false;
if(report.ATA != null || report.ATAPI != null)
{
ata = true;
List<string> ataOneValue = new List<string>();
Dictionary<string, string> ataTwoValue = new Dictionary<string, string>();
CommonTypes.Metadata.Ata ataReport;
if(report.ATAPI != null)
{
ViewBag.AtaItem = "ATAPI";
ataReport = report.ATAPI;
atapi = true;
}
else
{
ViewBag.AtaItem = "ATA";
ataReport = report.ATA;
}
bool cfa = report.CompactFlash;
if(atapi && !cfa) ViewBag.lblAtaDeviceType = "ATAPI device";
else if(!atapi && cfa) ViewBag.lblAtaDeviceType = "CompactFlash device";
else ViewBag.lblAtaDeviceType = "ATA device";
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
ViewBag.repAtaOne = ataOneValue;
ViewBag.repAtaTwo = ataTwoValue;
}
if(report.SCSI != null)
{
List<string> scsiOneValue = new List<string>();
Dictionary<string, string> modePages = new Dictionary<string, string>();
Dictionary<string, string> evpdPages = new Dictionary<string, string>();
string vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification);
if(report.SCSI.Inquiry != null)
{
Inquiry.SCSIInquiry inq = report.SCSI.Inquiry.Value;
ViewBag.lblScsiVendor = VendorString.Prettify(vendorId) != vendorId
? $"{vendorId} ({VendorString.Prettify(vendorId)})"
: vendorId;
ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification);
ViewBag.lblScsiRevision = StringHandlers.CToString(inq.ProductRevisionLevel);
}
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
if(report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)");
if(report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)");
if(report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages");
if(report.SCSI.ModeSense != null)
{
PeripheralDeviceTypes devType = PeripheralDeviceTypes.DirectAccess;
if(report.SCSI.Inquiry != null)
devType = (PeripheralDeviceTypes)report.SCSI.Inquiry.Value.PeripheralDeviceType;
ScsiModeSense.Report(report.SCSI.ModeSense, vendorId, devType, ref scsiOneValue, ref modePages);
}
if(modePages.Count > 0) ViewBag.repModeSense = modePages;
if(report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages);
if(evpdPages.Count > 0) ViewBag.repEvpd = evpdPages;
if(report.SCSI.MultiMediaDevice != null)
{
testedMedia = report.SCSI.MultiMediaDevice.TestedMedia;
if(report.SCSI.MultiMediaDevice.ModeSense2A != null)
{
List<string> mmcModeOneValue = new List<string>();
ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue);
if(mmcModeOneValue.Count > 0) ViewBag.repScsiMmcMode = mmcModeOneValue;
}
if(report.SCSI.MultiMediaDevice.Features != null)
{
List<string> mmcFeaturesOneValue = new List<string>();
ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue);
if(mmcFeaturesOneValue.Count > 0) ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue;
}
}
else if(report.SCSI.SequentialDevice != null)
{
ViewBag.divScsiSscVisible = true;
ViewBag.lblScsiSscGranularity =
report.SCSI.SequentialDevice.BlockSizeGranularity?.ToString() ?? "Unspecified";
ViewBag.lblScsiSscMaxBlock =
report.SCSI.SequentialDevice.MaxBlockLength?.ToString() ?? "Unspecified";
ViewBag.lblScsiSscMinBlock =
report.SCSI.SequentialDevice.MinBlockLength?.ToString() ?? "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null)
ViewBag.repScsiSscDensities = report.SCSI.SequentialDevice.SupportedDensities;
if(report.SCSI.SequentialDevice.SupportedMediaTypes != null)
ViewBag.repScsiSscMedias = report.SCSI.SequentialDevice.SupportedMediaTypes;
if(report.SCSI.SequentialDevice.TestedMedia != null)
{
List<string> mediaOneValue = new List<string>();
SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue);
if(mediaOneValue.Count > 0)
{
sscMedia = true;
ViewBag.repTestedMedia = mediaOneValue;
}
}
}
else if(report.SCSI.ReadCapabilities != null)
{
removable = false;
scsiOneValue.Add("");
if(report.SCSI.ReadCapabilities.Blocks.HasValue &&
report.SCSI.ReadCapabilities.BlockSize.HasValue)
{
scsiOneValue
.Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each");
if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
1024 > 1000000)
scsiOneValue
.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize /
1024 /
1024 > 1000)
scsiOneValue
.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
scsiOneValue
.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB");
}
if(report.SCSI.ReadCapabilities.MediumType.HasValue)
scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h");
if(report.SCSI.ReadCapabilities.Density.HasValue)
scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h");
if((report.SCSI.ReadCapabilities.SupportsReadLong == true ||
report.SCSI.ReadCapabilities.SupportsReadLong16 == true) &&
report.SCSI.ReadCapabilities.LongBlockSize.HasValue)
scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity == true)
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true)
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
if(report.SCSI.ReadCapabilities.SupportsRead6 == true)
scsiOneValue.Add("Device supports READ (6) command.");
if(report.SCSI.ReadCapabilities.SupportsRead10 == true)
scsiOneValue.Add("Device supports READ (10) command.");
if(report.SCSI.ReadCapabilities.SupportsRead12 == true)
scsiOneValue.Add("Device supports READ (12) command.");
if(report.SCSI.ReadCapabilities.SupportsRead16 == true)
scsiOneValue.Add("Device supports READ (16) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong == true)
scsiOneValue.Add("Device supports READ LONG (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong16 == true)
scsiOneValue.Add("Device supports READ LONG (16) command.");
}
else testedMedia = report.SCSI.RemovableMedias;
ViewBag.repScsi = scsiOneValue;
}
if(report.MultiMediaCard != null)
{
List<string> mmcOneValue = new List<string>();
if(report.MultiMediaCard.CID != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID)
.Replace("\n", "<br/>"));
mmcOneValue.Add("");
}
if(report.MultiMediaCard.CSD != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD)
.Replace("\n", "<br/>"));
mmcOneValue.Add("");
}
if(report.MultiMediaCard.ExtendedCSD != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD)
.Replace("\n", "<br/>"));
mmcOneValue.Add("");
}
if(report.MultiMediaCard.OCR != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR)
.Replace("\n", "<br/>"));
mmcOneValue.Add("");
}
ViewBag.repMMC = mmcOneValue;
}
if(report.SecureDigital != null)
{
List<string> sdOneValue = new List<string>();
if(report.SecureDigital.CID != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID)
.Replace("\n", "<br/>"));
sdOneValue.Add("");
}
if(report.SecureDigital.CSD != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD)
.Replace("\n", "<br/>"));
sdOneValue.Add("");
}
if(report.SecureDigital.SCR != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR)
.Replace("\n", "<br/>"));
sdOneValue.Add("");
}
if(report.SecureDigital.OCR != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR)
.Replace("\n", "<br/>"));
sdOneValue.Add("");
}
ViewBag.repSD = sdOneValue;
}
if(removable && !sscMedia && testedMedia != null)
{
List<string> mediaOneValue = new List<string>();
App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue);
if(mediaOneValue.Count > 0) ViewBag.repTestedMedia = mediaOneValue;
}
}
catch(Exception)
{
#if DEBUG
throw;
#endif
return Content("Could not load device report");
}
return View();
}
}
public class Item
{
public string Manufacturer;
public string Product;
public string ProductDescription;
public string VendorDescription;
}
public class PcmciaItem : Item
{
public string Compliance;
}
}

View File

@@ -0,0 +1,531 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : StatsController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Fetches statistics for Razor views.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Xml;
using System.Xml.Serialization;
using DiscImageChef.CommonTypes.Interop;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using Highsoft.Web.Mvc.Charts;
using Filter = DiscImageChef.Server.Models.Filter;
using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem;
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
using Version = DiscImageChef.Server.Models.Version;
namespace DiscImageChef.Server.Controllers
{
/// <summary>
/// Renders a page with statistics, list of media type, devices, etc
/// </summary>
public class StatsController : Controller
{
DicServerContext ctx = new DicServerContext();
List<DeviceItem> devices;
List<NameValueStats> operatingSystems;
List<MediaItem> realMedia;
List<NameValueStats> versions;
List<MediaItem> virtualMedia;
public ActionResult Index()
{
ViewBag.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
try
{
if(
System.IO.File
.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml")))
try
{
Stats statistics = new Stats();
XmlSerializer xs = new XmlSerializer(statistics.GetType());
FileStream fs =
WaitForFile(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"),
FileMode.Open, FileAccess.Read, FileShare.Read);
statistics = (Stats)xs.Deserialize(fs);
fs.Close();
StatsConverter.Convert(statistics);
System.IO.File
.Delete(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml"));
}
catch(XmlException)
{
// Do nothing
}
if(ctx.OperatingSystems.Any())
{
operatingSystems = new List<NameValueStats>();
foreach(OperatingSystem nvs in ctx.OperatingSystems)
operatingSystems.Add(new NameValueStats
{
name =
$"{DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.Name), nvs.Version)}{(string.IsNullOrEmpty(nvs.Version) ? "" : " ")}{nvs.Version}",
Value = nvs.Count
});
ViewBag.repOperatingSystems = operatingSystems.OrderBy(os => os.name).ToList();
List<PieSeriesData> osPieData = new List<PieSeriesData>();
decimal totalOsCount = ctx.OperatingSystems.Sum(o => o.Count);
foreach(string os in ctx.OperatingSystems.Select(o => o.Name).Distinct().ToList())
{
decimal osCount = ctx.OperatingSystems.Where(o => o.Name == os).Sum(o => o.Count);
osPieData.Add(new PieSeriesData
{
Name =
DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID),
os)),
Y = (double?)(osCount / totalOsCount),
Sliced = os == "Linux",
Selected = os == "Linux"
});
}
ViewData["osPieData"] = osPieData;
List<PieSeriesData> linuxPieData = new List<PieSeriesData>();
decimal linuxCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString())
.Sum(o => o.Count);
foreach(OperatingSystem version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()))
linuxPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.Linux, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
Y = (double?)(version.Count / linuxCount)
});
ViewData["linuxPieData"] = linuxPieData;
List<PieSeriesData> macosPieData = new List<PieSeriesData>();
decimal macosCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString())
.Sum(o => o.Count);
foreach(OperatingSystem version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()))
macosPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.MacOSX, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
Y = (double?)(version.Count / macosCount)
});
ViewData["macosPieData"] = macosPieData;
List<PieSeriesData> windowsPieData = new List<PieSeriesData>();
decimal windowsCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString())
.Sum(o => o.Count);
foreach(OperatingSystem version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()))
windowsPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.Win32NT, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
Y = (double?)(version.Count / windowsCount)
});
ViewData["windowsPieData"] = windowsPieData;
}
if(ctx.Versions.Any())
{
versions = new List<NameValueStats>();
foreach(Version nvs in ctx.Versions)
versions.Add(new NameValueStats
{
name = nvs.Value == "previous" ? "Previous than 3.4.99.0" : nvs.Value,
Value = nvs.Count
});
ViewBag.repVersions = versions.OrderBy(ver => ver.name).ToList();
decimal totalVersionCount = ctx.Versions.Sum(o => o.Count);
ViewData["versionsPieData"] = ctx.Versions.Select(version => new PieSeriesData
{
Name =
version.Value == "previous"
? "Previous than 3.4.99.0"
: version.Value,
Y = (double?)(version.Count /
totalVersionCount),
Sliced = version.Value == "previous",
Selected = version.Value == "previous"
}).ToList();
}
if(ctx.Commands.Any())
{
ViewBag.repCommands = ctx.Commands.OrderBy(c => c.Name).ToList();
decimal totalCommandCount = ctx.Commands.Sum(o => o.Count);
ViewData["commandsPieData"] = ctx
.Commands.Select(command => new PieSeriesData
{
Name = command.Name,
Y = (double?)(command.Count /
totalCommandCount),
Sliced = command.Name == "analyze",
Selected = command.Name == "analyze"
}).ToList();
}
if(ctx.Filters.Any())
{
ViewBag.repFilters = ctx.Filters.OrderBy(filter => filter.Name).ToList();
List<PieSeriesData> filtersPieData = new List<PieSeriesData>();
decimal totalFiltersCount = ctx.Filters.Sum(o => o.Count);
foreach(Filter filter in ctx.Filters.ToList())
filtersPieData.Add(new PieSeriesData
{
Name = filter.Name,
Y = (double?)(filter.Count / totalFiltersCount),
Sliced = filter.Name == "No filter",
Selected = filter.Name == "No filter"
});
ViewData["filtersPieData"] = filtersPieData;
}
if(ctx.MediaFormats.Any())
{
ViewBag.repMediaImages = ctx.MediaFormats.OrderBy(filter => filter.Name).ToList();
List<PieSeriesData> formatsPieData = new List<PieSeriesData>();
decimal totalFormatsCount = ctx.MediaFormats.Sum(o => o.Count);
decimal top10FormatCount = 0;
foreach(MediaFormat format in ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10))
{
top10FormatCount += format.Count;
formatsPieData.Add(new PieSeriesData
{
Name = format.Name, Y = (double?)(format.Count / totalFormatsCount)
});
}
formatsPieData.Add(new PieSeriesData
{
Name = "Other",
Y = (double?)((totalFormatsCount - top10FormatCount) /
totalFormatsCount),
Sliced = true,
Selected = true
});
ViewData["formatsPieData"] = formatsPieData;
}
if(ctx.Partitions.Any())
{
ViewBag.repPartitions = ctx.Partitions.OrderBy(filter => filter.Name).ToList();
List<PieSeriesData> partitionsPieData = new List<PieSeriesData>();
decimal totalPartitionsCount = ctx.Partitions.Sum(o => o.Count);
decimal top10PartitionCount = 0;
foreach(Partition partition in ctx.Partitions.OrderByDescending(o => o.Count).Take(10))
{
top10PartitionCount += partition.Count;
partitionsPieData.Add(new PieSeriesData
{
Name = partition.Name,
Y = (double?)(partition.Count / totalPartitionsCount)
});
}
partitionsPieData.Add(new PieSeriesData
{
Name = "Other",
Y = (double?)((totalPartitionsCount - top10PartitionCount) /
totalPartitionsCount),
Sliced = true,
Selected = true
});
ViewData["partitionsPieData"] = partitionsPieData;
}
if(ctx.Filesystems.Any())
{
ViewBag.repFilesystems = ctx.Filesystems.OrderBy(filter => filter.Name).ToList();
List<PieSeriesData> filesystemsPieData = new List<PieSeriesData>();
decimal totalFilesystemsCount = ctx.Filesystems.Sum(o => o.Count);
decimal top10FilesystemCount = 0;
foreach(Filesystem filesystem in ctx.Filesystems.OrderByDescending(o => o.Count).Take(10))
{
top10FilesystemCount += filesystem.Count;
filesystemsPieData.Add(new PieSeriesData
{
Name = filesystem.Name,
Y = (double?)(filesystem.Count / totalFilesystemsCount)
});
}
filesystemsPieData.Add(new PieSeriesData
{
Name = "Other",
Y = (double?)((totalFilesystemsCount - top10FilesystemCount) /
totalFilesystemsCount),
Sliced = true,
Selected = true
});
ViewData["filesystemsPieData"] = filesystemsPieData;
}
if(ctx.Medias.Any())
{
realMedia = new List<MediaItem>();
virtualMedia = new List<MediaItem>();
foreach(Media nvs in ctx.Medias)
try
{
MediaType
.MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.Type),
out string type, out string subtype);
if(nvs.Real)
realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count});
else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count});
}
catch
{
if(nvs.Real)
realMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count});
else virtualMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count});
}
if(realMedia.Count > 0)
{
ViewBag.repRealMedia =
realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
List<PieSeriesData> realMediaPieData = new List<PieSeriesData>();
decimal totalRealMediaCount = realMedia.Sum(o => o.Count);
decimal top10RealMediaCount = 0;
foreach(MediaItem realMediaItem in realMedia.OrderByDescending(o => o.Count).Take(10))
{
top10RealMediaCount += realMediaItem.Count;
realMediaPieData.Add(new PieSeriesData
{
Name = $"{realMediaItem.Type} ({realMediaItem.SubType})",
Y = (double?)(realMediaItem.Count / totalRealMediaCount)
});
}
realMediaPieData.Add(new PieSeriesData
{
Name = "Other",
Y = (double?)((totalRealMediaCount - top10RealMediaCount) /
totalRealMediaCount),
Sliced = true,
Selected = true
});
ViewData["realMediaPieData"] = realMediaPieData;
}
if(virtualMedia.Count > 0)
{
ViewBag.repVirtualMedia =
virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
List<PieSeriesData> virtualMediaPieData = new List<PieSeriesData>();
decimal totalVirtualMediaCount = virtualMedia.Sum(o => o.Count);
decimal top10VirtualMediaCount = 0;
foreach(MediaItem virtualMediaItem in virtualMedia.OrderByDescending(o => o.Count).Take(10))
{
top10VirtualMediaCount += virtualMediaItem.Count;
virtualMediaPieData.Add(new PieSeriesData
{
Name =
$"{virtualMediaItem.Type} ({virtualMediaItem.SubType})",
Y = (double?)(virtualMediaItem.Count /
totalVirtualMediaCount)
});
}
virtualMediaPieData.Add(new PieSeriesData
{
Name = "Other",
Y = (double?)
((totalVirtualMediaCount - top10VirtualMediaCount) /
totalVirtualMediaCount),
Sliced = true,
Selected = true
});
ViewData["virtualMediaPieData"] = virtualMediaPieData;
}
}
if(ctx.DeviceStats.Any())
{
devices = new List<DeviceItem>();
foreach(DeviceStat device in ctx.DeviceStats.ToList())
{
string xmlFile;
if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
!string.IsNullOrWhiteSpace(device.Model) &&
!string.IsNullOrWhiteSpace(device.Revision))
xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml";
else if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
!string.IsNullOrWhiteSpace(device.Model))
xmlFile = device.Manufacturer + "_" + device.Model + ".xml";
else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
xmlFile = device.Model + "_" + device.Revision + ".xml";
else xmlFile = device.Model + ".xml";
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
if(System.IO.File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Reports", xmlFile)))
{
DeviceReport deviceReport = new DeviceReport();
XmlSerializer xs = new XmlSerializer(deviceReport.GetType());
FileStream fs =
WaitForFile(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Reports", xmlFile),
FileMode.Open, FileAccess.Read, FileShare.Read);
deviceReport = (DeviceReport)xs.Deserialize(fs);
fs.Close();
DeviceReportV2 deviceReportV2 = new DeviceReportV2(deviceReport);
device.Report = ctx.Devices.Add(new Device(deviceReportV2));
ctx.SaveChanges();
System.IO.File
.Delete(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Reports", xmlFile));
}
devices.Add(new DeviceItem
{
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision,
Bus = device.Bus,
ReportId = device.Report != null && device.Report.Id != 0
? device.Report.Id
: 0
});
}
ViewBag.repDevices = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model)
.ThenBy(device => device.Revision).ThenBy(device => device.Bus)
.ToList();
ViewData["devicesBusPieData"] = (from deviceBus in devices.Select(d => d.Bus).Distinct()
let deviceBusCount = devices.Count(d => d.Bus == deviceBus)
select new PieSeriesData
{
Name = deviceBus,
Y = deviceBusCount / (double)devices.Count
}).ToList();
ViewData["devicesManufacturerPieData"] =
(from manufacturer in
devices.Where(d => d.Manufacturer != null).Select(d => d.Manufacturer.ToLowerInvariant())
.Distinct()
let manufacturerCount = devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer)
select new PieSeriesData {Name = manufacturer, Y = manufacturerCount / (double)devices.Count})
.ToList();
}
}
catch(Exception)
{
#if DEBUG
throw;
#endif
return Content("Could not read statistics");
}
return View();
}
static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
for(int numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
{
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
catch(IOException)
{
fs?.Dispose();
Thread.Sleep(50);
}
}
return null;
}
}
}

View File

@@ -0,0 +1,98 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UploadReportController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles report uploads.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Dto;
using DiscImageChef.Server.Models;
using Newtonsoft.Json;
namespace DiscImageChef.Server.Controllers
{
public class UpdateController : ApiController
{
/// <summary>
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
/// </summary>
/// <returns>HTTP response</returns>
[Route("api/update")]
[HttpGet]
public HttpResponseMessage UploadReport(long timestamp)
{
DicServerContext ctx = new DicServerContext();
SyncDto sync = new SyncDto();
DateTime lastSync = DateHandlers.UnixToDateTime(timestamp);
sync.UsbVendors = new List<UsbVendorDto>();
foreach(UsbVendor vendor in ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync))
sync.UsbVendors.Add(new UsbVendorDto {VendorId = (ushort)vendor.VendorId, Vendor = vendor.Vendor});
sync.UsbProducts = new List<UsbProductDto>();
foreach(UsbProduct product in ctx.UsbProducts.Where(p => p.ModifiedWhen > lastSync))
sync.UsbProducts.Add(new UsbProductDto
{
Id = product.Id,
Product = product.Product,
ProductId = (ushort)product.ProductId,
VendorId = (ushort)product.Vendor.VendorId
});
sync.Offsets = new List<CdOffsetDto>();
foreach(CompactDiscOffset offset in ctx.CdOffsets.Where(o => o.ModifiedWhen > lastSync))
sync.Offsets.Add(new CdOffsetDto(offset, offset.Id));
sync.Devices = new List<DeviceDto>();
foreach(Device device in ctx.Devices.Where(d => d.ModifiedWhen > lastSync).ToList())
sync.Devices.Add(new
DeviceDto(JsonConvert.DeserializeObject<DeviceReportV2>(JsonConvert.SerializeObject(device, Formatting.None, new JsonSerializerSettings {ReferenceLoopHandling = ReferenceLoopHandling.Ignore})),
device.Id, device.OptimalMultipleSectorsRead));
JsonSerializer js = JsonSerializer.Create();
StringWriter sw = new StringWriter();
js.Serialize(sw, sync);
return new HttpResponseMessage
{
StatusCode = HttpStatusCode.OK,
Content = new StringContent(sw.ToString(), Encoding.UTF8, "application/json")
};
}
}
}

View File

@@ -0,0 +1,195 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UploadReportController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles report uploads.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Hosting;
using System.Web.Http;
using System.Xml.Serialization;
using Cinchoo.PGP;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using MailKit.Net.Smtp;
using MimeKit;
using Newtonsoft.Json;
namespace DiscImageChef.Server.Controllers
{
public class UploadReportController : ApiController
{
DicServerContext ctx = new DicServerContext();
/// <summary>
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
/// </summary>
/// <returns>HTTP response</returns>
[Route("api/uploadreport")]
[HttpPost]
public HttpResponseMessage UploadReport()
{
HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
try
{
DeviceReport newReport = new DeviceReport();
HttpRequest request = HttpContext.Current.Request;
XmlSerializer xs = new XmlSerializer(newReport.GetType());
newReport = (DeviceReport)xs.Deserialize(request.InputStream);
if(newReport == null)
{
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
return response;
}
DeviceReportV2 reportV2 = new DeviceReportV2(newReport);
StringWriter jsonSw = new StringWriter();
jsonSw.Write(JsonConvert.SerializeObject(reportV2, Formatting.Indented,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
string reportV2String = jsonSw.ToString();
jsonSw.Close();
ctx.Reports.Add(new UploadedReport(reportV2));
ctx.SaveChanges();
MemoryStream pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String));
MemoryStream pgpOut = new MemoryStream();
ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"public.asc"), true);
pgpOut.Position = 0;
reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray());
MimeMessage message = new MimeMessage
{
Subject = "New device report (old version)",
Body = new TextPart("plain") {Text = reportV2String}
};
message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com"));
using(SmtpClient client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
client.Disconnect(true);
}
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
return response;
}
// ReSharper disable once RedundantCatchClause
catch
{
#if DEBUG
if(Debugger.IsAttached) throw;
#endif
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
return response;
}
}
/// <summary>
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
/// </summary>
/// <returns>HTTP response</returns>
[Route("api/uploadreportv2")]
[HttpPost]
public HttpResponseMessage UploadReportV2()
{
HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
try
{
HttpRequest request = HttpContext.Current.Request;
StreamReader sr = new StreamReader(request.InputStream);
string reportJson = sr.ReadToEnd();
DeviceReportV2 newReport = JsonConvert.DeserializeObject<DeviceReportV2>(reportJson);
if(newReport == null)
{
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
return response;
}
ctx.Reports.Add(new UploadedReport(newReport));
ctx.SaveChanges();
MemoryStream pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson));
MemoryStream pgpOut = new MemoryStream();
ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"public.asc"), true);
pgpOut.Position = 0;
reportJson = Encoding.UTF8.GetString(pgpOut.ToArray());
MimeMessage message = new MimeMessage
{
Subject = "New device report", Body = new TextPart("plain") {Text = reportJson}
};
message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com"));
using(SmtpClient client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
client.Disconnect(true);
}
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
return response;
}
// ReSharper disable once RedundantCatchClause
catch
{
#if DEBUG
if(Debugger.IsAttached) throw;
#endif
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
return response;
}
}
}
}

View File

@@ -0,0 +1,254 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UploadStatsController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles statistics uploads.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.Http;
using System.Xml.Serialization;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using Newtonsoft.Json;
using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem;
using Version = DiscImageChef.Server.Models.Version;
namespace DiscImageChef.Server.Controllers
{
public class UploadStatsController : ApiController
{
/// <summary>
/// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics XML
/// </summary>
/// <returns>HTTP response</returns>
[Route("api/uploadstats")]
[HttpPost]
public HttpResponseMessage UploadStats()
{
HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
try
{
Stats newStats = new Stats();
HttpRequest request = HttpContext.Current.Request;
XmlSerializer xs = new XmlSerializer(newStats.GetType());
newStats = (Stats)xs.Deserialize(request.InputStream);
if(newStats == null)
{
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
return response;
}
StatsConverter.Convert(newStats);
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
return response;
}
catch(Exception ex)
{
#if DEBUG
if(Debugger.IsAttached) throw;
#endif
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
return response;
}
}
/// <summary>
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
/// </summary>
/// <returns>HTTP response</returns>
[Route("api/uploadstatsv2")]
[HttpPost]
public HttpResponseMessage UploadStatsV2()
{
HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
try
{
HttpRequest request = HttpContext.Current.Request;
StreamReader sr = new StreamReader(request.InputStream);
StatsDto newstats = JsonConvert.DeserializeObject<StatsDto>(sr.ReadToEnd());
if(newstats == null)
{
response.Content = new StringContent("notstats", Encoding.UTF8, "text/plain");
return response;
}
DicServerContext ctx = new DicServerContext();
if(newstats.Commands != null)
foreach(NameValueStats nvs in newstats.Commands)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Commands.Add(new Command {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.Versions != null)
foreach(NameValueStats nvs in newstats.Versions)
{
Version existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
if(existing == null) ctx.Versions.Add(new Version {Value = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.Filesystems != null)
foreach(NameValueStats nvs in newstats.Filesystems)
{
Filesystem existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Filesystems.Add(new Filesystem {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.Partitions != null)
foreach(NameValueStats nvs in newstats.Partitions)
{
Partition existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Partitions.Add(new Partition {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.MediaFormats != null)
foreach(NameValueStats nvs in newstats.MediaFormats)
{
MediaFormat existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.MediaFormats.Add(new MediaFormat {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.Filters != null)
foreach(NameValueStats nvs in newstats.Filters)
{
Filter existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null) ctx.Filters.Add(new Filter {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
if(newstats.OperatingSystems != null)
foreach(OsStats operatingSystem in newstats.OperatingSystems)
{
OperatingSystem existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
c.Version == operatingSystem.version);
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Name = operatingSystem.name,
Version = operatingSystem.version,
Count = operatingSystem.Value
});
else existing.Count += operatingSystem.Value;
}
if(newstats.Medias != null)
foreach(MediaStats media in newstats.Medias)
{
Media existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
if(existing == null)
ctx.Medias.Add(new Media {Type = media.type, Real = media.real, Count = media.Value});
else existing.Count += media.Value;
}
if(newstats.Devices != null)
foreach(DeviceStats device in newstats.Devices)
{
DeviceStat existing =
ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus &&
c.Manufacturer == device.Manufacturer &&
c.Model == device.Model &&
c.Revision == device.Revision);
if(existing == null)
ctx.DeviceStats.Add(new DeviceStat
{
Bus = device.Bus,
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision
});
}
ctx.SaveChanges();
response.Content = new StringContent("ok", Encoding.UTF8, "text/plain");
return response;
}
// ReSharper disable once RedundantCatchClause
catch
{
#if DEBUG
if(Debugger.IsAttached) throw;
#endif
response.Content = new StringContent("error", Encoding.UTF8, "text/plain");
return response;
}
}
FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
for(int numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
{
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
catch(IOException)
{
if(fs != null) fs.Dispose();
Thread.Sleep(50);
}
}
return null;
}
}
}

View File

@@ -0,0 +1,480 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.props" Condition="Exists('..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{911ADDF5-E5FA-445D-88CD-C7F8FFDBE645}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DiscImageChef.Server</RootNamespace>
<AssemblyName>DiscImageChef.Server</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<SynchReleaseVersion>false</SynchReleaseVersion>
<ReleaseVersion>4.5.99.1693</ReleaseVersion>
<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>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ChoPGP, Version=1.0.1.2, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\ChoPGP.1.0.1.2\lib\ChoPGP.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Google.Protobuf, Version=3.7.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604">
<HintPath>..\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Highcharts.Web.Mvc, Version=7.0.1.0, Culture=neutral, PublicKeyToken=90b74bd27a557bd3">
<HintPath>..\packages\Highsoft.Highcharts.7.0.3.11\lib\net40\Highcharts.Web.Mvc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MailKit, Version=2.1.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b">
<HintPath>..\packages\MailKit.2.1.4\lib\net45\MailKit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Markdig, Version=0.16.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\Markdig.0.16.0\lib\net40\Markdig.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.TelemetryCorrelation, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.5\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MimeKit, Version=2.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814">
<HintPath>..\packages\MimeKit.2.1.4\lib\net45\MimeKit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
<HintPath>..\packages\MySql.Data.8.0.15\lib\net452\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data.EntityFramework, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.15\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\Ata.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\ScsiEvpd.cs" />
<Compile Include="App_Start\ScsiInquiry.cs" />
<Compile Include="App_Start\ScsiMmcFeatures.cs" />
<Compile Include="App_Start\ScsiMmcMode.cs" />
<Compile Include="App_Start\ScsiModeSense.cs" />
<Compile Include="App_Start\SscTestedMedia.cs" />
<Compile Include="App_Start\StatsConverter.cs" />
<Compile Include="App_Start\TestedMedia.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\ReportController.cs" />
<Compile Include="Controllers\StatsController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\UpdateController.cs" />
<Compile Include="Controllers\UploadReportController.cs" />
<Compile Include="Controllers\UploadStatsController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Migrations\201812201613369_InitialMigration.cs" />
<Compile Include="Migrations\201812201613369_InitialMigration.Designer.cs">
<DependentUpon>201812201613369_InitialMigration.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812220029427_AddStatistics.cs" />
<Compile Include="Migrations\201812220029427_AddStatistics.Designer.cs">
<DependentUpon>201812220029427_AddStatistics.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812221606592_LinkDeviceStatsToReport.cs" />
<Compile Include="Migrations\201812221606592_LinkDeviceStatsToReport.Designer.cs">
<DependentUpon>201812221606592_LinkDeviceStatsToReport.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812231612080_FixUnsignedFields.cs" />
<Compile Include="Migrations\201812231612080_FixUnsignedFields.Designer.cs">
<DependentUpon>201812231612080_FixUnsignedFields.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.cs" />
<Compile Include="Migrations\201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.Designer.cs">
<DependentUpon>201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812240552109_StoreUsbIdsInDatabase.cs" />
<Compile Include="Migrations\201812240552109_StoreUsbIdsInDatabase.Designer.cs">
<DependentUpon>201812240552109_StoreUsbIdsInDatabase.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812241719441_FixUsbIdsAndIndexes.cs" />
<Compile Include="Migrations\201812241719441_FixUsbIdsAndIndexes.Designer.cs">
<DependentUpon>201812241719441_FixUsbIdsAndIndexes.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812250223002_AddCdOffsets.cs" />
<Compile Include="Migrations\201812250223002_AddCdOffsets.Designer.cs">
<DependentUpon>201812250223002_AddCdOffsets.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812251556377_StoreMmcGetConfigurationResponse.cs" />
<Compile Include="Migrations\201812251556377_StoreMmcGetConfigurationResponse.Designer.cs">
<DependentUpon>201812251556377_StoreMmcGetConfigurationResponse.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201812252219066_StoreReadResultsInReportDatabase.cs" />
<Compile Include="Migrations\201812252219066_StoreReadResultsInReportDatabase.Designer.cs">
<DependentUpon>201812252219066_StoreReadResultsInReportDatabase.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201901022133012_AddMultisessionLeadTest.cs" />
<Compile Include="Migrations\201901022133012_AddMultisessionLeadTest.Designer.cs">
<DependentUpon>201901022133012_AddMultisessionLeadTest.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201901030344456_AddOptimalReadMultipleCount.cs" />
<Compile Include="Migrations\201901030344456_AddOptimalReadMultipleCount.Designer.cs">
<DependentUpon>201901030344456_AddOptimalReadMultipleCount.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201901081359499_AddChangeableScsiModes.cs" />
<Compile Include="Migrations\201901081359499_AddChangeableScsiModes.Designer.cs">
<DependentUpon>201901081359499_AddChangeableScsiModes.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201905252122267_IdForDensityCode.cs" />
<Compile Include="Migrations\201905252122267_IdForDensityCode.Designer.cs">
<DependentUpon>201905252122267_IdForDensityCode.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Models\CdOffset.cs" />
<Compile Include="Models\Command.cs" />
<Compile Include="Models\Context.cs" />
<Compile Include="Models\Device.cs" />
<Compile Include="Models\DeviceItem.cs" />
<Compile Include="Models\DeviceStat.cs" />
<Compile Include="Models\Filesystem.cs" />
<Compile Include="Models\Filter.cs" />
<Compile Include="Models\Media.cs" />
<Compile Include="Models\MediaFormat.cs" />
<Compile Include="Models\MediaItem.cs" />
<Compile Include="Models\OperatingSystem.cs" />
<Compile Include="Models\Partition.cs" />
<Compile Include="Models\UploadedReport.cs" />
<Compile Include="Models\UsbProduct.cs" />
<Compile Include="Models\UsbVendor.cs" />
<Compile Include="Models\Version.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="docs\Changelog.md" />
<Content Include="docs\CODE_OF_CONDUCT.md" />
<Content Include="docs\CONTRIBUTING.md" />
<Content Include="docs\DONATING.md" />
<Content Include="docs\ISSUE_TEMPLATE.md" />
<Content Include="docs\NEEDINFO.md" />
<Content Include="docs\PULL_REQUEST_TEMPLATE.md" />
<Content Include="docs\README.md" />
<Content Include="docs\TODO.md" />
<Content Include="fonts\ChicagoFLF.eot" />
<Content Include="fonts\ChicagoFLF.ttf" />
<Content Include="fonts\ChicagoFLF.woff" />
<Content Include="fonts\ChicagoFLF.woff2" />
<Content Include="Global.asax" />
<Content Include="fonts\vga_squarepx.eot" />
<Content Include="fonts\vga_squarepx.ttf" />
<Content Include="fonts\vga_squarepx.woff" />
<Content Include="package-lock.json" />
<Content Include="package.json" />
<Content Include="styles\dos\dicserver.css" />
<Content Include="styles\dos\dicserver.css.map" />
<Content Include="styles\dos\dicserver.scss" />
<Content Include="styles\dos\dicserver_highcharts.css" />
<Content Include="styles\dos\dicserver_highcharts.css.map" />
<Content Include="styles\dos\dicserver_highcharts.scss" />
<Content Include="styles\dos\_colors.scss" />
<Content Include="styles\dos\_fontstyles.scss" />
<Content Include="styles\dos\_font.scss" />
<Content Include="styles\mac\dicserver.css">
<DependentUpon>dicserver.scss</DependentUpon>
</Content>
<Content Include="styles\mac\dicserver.css.map">
<DependentUpon>dicserver.css</DependentUpon>
</Content>
<Content Include="styles\mac\dicserver.scss" />
<Content Include="styles\mac\dicserver_highcharts.css">
<DependentUpon>dicserver_highcharts.scss</DependentUpon>
</Content>
<Content Include="styles\mac\dicserver_highcharts.css.map">
<DependentUpon>dicserver_highcharts.css</DependentUpon>
</Content>
<Content Include="styles\mac\dicserver_highcharts.scss" />
<Content Include="styles\mac\_colors.scss" />
<Content Include="styles\mac\_fontstyles.scss" />
<Content Include="styles\mac\_font.scss" />
<Content Include="styles\_highcharts.scss" />
<Content Include="Views\Home\Changelog.cshtml" />
<Content Include="Views\Home\CODE_OF_CONDUCT.cshtml" />
<Content Include="Views\Home\CONTRIBUTING.cshtml" />
<Content Include="Views\Home\DONATING.cshtml" />
<Content Include="Views\Home\ISSUE_TEMPLATE.cshtml" />
<Content Include="Views\Home\PULL_REQUEST_TEMPLATE.cshtml" />
<Content Include="Views\Home\TODO.cshtml" />
<Content Include="Views\Report\View.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<None Include="fonts\.htaccess" />
<None Include="fonts\vga_squarepx.woff2" />
<None Include="Reports\.htaccess" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Web.config" />
<Content Include="Views\Stats\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj">
<Project>{f2b84194-26eb-4227-b1c5-6602517e85ae}</Project>
<Name>DiscImageChef.CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Decoders\DiscImageChef.Decoders.csproj">
<Project>{0beb3088-b634-4289-ae17-cdf2d25d00d5}</Project>
<Name>DiscImageChef.Decoders</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Dto\DiscImageChef.Dto.csproj">
<Project>{f4399ff5-9bd0-475a-9ea7-3dae45291fe2}</Project>
<Name>DiscImageChef.Dto</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
<Project>{f8bdf57b-1571-4cd0-84b3-b422088d359a}</Project>
<Name>DiscImageChef.Helpers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.LGPL">
<Link>LICENSE.LGPL</Link>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812201613369_InitialMigration.resx">
<DependentUpon>201812201613369_InitialMigration.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812220029427_AddStatistics.resx">
<DependentUpon>201812220029427_AddStatistics.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812221606592_LinkDeviceStatsToReport.resx">
<DependentUpon>201812221606592_LinkDeviceStatsToReport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812231612080_FixUnsignedFields.resx">
<DependentUpon>201812231612080_FixUnsignedFields.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.resx">
<DependentUpon>201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812240552109_StoreUsbIdsInDatabase.resx">
<DependentUpon>201812240552109_StoreUsbIdsInDatabase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812241719441_FixUsbIdsAndIndexes.resx">
<DependentUpon>201812241719441_FixUsbIdsAndIndexes.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812250223002_AddCdOffsets.resx">
<DependentUpon>201812250223002_AddCdOffsets.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812251556377_StoreMmcGetConfigurationResponse.resx">
<DependentUpon>201812251556377_StoreMmcGetConfigurationResponse.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201812252219066_StoreReadResultsInReportDatabase.resx">
<DependentUpon>201812252219066_StoreReadResultsInReportDatabase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201901022133012_AddMultisessionLeadTest.resx">
<DependentUpon>201901022133012_AddMultisessionLeadTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201901030344456_AddOptimalReadMultipleCount.resx">
<DependentUpon>201901030344456_AddOptimalReadMultipleCount.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201901081359499_AddChangeableScsiModes.resx">
<DependentUpon>201901081359499_AddChangeableScsiModes.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201905252122267_IdForDensityCode.resx">
<DependentUpon>201905252122267_IdForDensityCode.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>22810</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:22810/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.props'))" />
<Error Condition="!Exists('..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
<Import Project="..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.targets" Condition="Exists('..\packages\Unclassified.NetRevisionTask.0.2.5\build\Unclassified.NetRevisionTask.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> -->
</Project>

View File

@@ -0,0 +1 @@
<%@ Application Inherits="DiscImageChef.Server.Global" %>

View File

@@ -0,0 +1,47 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Global.asax.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// ASP.NET global definitions.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Web;
using System.Web.Http;
using System.Web.Routing;
namespace DiscImageChef.Server
{
public class Global : HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class InitialMigration : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(InitialMigration));
string IMigrationMetadata.Id
{
get { return "201812201613369_InitialMigration"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,584 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class InitialMigration : DbMigration
{
public override void Up()
{
CreateTable("dbo.Devices",
c => new
{
Id = c.Int(false, true),
AddedWhen = c.DateTime(false, 0),
CompactFlash = c.Boolean(false),
Manufacturer = c.String(unicode: false),
Model = c.String(unicode: false),
Revision = c.String(unicode: false),
Type = c.Int(false),
ATA_Id = c.Int(),
ATAPI_Id = c.Int(),
FireWire_Id = c.Int(),
MultiMediaCard_Id = c.Int(),
PCMCIA_Id = c.Int(),
SCSI_Id = c.Int(),
SecureDigital_Id = c.Int(),
USB_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Atas", t => t.ATA_Id)
.ForeignKey("dbo.Atas", t => t.ATAPI_Id).ForeignKey("dbo.FireWires", t => t.FireWire_Id)
.ForeignKey("dbo.MmcSds", t => t.MultiMediaCard_Id)
.ForeignKey("dbo.Pcmcias", t => t.PCMCIA_Id).ForeignKey("dbo.Scsis", t => t.SCSI_Id)
.ForeignKey("dbo.MmcSds", t => t.SecureDigital_Id).ForeignKey("dbo.Usbs", t => t.USB_Id)
.Index(t => t.ATA_Id).Index(t => t.ATAPI_Id).Index(t => t.FireWire_Id)
.Index(t => t.MultiMediaCard_Id).Index(t => t.PCMCIA_Id).Index(t => t.SCSI_Id)
.Index(t => t.SecureDigital_Id).Index(t => t.USB_Id);
CreateTable("dbo.Atas",
c => new {Id = c.Int(false, true), Identify = c.Binary(), ReadCapabilities_Id = c.Int()})
.PrimaryKey(t => t.Id).ForeignKey("dbo.TestedMedias", t => t.ReadCapabilities_Id)
.Index(t => t.ReadCapabilities_Id);
CreateTable("dbo.TestedMedias",
c => new
{
Id = c.Int(false, true),
IdentifyData = c.Binary(),
CanReadAACS = c.Boolean(),
CanReadADIP = c.Boolean(),
CanReadATIP = c.Boolean(),
CanReadBCA = c.Boolean(),
CanReadC2Pointers = c.Boolean(),
CanReadCMI = c.Boolean(),
CanReadCorrectedSubchannel = c.Boolean(),
CanReadCorrectedSubchannelWithC2 = c.Boolean(),
CanReadDCB = c.Boolean(),
CanReadDDS = c.Boolean(),
CanReadDMI = c.Boolean(),
CanReadDiscInformation = c.Boolean(),
CanReadFullTOC = c.Boolean(),
CanReadHDCMI = c.Boolean(),
CanReadLayerCapacity = c.Boolean(),
CanReadFirstTrackPreGap = c.Boolean(),
CanReadLeadIn = c.Boolean(),
CanReadLeadOut = c.Boolean(),
CanReadMediaID = c.Boolean(),
CanReadMediaSerial = c.Boolean(),
CanReadPAC = c.Boolean(),
CanReadPFI = c.Boolean(),
CanReadPMA = c.Boolean(),
CanReadPQSubchannel = c.Boolean(),
CanReadPQSubchannelWithC2 = c.Boolean(),
CanReadPRI = c.Boolean(),
CanReadRWSubchannel = c.Boolean(),
CanReadRWSubchannelWithC2 = c.Boolean(),
CanReadRecordablePFI = c.Boolean(),
CanReadSpareAreaInformation = c.Boolean(),
CanReadTOC = c.Boolean(),
Density = c.Byte(),
Manufacturer = c.String(unicode: false),
MediaIsRecognized = c.Boolean(false),
MediumType = c.Byte(),
MediumTypeName = c.String(unicode: false),
Model = c.String(unicode: false),
SupportsHLDTSTReadRawDVD = c.Boolean(),
SupportsNECReadCDDA = c.Boolean(),
SupportsPioneerReadCDDA = c.Boolean(),
SupportsPioneerReadCDDAMSF = c.Boolean(),
SupportsPlextorReadCDDA = c.Boolean(),
SupportsPlextorReadRawDVD = c.Boolean(),
SupportsRead10 = c.Boolean(),
SupportsRead12 = c.Boolean(),
SupportsRead16 = c.Boolean(),
SupportsRead6 = c.Boolean(),
SupportsReadCapacity16 = c.Boolean(),
SupportsReadCapacity = c.Boolean(),
SupportsReadCd = c.Boolean(),
SupportsReadCdMsf = c.Boolean(),
SupportsReadCdRaw = c.Boolean(),
SupportsReadCdMsfRaw = c.Boolean(),
SupportsReadLong16 = c.Boolean(),
SupportsReadLong = c.Boolean(),
ModeSense6Data = c.Binary(),
ModeSense10Data = c.Binary(),
SolidStateDevice = c.Boolean(),
SupportsReadDmaLba = c.Boolean(),
SupportsReadDmaRetryLba = c.Boolean(),
SupportsReadLba = c.Boolean(),
SupportsReadRetryLba = c.Boolean(),
SupportsReadLongLba = c.Boolean(),
SupportsReadLongRetryLba = c.Boolean(),
SupportsSeekLba = c.Boolean(),
SupportsReadDmaLba48 = c.Boolean(),
SupportsReadLba48 = c.Boolean(),
SupportsReadDma = c.Boolean(),
SupportsReadDmaRetry = c.Boolean(),
SupportsReadRetry = c.Boolean(),
SupportsReadSectors = c.Boolean(),
SupportsReadLongRetry = c.Boolean(),
SupportsSeek = c.Boolean(),
CHS_Id = c.Int(),
CurrentCHS_Id = c.Int(),
Ata_Id = c.Int(),
Mmc_Id = c.Int(),
Scsi_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Chs", t => t.CHS_Id)
.ForeignKey("dbo.Chs", t => t.CurrentCHS_Id).ForeignKey("dbo.Atas", t => t.Ata_Id)
.ForeignKey("dbo.Mmcs", t => t.Mmc_Id).ForeignKey("dbo.Scsis", t => t.Scsi_Id)
.Index(t => t.CHS_Id).Index(t => t.CurrentCHS_Id).Index(t => t.Ata_Id)
.Index(t => t.Mmc_Id).Index(t => t.Scsi_Id);
CreateTable("dbo.Chs", c => new {Id = c.Int(false, true)}).PrimaryKey(t => t.Id);
CreateTable("dbo.FireWires",
c => new
{
Id = c.Int(false, true),
Manufacturer = c.String(unicode: false),
Product = c.String(unicode: false),
RemovableMedia = c.Boolean(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.MmcSds",
c => new
{
Id = c.Int(false, true),
CID = c.Binary(),
CSD = c.Binary(),
OCR = c.Binary(),
SCR = c.Binary(),
ExtendedCSD = c.Binary()
}).PrimaryKey(t => t.Id);
CreateTable("dbo.Pcmcias",
c => new
{
Id = c.Int(false, true),
CIS = c.Binary(),
Compliance = c.String(unicode: false),
Manufacturer = c.String(unicode: false),
ProductName = c.String(unicode: false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.Scsis",
c => new
{
Id = c.Int(false, true),
InquiryData = c.Binary(),
SupportsModeSense6 = c.Boolean(false),
SupportsModeSense10 = c.Boolean(false),
SupportsModeSubpages = c.Boolean(false),
ModeSense6Data = c.Binary(),
ModeSense10Data = c.Binary(),
ModeSense_Id = c.Int(),
MultiMediaDevice_Id = c.Int(),
ReadCapabilities_Id = c.Int(),
SequentialDevice_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.ScsiModes", t => t.ModeSense_Id)
.ForeignKey("dbo.Mmcs", t => t.MultiMediaDevice_Id)
.ForeignKey("dbo.TestedMedias", t => t.ReadCapabilities_Id)
.ForeignKey("dbo.Sscs", t => t.SequentialDevice_Id).Index(t => t.ModeSense_Id)
.Index(t => t.MultiMediaDevice_Id).Index(t => t.ReadCapabilities_Id)
.Index(t => t.SequentialDevice_Id);
CreateTable("dbo.ScsiPages",
c => new
{
Id = c.Int(false, true),
page = c.Byte(false),
subpage = c.Byte(),
value = c.Binary(),
Scsi_Id = c.Int(),
ScsiMode_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Scsis", t => t.Scsi_Id)
.ForeignKey("dbo.ScsiModes", t => t.ScsiMode_Id).Index(t => t.Scsi_Id)
.Index(t => t.ScsiMode_Id);
CreateTable("dbo.ScsiModes",
c => new
{
Id = c.Int(false, true),
MediumType = c.Byte(),
WriteProtected = c.Boolean(false),
Speed = c.Byte(),
BufferedMode = c.Byte(),
BlankCheckEnabled = c.Boolean(false),
DPOandFUA = c.Boolean(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.BlockDescriptors",
c => new {Id = c.Int(false, true), Density = c.Byte(false), ScsiMode_Id = c.Int()})
.PrimaryKey(t => t.Id).ForeignKey("dbo.ScsiModes", t => t.ScsiMode_Id).Index(t => t.ScsiMode_Id);
CreateTable("dbo.Mmcs", c => new {Id = c.Int(false, true), Features_Id = c.Int(), ModeSense2A_Id = c.Int()})
.PrimaryKey(t => t.Id).ForeignKey("dbo.MmcFeatures", t => t.Features_Id)
.ForeignKey("dbo.ModePage_2A", t => t.ModeSense2A_Id).Index(t => t.Features_Id)
.Index(t => t.ModeSense2A_Id);
CreateTable("dbo.MmcFeatures",
c => new
{
Id = c.Int(false, true),
AACSVersion = c.Byte(),
AGIDs = c.Byte(),
BindingNonceBlocks = c.Byte(),
BufferUnderrunFreeInDVD = c.Boolean(false),
BufferUnderrunFreeInSAO = c.Boolean(false),
BufferUnderrunFreeInTAO = c.Boolean(false),
CanAudioScan = c.Boolean(false),
CanEject = c.Boolean(false),
CanEraseSector = c.Boolean(false),
CanExpandBDRESpareArea = c.Boolean(false),
CanFormat = c.Boolean(false),
CanFormatBDREWithoutSpare = c.Boolean(false),
CanFormatCert = c.Boolean(false),
CanFormatFRF = c.Boolean(false),
CanFormatQCert = c.Boolean(false),
CanFormatRRM = c.Boolean(false),
CanGenerateBindingNonce = c.Boolean(false),
CanLoad = c.Boolean(false),
CanMuteSeparateChannels = c.Boolean(false),
CanOverwriteSAOTrack = c.Boolean(false),
CanOverwriteTAOTrack = c.Boolean(false),
CanPlayCDAudio = c.Boolean(false),
CanPseudoOverwriteBDR = c.Boolean(false),
CanReadAllDualR = c.Boolean(false),
CanReadAllDualRW = c.Boolean(false),
CanReadBD = c.Boolean(false),
CanReadBDR = c.Boolean(false),
CanReadBDRE1 = c.Boolean(false),
CanReadBDRE2 = c.Boolean(false),
CanReadBDROM = c.Boolean(false),
CanReadBluBCA = c.Boolean(false),
CanReadCD = c.Boolean(false),
CanReadCDMRW = c.Boolean(false),
CanReadCPRM_MKB = c.Boolean(false),
CanReadDDCD = c.Boolean(false),
CanReadDVD = c.Boolean(false),
CanReadDVDPlusMRW = c.Boolean(false),
CanReadDVDPlusR = c.Boolean(false),
CanReadDVDPlusRDL = c.Boolean(false),
CanReadDVDPlusRW = c.Boolean(false),
CanReadDVDPlusRWDL = c.Boolean(false),
CanReadDriveAACSCertificate = c.Boolean(false),
CanReadHDDVD = c.Boolean(false),
CanReadHDDVDR = c.Boolean(false),
CanReadHDDVDRAM = c.Boolean(false),
CanReadLeadInCDText = c.Boolean(false),
CanReadOldBDR = c.Boolean(false),
CanReadOldBDRE = c.Boolean(false),
CanReadOldBDROM = c.Boolean(false),
CanReadSpareAreaInformation = c.Boolean(false),
CanReportDriveSerial = c.Boolean(false),
CanReportMediaSerial = c.Boolean(false),
CanTestWriteDDCDR = c.Boolean(false),
CanTestWriteDVD = c.Boolean(false),
CanTestWriteInSAO = c.Boolean(false),
CanTestWriteInTAO = c.Boolean(false),
CanUpgradeFirmware = c.Boolean(false),
CanWriteBD = c.Boolean(false),
CanWriteBDR = c.Boolean(false),
CanWriteBDRE1 = c.Boolean(false),
CanWriteBDRE2 = c.Boolean(false),
CanWriteBusEncryptedBlocks = c.Boolean(false),
CanWriteCDMRW = c.Boolean(false),
CanWriteCDRW = c.Boolean(false),
CanWriteCDRWCAV = c.Boolean(false),
CanWriteCDSAO = c.Boolean(false),
CanWriteCDTAO = c.Boolean(false),
CanWriteCSSManagedDVD = c.Boolean(false),
CanWriteDDCDR = c.Boolean(false),
CanWriteDDCDRW = c.Boolean(false),
CanWriteDVDPlusMRW = c.Boolean(false),
CanWriteDVDPlusR = c.Boolean(false),
CanWriteDVDPlusRDL = c.Boolean(false),
CanWriteDVDPlusRW = c.Boolean(false),
CanWriteDVDPlusRWDL = c.Boolean(false),
CanWriteDVDR = c.Boolean(false),
CanWriteDVDRDL = c.Boolean(false),
CanWriteDVDRW = c.Boolean(false),
CanWriteHDDVDR = c.Boolean(false),
CanWriteHDDVDRAM = c.Boolean(false),
CanWriteOldBDR = c.Boolean(false),
CanWriteOldBDRE = c.Boolean(false),
CanWritePackedSubchannelInTAO = c.Boolean(false),
CanWriteRWSubchannelInSAO = c.Boolean(false),
CanWriteRWSubchannelInTAO = c.Boolean(false),
CanWriteRaw = c.Boolean(false),
CanWriteRawMultiSession = c.Boolean(false),
CanWriteRawSubchannelInTAO = c.Boolean(false),
ChangerIsSideChangeCapable = c.Boolean(false),
ChangerSlots = c.Byte(false),
ChangerSupportsDiscPresent = c.Boolean(false),
CPRMVersion = c.Byte(),
CSSVersion = c.Byte(),
DBML = c.Boolean(false),
DVDMultiRead = c.Boolean(false),
EmbeddedChanger = c.Boolean(false),
ErrorRecoveryPage = c.Boolean(false),
FirmwareDate = c.DateTime(precision: 0),
LoadingMechanismType = c.Byte(),
Locked = c.Boolean(false),
MultiRead = c.Boolean(false),
PreventJumper = c.Boolean(false),
SupportsAACS = c.Boolean(false),
SupportsBusEncryption = c.Boolean(false),
SupportsC2 = c.Boolean(false),
SupportsCPRM = c.Boolean(false),
SupportsCSS = c.Boolean(false),
SupportsDAP = c.Boolean(false),
SupportsDeviceBusyEvent = c.Boolean(false),
SupportsHybridDiscs = c.Boolean(false),
SupportsModePage1Ch = c.Boolean(false),
SupportsOSSC = c.Boolean(false),
SupportsPWP = c.Boolean(false),
SupportsSWPP = c.Boolean(false),
SupportsSecurDisc = c.Boolean(false),
SupportsSeparateVolume = c.Boolean(false),
SupportsVCPS = c.Boolean(false),
SupportsWriteInhibitDCB = c.Boolean(false),
SupportsWriteProtectPAC = c.Boolean(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.ModePage_2A",
c => new
{
Id = c.Int(false, true),
PS = c.Boolean(false),
MultiSession = c.Boolean(false),
Mode2Form2 = c.Boolean(false),
Mode2Form1 = c.Boolean(false),
AudioPlay = c.Boolean(false),
ISRC = c.Boolean(false),
UPC = c.Boolean(false),
C2Pointer = c.Boolean(false),
DeinterlaveSubchannel = c.Boolean(false),
Subchannel = c.Boolean(false),
AccurateCDDA = c.Boolean(false),
CDDACommand = c.Boolean(false),
LoadingMechanism = c.Byte(false),
Eject = c.Boolean(false),
PreventJumper = c.Boolean(false),
LockState = c.Boolean(false),
Lock = c.Boolean(false),
SeparateChannelMute = c.Boolean(false),
SeparateChannelVolume = c.Boolean(false),
Method2 = c.Boolean(false),
ReadCDRW = c.Boolean(false),
ReadCDR = c.Boolean(false),
WriteCDRW = c.Boolean(false),
WriteCDR = c.Boolean(false),
DigitalPort2 = c.Boolean(false),
DigitalPort1 = c.Boolean(false),
Composite = c.Boolean(false),
SSS = c.Boolean(false),
SDP = c.Boolean(false),
Length = c.Byte(false),
LSBF = c.Boolean(false),
RCK = c.Boolean(false),
BCK = c.Boolean(false),
TestWrite = c.Boolean(false),
ReadBarcode = c.Boolean(false),
ReadDVDRAM = c.Boolean(false),
ReadDVDR = c.Boolean(false),
ReadDVDROM = c.Boolean(false),
WriteDVDRAM = c.Boolean(false),
WriteDVDR = c.Boolean(false),
LeadInPW = c.Boolean(false),
SCC = c.Boolean(false),
BUF = c.Boolean(false),
RotationControlSelected = c.Byte(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.Sscs", c => new {Id = c.Int(false, true), BlockSizeGranularity = c.Byte()})
.PrimaryKey(t => t.Id);
CreateTable("dbo.SupportedDensities",
c => new
{
Id = c.Int(false, true),
PrimaryCode = c.Byte(false),
SecondaryCode = c.Byte(false),
Writable = c.Boolean(false),
Duplicate = c.Boolean(false),
DefaultDensity = c.Boolean(false),
Organization = c.String(unicode: false),
Name = c.String(unicode: false),
Description = c.String(unicode: false),
Ssc_Id = c.Int(),
TestedSequentialMedia_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Sscs", t => t.Ssc_Id)
.ForeignKey("dbo.TestedSequentialMedias", t => t.TestedSequentialMedia_Id)
.Index(t => t.Ssc_Id).Index(t => t.TestedSequentialMedia_Id);
CreateTable("dbo.SscSupportedMedias",
c => new
{
Id = c.Int(false, true),
MediumType = c.Byte(false),
Organization = c.String(unicode: false),
Name = c.String(unicode: false),
Description = c.String(unicode: false),
Ssc_Id = c.Int(),
TestedSequentialMedia_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Sscs", t => t.Ssc_Id)
.ForeignKey("dbo.TestedSequentialMedias", t => t.TestedSequentialMedia_Id)
.Index(t => t.Ssc_Id).Index(t => t.TestedSequentialMedia_Id);
CreateTable("dbo.DensityCodes", c => new {Code = c.Int(false, true), SscSupportedMedia_Id = c.Int()})
.PrimaryKey(t => t.Code).ForeignKey("dbo.SscSupportedMedias", t => t.SscSupportedMedia_Id)
.Index(t => t.SscSupportedMedia_Id);
CreateTable("dbo.TestedSequentialMedias",
c => new
{
Id = c.Int(false, true),
CanReadMediaSerial = c.Boolean(),
Density = c.Byte(),
Manufacturer = c.String(unicode: false),
MediaIsRecognized = c.Boolean(false),
MediumType = c.Byte(),
MediumTypeName = c.String(unicode: false),
Model = c.String(unicode: false),
ModeSense6Data = c.Binary(),
ModeSense10Data = c.Binary(),
Ssc_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Sscs", t => t.Ssc_Id).Index(t => t.Ssc_Id);
CreateTable("dbo.Usbs",
c => new
{
Id = c.Int(false, true),
Manufacturer = c.String(unicode: false),
Product = c.String(unicode: false),
RemovableMedia = c.Boolean(false),
Descriptors = c.Binary()
}).PrimaryKey(t => t.Id);
CreateTable("dbo.UploadedReports",
c => new
{
Id = c.Int(false, true),
UploadedWhen = c.DateTime(false, 0),
CompactFlash = c.Boolean(false),
Manufacturer = c.String(unicode: false),
Model = c.String(unicode: false),
Revision = c.String(unicode: false),
Type = c.Int(false),
ATA_Id = c.Int(),
ATAPI_Id = c.Int(),
FireWire_Id = c.Int(),
MultiMediaCard_Id = c.Int(),
PCMCIA_Id = c.Int(),
SCSI_Id = c.Int(),
SecureDigital_Id = c.Int(),
USB_Id = c.Int()
}).PrimaryKey(t => t.Id).ForeignKey("dbo.Atas", t => t.ATA_Id)
.ForeignKey("dbo.Atas", t => t.ATAPI_Id).ForeignKey("dbo.FireWires", t => t.FireWire_Id)
.ForeignKey("dbo.MmcSds", t => t.MultiMediaCard_Id)
.ForeignKey("dbo.Pcmcias", t => t.PCMCIA_Id).ForeignKey("dbo.Scsis", t => t.SCSI_Id)
.ForeignKey("dbo.MmcSds", t => t.SecureDigital_Id).ForeignKey("dbo.Usbs", t => t.USB_Id)
.Index(t => t.ATA_Id).Index(t => t.ATAPI_Id).Index(t => t.FireWire_Id)
.Index(t => t.MultiMediaCard_Id).Index(t => t.PCMCIA_Id).Index(t => t.SCSI_Id)
.Index(t => t.SecureDigital_Id).Index(t => t.USB_Id);
}
public override void Down()
{
DropForeignKey("dbo.UploadedReports", "USB_Id", "dbo.Usbs");
DropForeignKey("dbo.UploadedReports", "SecureDigital_Id", "dbo.MmcSds");
DropForeignKey("dbo.UploadedReports", "SCSI_Id", "dbo.Scsis");
DropForeignKey("dbo.UploadedReports", "PCMCIA_Id", "dbo.Pcmcias");
DropForeignKey("dbo.UploadedReports", "MultiMediaCard_Id", "dbo.MmcSds");
DropForeignKey("dbo.UploadedReports", "FireWire_Id", "dbo.FireWires");
DropForeignKey("dbo.UploadedReports", "ATAPI_Id", "dbo.Atas");
DropForeignKey("dbo.UploadedReports", "ATA_Id", "dbo.Atas");
DropForeignKey("dbo.Devices", "USB_Id", "dbo.Usbs");
DropForeignKey("dbo.Devices", "SecureDigital_Id", "dbo.MmcSds");
DropForeignKey("dbo.Devices", "SCSI_Id", "dbo.Scsis");
DropForeignKey("dbo.Scsis", "SequentialDevice_Id", "dbo.Sscs");
DropForeignKey("dbo.TestedSequentialMedias", "Ssc_Id", "dbo.Sscs");
DropForeignKey("dbo.SscSupportedMedias", "TestedSequentialMedia_Id", "dbo.TestedSequentialMedias");
DropForeignKey("dbo.SupportedDensities", "TestedSequentialMedia_Id", "dbo.TestedSequentialMedias");
DropForeignKey("dbo.SscSupportedMedias", "Ssc_Id", "dbo.Sscs");
DropForeignKey("dbo.DensityCodes", "SscSupportedMedia_Id", "dbo.SscSupportedMedias");
DropForeignKey("dbo.SupportedDensities", "Ssc_Id", "dbo.Sscs");
DropForeignKey("dbo.TestedMedias", "Scsi_Id", "dbo.Scsis");
DropForeignKey("dbo.Scsis", "ReadCapabilities_Id", "dbo.TestedMedias");
DropForeignKey("dbo.Scsis", "MultiMediaDevice_Id", "dbo.Mmcs");
DropForeignKey("dbo.TestedMedias", "Mmc_Id", "dbo.Mmcs");
DropForeignKey("dbo.Mmcs", "ModeSense2A_Id", "dbo.ModePage_2A");
DropForeignKey("dbo.Mmcs", "Features_Id", "dbo.MmcFeatures");
DropForeignKey("dbo.Scsis", "ModeSense_Id", "dbo.ScsiModes");
DropForeignKey("dbo.ScsiPages", "ScsiMode_Id", "dbo.ScsiModes");
DropForeignKey("dbo.BlockDescriptors", "ScsiMode_Id", "dbo.ScsiModes");
DropForeignKey("dbo.ScsiPages", "Scsi_Id", "dbo.Scsis");
DropForeignKey("dbo.Devices", "PCMCIA_Id", "dbo.Pcmcias");
DropForeignKey("dbo.Devices", "MultiMediaCard_Id", "dbo.MmcSds");
DropForeignKey("dbo.Devices", "FireWire_Id", "dbo.FireWires");
DropForeignKey("dbo.Devices", "ATAPI_Id", "dbo.Atas");
DropForeignKey("dbo.Devices", "ATA_Id", "dbo.Atas");
DropForeignKey("dbo.TestedMedias", "Ata_Id", "dbo.Atas");
DropForeignKey("dbo.Atas", "ReadCapabilities_Id", "dbo.TestedMedias");
DropForeignKey("dbo.TestedMedias", "CurrentCHS_Id", "dbo.Chs");
DropForeignKey("dbo.TestedMedias", "CHS_Id", "dbo.Chs");
DropIndex("dbo.UploadedReports", new[] {"USB_Id"});
DropIndex("dbo.UploadedReports", new[] {"SecureDigital_Id"});
DropIndex("dbo.UploadedReports", new[] {"SCSI_Id"});
DropIndex("dbo.UploadedReports", new[] {"PCMCIA_Id"});
DropIndex("dbo.UploadedReports", new[] {"MultiMediaCard_Id"});
DropIndex("dbo.UploadedReports", new[] {"FireWire_Id"});
DropIndex("dbo.UploadedReports", new[] {"ATAPI_Id"});
DropIndex("dbo.UploadedReports", new[] {"ATA_Id"});
DropIndex("dbo.TestedSequentialMedias", new[] {"Ssc_Id"});
DropIndex("dbo.DensityCodes", new[] {"SscSupportedMedia_Id"});
DropIndex("dbo.SscSupportedMedias", new[] {"TestedSequentialMedia_Id"});
DropIndex("dbo.SscSupportedMedias", new[] {"Ssc_Id"});
DropIndex("dbo.SupportedDensities", new[] {"TestedSequentialMedia_Id"});
DropIndex("dbo.SupportedDensities", new[] {"Ssc_Id"});
DropIndex("dbo.Mmcs", new[] {"ModeSense2A_Id"});
DropIndex("dbo.Mmcs", new[] {"Features_Id"});
DropIndex("dbo.BlockDescriptors", new[] {"ScsiMode_Id"});
DropIndex("dbo.ScsiPages", new[] {"ScsiMode_Id"});
DropIndex("dbo.ScsiPages", new[] {"Scsi_Id"});
DropIndex("dbo.Scsis", new[] {"SequentialDevice_Id"});
DropIndex("dbo.Scsis", new[] {"ReadCapabilities_Id"});
DropIndex("dbo.Scsis", new[] {"MultiMediaDevice_Id"});
DropIndex("dbo.Scsis", new[] {"ModeSense_Id"});
DropIndex("dbo.TestedMedias", new[] {"Scsi_Id"});
DropIndex("dbo.TestedMedias", new[] {"Mmc_Id"});
DropIndex("dbo.TestedMedias", new[] {"Ata_Id"});
DropIndex("dbo.TestedMedias", new[] {"CurrentCHS_Id"});
DropIndex("dbo.TestedMedias", new[] {"CHS_Id"});
DropIndex("dbo.Atas", new[] {"ReadCapabilities_Id"});
DropIndex("dbo.Devices", new[] {"USB_Id"});
DropIndex("dbo.Devices", new[] {"SecureDigital_Id"});
DropIndex("dbo.Devices", new[] {"SCSI_Id"});
DropIndex("dbo.Devices", new[] {"PCMCIA_Id"});
DropIndex("dbo.Devices", new[] {"MultiMediaCard_Id"});
DropIndex("dbo.Devices", new[] {"FireWire_Id"});
DropIndex("dbo.Devices", new[] {"ATAPI_Id"});
DropIndex("dbo.Devices", new[] {"ATA_Id"});
DropTable("dbo.UploadedReports");
DropTable("dbo.Usbs");
DropTable("dbo.TestedSequentialMedias");
DropTable("dbo.DensityCodes");
DropTable("dbo.SscSupportedMedias");
DropTable("dbo.SupportedDensities");
DropTable("dbo.Sscs");
DropTable("dbo.ModePage_2A");
DropTable("dbo.MmcFeatures");
DropTable("dbo.Mmcs");
DropTable("dbo.BlockDescriptors");
DropTable("dbo.ScsiModes");
DropTable("dbo.ScsiPages");
DropTable("dbo.Scsis");
DropTable("dbo.Pcmcias");
DropTable("dbo.MmcSds");
DropTable("dbo.FireWires");
DropTable("dbo.Chs");
DropTable("dbo.TestedMedias");
DropTable("dbo.Atas");
DropTable("dbo.Devices");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddStatistics : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddStatistics));
string IMigrationMetadata.Id
{
get { return "201812220029427_AddStatistics"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,75 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class AddStatistics : DbMigration
{
public override void Up()
{
CreateTable("dbo.Commands",
c => new {Id = c.Int(false, true), Name = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
CreateTable("dbo.DeviceStats",
c => new
{
Id = c.Int(false, true),
Manufacturer = c.String(unicode: false),
Model = c.String(unicode: false),
Revision = c.String(unicode: false),
Bus = c.String(unicode: false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.Filesystems",
c => new {Id = c.Int(false, true), Name = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
CreateTable("dbo.Filters",
c => new {Id = c.Int(false, true), Name = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
CreateTable("dbo.MediaFormats",
c => new {Id = c.Int(false, true), Name = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
CreateTable("dbo.Media",
c => new
{
Id = c.Int(false, true),
Type = c.String(unicode: false),
Real = c.Boolean(false),
Count = c.Long(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.OperatingSystems",
c => new
{
Id = c.Int(false, true),
Name = c.String(unicode: false),
Version = c.String(unicode: false),
Count = c.Long(false)
}).PrimaryKey(t => t.Id);
CreateTable("dbo.Partitions",
c => new {Id = c.Int(false, true), Name = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
CreateTable("dbo.Versions",
c => new {Id = c.Int(false, true), Value = c.String(unicode: false), Count = c.Long(false)})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropTable("dbo.Versions");
DropTable("dbo.Partitions");
DropTable("dbo.OperatingSystems");
DropTable("dbo.Media");
DropTable("dbo.MediaFormats");
DropTable("dbo.Filters");
DropTable("dbo.Filesystems");
DropTable("dbo.DeviceStats");
DropTable("dbo.Commands");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class LinkDeviceStatsToReport : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(LinkDeviceStatsToReport));
string IMigrationMetadata.Id
{
get { return "201812221606592_LinkDeviceStatsToReport"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,21 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class LinkDeviceStatsToReport : DbMigration
{
public override void Up()
{
AddColumn("dbo.DeviceStats", "Report_Id", c => c.Int());
CreateIndex("dbo.DeviceStats", "Report_Id");
AddForeignKey("dbo.DeviceStats", "Report_Id", "dbo.Devices", "Id");
}
public override void Down()
{
DropForeignKey("dbo.DeviceStats", "Report_Id", "dbo.Devices");
DropIndex("dbo.DeviceStats", new[] {"Report_Id"});
DropColumn("dbo.DeviceStats", "Report_Id");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class FixUnsignedFields : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FixUnsignedFields));
string IMigrationMetadata.Id
{
get { return "201812231612080_FixUnsignedFields"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,81 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class FixUnsignedFields : DbMigration
{
public override void Up()
{
AddColumn("dbo.TestedMedias", "BlocksSql", c => c.Long());
AddColumn("dbo.TestedMedias", "BlockSizeSql", c => c.Int());
AddColumn("dbo.TestedMedias", "LongBlockSizeSql", c => c.Int());
AddColumn("dbo.TestedMedias", "LBASectorsSql", c => c.Int());
AddColumn("dbo.TestedMedias", "LBA48SectorsSql", c => c.Long());
AddColumn("dbo.TestedMedias", "LogicalAlignmentSql", c => c.Short());
AddColumn("dbo.TestedMedias", "NominalRotationRateSql", c => c.Short());
AddColumn("dbo.TestedMedias", "PhysicalBlockSizeSql", c => c.Int());
AddColumn("dbo.TestedMedias", "UnformattedBPTSql", c => c.Short());
AddColumn("dbo.TestedMedias", "UnformattedBPSSql", c => c.Short());
AddColumn("dbo.Chs", "CylindersSql", c => c.Short(false));
AddColumn("dbo.Chs", "HeadsSql", c => c.Short(false));
AddColumn("dbo.Chs", "SectorsSql", c => c.Short(false));
AddColumn("dbo.FireWires", "VendorIDSql", c => c.Int(false));
AddColumn("dbo.FireWires", "ProductIDSql", c => c.Int(false));
AddColumn("dbo.Pcmcias", "ManufacturerCodeSql", c => c.Short());
AddColumn("dbo.Pcmcias", "CardCodeSql", c => c.Short());
AddColumn("dbo.BlockDescriptors", "BlocksSql", c => c.Long());
AddColumn("dbo.BlockDescriptors", "BlockLengthSql", c => c.Int());
AddColumn("dbo.MmcFeatures", "BlocksPerReadableUnitSql", c => c.Short());
AddColumn("dbo.MmcFeatures", "LogicalBlockSizeSql", c => c.Int());
AddColumn("dbo.MmcFeatures", "PhysicalInterfaceStandardNumberSql", c => c.Int());
AddColumn("dbo.MmcFeatures", "VolumeLevelsSql", c => c.Short());
AddColumn("dbo.Sscs", "MaxBlockLengthSql", c => c.Int());
AddColumn("dbo.Sscs", "MinBlockLengthSql", c => c.Int());
AddColumn("dbo.SupportedDensities", "BitsPerMmSql", c => c.Int(false));
AddColumn("dbo.SupportedDensities", "WidthSql", c => c.Short(false));
AddColumn("dbo.SupportedDensities", "TracksSql", c => c.Short(false));
AddColumn("dbo.SupportedDensities", "CapacitySql", c => c.Int(false));
AddColumn("dbo.SscSupportedMedias", "WidthSql", c => c.Short(false));
AddColumn("dbo.SscSupportedMedias", "LengthSql", c => c.Short(false));
AddColumn("dbo.Usbs", "VendorIDSql", c => c.Short(false));
AddColumn("dbo.Usbs", "ProductIDSql", c => c.Short(false));
}
public override void Down()
{
DropColumn("dbo.Usbs", "ProductIDSql");
DropColumn("dbo.Usbs", "VendorIDSql");
DropColumn("dbo.SscSupportedMedias", "LengthSql");
DropColumn("dbo.SscSupportedMedias", "WidthSql");
DropColumn("dbo.SupportedDensities", "CapacitySql");
DropColumn("dbo.SupportedDensities", "TracksSql");
DropColumn("dbo.SupportedDensities", "WidthSql");
DropColumn("dbo.SupportedDensities", "BitsPerMmSql");
DropColumn("dbo.Sscs", "MinBlockLengthSql");
DropColumn("dbo.Sscs", "MaxBlockLengthSql");
DropColumn("dbo.MmcFeatures", "VolumeLevelsSql");
DropColumn("dbo.MmcFeatures", "PhysicalInterfaceStandardNumberSql");
DropColumn("dbo.MmcFeatures", "LogicalBlockSizeSql");
DropColumn("dbo.MmcFeatures", "BlocksPerReadableUnitSql");
DropColumn("dbo.BlockDescriptors", "BlockLengthSql");
DropColumn("dbo.BlockDescriptors", "BlocksSql");
DropColumn("dbo.Pcmcias", "CardCodeSql");
DropColumn("dbo.Pcmcias", "ManufacturerCodeSql");
DropColumn("dbo.FireWires", "ProductIDSql");
DropColumn("dbo.FireWires", "VendorIDSql");
DropColumn("dbo.Chs", "SectorsSql");
DropColumn("dbo.Chs", "HeadsSql");
DropColumn("dbo.Chs", "CylindersSql");
DropColumn("dbo.TestedMedias", "UnformattedBPSSql");
DropColumn("dbo.TestedMedias", "UnformattedBPTSql");
DropColumn("dbo.TestedMedias", "PhysicalBlockSizeSql");
DropColumn("dbo.TestedMedias", "NominalRotationRateSql");
DropColumn("dbo.TestedMedias", "LogicalAlignmentSql");
DropColumn("dbo.TestedMedias", "LBA48SectorsSql");
DropColumn("dbo.TestedMedias", "LBASectorsSql");
DropColumn("dbo.TestedMedias", "LongBlockSizeSql");
DropColumn("dbo.TestedMedias", "BlockSizeSql");
DropColumn("dbo.TestedMedias", "BlocksSql");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class UseBinaryDataForIdentifyInquiryAndModesInReports : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(UseBinaryDataForIdentifyInquiryAndModesInReports));
string IMigrationMetadata.Id
{
get { return "201812232250198_UseBinaryDataForIdentifyInquiryAndModesInReports"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,74 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class UseBinaryDataForIdentifyInquiryAndModesInReports : DbMigration
{
public override void Up()
{
DropForeignKey("Mmcs", "ModeSense2A_Id", "ModePage_2A");
DropIndex("dbo.Mmcs", new[] {"ModeSense2A_Id"});
AddColumn("dbo.Mmcs", "ModeSense2AData", c => c.Binary());
DropColumn("dbo.Mmcs", "ModeSense2A_Id");
DropTable("dbo.ModePage_2A");
}
public override void Down()
{
CreateTable("dbo.ModePage_2A",
c => new
{
Id = c.Int(false, true),
PS = c.Boolean(false),
MultiSession = c.Boolean(false),
Mode2Form2 = c.Boolean(false),
Mode2Form1 = c.Boolean(false),
AudioPlay = c.Boolean(false),
ISRC = c.Boolean(false),
UPC = c.Boolean(false),
C2Pointer = c.Boolean(false),
DeinterlaveSubchannel = c.Boolean(false),
Subchannel = c.Boolean(false),
AccurateCDDA = c.Boolean(false),
CDDACommand = c.Boolean(false),
LoadingMechanism = c.Byte(false),
Eject = c.Boolean(false),
PreventJumper = c.Boolean(false),
LockState = c.Boolean(false),
Lock = c.Boolean(false),
SeparateChannelMute = c.Boolean(false),
SeparateChannelVolume = c.Boolean(false),
Method2 = c.Boolean(false),
ReadCDRW = c.Boolean(false),
ReadCDR = c.Boolean(false),
WriteCDRW = c.Boolean(false),
WriteCDR = c.Boolean(false),
DigitalPort2 = c.Boolean(false),
DigitalPort1 = c.Boolean(false),
Composite = c.Boolean(false),
SSS = c.Boolean(false),
SDP = c.Boolean(false),
Length = c.Byte(false),
LSBF = c.Boolean(false),
RCK = c.Boolean(false),
BCK = c.Boolean(false),
TestWrite = c.Boolean(false),
ReadBarcode = c.Boolean(false),
ReadDVDRAM = c.Boolean(false),
ReadDVDR = c.Boolean(false),
ReadDVDROM = c.Boolean(false),
WriteDVDRAM = c.Boolean(false),
WriteDVDR = c.Boolean(false),
LeadInPW = c.Boolean(false),
SCC = c.Boolean(false),
BUF = c.Boolean(false),
RotationControlSelected = c.Byte(false)
}).PrimaryKey(t => t.Id);
AddColumn("dbo.Mmcs", "ModeSense2A_Id", c => c.Int());
DropColumn("dbo.Mmcs", "ModeSense2AData");
CreateIndex("dbo.Mmcs", "ModeSense2A_Id");
AddForeignKey("dbo.Mmcs", "ModeSense2A_Id", "dbo.ModePage_2A", "Id");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class StoreUsbIdsInDatabase : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(StoreUsbIdsInDatabase));
string IMigrationMetadata.Id
{
get { return "201812240552109_StoreUsbIdsInDatabase"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,39 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class StoreUsbIdsInDatabase : DbMigration
{
public override void Up()
{
CreateTable("dbo.UsbProducts",
c => new
{
Id = c.Int(false, true),
ProductId = c.Int(false),
Product = c.String(unicode: false),
AddedWhen = c.DateTime(false, 0),
ModifiedWhen = c.DateTime(false, 0),
VendorId = c.Int(false)
}).PrimaryKey(t => t.Id).ForeignKey("dbo.UsbVendors", t => t.VendorId, true)
.Index(t => t.VendorId);
CreateTable("dbo.UsbVendors",
c => new
{
Id = c.Int(false, true),
Vendor = c.String(unicode: false),
AddedWhen = c.DateTime(false, 0),
ModifiedWhen = c.DateTime(false, 0)
}).PrimaryKey(t => t.Id);
}
public override void Down()
{
DropForeignKey("dbo.UsbProducts", "VendorId", "dbo.UsbVendors");
DropIndex("dbo.UsbProducts", new[] {"VendorId"});
DropTable("dbo.UsbVendors");
DropTable("dbo.UsbProducts");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class FixUsbIdsAndIndexes : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FixUsbIdsAndIndexes));
string IMigrationMetadata.Id
{
get { return "201812241719441_FixUsbIdsAndIndexes"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,25 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class FixUsbIdsAndIndexes : DbMigration
{
public override void Up()
{
AddColumn("dbo.UsbVendors", "VendorId", c => c.Int(false));
CreateIndex("dbo.UsbProducts", "ProductId");
CreateIndex("dbo.UsbProducts", "ModifiedWhen");
CreateIndex("dbo.UsbVendors", "VendorId", true);
CreateIndex("dbo.UsbVendors", "ModifiedWhen");
}
public override void Down()
{
DropIndex("dbo.UsbVendors", new[] {"ModifiedWhen"});
DropIndex("dbo.UsbVendors", new[] {"VendorId"});
DropIndex("dbo.UsbProducts", new[] {"ModifiedWhen"});
DropIndex("dbo.UsbProducts", new[] {"ProductId"});
DropColumn("dbo.UsbVendors", "VendorId");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddCdOffsets : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddCdOffsets));
string IMigrationMetadata.Id
{
get { return "201812250223002_AddCdOffsets"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,40 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class AddCdOffsets : DbMigration
{
public override void Up()
{
CreateTable("dbo.CompactDiscOffsets",
c => new
{
Id = c.Int(false, true),
AddedWhen = c.DateTime(false, 0),
ModifiedWhen = c.DateTime(false, 0),
Manufacturer = c.String(unicode: false),
Model = c.String(unicode: false),
Offset = c.Short(false),
Submissions = c.Int(false),
Agreement = c.Single(false)
}).PrimaryKey(t => t.Id).Index(t => t.ModifiedWhen);
AddColumn("dbo.Devices", "ModifiedWhen", c => c.DateTime(precision: 0));
AddColumn("dbo.Devices", "CdOffset_Id", c => c.Int());
CreateIndex("dbo.Devices", "ModifiedWhen");
CreateIndex("dbo.Devices", "CdOffset_Id");
AddForeignKey("dbo.Devices", "CdOffset_Id", "dbo.CompactDiscOffsets", "Id");
}
public override void Down()
{
DropForeignKey("dbo.Devices", "CdOffset_Id", "dbo.CompactDiscOffsets");
DropIndex("dbo.Devices", new[] {"CdOffset_Id"});
DropIndex("dbo.Devices", new[] {"ModifiedWhen"});
DropIndex("dbo.CompactDiscOffsets", new[] {"ModifiedWhen"});
DropColumn("dbo.Devices", "CdOffset_Id");
DropColumn("dbo.Devices", "ModifiedWhen");
DropTable("dbo.CompactDiscOffsets");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class StoreMmcGetConfigurationResponse : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(StoreMmcGetConfigurationResponse));
string IMigrationMetadata.Id
{
get { return "201812251556377_StoreMmcGetConfigurationResponse"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,17 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class StoreMmcGetConfigurationResponse : DbMigration
{
public override void Up()
{
AddColumn("dbo.MmcFeatures", "BinaryData", c => c.Binary());
}
public override void Down()
{
DropColumn("dbo.MmcFeatures", "BinaryData");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class StoreReadResultsInReportDatabase : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(StoreReadResultsInReportDatabase));
string IMigrationMetadata.Id
{
get { return "201812252219066_StoreReadResultsInReportDatabase"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,139 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class StoreReadResultsInReportDatabase : DbMigration
{
public override void Up()
{
AddColumn("dbo.TestedMedias", "Read6Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "Read10Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "Read12Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "Read16Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLong10Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLong16Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadSectorsData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadSectorsRetryData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadDmaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadDmaRetryData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadRetryLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadDmaLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadDmaRetryLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLba48Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadDmaLba48Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLongData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLongRetryData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLongLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadLongRetryLbaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "TocData", c => c.Binary());
AddColumn("dbo.TestedMedias", "FullTocData", c => c.Binary());
AddColumn("dbo.TestedMedias", "AtipData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PmaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadCdData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadCdMsfData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadCdFullData", c => c.Binary());
AddColumn("dbo.TestedMedias", "ReadCdMsfFullData", c => c.Binary());
AddColumn("dbo.TestedMedias", "Track1PregapData", c => c.Binary());
AddColumn("dbo.TestedMedias", "LeadInData", c => c.Binary());
AddColumn("dbo.TestedMedias", "LeadOutData", c => c.Binary());
AddColumn("dbo.TestedMedias", "C2PointersData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PQSubchannelData", c => c.Binary());
AddColumn("dbo.TestedMedias", "RWSubchannelData", c => c.Binary());
AddColumn("dbo.TestedMedias", "CorrectedSubchannelData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PQSubchannelWithC2Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "RWSubchannelWithC2Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "CorrectedSubchannelWithC2Data", c => c.Binary());
AddColumn("dbo.TestedMedias", "PfiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DmiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "CmiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DvdBcaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DvdAacsData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DvdDdsData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DvdSaiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PriData", c => c.Binary());
AddColumn("dbo.TestedMedias", "EmbossedPfiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "AdipData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DcbData", c => c.Binary());
AddColumn("dbo.TestedMedias", "HdCmiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "DvdLayerData", c => c.Binary());
AddColumn("dbo.TestedMedias", "BluBcaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "BluDdsData", c => c.Binary());
AddColumn("dbo.TestedMedias", "BluSaiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "BluDiData", c => c.Binary());
AddColumn("dbo.TestedMedias", "BluPacData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PlextorReadCddaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PioneerReadCddaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PioneerReadCddaMsfData", c => c.Binary());
AddColumn("dbo.TestedMedias", "NecReadCddaData", c => c.Binary());
AddColumn("dbo.TestedMedias", "PlextorReadRawDVDData", c => c.Binary());
AddColumn("dbo.TestedMedias", "HLDTSTReadRawDVDData", c => c.Binary());
}
public override void Down()
{
DropColumn("dbo.TestedMedias", "HLDTSTReadRawDVDData");
DropColumn("dbo.TestedMedias", "PlextorReadRawDVDData");
DropColumn("dbo.TestedMedias", "NecReadCddaData");
DropColumn("dbo.TestedMedias", "PioneerReadCddaMsfData");
DropColumn("dbo.TestedMedias", "PioneerReadCddaData");
DropColumn("dbo.TestedMedias", "PlextorReadCddaData");
DropColumn("dbo.TestedMedias", "BluPacData");
DropColumn("dbo.TestedMedias", "BluDiData");
DropColumn("dbo.TestedMedias", "BluSaiData");
DropColumn("dbo.TestedMedias", "BluDdsData");
DropColumn("dbo.TestedMedias", "BluBcaData");
DropColumn("dbo.TestedMedias", "DvdLayerData");
DropColumn("dbo.TestedMedias", "HdCmiData");
DropColumn("dbo.TestedMedias", "DcbData");
DropColumn("dbo.TestedMedias", "AdipData");
DropColumn("dbo.TestedMedias", "EmbossedPfiData");
DropColumn("dbo.TestedMedias", "PriData");
DropColumn("dbo.TestedMedias", "DvdSaiData");
DropColumn("dbo.TestedMedias", "DvdDdsData");
DropColumn("dbo.TestedMedias", "DvdAacsData");
DropColumn("dbo.TestedMedias", "DvdBcaData");
DropColumn("dbo.TestedMedias", "CmiData");
DropColumn("dbo.TestedMedias", "DmiData");
DropColumn("dbo.TestedMedias", "PfiData");
DropColumn("dbo.TestedMedias", "CorrectedSubchannelWithC2Data");
DropColumn("dbo.TestedMedias", "RWSubchannelWithC2Data");
DropColumn("dbo.TestedMedias", "PQSubchannelWithC2Data");
DropColumn("dbo.TestedMedias", "CorrectedSubchannelData");
DropColumn("dbo.TestedMedias", "RWSubchannelData");
DropColumn("dbo.TestedMedias", "PQSubchannelData");
DropColumn("dbo.TestedMedias", "C2PointersData");
DropColumn("dbo.TestedMedias", "LeadOutData");
DropColumn("dbo.TestedMedias", "LeadInData");
DropColumn("dbo.TestedMedias", "Track1PregapData");
DropColumn("dbo.TestedMedias", "ReadCdMsfFullData");
DropColumn("dbo.TestedMedias", "ReadCdFullData");
DropColumn("dbo.TestedMedias", "ReadCdMsfData");
DropColumn("dbo.TestedMedias", "ReadCdData");
DropColumn("dbo.TestedMedias", "PmaData");
DropColumn("dbo.TestedMedias", "AtipData");
DropColumn("dbo.TestedMedias", "FullTocData");
DropColumn("dbo.TestedMedias", "TocData");
DropColumn("dbo.TestedMedias", "ReadLongRetryLbaData");
DropColumn("dbo.TestedMedias", "ReadLongLbaData");
DropColumn("dbo.TestedMedias", "ReadLongRetryData");
DropColumn("dbo.TestedMedias", "ReadLongData");
DropColumn("dbo.TestedMedias", "ReadDmaLba48Data");
DropColumn("dbo.TestedMedias", "ReadLba48Data");
DropColumn("dbo.TestedMedias", "ReadDmaRetryLbaData");
DropColumn("dbo.TestedMedias", "ReadDmaLbaData");
DropColumn("dbo.TestedMedias", "ReadRetryLbaData");
DropColumn("dbo.TestedMedias", "ReadLbaData");
DropColumn("dbo.TestedMedias", "ReadDmaRetryData");
DropColumn("dbo.TestedMedias", "ReadDmaData");
DropColumn("dbo.TestedMedias", "ReadSectorsRetryData");
DropColumn("dbo.TestedMedias", "ReadSectorsData");
DropColumn("dbo.TestedMedias", "ReadLong16Data");
DropColumn("dbo.TestedMedias", "ReadLong10Data");
DropColumn("dbo.TestedMedias", "Read16Data");
DropColumn("dbo.TestedMedias", "Read12Data");
DropColumn("dbo.TestedMedias", "Read10Data");
DropColumn("dbo.TestedMedias", "Read6Data");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddMultisessionLeadTest : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddMultisessionLeadTest));
string IMigrationMetadata.Id
{
get { return "201901022133012_AddMultisessionLeadTest"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,23 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class AddMultisessionLeadTest : DbMigration
{
public override void Up()
{
AddColumn("dbo.TestedMedias", "CanReadingIntersessionLeadIn", c => c.Boolean());
AddColumn("dbo.TestedMedias", "CanReadingIntersessionLeadOut", c => c.Boolean());
AddColumn("dbo.TestedMedias", "IntersessionLeadInData", c => c.Binary());
AddColumn("dbo.TestedMedias", "IntersessionLeadOutData", c => c.Binary());
}
public override void Down()
{
DropColumn("dbo.TestedMedias", "IntersessionLeadOutData");
DropColumn("dbo.TestedMedias", "IntersessionLeadInData");
DropColumn("dbo.TestedMedias", "CanReadingIntersessionLeadOut");
DropColumn("dbo.TestedMedias", "CanReadingIntersessionLeadIn");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddOptimalReadMultipleCount : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddOptimalReadMultipleCount));
string IMigrationMetadata.Id
{
get { return "201901030344456_AddOptimalReadMultipleCount"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,17 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class AddOptimalReadMultipleCount : DbMigration
{
public override void Up()
{
AddColumn("dbo.Devices", "OptimalMultipleSectorsRead", c => c.Int(false, defaultValue: 0));
}
public override void Down()
{
DropColumn("dbo.Devices", "OptimalMultipleSectorsRead");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddChangeableScsiModes : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddChangeableScsiModes));
string IMigrationMetadata.Id
{
get { return "201901081359499_AddChangeableScsiModes"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,23 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class AddChangeableScsiModes : DbMigration
{
public override void Up()
{
AddColumn("dbo.Scsis", "ModeSense6CurrentData", c => c.Binary());
AddColumn("dbo.Scsis", "ModeSense10CurrentData", c => c.Binary());
AddColumn("dbo.Scsis", "ModeSense6ChangeableData", c => c.Binary());
AddColumn("dbo.Scsis", "ModeSense10ChangeableData", c => c.Binary());
}
public override void Down()
{
DropColumn("dbo.Scsis", "ModeSense10ChangeableData");
DropColumn("dbo.Scsis", "ModeSense6ChangeableData");
DropColumn("dbo.Scsis", "ModeSense10CurrentData");
DropColumn("dbo.Scsis", "ModeSense6CurrentData");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class IdForDensityCode : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(IdForDensityCode));
string IMigrationMetadata.Id
{
get { return "201905252122267_IdForDensityCode"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,34 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class IdForDensityCode : DbMigration
{
public override void Up()
{
RenameTable("DensityCodes", "DensityCodes_old");
CreateTable("dbo.DensityCodes",
c => new {Code = c.Int(false), SscSupportedMedia_Id = c.Int(), Id = c.Int(false, true)})
.PrimaryKey(t => t.Id).ForeignKey("dbo.SscSupportedMedias", t => t.SscSupportedMedia_Id)
.Index(t => t.SscSupportedMedia_Id);
Sql("INSERT INTO DensityCodes (Code, SscSupportedMedia_Id) SELECT Code, SscSupportedMedia_Id FROM DensityCodes_old");
DropTable("DensityCodes_old");
}
public override void Down()
{
RenameTable("DensityCodes", "DensityCodes_old");
CreateTable("dbo.DensityCodes", c => new {Code = c.Int(false, true), SscSupportedMedia_Id = c.Int()})
.PrimaryKey(t => t.Code).ForeignKey("dbo.SscSupportedMedias", t => t.SscSupportedMedia_Id)
.Index(t => t.SscSupportedMedia_Id);
Sql("INSERT INTO DensityCodes (Code, SscSupportedMedia_Id) SELECT Code, SscSupportedMedia_Id FROM DensityCodes_old");
DropTable("DensityCodes_old");
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
// <auto-generated />
namespace DiscImageChef.Server.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class MakeEntityFrameworkHappy : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(MakeEntityFrameworkHappy));
string IMigrationMetadata.Id
{
get { return "201905252245072_MakeEntityFrameworkHappy"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}

View File

@@ -0,0 +1,11 @@
using System.Data.Entity.Migrations;
namespace DiscImageChef.Server.Migrations
{
public partial class MakeEntityFrameworkHappy : DbMigration
{
public override void Up() { }
public override void Down() { }
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Configuration.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Provides database context configuration.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Data.Entity.Migrations;
using DiscImageChef.Server.Models;
namespace DiscImageChef.Server.Migrations
{
public sealed class Configuration : DbMigrationsConfiguration<DicServerContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(DicServerContext context)
{
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data.
}
}
}

View File

@@ -0,0 +1,70 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : CdOffset.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing Compact Disc read offsets in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server.Models
{
public class CompactDiscOffset : CdOffset
{
public CompactDiscOffset() { }
public CompactDiscOffset(string manufacturer, string model, short offset, int submissions, float agreement)
{
Manufacturer = manufacturer;
Model = model;
Offset = offset;
Submissions = submissions;
Agreement = agreement;
AddedWhen = ModifiedWhen = DateTime.UtcNow;
}
public CompactDiscOffset(CdOffset offset)
{
Manufacturer = offset.Manufacturer;
Model = offset.Model;
Offset = offset.Offset;
Submissions = offset.Submissions;
Agreement = offset.Agreement;
AddedWhen = ModifiedWhen = DateTime.UtcNow;
}
public int Id { get; set; }
public DateTime AddedWhen { get; set; }
[Index]
public DateTime ModifiedWhen { get; set; }
public virtual ICollection<Device> Devices { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Command.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing command statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Command
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Context.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Entity framework database context.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Data.Entity;
using MySql.Data.EntityFramework;
namespace DiscImageChef.Server.Models
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public sealed class DicServerContext : DbContext
{
public DbSet<Device> Devices { get; set; }
public DbSet<UploadedReport> Reports { get; set; }
public DbSet<Command> Commands { get; set; }
public DbSet<DeviceStat> DeviceStats { get; set; }
public DbSet<Filesystem> Filesystems { get; set; }
public DbSet<Filter> Filters { get; set; }
public DbSet<Media> Medias { get; set; }
public DbSet<MediaFormat> MediaFormats { get; set; }
public DbSet<OperatingSystem> OperatingSystems { get; set; }
public DbSet<Partition> Partitions { get; set; }
public DbSet<Version> Versions { get; set; }
public DbSet<UsbVendor> UsbVendors { get; set; }
public DbSet<UsbProduct> UsbProducts { get; set; }
public DbSet<CompactDiscOffset> CdOffsets { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Device.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing processed device reports in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server.Models
{
public class Device : DeviceReportV2
{
public Device()
{
AddedWhen = DateTime.UtcNow;
}
public Device(DeviceReportV2 report)
{
ATA = report.ATA;
ATAPI = report.ATAPI;
CompactFlash = report.CompactFlash;
FireWire = report.FireWire;
AddedWhen = DateTime.UtcNow;
ModifiedWhen = DateTime.UtcNow;
MultiMediaCard = report.MultiMediaCard;
PCMCIA = report.PCMCIA;
SCSI = report.SCSI;
SecureDigital = report.SecureDigital;
USB = report.USB;
Manufacturer = report.Manufacturer;
Model = report.Model;
Revision = report.Revision;
Type = report.Type;
}
public DateTime AddedWhen { get; set; }
[Index]
public DateTime? ModifiedWhen { get; set; }
public virtual CompactDiscOffset CdOffset { get; set; }
[DefaultValue(0)]
public int OptimalMultipleSectorsRead { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DeviceItem.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for showing device statistics.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Server.Models
{
public class DeviceItem
{
public string Manufacturer { get; set; }
public string Model { get; set; }
public string Revision { get; set; }
public string Bus { get; set; }
public int ReportId { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DeviceStat.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing device statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class DeviceStat
{
[Key]
public int Id { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public string Revision { get; set; }
public string Bus { get; set; }
public virtual Device Report { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Filesystem.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing filesystem statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Filesystem
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Filter.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing filter statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Filter
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Media.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing media type statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Media
{
[Key]
public int Id { get; set; }
public string Type { get; set; }
public bool Real { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : MediaFormat.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing media image format statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class MediaFormat
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : MediaItem.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for showing media type statistics.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Server.Models
{
public class MediaItem
{
public string Type { get; set; }
public string SubType { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : OperatingSystem.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing operating system statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class OperatingSystem
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public string Version { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Partition.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing partition statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Partition
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UploadedReport.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing uploaded device reports in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server.Models
{
public class UploadedReport : DeviceReportV2
{
public UploadedReport()
{
UploadedWhen = DateTime.UtcNow;
}
public UploadedReport(DeviceReportV2 report)
{
ATA = report.ATA;
ATAPI = report.ATAPI;
CompactFlash = report.CompactFlash;
FireWire = report.FireWire;
UploadedWhen = DateTime.UtcNow;
MultiMediaCard = report.MultiMediaCard;
PCMCIA = report.PCMCIA;
SCSI = report.SCSI;
SecureDigital = report.SecureDigital;
USB = report.USB;
Manufacturer = report.Manufacturer;
Model = report.Model;
Revision = report.Revision;
Type = report.Type;
}
public DateTime UploadedWhen { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UsbProduct.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing USB product identifiers in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace DiscImageChef.Server.Models
{
public class UsbProduct
{
public UsbProduct() { }
public UsbProduct(UsbVendor vendor, ushort id, string product)
{
ProductId = id;
Product = product;
AddedWhen = ModifiedWhen = DateTime.UtcNow;
Vendor = vendor;
}
[Key]
public int Id { get; set; }
[Index]
public int ProductId { get; set; }
public string Product { get; set; }
public DateTime AddedWhen { get; set; }
[Index]
public DateTime ModifiedWhen { get; set; }
[Index]
public int VendorId { get; set; }
[JsonIgnore]
public virtual UsbVendor Vendor { get; set; }
}
}

View File

@@ -0,0 +1,64 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : UsbVendor.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing USB vendor identifiers in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace DiscImageChef.Server.Models
{
public class UsbVendor
{
public UsbVendor() { }
public UsbVendor(ushort id, string vendor)
{
VendorId = id;
Vendor = vendor;
AddedWhen = ModifiedWhen = DateTime.UtcNow;
}
[Key]
public int Id { get; set; }
[Index(IsUnique = true)]
public int VendorId { get; set; }
public string Vendor { get; set; }
public DateTime AddedWhen { get; set; }
[Index]
public DateTime ModifiedWhen { get; set; }
[JsonIgnore]
public virtual ICollection<UsbProduct> Products { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Version.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Model for storing version statistics in database.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class Version
{
[Key]
public int Id { get; set; }
public string Value { get; set; }
public long Count { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
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")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiscImageChef.Server")]
[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("A893FA0E-6952-4517-B4AA-658E421737C1")]
// 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")]

View File

@@ -0,0 +1 @@
IndexIgnore *

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : CODE_OF_CONDUCT.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders code of conduct.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef's code of conduct:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : CONTRIBUTING.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders contributing guidelines.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
How to contribute to DiscImageChef:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Changelog.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders changelog.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef list of changes:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DONATING.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders list of needed donations.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef list of things to be donated:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ISSUE_TEMPLATE.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders issue's template.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef's template for issue reports:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,47 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Index.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders readme.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<header>
Welcome to
<i>
<a href="http://github.com/claunia/discimagechef"
target="_blank">
DiscImageChef
</a>
</i> Server version @ViewBag.lblVersion
</header>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : PULL_REQUEST_TEMPLATE.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders pull request's template.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef's template for pull requests:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,42 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : TODO.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders todo list.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
DiscImageChef list of things to do:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -0,0 +1,265 @@
@using DiscImageChef.CommonTypes.Metadata
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "DiscImageChef Device Report";
}
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : View.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Renders device report.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<div class="container-fluid">
DiscImageChef Report for
@ViewBag.lblManufacturer
@ViewBag.lblModel
@ViewBag.lblRevision
@if(ViewBag.UsbItem != null)
{
<div id="divUsb">
<br />
<b>USB characteristics:</b><br />
<i>Manufacturer:</i> @ViewBag.UsbItem.Manufacturer<br />
<i>Product:</i> @ViewBag.UsbItem.Product<br />
<i>Vendor ID:</i> @ViewBag.UsbItem.VendorDescription<br />
<i>Product ID:</i> @ViewBag.UsbItem.ProductDescription
</div>
}
@if(ViewBag.FireWireItem != null)
{
<div id="divFireWire">
<br />
<b>FireWire characteristics:</b><br />
<i>Manufacturer:</i> @ViewBag.FireWire.Manufacturer<br />
<i>Product:</i> @ViewBag.FireWire.Product<br />
<i>Vendor ID:</i> @ViewBag.FireWire.VendorDescription<br />
<i>Product ID:</i> @ViewBag.FireWire.ProductDescription
</div>
}
@if(ViewBag.PcmciaItem != null)
{
<div id="divPcmcia">
<br />
<b>PCMCIA characteristics:</b><br />
<i>Manufacturer:</i> @ViewBag.PcmciaItem.Manufacturer<br />
<i>Product:</i> @ViewBag.PcmciaItem.ProductName<br />
<i>Manufacturer code:</i> @ViewBag.PcmciaItem.VendorDescription<br />
<i>Card code:</i> @ViewBag.PcmciaItem.CardCode<br />
<i>Compliance:</i> @ViewBag.PcmciaItem.Compliance<br />
@if(ViewBag.repPcmciaTuples != null)
{
foreach(KeyValuePair<string, string> kvp in ViewBag.repPcmciaTuples)
{
<text><i>@kvp.Key</i>: @kvp.Value<br /></text>
}
}
</div>
}
@if(ViewBag.AtaItem != null)
{
<div id="divAta">
<br />
<b>
@ViewBag.AtaItem characteristics:
</b><br />
@ViewBag.lblAtaDeviceType<br />
@foreach(KeyValuePair<string, string> kvp in ViewBag.repAtaTwo)
{
<text><i>@kvp.Key</i>: @kvp.Value<br /></text>
}
<br />
@foreach(string item in ViewBag.repAtaOne)
{
@Html.Raw(item)<br />
}
</div>
}
@if(ViewBag.repScsi != null)
{
<div id="divScsi">
<br />
<b>SCSI characteristics:</b><br />
<i>Vendor: </i>@ViewBag.lblScsiVendor<br />
<i>Product: </i>@ViewBag.lblScsiProduct<br />
<i>Revision: </i>@ViewBag.lblScsiRevision<br />
@foreach(string item in ViewBag.repScsi)
{
@Html.Raw(item)<br />
}
@if(ViewBag.repModeSense != null)
{
<div id="divScsiModeSense">
<br /><i>SCSI mode sense pages:</i>
<table border="1">
<tr>
<th>Mode</th>
<th>Contents</th>
</tr>
@foreach(KeyValuePair<string, string> kvp in ViewBag.repModeSense)
{
<tr>
<td>
@kvp.Key
</td>
<td>
@Html.Raw(kvp.Value)
</td>
</tr>
}
</table>
</div>
}
@if(ViewBag.repEvpd != null)
{
<div id="divScsiEvpd">
<br /><i>SCSI extended vital product data pages:</i>
<table border="1">
<tr>
<th>EVPD</th>
<th>Contents</th>
</tr>
@foreach(KeyValuePair<string, string> kvp in ViewBag.repEvpd)
{
<tr>
<td>
@kvp.Key
</td>
<td>
@Html.Raw(kvp.Value)
</td>
</tr>
}
</table>
</div>
}
@if(ViewBag.repScsiMmcMode != null)
{
<div id="divScsiMmcMode">
<br /><b>SCSI CD-ROM capabilities:</b><br />
@foreach(string item in ViewBag.repScsiMmcMode)
{
@Html.Raw(item)<br />
}
</div>
}
@if(ViewBag.repScsiMmcFeatures != null)
{
<div id="divScsiMmcFeatures">
<br /><b>SCSI MMC features:</b><br />
@foreach(string item in ViewBag.repScsiMmcFeatures)
{
@Html.Raw(item)<br />
}
</div>
}
@if(ViewBag.divScsiSscVisible == true)
{
<div id="divScsiSsc">
<br /><b>SCSI Streaming device capabilities:</b><br />
Block size granularity: @ViewBag.lblScsiSscGranularity<br />
Maximum block length: @ViewBag.lblScsiSscMaxBlock bytes<br />
Minimum block length: @ViewBag.lblScsiSscMinBlock bytes<br />
@if(ViewBag.repScsiSscDensities != null)
{
foreach(SupportedDensity density in ViewBag.repScsiSscDensities)
{
<text>
<br />
<b>
Information for supported density with primary code @($"{density.PrimaryCode:X2h}") and secondary code @($"{density.SecondaryCode:X2h}")
</b><br />
Drive can write this density: @density.Writable<br />
Duplicate density: @density.Duplicate<br />
Default density: @density.DefaultDensity<br />
Density has @density.BitsPerMm bits per mm, with @density.Tracks tracks in a @density.Width mm width tape
Name: @density.Name<br />
Organization: @density.Organization<br />
Description: @density.Description<br />
Maximum capacity: @density.Capacity megabytes<br />
</text>
}
}
@if(ViewBag.repScsiSscMedias != null)
{
foreach(SscSupportedMedia media in ViewBag.repScsiSscMedias)
{
<text>
<br />
<b>
Information for supported media with type code @($"{media.MediumType:X2h}")
</b><br />
Media is @media.Length m long in a @media.Width mm width tape
Name: @media.Name<br />
Organization: @media.Organization<br />
Description: @media.Description<br />
</text>
}
}
</div>
}
</div>
}
@if(ViewBag.repTestedMedia != null)
{
<div id="divTestedMedia">
<br /><b>Tested media:</b><br />
@foreach(string item in ViewBag.repTestedMedia)
{
@Html.Raw(item)<br />
}
</div>
}
@if(ViewBag.repMMC != null)
{
<div id="divMMC">
<br />
<b>MultiMediaCard device:</b><br />
@foreach(string item in ViewBag.repMMC)
{
@Html.Raw(item)<br />
}
</div>
}
@if(ViewBag.repSD != null)
{
<div id="divSD">
<br />
<b>SecureDigital device:</b><br />
@foreach(string item in ViewBag.repSD)
{
@Html.Raw(item)<br />
}
</div>
}
</div>

View File

@@ -0,0 +1,110 @@
@{
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : _Layout.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains layout.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
}
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
@switch(DateTime.UtcNow.DayOfYear)
{
// 24th January, Macintosh launch
case 24:
<link href="../../styles/mac/dicserver.css"
rel="stylesheet"type="text/css" />
<link href="../../styles/mac/dicserver_highcharts.css"
rel="stylesheet"type="text/css" />
break;
default:
<link href="../../styles/dos/dicserver.css"
rel="stylesheet"type="text/css" />
<link href="../../styles/dos/dicserver_highcharts.css"
rel="stylesheet"type="text/css" />
break;
}
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async
src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-111466173-1');
</script>
</head>
<body>
@RenderBody()
<footer class="container-fluid">
© 2011-2019
<a href="http://www.claunia.com"
target="_blank">
Claunia.com
</a><br />
@switch(DateTime.UtcNow.DayOfYear)
{
// 24th January, Macintosh launch
case 24:
@Html.Raw("Fonts are © 2014 <a href=\"http://christtrekker.users.sourceforge.net/fnt/chicago.shtml\" target=\"_blank\">Robin Casady</a>")
;
break;
default:
@Html.Raw("Fonts are © 2015 - 2016 <a href=\"http://int10h.org\" target=\"_blank\">VileR</a>")
;
break;
}
<br />
CSS © 2018-2019
<a href="https://getbootstrap.com/"
target="_blank">
Bootstrap
</a> and
<a href="http://www.claunia.com"
target="_blank">
Claunia.com
</a>
</footer>
<script crossorigin="anonymous"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script crossorigin="anonymous"
integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut"
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script crossorigin="anonymous"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More