commit 5ed724cd8568bb6a9611e15c423e37445a4a5a96 Author: Natalia Portillo Date: Tue Jan 1 16:43:34 2019 +0000 Add update endpoint. diff --git a/CdOffsetDto.cs b/CdOffsetDto.cs new file mode 100644 index 000000000..c5af8f04f --- /dev/null +++ b/CdOffsetDto.cs @@ -0,0 +1,53 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : CdOffset.cs +// Author(s) : Natalia Portillo +// +// 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 . +// +// ---------------------------------------------------------------------------- +// 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; } + } +} \ No newline at end of file diff --git a/DeviceDto.cs b/DeviceDto.cs new file mode 100644 index 000000000..cddb798d2 --- /dev/null +++ b/DeviceDto.cs @@ -0,0 +1,225 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Device.cs +// Author(s) : Natalia Portillo +// +// 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 . +// +// ---------------------------------------------------------------------------- +// 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(); + 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(); + 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(); + 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(); + 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; + } + } +} \ No newline at end of file diff --git a/DiscImageChef.Dto.csproj b/DiscImageChef.Dto.csproj new file mode 100644 index 000000000..99049d1e1 --- /dev/null +++ b/DiscImageChef.Dto.csproj @@ -0,0 +1,77 @@ + + + + Debug + AnyCPU + 2.0 + {F4399FF5-9BD0-475A-9EA7-3DAE45291FE2} + Library + DiscImageChef.Dto + DiscImageChef.Dto + $(Version) + false + true + 4.5.99.1693 + Claunia.com + Copyright © 2011-2019 Natalia Portillo + The Disc Image Chef + DiscImageChef.Dto + $(Version) + net461;netstandard2.0 + + + $(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified} + true + true + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + + + LICENSE.LGPL + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SyncDto.cs b/SyncDto.cs new file mode 100644 index 000000000..ce3186d6a --- /dev/null +++ b/SyncDto.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using DiscImageChef.Server.Models; + +namespace DiscImageChef.Dto +{ + public class SyncDto + { + public List UsbVendors { get; set; } + public List UsbProducts { get; set; } + public List Offsets { get; set; } + public List Devices { get; set; } + } +} \ No newline at end of file diff --git a/UsbProductDto.cs b/UsbProductDto.cs new file mode 100644 index 000000000..e6f2daf4e --- /dev/null +++ b/UsbProductDto.cs @@ -0,0 +1,42 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : UsbProduct.cs +// Author(s) : Natalia Portillo +// +// 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 . +// +// ---------------------------------------------------------------------------- +// 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; } + } +} \ No newline at end of file diff --git a/UsbVendorDto.cs b/UsbVendorDto.cs new file mode 100644 index 000000000..56f6424b8 --- /dev/null +++ b/UsbVendorDto.cs @@ -0,0 +1,40 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : UsbVendor.cs +// Author(s) : Natalia Portillo +// +// 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2019 Natalia Portillo +// ****************************************************************************/ + +namespace DiscImageChef.Dto +{ + public class UsbVendorDto + { + public ushort VendorId { get; set; } + public string Vendor { get; set; } + } +} \ No newline at end of file