mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add update endpoint.
This commit is contained in:
53
CdOffsetDto.cs
Normal file
53
CdOffsetDto.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : CdOffset.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Database.
|
||||
//
|
||||
// --[ 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 DiscImageChef.CommonTypes.Metadata;
|
||||
|
||||
namespace DiscImageChef.Dto
|
||||
{
|
||||
public class CdOffsetDto : CdOffset
|
||||
{
|
||||
public CdOffsetDto() { }
|
||||
|
||||
public CdOffsetDto(CdOffset offset, int id)
|
||||
{
|
||||
Manufacturer = offset.Manufacturer;
|
||||
Model = offset.Model;
|
||||
Offset = offset.Offset;
|
||||
Submissions = offset.Submissions;
|
||||
Agreement = offset.Agreement;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
225
DeviceDto.cs
Normal file
225
DeviceDto.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
// /***************************************************************************
|
||||
// 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.Collections.Generic;
|
||||
using DiscImageChef.CommonTypes.Metadata;
|
||||
|
||||
// ReSharper disable VirtualMemberCallInConstructor
|
||||
|
||||
namespace DiscImageChef.Server.Models
|
||||
{
|
||||
public class DeviceDto : DeviceReportV2
|
||||
{
|
||||
public DeviceDto(DeviceReportV2 report)
|
||||
{
|
||||
ATA = report.ATA;
|
||||
ATAPI = report.ATAPI;
|
||||
CompactFlash = report.CompactFlash;
|
||||
FireWire = report.FireWire;
|
||||
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 DeviceDto(DeviceReportV2 report, int id)
|
||||
{
|
||||
ATA = report.ATA;
|
||||
ATAPI = report.ATAPI;
|
||||
CompactFlash = report.CompactFlash;
|
||||
FireWire = report.FireWire;
|
||||
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;
|
||||
|
||||
if(ATA != null)
|
||||
{
|
||||
ATA.Identify = null;
|
||||
ATA.ReadCapabilities = ClearBinaries(ATA.ReadCapabilities);
|
||||
if(ATA.RemovableMedias != null)
|
||||
{
|
||||
TestedMedia[] medias = ATA.RemovableMedias.ToArray();
|
||||
ATA.RemovableMedias = new List<TestedMedia>();
|
||||
foreach(TestedMedia media in medias) ATA.RemovableMedias.Add(ClearBinaries(media));
|
||||
}
|
||||
}
|
||||
|
||||
if(ATAPI != null)
|
||||
{
|
||||
ATAPI.Identify = null;
|
||||
ATAPI.ReadCapabilities = ClearBinaries(ATAPI.ReadCapabilities);
|
||||
if(ATAPI.RemovableMedias != null)
|
||||
{
|
||||
TestedMedia[] medias = ATAPI.RemovableMedias.ToArray();
|
||||
ATAPI.RemovableMedias = new List<TestedMedia>();
|
||||
foreach(TestedMedia media in medias) ATAPI.RemovableMedias.Add(ClearBinaries(media));
|
||||
}
|
||||
}
|
||||
|
||||
if(PCMCIA != null)
|
||||
{
|
||||
PCMCIA.AdditionalInformation = null;
|
||||
PCMCIA.CIS = null;
|
||||
}
|
||||
|
||||
MultiMediaCard = null;
|
||||
SecureDigital = null;
|
||||
|
||||
if(SCSI != null)
|
||||
{
|
||||
SCSI.EVPDPages = null;
|
||||
SCSI.InquiryData = null;
|
||||
SCSI.ModeSense6Data = null;
|
||||
SCSI.ModeSense10Data = null;
|
||||
SCSI.ReadCapabilities = ClearBinaries(SCSI.ReadCapabilities);
|
||||
|
||||
if(SCSI.ModeSense != null)
|
||||
{
|
||||
SCSI.ModeSense.BlockDescriptors = null;
|
||||
SCSI.ModeSense.ModePages = null;
|
||||
}
|
||||
|
||||
if(SCSI.RemovableMedias != null)
|
||||
{
|
||||
TestedMedia[] medias = SCSI.RemovableMedias.ToArray();
|
||||
SCSI.RemovableMedias = new List<TestedMedia>();
|
||||
foreach(TestedMedia media in medias) SCSI.RemovableMedias.Add(ClearBinaries(media));
|
||||
}
|
||||
|
||||
if(SCSI.MultiMediaDevice != null)
|
||||
{
|
||||
SCSI.MultiMediaDevice.ModeSense2AData = null;
|
||||
|
||||
if(SCSI.MultiMediaDevice.Features != null) SCSI.MultiMediaDevice.Features.BinaryData = null;
|
||||
|
||||
if(SCSI.MultiMediaDevice.TestedMedia != null)
|
||||
{
|
||||
TestedMedia[] medias = SCSI.MultiMediaDevice.TestedMedia.ToArray();
|
||||
SCSI.MultiMediaDevice.TestedMedia = new List<TestedMedia>();
|
||||
foreach(TestedMedia media in medias)
|
||||
SCSI.MultiMediaDevice.TestedMedia.Add(ClearBinaries(media));
|
||||
}
|
||||
}
|
||||
|
||||
SCSI.SequentialDevice = null;
|
||||
}
|
||||
|
||||
if(USB != null) USB.Descriptors = null;
|
||||
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public new int Id { get; set; }
|
||||
|
||||
static TestedMedia ClearBinaries(TestedMedia media)
|
||||
{
|
||||
if(media is null) return null;
|
||||
|
||||
media.AdipData = null;
|
||||
media.AtipData = null;
|
||||
media.BluBcaData = null;
|
||||
media.BluDdsData = null;
|
||||
media.BluDiData = null;
|
||||
media.BluPacData = null;
|
||||
media.BluSaiData = null;
|
||||
media.C2PointersData = null;
|
||||
media.CmiData = null;
|
||||
media.CorrectedSubchannelData = null;
|
||||
media.CorrectedSubchannelWithC2Data = null;
|
||||
media.DcbData = null;
|
||||
media.DmiData = null;
|
||||
media.DvdAacsData = null;
|
||||
media.DvdBcaData = null;
|
||||
media.DvdDdsData = null;
|
||||
media.DvdLayerData = null;
|
||||
media.DvdSaiData = null;
|
||||
media.EmbossedPfiData = null;
|
||||
media.FullTocData = null;
|
||||
media.HdCmiData = null;
|
||||
media.HLDTSTReadRawDVDData = null;
|
||||
media.IdentifyData = null;
|
||||
media.LeadInData = null;
|
||||
media.LeadOutData = null;
|
||||
media.ModeSense6Data = null;
|
||||
media.ModeSense10Data = null;
|
||||
media.NecReadCddaData = null;
|
||||
media.PfiData = null;
|
||||
media.PioneerReadCddaData = null;
|
||||
media.PioneerReadCddaMsfData = null;
|
||||
media.PlextorReadCddaData = null;
|
||||
media.PlextorReadRawDVDData = null;
|
||||
media.PmaData = null;
|
||||
media.PQSubchannelData = null;
|
||||
media.PQSubchannelWithC2Data = null;
|
||||
media.PriData = null;
|
||||
media.Read6Data = null;
|
||||
media.Read10Data = null;
|
||||
media.Read12Data = null;
|
||||
media.Read16Data = null;
|
||||
media.ReadCdData = null;
|
||||
media.ReadCdFullData = null;
|
||||
media.ReadCdMsfData = null;
|
||||
media.ReadCdMsfFullData = null;
|
||||
media.ReadDmaData = null;
|
||||
media.ReadDmaLba48Data = null;
|
||||
media.ReadDmaLbaData = null;
|
||||
media.ReadDmaRetryData = null;
|
||||
media.ReadLba48Data = null;
|
||||
media.ReadLbaData = null;
|
||||
media.ReadLong10Data = null;
|
||||
media.ReadLong16Data = null;
|
||||
media.ReadLongData = null;
|
||||
media.ReadLongLbaData = null;
|
||||
media.ReadLongRetryData = null;
|
||||
media.ReadLongRetryLbaData = null;
|
||||
media.ReadRetryLbaData = null;
|
||||
media.ReadSectorsData = null;
|
||||
media.ReadSectorsRetryData = null;
|
||||
media.RWSubchannelData = null;
|
||||
media.RWSubchannelWithC2Data = null;
|
||||
media.TocData = null;
|
||||
media.Track1PregapData = null;
|
||||
return media;
|
||||
}
|
||||
}
|
||||
}
|
||||
77
DiscImageChef.Dto.csproj
Normal file
77
DiscImageChef.Dto.csproj
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F4399FF5-9BD0-475A-9EA7-3DAE45291FE2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DiscImageChef.Dto</RootNamespace>
|
||||
<AssemblyName>DiscImageChef.Dto</AssemblyName>
|
||||
<ReleaseVersion>$(Version)</ReleaseVersion>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<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.Dto</Title>
|
||||
<ApplicationVersion>$(Version)</ApplicationVersion>
|
||||
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
|
||||
</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\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\LICENSE.LGPL">
|
||||
<Link>LICENSE.LGPL</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CdOffsetDto.cs" />
|
||||
<Compile Include="DeviceDto.cs" />
|
||||
<Compile Include="SyncDto.cs" />
|
||||
<Compile Include="UsbProductDto.cs" />
|
||||
<Compile Include="UsbVendorDto.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj" />
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<StandardHeader IncludeInNewFiles="True" Text="/***************************************************************************
The Disc Image Chef
----------------------------------------------------------------------------
 
Filename : ${FileName}
Author(s) : ${AuthorName} <${AuthorEmail}>

Component : Component
 
--[ Description ] ----------------------------------------------------------
 
 Description
 
--[ 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-${Year} ${CopyrightHolder}
****************************************************************************/" />
|
||||
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
13
SyncDto.cs
Normal file
13
SyncDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Server.Models;
|
||||
|
||||
namespace DiscImageChef.Dto
|
||||
{
|
||||
public class SyncDto
|
||||
{
|
||||
public List<UsbVendorDto> UsbVendors { get; set; }
|
||||
public List<UsbProductDto> UsbProducts { get; set; }
|
||||
public List<CdOffsetDto> Offsets { get; set; }
|
||||
public List<DeviceDto> Devices { get; set; }
|
||||
}
|
||||
}
|
||||
42
UsbProductDto.cs
Normal file
42
UsbProductDto.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
// /***************************************************************************
|
||||
// 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
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace DiscImageChef.Dto
|
||||
{
|
||||
public class UsbProductDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ushort ProductId { get; set; }
|
||||
public string Product { get; set; }
|
||||
public ushort VendorId { get; set; }
|
||||
}
|
||||
}
|
||||
40
UsbVendorDto.cs
Normal file
40
UsbVendorDto.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
// /***************************************************************************
|
||||
// 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
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace DiscImageChef.Dto
|
||||
{
|
||||
public class UsbVendorDto
|
||||
{
|
||||
public ushort VendorId { get; set; }
|
||||
public string Vendor { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user