Code style fixes.

This commit is contained in:
2020-07-22 15:26:02 +01:00
parent 6b62580714
commit 2280ff50c0
94 changed files with 1389 additions and 1299 deletions

View File

@@ -154,7 +154,7 @@ place_simple_embedded_block_on_same_line=false
place_simple_anonymousmethod_on_single_line=false
keep_existing_initializer_arrangement=false
place_simple_initializer_on_single_line=false
wrap_object_and_collection_initializer_style=wrap_if_long
wrap_object_and_collection_initializer_style=chop_always
wrap_array_initializer_style=wrap_if_long
wrap_arguments_style=wrap_if_long
keep_existing_invocation_parens_arrangement=false
@@ -298,7 +298,7 @@ dotnet_sort_system_directives_first=true
# Constants in C style, all-caps
dotnet_naming_rule.constant_fields_caps.symbols = constant_fields
dotnet_naming_rule.constant_fields_caps.severity = suggestion
dotnet_naming_rule.constant_fields_caps.severity = warning
dotnet_naming_rule.constant_fields_caps.style = caps_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
@@ -313,7 +313,7 @@ dotnet_naming_style.pascal_case_interface_style.required_prefix = I
dotnet_naming_style.pascal_case_interface_style.capitalization = pascal_case
## internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
@@ -506,6 +506,7 @@ csharp_int_align_invocations=false
csharp_int_align_binary_expressions=true
csharp_int_align_comments=true
csharp_int_align_switch_sections=true
csharp_int_align=true
csharp_keep_user_linebreaks=false
csharp_keep_existing_arrangement=false
csharp_keep_existing_linebreaks=false
@@ -559,7 +560,7 @@ csharp_place_simple_embedded_block_on_same_line=false
csharp_place_simple_anonymousmethod_on_single_line=false
csharp_keep_existing_initializer_arrangement=false
csharp_place_simple_initializer_on_single_line=false
csharp_wrap_object_and_collection_initializer_style=wrap_if_long
csharp_wrap_object_and_collection_initializer_style=chop_always
csharp_wrap_array_initializer_style=wrap_if_long
csharp_wrap_arguments_style=wrap_if_long
csharp_keep_existing_invocation_parens_arrangement=false

View File

@@ -142,8 +142,7 @@ namespace Aaru.Server.Task
System.Console.
WriteLine("{0}: Will modify product with ID {1:X4} and vendor {2} ({3:X4}) from \"{4}\" to \"{5}\"",
DateTime.UtcNow, product.ProductId, product.Vendor?.Vendor ?? "null",
product.Vendor?.VendorId ?? 0,
product.Product, name);
product.Vendor?.VendorId ?? 0, product.Product, name);
product.Product = name;
product.ModifiedWhen = DateTime.UtcNow;
@@ -399,7 +398,7 @@ namespace Aaru.Server.Task
if(!int.TryParse(column2, out int submissions))
continue;
if(column3[column3.Length - 1] != '%')
if(column3[^1] != '%')
continue;
column3 = column3.Substring(0, column3.Length - 1);
@@ -413,8 +412,12 @@ namespace Aaru.Server.Task
{
cdOffset = new CompactDiscOffset
{
AddedWhen = DateTime.UtcNow, ModifiedWhen = DateTime.UtcNow, Agreement = percentage,
Manufacturer = manufacturer, Model = model, Offset = offset,
AddedWhen = DateTime.UtcNow,
ModifiedWhen = DateTime.UtcNow,
Agreement = percentage,
Manufacturer = manufacturer,
Model = model,
Offset = offset,
Submissions = submissions
};
@@ -451,10 +454,9 @@ namespace Aaru.Server.Task
Devices.
Where(d => d.Manufacturer == null && d.Model != null &&
d.Model.Trim() == model).
Union(ctx.Devices.Where(d => d.Manufacturer != null &&
Union(ctx.Devices.Where(d => d.Manufacturer != null &&
d.Manufacturer.Trim() == manufacturer &&
d.Model != null &&
d.Model == model)))
d.Model != null && d.Model == model)))
{
if(device.CdOffset == cdOffset &&
device.ModifiedWhen == cdOffset.ModifiedWhen)

View File

@@ -1,4 +1,19 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">/opt/dotnet/sdk/3.0.100/MSBuild.dll</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">4294967295</s:Int64>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aaru/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=AACS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aaru/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CPRM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DDCD/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=doubleword/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=INCITS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=IORDY/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ISRC/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=MDMA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=OSTA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PLEXTOR/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Portillo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SATA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subchannel/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subchannels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=UDMA/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -3,18 +3,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.Server.Core;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Ata = Aaru.CommonTypes.Metadata.Ata;
using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class AtasController : Controller
public sealed class AtasController : Controller
{
readonly AaruServerContext _context;
@@ -32,7 +34,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
return NotFound();
}
CommonTypes.Metadata.Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
@@ -50,7 +52,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
return NotFound();
}
CommonTypes.Metadata.Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
@@ -64,7 +66,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
CommonTypes.Metadata.Ata ata = await _context.Ata.FindAsync(id);
Ata ata = await _context.Ata.FindAsync(id);
_context.Ata.Remove(ata);
await _context.SaveChangesAsync();
@@ -81,7 +83,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
for(int i = 0; i < dups.Count; i++)
{
CommonTypes.Metadata.Ata unique = _context.Ata.First(a => a.Id == dups[i].Id);
Ata unique = _context.Ata.First(a => a.Id == dups[i].Id);
dups[i].Description = unique.IdentifyDevice?.Model;
dups[i].Duplicates = hashes.Where(h => h.Hash == dups[i].Hash).Skip(1).Select(x => x.Id).ToArray();
@@ -89,7 +91,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
return View(new IdHashModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}
@@ -112,14 +115,14 @@ namespace Aaru.Server.Areas.Admin.Controllers
foreach(IdHashModel duplicate in duplicates)
{
CommonTypes.Metadata.Ata master = _context.Ata.FirstOrDefault(m => m.Id == duplicate.Id);
Ata master = _context.Ata.FirstOrDefault(m => m.Id == duplicate.Id);
if(master is null)
continue;
foreach(int duplicateId in duplicate.Duplicates)
{
CommonTypes.Metadata.Ata slave = _context.Ata.FirstOrDefault(m => m.Id == duplicateId);
Ata slave = _context.Ata.FirstOrDefault(m => m.Id == duplicateId);
if(slave is null)
continue;
@@ -165,20 +168,22 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult ConsolidateWithIds(int masterId, int slaveId)
{
CommonTypes.Metadata.Ata master = _context.Ata.FirstOrDefault(m => m.Id == masterId);
Ata master = _context.Ata.FirstOrDefault(m => m.Id == masterId);
if(master is null)
return RedirectToAction(nameof(Compare), new
{
id = masterId, rightId = slaveId
id = masterId,
rightId = slaveId
});
CommonTypes.Metadata.Ata slave = _context.Ata.FirstOrDefault(m => m.Id == slaveId);
Ata slave = _context.Ata.FirstOrDefault(m => m.Id == slaveId);
if(slave is null)
return RedirectToAction(nameof(Compare), new
{
id = masterId, rightId = slaveId
id = masterId,
rightId = slaveId
});
foreach(Device ataDevice in _context.Devices.Where(d => d.ATA.Id == slaveId))
@@ -222,11 +227,12 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
var model = new CompareModel
{
LeftId = id, RightId = rightId
LeftId = id,
RightId = rightId
};
CommonTypes.Metadata.Ata left = _context.Ata.FirstOrDefault(l => l.Id == id);
CommonTypes.Metadata.Ata right = _context.Ata.FirstOrDefault(r => r.Id == rightId);
Ata left = _context.Ata.FirstOrDefault(l => l.Id == id);
Ata right = _context.Ata.FirstOrDefault(r => r.Id == rightId);
if(left is null)
{
@@ -356,10 +362,10 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult CheckPrivate()
{
List<CommonTypes.Metadata.Ata> havePrivacy = new List<CommonTypes.Metadata.Ata>();
byte[] tmp;
List<Ata> havePrivacy = new List<Ata>();
byte[] tmp;
foreach(CommonTypes.Metadata.Ata ata in _context.Ata)
foreach(Ata ata in _context.Ata)
{
Identify.IdentifyDevice? id = ata.IdentifyDevice;
@@ -435,7 +441,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult ClearPrivate(int id)
{
CommonTypes.Metadata.Ata ata = _context.Ata.FirstOrDefault(a => a.Id == id);
Ata ata = _context.Ata.FirstOrDefault(a => a.Id == id);
if(ata is null)
return RedirectToAction(nameof(CheckPrivate));
@@ -461,7 +467,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult ClearReserved(int id)
{
CommonTypes.Metadata.Ata ata = _context.Ata.FirstOrDefault(a => a.Id == id);
Ata ata = _context.Ata.FirstOrDefault(a => a.Id == id);
if(ata is null)
return RedirectToAction(nameof(CheckPrivate));
@@ -495,7 +501,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult ClearPrivateAll()
{
foreach(CommonTypes.Metadata.Ata ata in _context.Ata)
foreach(Ata ata in _context.Ata)
{
if(ata is null)
return RedirectToAction(nameof(CheckPrivate));
@@ -523,7 +529,7 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult ClearReservedAll()
{
foreach(CommonTypes.Metadata.Ata ata in _context.Ata)
foreach(Ata ata in _context.Ata)
{
// ReservedWords121
for(int i = 0; i < 10; i++)

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class BlockDescriptorsController : Controller
public sealed class BlockDescriptorsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -11,7 +11,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class ChsController : Controller
public sealed class ChsController : Controller
{
readonly AaruServerContext _context;
@@ -26,15 +26,20 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
List<ChsModel> dups = _context.Chs.GroupBy(x => new
{
x.Cylinders, x.Heads, x.Sectors
x.Cylinders,
x.Heads,
x.Sectors
}).Where(x => x.Count() > 1).Select(x => new ChsModel
{
Cylinders = x.Key.Cylinders, Heads = x.Key.Heads, Sectors = x.Key.Sectors
Cylinders = x.Key.Cylinders,
Heads = x.Key.Heads,
Sectors = x.Key.Sectors
}).ToList();
return View(new ChsModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class CommandsController : Controller
public sealed class CommandsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class CompactDiscOffsetsController : Controller
public sealed class CompactDiscOffsetsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class DeviceStatsController : Controller
public sealed class DeviceStatsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class DevicesController : Controller
public sealed class DevicesController : Controller
{
readonly AaruServerContext _context;
@@ -406,9 +406,12 @@ namespace Aaru.Server.Areas.Admin.Controllers
var found = new FindReportModel
{
Id = id, Manufacturer = manufacturer, Model = model, Revision = revision,
Bus = bus,
LikeDevices = _context.Devices.Where(r => r.Model.ToLower().Contains(model.ToLower())).ToList()
Id = id,
Manufacturer = manufacturer,
Model = model,
Revision = revision,
Bus = bus,
LikeDevices = _context.Devices.Where(r => r.Model.ToLower().Contains(model.ToLower())).ToList()
};
return View(found);

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class FilesystemsController : Controller
public sealed class FilesystemsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class FiltersController : Controller
public sealed class FiltersController : Controller
{
readonly AaruServerContext _context;

View File

@@ -11,7 +11,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class FireWiresController : Controller
public sealed class FireWiresController : Controller
{
readonly AaruServerContext _context;
@@ -112,17 +112,24 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
List<FireWireModel> dups = _context.FireWire.GroupBy(x => new
{
x.VendorID, x.ProductID, x.Manufacturer, x.Product,
x.VendorID,
x.ProductID,
x.Manufacturer,
x.Product,
x.RemovableMedia
}).Where(x => x.Count() > 1).Select(x => new FireWireModel
{
VendorID = x.Key.VendorID, ProductID = x.Key.ProductID, Manufacturer = x.Key.Manufacturer,
Product = x.Key.Product, RemovableMedia = x.Key.RemovableMedia
VendorID = x.Key.VendorID,
ProductID = x.Key.ProductID,
Manufacturer = x.Key.Manufacturer,
Product = x.Key.Product,
RemovableMedia = x.Key.RemovableMedia
}).ToList();
return View(new FireWireModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using System.Web;
using Aaru.CommonTypes.Metadata;
using Aaru.Decoders.CD;
using Aaru.Helpers;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -13,7 +14,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class GdRomSwapDiscCapabilitiesController : Controller
public sealed class GdRomSwapDiscCapabilitiesController : Controller
{
readonly AaruServerContext _context;
@@ -82,7 +83,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
var model = new TestedMediaDataModel
{
TestedMediaId = id, DataName = data
TestedMediaId = id,
DataName = data
};
byte[] buffer;

View File

@@ -31,18 +31,13 @@
// ****************************************************************************/
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class HomeController : Controller
public sealed class HomeController : Controller
{
readonly IWebHostEnvironment _environment;
public HomeController(IWebHostEnvironment environment) => _environment = environment;
public ActionResult Index() => View();
}
}

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class MediaFormatsController : Controller
public sealed class MediaFormatsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class MediasController : Controller
public sealed class MediasController : Controller
{
readonly AaruServerContext _context;

View File

@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class MmcController : Controller
public sealed class MmcController : Controller
{
readonly AaruServerContext _context;
@@ -19,13 +19,15 @@ namespace Aaru.Server.Areas.Admin.Controllers
public IActionResult Index() => View(_context.Mmc.Where(m => m.ModeSense2AData != null).
Select(m => new MmcModelForView
{
Id = m.Id, FeaturesId = m.FeaturesId,
Id = m.Id,
FeaturesId = m.FeaturesId,
DataLength = m.ModeSense2AData.Length
}).ToList().
Concat(_context.Mmc.Where(m => m.ModeSense2AData == null).
Select(m => new MmcModelForView
{
Id = m.Id, FeaturesId = m.FeaturesId,
Id = m.Id,
FeaturesId = m.FeaturesId,
DataLength = 0
}).ToList()).OrderBy(m => m.Id));

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class MmcFeaturesController : Controller
public sealed class MmcFeaturesController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class MmcSdsController : Controller
public sealed class MmcSdsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class OperatingSystemsController : Controller
public sealed class OperatingSystemsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class PartitionsController : Controller
public sealed class PartitionsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class PcmciasController : Controller
public sealed class PcmciasController : Controller
{
readonly AaruServerContext _context;

View File

@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class ReportsController : Controller
public sealed class ReportsController : Controller
{
readonly AaruServerContext _context;
@@ -165,8 +165,6 @@ namespace Aaru.Server.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
bool UploadedReportExists(int id) => _context.Reports.Any(e => e.Id == id);
public IActionResult Promote(int? id)
{
if(id == null)

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class ScsiModesController : Controller
public sealed class ScsiModesController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class ScsiPagesController : Controller
public sealed class ScsiPagesController : Controller
{
readonly AaruServerContext _context;

View File

@@ -5,16 +5,19 @@ using System.Reflection;
using System.Threading.Tasks;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Helpers;
using Aaru.Server.Core;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class ScsisController : Controller
public sealed class ScsisController : Controller
{
readonly AaruServerContext _context;
@@ -99,7 +102,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
return View(new IdHashModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}
@@ -167,7 +171,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
var model = new CompareModel
{
LeftId = id, RightId = rightId
LeftId = id,
RightId = rightId
};
Scsi left = _context.Scsi.FirstOrDefault(l => l.Id == id);
@@ -335,7 +340,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
if(master is null)
return RedirectToAction(nameof(Compare), new
{
id = masterId, rightId = slaveId
id = masterId,
rightId = slaveId
});
Scsi slave = _context.Scsi.FirstOrDefault(m => m.Id == slaveId);
@@ -343,7 +349,8 @@ namespace Aaru.Server.Areas.Admin.Controllers
if(slave is null)
return RedirectToAction(nameof(Compare), new
{
id = masterId, rightId = slaveId
id = masterId,
rightId = slaveId
});
foreach(Device scsiDevice in _context.Devices.Where(d => d.SCSI.Id == slaveId))

View File

@@ -11,7 +11,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class SscsController : Controller
public sealed class SscsController : Controller
{
readonly AaruServerContext _context;
@@ -55,16 +55,20 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
List<SscModel> dups = _context.Ssc.GroupBy(x => new
{
x.BlockSizeGranularity, x.MaxBlockLength, x.MinBlockLength
x.BlockSizeGranularity,
x.MaxBlockLength,
x.MinBlockLength
}).Where(x => x.Count() > 1).Select(x => new SscModel
{
BlockSizeGranularity = x.Key.BlockSizeGranularity, MaxBlockLength = x.Key.MaxBlockLength,
BlockSizeGranularity = x.Key.BlockSizeGranularity,
MaxBlockLength = x.Key.MaxBlockLength,
MinBlockLength = x.Key.MinBlockLength
}).ToList();
return View(new SscModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}

View File

@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class SupportedDensitiesController : Controller
public sealed class SupportedDensitiesController : Controller
{
readonly AaruServerContext _context;

View File

@@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Aaru.CommonTypes.Metadata;
@@ -10,6 +9,7 @@ using Aaru.Decoders.Bluray;
using Aaru.Decoders.CD;
using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Helpers;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -22,7 +22,7 @@ using Spare = Aaru.Decoders.Bluray.Spare;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class TestedMediasController : Controller
public sealed class TestedMediasController : Controller
{
readonly AaruServerContext _context;
@@ -140,8 +140,6 @@ namespace Aaru.Server.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
bool TestedMediaExists(int id) => _context.TestedMedia.Any(e => e.Id == id);
public IActionResult ViewData(int id, string data)
{
if(string.IsNullOrWhiteSpace(data))
@@ -156,16 +154,16 @@ namespace Aaru.Server.Areas.Admin.Controllers
var model = new TestedMediaDataModel
{
TestedMediaId = id, DataName = data
TestedMediaId = id,
DataName = data
};
byte[] buffer;
StringBuilder sb;
byte[] sector = new byte[2352];
byte[] subq = new byte[16];
byte[] fullsub = new byte[96];
bool c2Errors = false;
bool scrambled = false;
byte[] buffer;
byte[] sector = new byte[2352];
byte[] subq = new byte[16];
byte[] fullsub = new byte[96];
bool c2Errors = false;
bool scrambled = false;
switch(data)
{

View File

@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class TestedSequentialMediasController : Controller
public sealed class TestedSequentialMediasController : Controller
{
readonly AaruServerContext _context;

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class UsbProductsController : Controller
public sealed class UsbProductsController : Controller
{
readonly AaruServerContext _context;
@@ -20,9 +20,10 @@ namespace Aaru.Server.Areas.Admin.Controllers
OrderBy(p => p.Vendor.Vendor).ThenBy(p => p.Product).
ThenBy(p => p.ProductId).Select(p => new UsbProductModel
{
ProductId = p.ProductId, ProductName = p.Product,
VendorId = p.Vendor.Id,
VendorName = p.Vendor.Vendor
ProductId = p.ProductId,
ProductName = p.Product,
VendorId = p.Vendor.Id,
VendorName = p.Vendor.Vendor
}).ToListAsync());
}
}

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class UsbVendorsController : Controller
public sealed class UsbVendorsController : Controller
{
readonly AaruServerContext _context;
@@ -35,17 +35,14 @@ namespace Aaru.Server.Areas.Admin.Controllers
return View(new UsbVendorModel
{
Vendor = usbVendor.Vendor, VendorId = usbVendor.VendorId, Products = _context.
UsbProducts.
Where(p => p.VendorId ==
usbVendor.Id).
OrderBy(p => p.Product).
ThenBy(p => p.ProductId).
Select(p => new UsbProductModel
{
ProductId = p.ProductId,
ProductName = p.Product
}).ToList()
Vendor = usbVendor.Vendor,
VendorId = usbVendor.VendorId,
Products = _context.UsbProducts.Where(p => p.VendorId == usbVendor.Id).OrderBy(p => p.Product).
ThenBy(p => p.ProductId).Select(p => new UsbProductModel
{
ProductId = p.ProductId,
ProductName = p.Product
}).ToList()
});
}
}

View File

@@ -11,7 +11,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class UsbsController : Controller
public sealed class UsbsController : Controller
{
readonly AaruServerContext _context;
@@ -73,16 +73,22 @@ namespace Aaru.Server.Areas.Admin.Controllers
{
List<UsbModel> dups = _context.Usb.GroupBy(x => new
{
x.Manufacturer, x.Product, x.VendorID, x.ProductID
x.Manufacturer,
x.Product,
x.VendorID,
x.ProductID
}).Where(x => x.Count() > 1).Select(x => new UsbModel
{
Manufacturer = x.Key.Manufacturer, Product = x.Key.Product, VendorID = x.Key.VendorID,
Manufacturer = x.Key.Manufacturer,
Product = x.Key.Product,
VendorID = x.Key.VendorID,
ProductID = x.Key.ProductID
}).ToList();
return View(new UsbModelForView
{
List = dups, Json = JsonConvert.SerializeObject(dups)
List = dups,
Json = JsonConvert.SerializeObject(dups)
});
}

View File

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Areas.Admin.Controllers
{
[Area("Admin"), Authorize]
public class VersionsController : Controller
public sealed class VersionsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.ATA
@using Aaru.Server.Core
@using Aaru.Decoders.ATA
@model Aaru.CommonTypes.Metadata.Ata
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.ATA
@using Aaru.Server.Core
@using Aaru.Decoders.ATA
@model Aaru.CommonTypes.Metadata.Ata
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SCSI
@using Aaru.Server.Core
@using Aaru.Decoders.SCSI
@model Aaru.CommonTypes.Metadata.Mmc
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SCSI
@using Aaru.Server.Core
@using Aaru.Decoders.SCSI
@model Aaru.CommonTypes.Metadata.Mmc
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SecureDigital
@using Aaru.Server.Core
@using Aaru.Decoders.SecureDigital
@model Aaru.CommonTypes.Metadata.MmcSd
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SecureDigital
@using Aaru.Server.Core
@using Aaru.Decoders.SecureDigital
@model Aaru.CommonTypes.Metadata.MmcSd
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SCSI
@using Aaru.Server.Core
@using Aaru.Decoders.SCSI
@model Aaru.CommonTypes.Metadata.Scsi
@{

View File

@@ -1,5 +1,5 @@
@using Aaru.Decoders.SCSI
@using Aaru.Server.Core
@using Aaru.Decoders.SCSI
@model Aaru.CommonTypes.Metadata.Scsi
@{

View File

@@ -1,4 +1,4 @@
@using Aaru
@using Aaru.Helpers
@model IEnumerable<Aaru.CommonTypes.Metadata.Scsi>
@{

View File

@@ -82,10 +82,7 @@
{
<div>
<a asp-area="Identity" asp-page="/Account/Manage/Index" class="text-dark" id="manage" title="Manage">Hello @UserManager.GetUserName(User)!</a>
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new
{
area = ""
})">
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
<button class="btn btn-link text-dark" id="logout" type="submit">Logout</button>
</form>
</div>

View File

@@ -8,10 +8,7 @@
<a asp-area="Identity" asp-page="/Account/Manage/Index" class="nav-link text-dark" id="manage" title="Manage">Hello @UserManager.GetUserName(User)!</a>
</li>
<li class="nav-item">
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new
{
area = ""
})">
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
<button class="btn btn-link nav-link text-dark" id="logout" type="submit">Logout</button>
</form>
</li>

View File

@@ -1,4 +1,5 @@
@using Aaru.Server
@using Aaru.Server.Models
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
@using Microsoft.ApplicationInsights.AspNetCore
@inject JavaScriptSnippet JavaScriptSnippet
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Aaru.Server.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class RegisterModel : PageModel
public sealed class RegisterModel : PageModel
{
public IActionResult OnGetAsync(string returnUrl = null) => RedirectToPage("Login");

View File

@@ -12,23 +12,22 @@ using Microsoft.Extensions.Configuration;
namespace Aaru.Server
{
public class BasicAuthMiddleware
public sealed class BasicAuthMiddleware
{
readonly RequestDelegate next;
readonly string realm;
readonly RequestDelegate _next;
readonly string _realm;
public BasicAuthMiddleware(RequestDelegate next, string realm)
{
this.next = next;
this.realm = realm;
_next = next;
_realm = realm;
}
public async Task Invoke(HttpContext context)
{
string authHeader = context.Request.Headers["Authorization"];
if(authHeader != null &&
authHeader.StartsWith("Basic "))
if(authHeader?.StartsWith("Basic ") == true)
{
// Get the encoded username and password
string encodedUsernamePassword =
@@ -45,7 +44,7 @@ namespace Aaru.Server
// Check if login is correct
if(IsAuthorized(username, password))
{
await next.Invoke(context);
await _next.Invoke(context);
return;
}
@@ -55,9 +54,9 @@ namespace Aaru.Server
context.Response.Headers["WWW-Authenticate"] = "Basic";
// Add realm if it is not null
if(!string.IsNullOrWhiteSpace(realm))
if(!string.IsNullOrWhiteSpace(_realm))
{
context.Response.Headers["WWW-Authenticate"] += $" realm=\"{realm}\"";
context.Response.Headers["WWW-Authenticate"] += $" realm=\"{_realm}\"";
}
// Return unauthorized
@@ -73,8 +72,7 @@ namespace Aaru.Server
string validUser = configuration.GetValue<string>("MetricsAuthentication:Username");
string validPassword = configuration.GetValue<string>("MetricsAuthentication:Password");
return !string.IsNullOrWhiteSpace(validUser) &&
!string.IsNullOrWhiteSpace(validPassword) &&
return !string.IsNullOrWhiteSpace(validUser) && !string.IsNullOrWhiteSpace(validPassword) &&
username.Equals(validUser, StringComparison.InvariantCultureIgnoreCase) &&
password.Equals(validPassword);
}

View File

@@ -39,7 +39,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Aaru.Server.Controllers
{
public class HomeController : Controller
public sealed class HomeController : Controller
{
readonly IWebHostEnvironment _environment;
@@ -59,7 +59,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
@@ -78,7 +78,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
@@ -97,7 +97,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
@@ -116,7 +116,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
@@ -135,13 +135,13 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
[Route("CONTRIBUTING")]
public ActionResult CONTRIBUTING()
public ActionResult Contributing()
{
var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
@@ -173,7 +173,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
@@ -192,13 +192,13 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}
[Route("TODO")]
public ActionResult TODO()
public ActionResult Todo()
{
var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
@@ -211,7 +211,7 @@ namespace Aaru.Server.Controllers
ViewBag.Markdown = Markdown.ToHtml(mdcontent);
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
ViewBag.lblVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
return View();
}

View File

@@ -33,19 +33,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Decoders.PCMCIA;
using Aaru.Decoders.SCSI;
using Aaru.Helpers;
using Aaru.Server.Core;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Ata = Aaru.CommonTypes.Metadata.Ata;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
namespace Aaru.Server.Controllers
{
public class ReportController : Controller
public sealed class ReportController : Controller
{
readonly AaruServerContext _ctx;
@@ -81,8 +84,7 @@ namespace Aaru.Server.Controllers
string usbProductDescription = null;
UsbProduct dbProduct =
_ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID &&
p.Vendor != null &&
_ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID && p.Vendor != null &&
p.Vendor.VendorId == report.USB.VendorID);
if(dbProduct is null)
@@ -100,7 +102,8 @@ namespace Aaru.Server.Controllers
ViewBag.UsbItem = new Item
{
Manufacturer = report.USB.Manufacturer, Product = report.USB.Product,
Manufacturer = report.USB.Manufacturer,
Product = report.USB.Product,
VendorDescription = usbVendorDescription != null
? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})"
: $"0x{report.USB.VendorID:x4}",
@@ -113,7 +116,8 @@ namespace Aaru.Server.Controllers
if(report.FireWire != null)
ViewBag.FireWireItem = new Item
{
Manufacturer = report.FireWire.Manufacturer, Product = report.FireWire.Product,
Manufacturer = report.FireWire.Manufacturer,
Product = report.FireWire.Product,
VendorDescription = $"0x{report.FireWire.VendorID:x8}",
ProductDescription = $"0x{report.FireWire.ProductID:x8}"
};
@@ -122,9 +126,11 @@ namespace Aaru.Server.Controllers
{
ViewBag.PcmciaItem = new PcmciaItem
{
Manufacturer = report.PCMCIA.Manufacturer, Product = report.PCMCIA.ProductName,
Manufacturer = report.PCMCIA.Manufacturer,
Product = report.PCMCIA.ProductName,
VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}",
ProductDescription = $"0x{report.PCMCIA.CardCode:x4}", Compliance = report.PCMCIA.Compliance
ProductDescription = $"0x{report.PCMCIA.CardCode:x4}",
Compliance = report.PCMCIA.Compliance
};
Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS);
@@ -214,17 +220,15 @@ namespace Aaru.Server.Controllers
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;
Ata ataReport;
if(report.ATAPI != null)
{
@@ -247,7 +251,8 @@ namespace Aaru.Server.Controllers
else
ViewBag.lblAtaDeviceType = "ATA device";
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
Core.Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue,
ref testedMedia);
ViewBag.repAtaOne = ataOneValue;
ViewBag.repAtaTwo = ataTwoValue;
@@ -371,8 +376,7 @@ namespace Aaru.Server.Controllers
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)
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
@@ -506,7 +510,7 @@ namespace Aaru.Server.Controllers
testedMedia != null)
{
List<string> mediaOneValue = new List<string>();
App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue);
Core.TestedMedia.Report(testedMedia, ref mediaOneValue);
if(mediaOneValue.Count > 0)
ViewBag.repTestedMedia = mediaOneValue;
@@ -532,7 +536,7 @@ namespace Aaru.Server.Controllers
public string VendorDescription;
}
public class PcmciaItem : Item
public sealed class PcmciaItem : Item
{
public string Compliance;
}

View File

@@ -40,6 +40,7 @@ using System.Xml;
using System.Xml.Serialization;
using Aaru.CommonTypes.Interop;
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Core;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
@@ -50,15 +51,15 @@ using Version = Aaru.Server.Models.Version;
namespace Aaru.Server.Controllers
{
/// <summary>Renders a page with statistics, list of media type, devices, etc</summary>
public class StatsController : Controller
public sealed class StatsController : Controller
{
readonly AaruServerContext ctx;
readonly IWebHostEnvironment env;
readonly AaruServerContext _ctx;
readonly IWebHostEnvironment _env;
public StatsController(IWebHostEnvironment environment, AaruServerContext context)
{
env = environment;
ctx = context;
_env = environment;
_ctx = context;
}
public ActionResult Index()
@@ -67,7 +68,7 @@ namespace Aaru.Server.Controllers
try
{
if(System.IO.File.Exists(Path.Combine(env.ContentRootPath ?? throw new InvalidOperationException(),
if(System.IO.File.Exists(Path.Combine(_env.ContentRootPath ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml")))
try
{
@@ -76,7 +77,7 @@ namespace Aaru.Server.Controllers
var xs = new XmlSerializer(statistics.GetType());
FileStream fs =
WaitForFile(Path.Combine(env.ContentRootPath ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"),
WaitForFile(Path.Combine(_env.ContentRootPath ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"),
FileMode.Open, FileAccess.Read, FileShare.Read);
statistics = (Stats)xs.Deserialize(fs);
@@ -84,19 +85,20 @@ namespace Aaru.Server.Controllers
StatsConverter.Convert(statistics);
System.IO.File.Delete(Path.Combine(env.ContentRootPath ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml"));
System.IO.File.
Delete(Path.Combine(_env.ContentRootPath ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml"));
}
catch(XmlException)
{
// Do nothing
}
if(ctx.OperatingSystems.Any())
if(_ctx.OperatingSystems.Any())
{
List<NameValueStats> operatingSystems = new List<NameValueStats>();
foreach(OperatingSystem nvs in ctx.OperatingSystems)
foreach(OperatingSystem nvs in _ctx.OperatingSystems)
operatingSystems.Add(new NameValueStats
{
name =
@@ -107,40 +109,41 @@ namespace Aaru.Server.Controllers
ViewBag.repOperatingSystems = operatingSystems.OrderBy(os => os.name).ToList();
}
if(ctx.Versions.Any())
if(_ctx.Versions.Any())
{
List<NameValueStats> versions = new List<NameValueStats>();
foreach(Version nvs in ctx.Versions)
foreach(Version nvs in _ctx.Versions)
versions.Add(new NameValueStats
{
name = nvs.Name == "previous" ? "Previous than 3.4.99.0" : nvs.Name, Value = nvs.Count
name = nvs.Name == "previous" ? "Previous than 3.4.99.0" : nvs.Name,
Value = nvs.Count
});
ViewBag.repVersions = versions.OrderBy(ver => ver.name).ToList();
}
if(ctx.Commands.Any())
ViewBag.repCommands = ctx.Commands.OrderBy(c => c.Name).ToList();
if(_ctx.Commands.Any())
ViewBag.repCommands = _ctx.Commands.OrderBy(c => c.Name).ToList();
if(ctx.Filters.Any())
ViewBag.repFilters = ctx.Filters.OrderBy(filter => filter.Name).ToList();
if(_ctx.Filters.Any())
ViewBag.repFilters = _ctx.Filters.OrderBy(filter => filter.Name).ToList();
if(ctx.MediaFormats.Any())
ViewBag.repMediaImages = ctx.MediaFormats.OrderBy(filter => filter.Name).ToList();
if(_ctx.MediaFormats.Any())
ViewBag.repMediaImages = _ctx.MediaFormats.OrderBy(filter => filter.Name).ToList();
if(ctx.Partitions.Any())
ViewBag.repPartitions = ctx.Partitions.OrderBy(filter => filter.Name).ToList();
if(_ctx.Partitions.Any())
ViewBag.repPartitions = _ctx.Partitions.OrderBy(filter => filter.Name).ToList();
if(ctx.Filesystems.Any())
ViewBag.repFilesystems = ctx.Filesystems.OrderBy(filter => filter.Name).ToList();
if(_ctx.Filesystems.Any())
ViewBag.repFilesystems = _ctx.Filesystems.OrderBy(filter => filter.Name).ToList();
if(ctx.Medias.Any())
if(_ctx.Medias.Any())
{
List<MediaItem> realMedia = new List<MediaItem>();
List<MediaItem> virtualMedia = new List<MediaItem>();
foreach(Media nvs in ctx.Medias)
foreach(Media nvs in _ctx.Medias)
try
{
(string type, string subType) mediaType =
@@ -150,12 +153,16 @@ namespace Aaru.Server.Controllers
if(nvs.Real)
realMedia.Add(new MediaItem
{
Type = mediaType.type, SubType = mediaType.subType, Count = nvs.Count
Type = mediaType.type,
SubType = mediaType.subType,
Count = nvs.Count
});
else
virtualMedia.Add(new MediaItem
{
Type = mediaType.type, SubType = mediaType.subType, Count = nvs.Count
Type = mediaType.type,
SubType = mediaType.subType,
Count = nvs.Count
});
}
catch
@@ -163,12 +170,16 @@ namespace Aaru.Server.Controllers
if(nvs.Real)
realMedia.Add(new MediaItem
{
Type = nvs.Type, SubType = null, Count = nvs.Count
Type = nvs.Type,
SubType = null,
Count = nvs.Count
});
else
virtualMedia.Add(new MediaItem
{
Type = nvs.Type, SubType = null, Count = nvs.Count
Type = nvs.Type,
SubType = null,
Count = nvs.Count
});
}
@@ -181,11 +192,11 @@ namespace Aaru.Server.Controllers
virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
}
if(ctx.DeviceStats.Any())
if(_ctx.DeviceStats.Any())
{
List<DeviceItem> devices = new List<DeviceItem>();
foreach(DeviceStat device in ctx.DeviceStats.ToList())
foreach(DeviceStat device in _ctx.DeviceStats.ToList())
{
string xmlFile;
@@ -204,14 +215,14 @@ namespace Aaru.Server.Controllers
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
if(System.IO.File.Exists(Path.Combine(env.ContentRootPath, "Reports", xmlFile)))
if(System.IO.File.Exists(Path.Combine(_env.ContentRootPath, "Reports", xmlFile)))
{
var deviceReport = new DeviceReport();
var xs = new XmlSerializer(deviceReport.GetType());
FileStream fs =
WaitForFile(Path.Combine(env.ContentRootPath ?? throw new InvalidOperationException(), "Reports", xmlFile),
WaitForFile(Path.Combine(_env.ContentRootPath ?? throw new InvalidOperationException(), "Reports", xmlFile),
FileMode.Open, FileAccess.Read, FileShare.Read);
deviceReport = (DeviceReport)xs.Deserialize(fs);
@@ -219,17 +230,19 @@ namespace Aaru.Server.Controllers
var deviceReportV2 = new DeviceReportV2(deviceReport);
device.Report = ctx.Devices.Add(new Device(deviceReportV2)).Entity;
ctx.SaveChanges();
device.Report = _ctx.Devices.Add(new Device(deviceReportV2)).Entity;
_ctx.SaveChanges();
System.IO.File.
Delete(Path.Combine(env.ContentRootPath ?? throw new InvalidOperationException(),
Delete(Path.Combine(_env.ContentRootPath ?? throw new InvalidOperationException(),
"Reports", xmlFile));
}
devices.Add(new DeviceItem
{
Manufacturer = device.Manufacturer, Model = device.Model, Revision = device.Revision,
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision,
Bus = device.Bus,
ReportId = device.Report != null && device.Report.Id != 0 ? device.Report.Id : 0
});
@@ -275,12 +288,13 @@ namespace Aaru.Server.Controllers
public IActionResult GetOsData()
{
var query = ctx.OperatingSystems.GroupBy(x => new
var query = _ctx.OperatingSystems.GroupBy(x => new
{
x.Name
}, x => x.Count).Select(g => new
{
g.Key.Name, Count = g.Sum()
g.Key.Name,
Count = g.Sum()
});
string[][] result = new string[2][];
@@ -297,13 +311,13 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).OrderByDescending(o => o.Count).
Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.Linux, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).OrderByDescending(o => o.Count).
Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).OrderByDescending(o => o.Count).
Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.Linux, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).OrderByDescending(o => o.Count).
Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -311,7 +325,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).Sum(o => o.Count) -
result[1][9] = (_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()).Sum(o => o.Count) -
result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
@@ -321,13 +335,13 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).OrderByDescending(o => o.Count).
Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.MacOSX, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).OrderByDescending(o => o.Count).
Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).
OrderByDescending(o => o.Count).Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.MacOSX, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).
OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -335,7 +349,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).Sum(o => o.Count) -
result[1][9] = (_ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()).Sum(o => o.Count) -
result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
@@ -345,13 +359,13 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).
OrderByDescending(o => o.Count).Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.Win32NT, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).
OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).
OrderByDescending(o => o.Count).Take(10).
Select(x =>
$"{DetectOS.GetPlatformName(PlatformID.Win32NT, x.Version)}{(string.IsNullOrEmpty(x.Version) ? "" : " ")}{x.Version}").
ToArray(),
_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).
OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -359,8 +373,9 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).Sum(o => o.Count) -
result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] =
(_ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()).Sum(o => o.Count) -
result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -369,9 +384,9 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.Versions.OrderByDescending(o => o.Count).Take(10).
Select(v => v.Name == "previous" ? "Previous than 3.4.99.0" : v.Name).ToArray(),
ctx.Versions.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.Versions.OrderByDescending(o => o.Count).Take(10).
Select(v => v.Name == "previous" ? "Previous than 3.4.99.0" : v.Name).ToArray(),
_ctx.Versions.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -379,7 +394,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Versions.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.Versions.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -388,8 +403,8 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
_ctx.Commands.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -397,7 +412,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Commands.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.Commands.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -406,8 +421,8 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.Filters.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
ctx.Filters.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.Filters.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
_ctx.Filters.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -415,7 +430,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Filters.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.Filters.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -424,8 +439,8 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
_ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -433,7 +448,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.MediaFormats.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.MediaFormats.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -442,8 +457,8 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.Partitions.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
ctx.Partitions.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.Partitions.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
_ctx.Partitions.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -451,7 +466,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Partitions.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.Partitions.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
@@ -460,8 +475,8 @@ namespace Aaru.Server.Controllers
{
string[][] result =
{
ctx.Filesystems.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
ctx.Filesystems.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
_ctx.Filesystems.OrderByDescending(o => o.Count).Take(10).Select(v => v.Name).ToArray(),
_ctx.Filesystems.OrderByDescending(o => o.Count).Take(10).Select(x => x.Count.ToString()).ToArray()
};
if(result[0].Length < 10)
@@ -469,14 +484,14 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Filesystems.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
result[1][9] = (_ctx.Filesystems.Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).ToString();
return Json(result);
}
public IActionResult GetVirtualMediaData()
{
Media[] virtualMedias = ctx.Medias.Where(o => !o.Real).OrderByDescending(o => o.Count).Take(10).ToArray();
Media[] virtualMedias = _ctx.Medias.Where(o => !o.Real).OrderByDescending(o => o.Count).Take(10).ToArray();
foreach(Media media in virtualMedias)
{
@@ -504,7 +519,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Medias.Where(o => !o.Real).Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).
result[1][9] = (_ctx.Medias.Where(o => !o.Real).Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).
ToString();
return Json(result);
@@ -512,7 +527,7 @@ namespace Aaru.Server.Controllers
public IActionResult GetRealMediaData()
{
Media[] realMedias = ctx.Medias.Where(o => o.Real).OrderByDescending(o => o.Count).Take(10).ToArray();
Media[] realMedias = _ctx.Medias.Where(o => o.Real).OrderByDescending(o => o.Count).Take(10).ToArray();
foreach(Media media in realMedias)
{
@@ -540,7 +555,7 @@ namespace Aaru.Server.Controllers
result[0][9] = "Other";
result[1][9] = (ctx.Medias.Where(o => o.Real).Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).
result[1][9] = (_ctx.Medias.Where(o => o.Real).Sum(o => o.Count) - result[1].Take(9).Sum(long.Parse)).
ToString();
return Json(result);
@@ -548,12 +563,14 @@ namespace Aaru.Server.Controllers
public IActionResult GetDevicesByBusData()
{
var data = ctx.DeviceStats.Select(d => d.Bus).Distinct().Select(deviceBus => new
var data = _ctx.DeviceStats.Select(d => d.Bus).Distinct().Select(deviceBus => new
{
deviceBus, deviceBusCount = ctx.DeviceStats.Count(d => d.Bus == deviceBus)
deviceBus,
deviceBusCount = _ctx.DeviceStats.Count(d => d.Bus == deviceBus)
}).Select(t => new
{
Name = t.deviceBus, Count = t.deviceBusCount
Name = t.deviceBus,
Count = t.deviceBusCount
}).ToList();
string[][] result =
@@ -574,14 +591,16 @@ namespace Aaru.Server.Controllers
public IActionResult GetDevicesByManufacturerData()
{
List<Device> devices = ctx.Devices.Where(d => d.Manufacturer != null && d.Manufacturer != "").ToList();
List<Device> devices = _ctx.Devices.Where(d => d.Manufacturer != null && d.Manufacturer != "").ToList();
var data = devices.Select(d => d.Manufacturer.ToLowerInvariant()).Distinct().Select(manufacturer => new
{
manufacturer, manufacturerCount = devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer)
manufacturer,
manufacturerCount = devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer)
}).Select(t => new
{
Name = t.manufacturer, Count = t.manufacturerCount
Name = t.manufacturer,
Count = t.manufacturerCount
}).ToList();
string[][] result =

View File

@@ -37,6 +37,7 @@ using System.Linq;
using System.Net;
using Aaru.CommonTypes.Metadata;
using Aaru.Dto;
using Aaru.Helpers;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -44,7 +45,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Controllers
{
public class UpdateController : Controller
public sealed class UpdateController : Controller
{
readonly AaruServerContext _ctx;
@@ -63,7 +64,8 @@ namespace Aaru.Server.Controllers
foreach(UsbVendor vendor in _ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync))
sync.UsbVendors.Add(new UsbVendorDto
{
VendorId = vendor.VendorId, Vendor = vendor.Vendor
VendorId = vendor.VendorId,
Vendor = vendor.Vendor
});
sync.UsbProducts = new List<UsbProductDto>();
@@ -71,8 +73,10 @@ namespace Aaru.Server.Controllers
foreach(UsbProduct product in _ctx.UsbProducts.Include(p => p.Vendor).Where(p => p.ModifiedWhen > lastSync))
sync.UsbProducts.Add(new UsbProductDto
{
Id = product.Id, Product = product.Product, ProductId = product.ProductId,
VendorId = product.Vendor.VendorId
Id = product.Id,
Product = product.Product,
ProductId = product.ProductId,
VendorId = product.Vendor.VendorId
});
sync.Offsets = new List<CdOffsetDto>();
@@ -103,7 +107,9 @@ namespace Aaru.Server.Controllers
return new ContentResult
{
StatusCode = (int)HttpStatusCode.OK, Content = sw.ToString(), ContentType = "application/json"
StatusCode = (int)HttpStatusCode.OK,
Content = sw.ToString(),
ContentType = "application/json"
};
}
}

View File

@@ -50,7 +50,7 @@ using Newtonsoft.Json;
namespace Aaru.Server.Controllers
{
public class UploadReportController : Controller
public sealed class UploadReportController : Controller
{
readonly AaruServerContext _ctx;
readonly IWebHostEnvironment _environment;
@@ -68,7 +68,8 @@ namespace Aaru.Server.Controllers
{
var response = new ContentResult
{
StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"
StatusCode = (int)HttpStatusCode.OK,
ContentType = "text/plain"
};
try
@@ -92,10 +93,11 @@ namespace Aaru.Server.Controllers
var reportV2 = new DeviceReportV2(newReport);
var jsonSw = new StringWriter();
jsonSw.Write(JsonConvert.SerializeObject(reportV2, Formatting.Indented, new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
await jsonSw.WriteAsync(JsonConvert.SerializeObject(reportV2, Formatting.Indented,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
string reportV2String = jsonSw.ToString();
jsonSw.Close();
@@ -185,23 +187,24 @@ namespace Aaru.Server.Controllers
}
}
_ctx.Reports.Add(newUploadedReport);
_ctx.SaveChanges();
await _ctx.Reports.AddAsync(newUploadedReport);
await _ctx.SaveChangesAsync();
var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String));
var pgpOut = new MemoryStream();
var pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
"public.asc"));
await pgp.EncryptAsync(pgpIn, pgpOut,
Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
"public.asc"));
pgpOut.Position = 0;
reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray());
var message = new MimeMessage
{
Subject = "New device report (old version)", Body = new TextPart("plain")
Subject = "New device report (old version)",
Body = new TextPart("plain")
{
Text = reportV2String
}
@@ -212,9 +215,9 @@ namespace Aaru.Server.Controllers
using(var client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
client.Disconnect(true);
await client.ConnectAsync("mail.claunia.com", 25, false);
await client.SendAsync(message);
await client.DisconnectAsync(true);
}
response.Content = "ok";
@@ -242,7 +245,8 @@ namespace Aaru.Server.Controllers
{
var response = new ContentResult
{
StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"
StatusCode = (int)HttpStatusCode.OK,
ContentType = "text/plain"
};
try
@@ -345,23 +349,24 @@ namespace Aaru.Server.Controllers
}
}
_ctx.Reports.Add(newUploadedReport);
_ctx.SaveChanges();
await _ctx.Reports.AddAsync(newUploadedReport);
await _ctx.SaveChangesAsync();
var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson));
var pgpOut = new MemoryStream();
var pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
"public.asc"));
await pgp.EncryptAsync(pgpIn, pgpOut,
Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
"public.asc"));
pgpOut.Position = 0;
reportJson = Encoding.UTF8.GetString(pgpOut.ToArray());
var message = new MimeMessage
{
Subject = "New device report", Body = new TextPart("plain")
Subject = "New device report",
Body = new TextPart("plain")
{
Text = reportJson
}
@@ -372,9 +377,9 @@ namespace Aaru.Server.Controllers
using(var client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
client.Disconnect(true);
await client.ConnectAsync("mail.claunia.com", 25, false);
await client.SendAsync(message);
await client.DisconnectAsync(true);
}
response.Content = "ok";

View File

@@ -35,12 +35,11 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Aaru.CommonTypes.Metadata;
using Aaru.Server.Core;
using Aaru.Server.Models;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
@@ -49,16 +48,11 @@ using Version = Aaru.Server.Models.Version;
namespace Aaru.Server.Controllers
{
public class UploadStatsController : Controller
public sealed class UploadStatsController : Controller
{
readonly AaruServerContext _ctx;
IWebHostEnvironment _environment;
public UploadStatsController(IWebHostEnvironment environment, AaruServerContext ctx)
{
_environment = environment;
_ctx = ctx;
}
public UploadStatsController(AaruServerContext ctx) => _ctx = ctx;
/// <summary>Receives statistics from Aaru.Core, processes them and adds them to a server-side global statistics XML</summary>
/// <returns>HTTP response</returns>
@@ -67,7 +61,8 @@ namespace Aaru.Server.Controllers
{
var response = new ContentResult
{
StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"
StatusCode = (int)HttpStatusCode.OK,
ContentType = "text/plain"
};
try
@@ -93,7 +88,7 @@ namespace Aaru.Server.Controllers
return response;
}
catch(Exception ex)
catch(Exception)
{
#if DEBUG
if(Debugger.IsAttached)
@@ -112,7 +107,8 @@ namespace Aaru.Server.Controllers
{
var response = new ContentResult
{
StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"
StatusCode = (int)HttpStatusCode.OK,
ContentType = "text/plain"
};
try
@@ -136,9 +132,10 @@ namespace Aaru.Server.Controllers
Command existing = _ctx.Commands.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.Commands.Add(new Command
await _ctx.Commands.AddAsync(new Command
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -150,9 +147,10 @@ namespace Aaru.Server.Controllers
Version existing = _ctx.Versions.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.Versions.Add(new Version
await _ctx.Versions.AddAsync(new Version
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -164,9 +162,10 @@ namespace Aaru.Server.Controllers
Filesystem existing = _ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.Filesystems.Add(new Filesystem
await _ctx.Filesystems.AddAsync(new Filesystem
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -178,9 +177,10 @@ namespace Aaru.Server.Controllers
Partition existing = _ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.Partitions.Add(new Partition
await _ctx.Partitions.AddAsync(new Partition
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -192,9 +192,10 @@ namespace Aaru.Server.Controllers
MediaFormat existing = _ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.MediaFormats.Add(new MediaFormat
await _ctx.MediaFormats.AddAsync(new MediaFormat
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -206,9 +207,10 @@ namespace Aaru.Server.Controllers
Filter existing = _ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.Filters.Add(new Filter
await _ctx.Filters.AddAsync(new Filter
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -222,10 +224,11 @@ namespace Aaru.Server.Controllers
c.Version == operatingSystem.version);
if(existing == null)
_ctx.OperatingSystems.Add(new OperatingSystem
await _ctx.OperatingSystems.AddAsync(new OperatingSystem
{
Name = operatingSystem.name, Version = operatingSystem.version,
Count = operatingSystem.Value
Name = operatingSystem.name,
Version = operatingSystem.version,
Count = operatingSystem.Value
});
else
existing.Count += operatingSystem.Value;
@@ -237,29 +240,33 @@ namespace Aaru.Server.Controllers
Media existing = _ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
if(existing == null)
_ctx.Medias.Add(new Media
await _ctx.Medias.AddAsync(new Media
{
Type = media.type, Real = media.real, Count = media.Value
Type = media.type,
Real = media.real,
Count = media.Value
});
else
existing.Count += media.Value;
}
if(newstats.Devices != null)
foreach(DeviceStats device in newstats.Devices)
foreach(DeviceStats device in from device in newstats.Devices let existing =
_ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus &&
c.Manufacturer ==
device.Manufacturer &&
c.Model == device.Model &&
c.Revision ==
device.Revision)
where existing == null select device)
{
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
});
await _ctx.DeviceStats.AddAsync(new DeviceStat
{
Bus = device.Bus,
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision
});
}
if(newstats.RemoteApplications != null)
@@ -270,9 +277,11 @@ namespace Aaru.Server.Controllers
c.Version == application.version);
if(existing == null)
_ctx.RemoteApplications.Add(new RemoteApplication
await _ctx.RemoteApplications.AddAsync(new RemoteApplication
{
Name = application.name, Version = application.version, Count = application.Value
Name = application.name,
Version = application.version,
Count = application.Value
});
else
existing.Count += application.Value;
@@ -284,9 +293,10 @@ namespace Aaru.Server.Controllers
RemoteArchitecture existing = _ctx.RemoteArchitectures.FirstOrDefault(c => c.Name == nvs.name);
if(existing == null)
_ctx.RemoteArchitectures.Add(new RemoteArchitecture
await _ctx.RemoteArchitectures.AddAsync(new RemoteArchitecture
{
Name = nvs.name, Count = nvs.Value
Name = nvs.name,
Count = nvs.Value
});
else
existing.Count += nvs.Value;
@@ -300,16 +310,17 @@ namespace Aaru.Server.Controllers
c.Version == remoteOperatingSystem.version);
if(existing == null)
_ctx.RemoteOperatingSystems.Add(new RemoteOperatingSystem
await _ctx.RemoteOperatingSystems.AddAsync(new RemoteOperatingSystem
{
Name = remoteOperatingSystem.name, Version = remoteOperatingSystem.version,
Count = remoteOperatingSystem.Value
Name = remoteOperatingSystem.name,
Version = remoteOperatingSystem.version,
Count = remoteOperatingSystem.Value
});
else
existing.Count += remoteOperatingSystem.Value;
}
_ctx.SaveChanges();
await _ctx.SaveChangesAsync();
response.Content = "ok";
@@ -328,29 +339,5 @@ namespace Aaru.Server.Controllers
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

@@ -31,11 +31,10 @@
// ****************************************************************************/
using System.Collections.Generic;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.CommonTypes.Structs.Devices.SCSI;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class Ata
{
@@ -52,9 +51,9 @@ namespace Aaru.Server
/// <param name="testedMedia">List of tested media</param>
public static void Report(CommonTypes.Metadata.Ata ataReport, bool cfa, bool atapi, ref bool removable,
ref List<string> ataOneValue, ref Dictionary<string, string> ataTwoValue,
ref List<TestedMedia> testedMedia)
ref List<CommonTypes.Metadata.TestedMedia> testedMedia)
{
uint logicalsectorsize = 0;
uint logicalSectorSize = 0;
Identify.IdentifyDevice? ataIdentifyNullable = Identify.Decode(ataReport.Identify);
@@ -117,113 +116,111 @@ namespace Aaru.Server
acs4 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS4);
}
int maxatalevel = 0;
int minatalevel = 255;
int maxAtaLevel = 0;
int minAtaLevel = 255;
string tmpString = "";
if(ata1)
{
tmpString += "ATA-1 ";
maxatalevel = 1;
if(minatalevel > 1)
minatalevel = 1;
maxAtaLevel = 1;
minAtaLevel = 1;
}
if(ata2)
{
tmpString += "ATA-2 ";
maxatalevel = 2;
maxAtaLevel = 2;
if(minatalevel > 2)
minatalevel = 2;
if(minAtaLevel > 2)
minAtaLevel = 2;
}
if(ata3)
{
tmpString += "ATA-3 ";
maxatalevel = 3;
maxAtaLevel = 3;
if(minatalevel > 3)
minatalevel = 3;
if(minAtaLevel > 3)
minAtaLevel = 3;
}
if(ata4)
{
tmpString += "ATA/ATAPI-4 ";
maxatalevel = 4;
maxAtaLevel = 4;
if(minatalevel > 4)
minatalevel = 4;
if(minAtaLevel > 4)
minAtaLevel = 4;
}
if(ata5)
{
tmpString += "ATA/ATAPI-5 ";
maxatalevel = 5;
maxAtaLevel = 5;
if(minatalevel > 5)
minatalevel = 5;
if(minAtaLevel > 5)
minAtaLevel = 5;
}
if(ata6)
{
tmpString += "ATA/ATAPI-6 ";
maxatalevel = 6;
maxAtaLevel = 6;
if(minatalevel > 6)
minatalevel = 6;
if(minAtaLevel > 6)
minAtaLevel = 6;
}
if(ata7)
{
tmpString += "ATA/ATAPI-7 ";
maxatalevel = 7;
maxAtaLevel = 7;
if(minatalevel > 7)
minatalevel = 7;
if(minAtaLevel > 7)
minAtaLevel = 7;
}
if(acs)
{
tmpString += "ATA8-ACS ";
maxatalevel = 8;
maxAtaLevel = 8;
if(minatalevel > 8)
minatalevel = 8;
if(minAtaLevel > 8)
minAtaLevel = 8;
}
if(acs2)
{
tmpString += "ATA8-ACS2 ";
maxatalevel = 9;
maxAtaLevel = 9;
if(minatalevel > 9)
minatalevel = 9;
if(minAtaLevel > 9)
minAtaLevel = 9;
}
if(acs3)
{
tmpString += "ATA8-ACS3 ";
maxatalevel = 10;
maxAtaLevel = 10;
if(minatalevel > 10)
minatalevel = 10;
if(minAtaLevel > 10)
minAtaLevel = 10;
}
if(acs4)
{
tmpString += "ATA8-ACS4 ";
maxatalevel = 11;
maxAtaLevel = 11;
if(minatalevel > 11)
minatalevel = 11;
if(minAtaLevel > 11)
minAtaLevel = 11;
}
if(tmpString != "")
ataTwoValue.Add("Supported ATA versions", tmpString);
if(maxatalevel >= 3)
if(maxAtaLevel >= 3)
{
switch(ataIdentify.MinorVersion)
{
@@ -613,7 +610,7 @@ namespace Aaru.Server
}
else if(!cfa)
{
if(minatalevel >= 5)
if(minAtaLevel >= 5)
if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.IncompleteResponse))
ataOneValue.Add("Incomplete identify response");
@@ -623,7 +620,7 @@ namespace Aaru.Server
if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
ataOneValue.Add("Device is removable");
if(minatalevel <= 5)
if(minAtaLevel <= 5)
if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Fixed))
ataOneValue.Add("Device is fixed");
@@ -708,29 +705,29 @@ namespace Aaru.Server
{
case 1:
ataOneValue.
Add($"{(ataIdentify.BufferSize * logicalsectorsize) / 1024} KiB of single ported single sector buffer");
Add($"{(ataIdentify.BufferSize * logicalSectorSize) / 1024} KiB of single ported single sector buffer");
break;
case 2:
ataOneValue.
Add($"{(ataIdentify.BufferSize * logicalsectorsize) / 1024} KiB of dual ported multi sector buffer");
Add($"{(ataIdentify.BufferSize * logicalSectorSize) / 1024} KiB of dual ported multi sector buffer");
break;
case 3:
ataOneValue.
Add($"{(ataIdentify.BufferSize * logicalsectorsize) / 1024} KiB of dual ported multi sector buffer with read caching");
Add($"{(ataIdentify.BufferSize * logicalSectorSize) / 1024} KiB of dual ported multi sector buffer with read caching");
break;
default:
ataOneValue.
Add($"{(ataIdentify.BufferSize * logicalsectorsize) / 1024} KiB of unknown type {ataIdentify.BufferType} buffer");
Add($"{(ataIdentify.BufferSize * logicalSectorSize) / 1024} KiB of unknown type {ataIdentify.BufferType} buffer");
break;
}
ataOneValue.Add("<i>Device capabilities:</i>");
if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStanbyTimer))
if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStandbyTimer))
ataOneValue.Add("Standby time values are standard");
if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.IORDY))
@@ -776,7 +773,7 @@ namespace Aaru.Server
if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
ataOneValue.Add("Device supports doubleword I/O");
if(minatalevel <= 3)
if(minAtaLevel <= 3)
{
if(ataIdentify.PIOTransferTimingMode > 0)
ataTwoValue.Add("PIO timing mode", $"{ataIdentify.PIOTransferTimingMode}");
@@ -814,7 +811,7 @@ namespace Aaru.Server
if(!string.IsNullOrEmpty(tmpString))
ataTwoValue.Add("Advanced PIO", tmpString);
if(minatalevel <= 3 &&
if(minAtaLevel <= 3 &&
!atapi)
{
tmpString = "";
@@ -1119,7 +1116,7 @@ namespace Aaru.Server
if(ataIdentify.InterseekDelay != 0x0000 &&
ataIdentify.InterseekDelay != 0xFFFF)
ataOneValue.
Add($"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing");
Add($"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 acoustic testing");
if((ushort)ataIdentify.DeviceFormFactor != 0x0000 &&
(ushort)ataIdentify.DeviceFormFactor != 0xFFFF)
@@ -1498,7 +1495,7 @@ namespace Aaru.Server
}
if(!ata1 &&
maxatalevel >= 8)
maxAtaLevel >= 8)
if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Set) &&
!ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Clear) &&
ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
@@ -1600,7 +1597,7 @@ namespace Aaru.Server
? "Security is frozen" : "Security is not frozen");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Expired)
? "Security count has expired" : "Security count has notexpired");
? "Security count has expired" : "Security count has not expired");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Maximum)
? "Security level is maximum" : "Security level is high");
@@ -1668,7 +1665,7 @@ namespace Aaru.Server
ataOneValue.Add($"Version {(ataIdentify.NVCacheCaps & 0x0F00) >> 8}");
}
ataOneValue.Add($"Non-Volatile Cache is {ataIdentify.NVCacheSize * logicalsectorsize} bytes");
ataOneValue.Add($"Non-Volatile Cache is {ataIdentify.NVCacheSize * logicalSectorSize} bytes");
}
if(ataReport.ReadCapabilities != null)
@@ -1687,7 +1684,7 @@ namespace Aaru.Server
if(ataReport.ReadCapabilities.BlockSize != null)
{
ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes");
logicalsectorsize = ataReport.ReadCapabilities.BlockSize.Value;
logicalSectorSize = ataReport.ReadCapabilities.BlockSize.Value;
}
if(ataReport.ReadCapabilities.PhysicalBlockSize != null)
@@ -1726,7 +1723,7 @@ namespace Aaru.Server
$"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current");
ataTwoValue.Add("Device size in CHS mode",
$"{(ulong)currentSectors * logicalsectorsize} bytes, {((ulong)currentSectors * logicalsectorsize) / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
$"{(ulong)currentSectors * logicalSectorSize} bytes, {((ulong)currentSectors * logicalSectorSize) / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalSectorSize) / 1024 / 1024:F2} MiB");
}
else if(ataReport.ReadCapabilities.CHS != null)
{
@@ -1740,7 +1737,7 @@ namespace Aaru.Server
ataTwoValue.Add("Sectors addressable in CHS mode", $"{currentSectors}");
ataTwoValue.Add("Device size in CHS mode",
$"{(ulong)currentSectors * logicalsectorsize} bytes, {((ulong)currentSectors * logicalsectorsize) / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
$"{(ulong)currentSectors * logicalSectorSize} bytes, {((ulong)currentSectors * logicalSectorSize) / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalSectorSize) / 1024 / 1024:F2} MiB");
}
if(ataReport.ReadCapabilities.LBASectors != null)
@@ -1748,15 +1745,15 @@ namespace Aaru.Server
ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode",
$"{ataReport.ReadCapabilities.LBASectors}");
if(((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 > 1000000)
if(((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 28-bit LBA mode",
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 > 1000)
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1024 / 1024 > 1000)
ataTwoValue.Add("Device size in 28-bit LBA mode",
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000} Gb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1000 / 1000 / 1000} Gb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1024 / 1024 / 1024:F2} GiB");
else
ataTwoValue.Add("Device size in 28-bit LBA mode",
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1000 / 1000} Mb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
$"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize} bytes, {((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1000 / 1000} Mb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalSectorSize) / 1024 / 1024:F2} MiB");
}
if(ataReport.ReadCapabilities.LBA48Sectors != null)
@@ -1764,15 +1761,15 @@ namespace Aaru.Server
ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode",
$"{ataReport.ReadCapabilities.LBA48Sectors}");
if((ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 > 1000000)
if((ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 48-bit LBA mode",
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000} Tb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if((ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 > 1000)
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1000 / 1000 / 1000 / 1000} Tb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if((ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1024 / 1024 > 1000)
ataTwoValue.Add("Device size in 48-bit LBA mode",
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000} Gb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1000 / 1000 / 1000} Gb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1024 / 1024 / 1024:F2} GiB");
else
ataTwoValue.Add("Device size in 48-bit LBA mode",
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1000 / 1000} Mb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
$"{ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize} bytes, {(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1000 / 1000} Mb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalSectorSize) / 1024 / 1024:F2} MiB");
}
if(ata1 || cfa)

View File

@@ -1,6 +1,6 @@
using System.Security.Cryptography;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class Hash
{

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using Aaru.CommonTypes.Metadata;
using Aaru.Decoders.SCSI;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class ScsiEvpd
{

View File

@@ -33,7 +33,7 @@
using System.Collections.Generic;
using Aaru.CommonTypes.Structs.Devices.SCSI;
namespace Aaru.Server
namespace Aaru.Server.Core
{
internal static class ScsiInquiry
{
@@ -328,19 +328,19 @@ namespace Aaru.Server
switch((TGPSValues)inquiry.TPGS)
{
case TGPSValues.NotSupported:
scsiOneValue.Add("Device does not support assymetrical access");
scsiOneValue.Add("Device does not support asymmetrical access");
break;
case TGPSValues.OnlyImplicit:
scsiOneValue.Add("Device only supports implicit assymetrical access");
scsiOneValue.Add("Device only supports implicit asymmetrical access");
break;
case TGPSValues.OnlyExplicit:
scsiOneValue.Add("Device only supports explicit assymetrical access");
scsiOneValue.Add("Device only supports explicit asymmetrical access");
break;
case TGPSValues.Both:
scsiOneValue.Add("Device supports implicit and explicit assymetrical access");
scsiOneValue.Add("Device supports implicit and explicit asymmetrical access");
break;
default:

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.SCSI;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class ScsiMmcFeatures
{
@@ -121,7 +121,7 @@ namespace Aaru.Server
mmcOneValue.Add("Drive has an analogue audio output");
if(ftr.CanPseudoOverwriteBDR)
mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
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");
@@ -431,7 +431,7 @@ namespace Aaru.Server
if(ftr.SupportsCPRM &&
ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
mmcOneValue.Add($"Drive supports DVD CPRM version {ftr.CPRMVersion}");
else if(ftr.SupportsCPRM)
mmcOneValue.Add("Drive supports DVD CPRM");

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes.Structs.Devices.SCSI.Modes;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class ScsiMmcMode
{

View File

@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Decoders.SCSI;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class ScsiModeSense
{

View File

@@ -33,7 +33,7 @@
using System.Collections.Generic;
using Aaru.CommonTypes.Metadata;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class SscTestedMedia
{

View File

@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Metadata;
using Aaru.Server.Models;
using Version = Aaru.Server.Models.Version;
namespace Aaru.Server
namespace Aaru.Server.Core
{
public static class StatsConverter
{
@@ -43,280 +43,298 @@ namespace Aaru.Server
{
var ctx = new AaruServerContext();
if(newStats.Commands != null)
if(newStats.Commands?.Analyze > 0)
{
if(newStats.Commands.Analyze > 0)
{
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ImageInfo,
Name = "image-info"
});
else
existing.Count += newStats.Commands.ImageInfo;
}
if(newStats.OperatingSystems != null)
@@ -334,7 +352,8 @@ namespace Aaru.Server
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Count = operatingSystem.Value, Name = operatingSystem.name,
Count = operatingSystem.Value,
Name = operatingSystem.name,
Version = operatingSystem.version
});
else
@@ -349,7 +368,8 @@ namespace Aaru.Server
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Count = 1, Name = "Linux"
Count = 1,
Name = "Linux"
});
else
existing.Count++;
@@ -367,7 +387,8 @@ namespace Aaru.Server
if(existing == null)
ctx.Versions.Add(new Version
{
Count = nvs.Value, Name = nvs.name
Count = nvs.Value,
Name = nvs.name
});
else
existing.Count += nvs.Value;
@@ -380,7 +401,8 @@ namespace Aaru.Server
if(existing == null)
ctx.Versions.Add(new Version
{
Count = 1, Name = "previous"
Count = 1,
Name = "previous"
});
else
existing.Count++;
@@ -397,7 +419,8 @@ namespace Aaru.Server
if(existing == null)
ctx.Filesystems.Add(new Filesystem
{
Count = nvs.Value, Name = nvs.name
Count = nvs.Value,
Name = nvs.name
});
else
existing.Count += nvs.Value;
@@ -414,7 +437,8 @@ namespace Aaru.Server
if(existing == null)
ctx.Partitions.Add(new Partition
{
Count = nvs.Value, Name = nvs.name
Count = nvs.Value,
Name = nvs.name
});
else
existing.Count += nvs.Value;
@@ -431,7 +455,8 @@ namespace Aaru.Server
if(existing == null)
ctx.MediaFormats.Add(new MediaFormat
{
Count = nvs.Value, Name = nvs.name
Count = nvs.Value,
Name = nvs.name
});
else
existing.Count += nvs.Value;
@@ -448,25 +473,29 @@ namespace Aaru.Server
if(existing == null)
ctx.Filters.Add(new Filter
{
Count = nvs.Value, Name = nvs.name
Count = nvs.Value,
Name = nvs.name
});
else
existing.Count += nvs.Value;
}
if(newStats.Devices != null)
foreach(DeviceStats device in newStats.Devices)
foreach(DeviceStats device in newStats.
Devices.Where(device => !string.IsNullOrWhiteSpace(device.Model)).
Where(device => !ctx.DeviceStats.Any(c => c.Bus == device.Bus &&
c.Manufacturer ==
device.Manufacturer &&
c.Model == device.Model &&
c.Revision == device.Revision)))
{
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
});
ctx.DeviceStats.Add(new DeviceStat
{
Bus = device.Bus,
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision
});
}
if(newStats.Medias != null)
@@ -480,7 +509,9 @@ namespace Aaru.Server
if(existing == null)
ctx.Medias.Add(new Media
{
Count = media.Value, Real = media.real, Type = media.type
Count = media.Value,
Real = media.real,
Type = media.type
});
else
existing.Count += media.Value;

View File

@@ -32,12 +32,11 @@
using System.Collections.Generic;
namespace Aaru.Server.App_Start
namespace Aaru.Server.Core
{
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)
@@ -276,7 +275,7 @@ namespace Aaru.Server.App_Start
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");
mediaOneValue.Add("Device can use the PLEXTOR 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");
@@ -310,7 +309,7 @@ namespace Aaru.Server.App_Start
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");
mediaOneValue.Add("Device can read the Disc Manufacturer Information from this medium");
if(testedMedia.CanReadDiscInformation == true)
mediaOneValue.Add("Device can read the Disc Information from this medium");

View File

@@ -10,53 +10,53 @@ namespace Aaru.Server.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
#region Check for old tables
bool AtasExists = AaruServerContext.TableExists("Atas");
bool BlockDescriptorsExists = AaruServerContext.TableExists("BlockDescriptors");
bool ChsExists = AaruServerContext.TableExists("Chs");
bool CommandsExists = AaruServerContext.TableExists("Commands");
bool CompactDiscOffsetsExists = AaruServerContext.TableExists("CompactDiscOffsets");
bool DensityCodesExists = AaruServerContext.TableExists("DensityCodes");
bool DevicesExists = AaruServerContext.TableExists("Devices");
bool DeviceStatsExists = AaruServerContext.TableExists("DeviceStats");
bool FilesystemsExists = AaruServerContext.TableExists("Filesystems");
bool FiltersExists = AaruServerContext.TableExists("Filters");
bool FireWiresExists = AaruServerContext.TableExists("FireWires");
bool MediaExists = AaruServerContext.TableExists("Media");
bool MediaFormatsExists = AaruServerContext.TableExists("MediaFormats");
bool MmcFeaturesExists = AaruServerContext.TableExists("MmcFeatures");
bool MmcsExists = AaruServerContext.TableExists("Mmcs");
bool MmcSdsExists = AaruServerContext.TableExists("MmcSds");
bool OperatingSystemsExists = AaruServerContext.TableExists("OperatingSystems");
bool PartitionsExists = AaruServerContext.TableExists("Partitions");
bool PcmciasExists = AaruServerContext.TableExists("Pcmcias");
bool ScsiModesExists = AaruServerContext.TableExists("ScsiModes");
bool ScsiPagesExists = AaruServerContext.TableExists("ScsiPages");
bool ScsisExists = AaruServerContext.TableExists("Scsis");
bool SscsExists = AaruServerContext.TableExists("Sscs");
bool SscSupportedMediasExists = AaruServerContext.TableExists("SscSupportedMedias");
bool SupportedDensitiesExists = AaruServerContext.TableExists("SupportedDensities");
bool TestedMediasExists = AaruServerContext.TableExists("TestedMedias");
bool TestedSequentialMediasExists = AaruServerContext.TableExists("TestedSequentialMedias");
bool UploadedReportsExists = AaruServerContext.TableExists("UploadedReports");
bool UsbProductsExists = AaruServerContext.TableExists("UsbProducts");
bool UsbsExists = AaruServerContext.TableExists("Usbs");
bool UsbVendorsExists = AaruServerContext.TableExists("UsbVendors");
bool VersionsExists = AaruServerContext.TableExists("Versions");
bool EFExists = AaruServerContext.TableExists("__MigrationHistory");
bool atasExists = AaruServerContext.TableExists("Atas");
bool blockDescriptorsExists = AaruServerContext.TableExists("BlockDescriptors");
bool chsExists = AaruServerContext.TableExists("Chs");
bool commandsExists = AaruServerContext.TableExists("Commands");
bool compactDiscOffsetsExists = AaruServerContext.TableExists("CompactDiscOffsets");
bool densityCodesExists = AaruServerContext.TableExists("DensityCodes");
bool devicesExists = AaruServerContext.TableExists("Devices");
bool deviceStatsExists = AaruServerContext.TableExists("DeviceStats");
bool filesystemsExists = AaruServerContext.TableExists("Filesystems");
bool filtersExists = AaruServerContext.TableExists("Filters");
bool fireWiresExists = AaruServerContext.TableExists("FireWires");
bool mediaExists = AaruServerContext.TableExists("Media");
bool mediaFormatsExists = AaruServerContext.TableExists("MediaFormats");
bool mmcFeaturesExists = AaruServerContext.TableExists("MmcFeatures");
bool mmcsExists = AaruServerContext.TableExists("Mmcs");
bool mmcSdsExists = AaruServerContext.TableExists("MmcSds");
bool operatingSystemsExists = AaruServerContext.TableExists("OperatingSystems");
bool partitionsExists = AaruServerContext.TableExists("Partitions");
bool pcmciasExists = AaruServerContext.TableExists("Pcmcias");
bool scsiModesExists = AaruServerContext.TableExists("ScsiModes");
bool scsiPagesExists = AaruServerContext.TableExists("ScsiPages");
bool scsisExists = AaruServerContext.TableExists("Scsis");
bool sscsExists = AaruServerContext.TableExists("Sscs");
bool sscSupportedMediasExists = AaruServerContext.TableExists("SscSupportedMedias");
bool supportedDensitiesExists = AaruServerContext.TableExists("SupportedDensities");
bool testedMediasExists = AaruServerContext.TableExists("TestedMedias");
bool testedSequentialMediasExists = AaruServerContext.TableExists("TestedSequentialMedias");
bool uploadedReportsExists = AaruServerContext.TableExists("UploadedReports");
bool usbProductsExists = AaruServerContext.TableExists("UsbProducts");
bool usbsExists = AaruServerContext.TableExists("Usbs");
bool usbVendorsExists = AaruServerContext.TableExists("UsbVendors");
bool versionsExists = AaruServerContext.TableExists("Versions");
bool efExists = AaruServerContext.TableExists("__MigrationHistory");
#endregion
#region Drop old restrictions
if(AtasExists)
if(atasExists)
migrationBuilder.DropForeignKey("FK_Atas_TestedMedias_ReadCapabilities_Id", "Atas");
if(BlockDescriptorsExists)
if(blockDescriptorsExists)
migrationBuilder.DropForeignKey("FK_BlockDescriptors_ScsiModes_ScsiMode_Id", "BlockDescriptors");
if(DensityCodesExists)
if(densityCodesExists)
migrationBuilder.DropForeignKey("FK_DensityCodes_SscSupportedMedias_SscSupportedMedia_Id",
"DensityCodes");
if(DevicesExists)
if(devicesExists)
{
migrationBuilder.DropForeignKey("FK_Devices_Atas_ATA_Id", "Devices");
migrationBuilder.DropForeignKey("FK_Devices_Atas_ATAPI_Id", "Devices");
@@ -69,19 +69,19 @@ namespace Aaru.Server.Migrations
migrationBuilder.DropForeignKey("FK_Devices_Usbs_USB_Id", "Devices");
}
if(DeviceStatsExists)
if(deviceStatsExists)
migrationBuilder.DropForeignKey("FK_DeviceStats_Devices_Report_Id", "DeviceStats");
if(MmcsExists)
if(mmcsExists)
migrationBuilder.DropForeignKey("FK_Mmcs_MmcFeatures_Features_Id", "Mmcs");
if(ScsiPagesExists)
if(scsiPagesExists)
{
migrationBuilder.DropForeignKey("FK_ScsiPages_ScsiModes_ScsiMode_Id", "ScsiPages");
migrationBuilder.DropForeignKey("FK_ScsiPages_Scsis_Scsi_Id", "ScsiPages");
}
if(ScsisExists)
if(scsisExists)
{
migrationBuilder.DropForeignKey("FK_Scsis_Mmcs_MultiMediaDevice_Id", "Scsis");
migrationBuilder.DropForeignKey("FK_Scsis_ScsiModes_ModeSense_Id", "Scsis");
@@ -89,19 +89,19 @@ namespace Aaru.Server.Migrations
migrationBuilder.DropForeignKey("FK_Scsis_TestedMedias_ReadCapabilities_Id", "Scsis");
}
if(SscSupportedMediasExists)
if(sscSupportedMediasExists)
{
migrationBuilder.DropForeignKey("FK_a812ec60296b45bcb3d245a5c6d01d73", "SscSupportedMedias");
migrationBuilder.DropForeignKey("FK_SscSupportedMedias_Sscs_Ssc_Id", "SscSupportedMedias");
}
if(SupportedDensitiesExists)
if(supportedDensitiesExists)
{
migrationBuilder.DropForeignKey("FK_783f1b3552774280af1caf44fb27e285", "SupportedDensities");
migrationBuilder.DropForeignKey("FK_SupportedDensities_Sscs_Ssc_Id", "SupportedDensities");
}
if(TestedMediasExists)
if(testedMediasExists)
{
migrationBuilder.DropForeignKey("FK_TestedMedias_Atas_Ata_Id", "TestedMedias");
migrationBuilder.DropForeignKey("FK_TestedMedias_Chs_CHS_Id", "TestedMedias");
@@ -110,10 +110,10 @@ namespace Aaru.Server.Migrations
migrationBuilder.DropForeignKey("FK_TestedMedias_Scsis_Scsi_Id", "TestedMedias");
}
if(TestedSequentialMediasExists)
if(testedSequentialMediasExists)
migrationBuilder.DropForeignKey("FK_TestedSequentialMedias_Sscs_Ssc_Id", "TestedSequentialMedias");
if(UploadedReportsExists)
if(uploadedReportsExists)
{
migrationBuilder.DropForeignKey("FK_UploadedReports_Atas_ATA_Id", "UploadedReports");
migrationBuilder.DropForeignKey("FK_UploadedReports_Atas_ATAPI_Id", "UploadedReports");
@@ -125,7 +125,7 @@ namespace Aaru.Server.Migrations
migrationBuilder.DropForeignKey("FK_UploadedReports_Usbs_USB_Id", "UploadedReports");
}
if(UsbProductsExists)
if(usbProductsExists)
migrationBuilder.DropForeignKey("FK_UsbProducts_UsbVendors_VendorId", "UsbProducts");
#endregion
@@ -134,16 +134,16 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Manufacturer = table.Column<string>(nullable: true), Model = table.Column<string>(nullable: true),
Offset = table.Column<short>(), Submissions = table.Column<int>(),
Manufacturer = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
Offset = table.Column<short>(),
Submissions = table.Column<int>(),
Agreement = table.Column<float>(),
AddedWhen = table.Column<DateTime>(), ModifiedWhen = table.Column<DateTime>()
}, constraints: table =>
{
table.PrimaryKey("PK_CdOffsets", x => x.Id);
});
AddedWhen = table.Column<DateTime>(),
ModifiedWhen = table.Column<DateTime>()
}, constraints: table => table.PrimaryKey("PK_CdOffsets", x => x.Id));
if(CompactDiscOffsetsExists)
if(compactDiscOffsetsExists)
{
migrationBuilder.
Sql("INSERT INTO CdOffsets (Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen) SELECT Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen FROM CompactDiscOffsets");
@@ -153,23 +153,22 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: Chs
if(ChsExists)
if(chsExists)
migrationBuilder.RenameTable("Chs", newName: "Chs_old");
migrationBuilder.CreateTable("Chs", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Cylinders = table.Column<ushort>(), Heads = table.Column<ushort>(),
Cylinders = table.Column<ushort>(),
Heads = table.Column<ushort>(),
Sectors = table.Column<ushort>(),
CylindersSql = table.Column<short>(), HeadsSql = table.Column<short>(),
CylindersSql = table.Column<short>(),
HeadsSql = table.Column<short>(),
SectorsSql = table.Column<short>()
}, constraints: table =>
{
table.PrimaryKey("PK_Chs", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_Chs", x => x.Id));
if(ChsExists)
if(chsExists)
{
migrationBuilder.
Sql("INSERT INTO Chs (Id, Cylinders, Heads, Sectors, CylindersSql, HeadsSql, SectorsSql) SELECT Id, CylindersSql AS Cylinders, HeadsSql AS Heads, SectorsSql AS Sectors, CylindersSql, HeadsSql, SectorsSql FROM Chs_old");
@@ -179,20 +178,18 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: Commands
if(CommandsExists)
if(commandsExists)
migrationBuilder.RenameTable("Commands", newName: "Commands_old");
migrationBuilder.CreateTable("Commands", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Commands", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Commands", x => x.Id));
if(CommandsExists)
if(commandsExists)
{
migrationBuilder.Sql("INSERT INTO Commands (Id, Name, Count) SELECT Id, Name, Count FROM Commands_old");
migrationBuilder.DropTable("Commands_old");
@@ -200,20 +197,18 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: Filesystems
if(FilesystemsExists)
if(filesystemsExists)
migrationBuilder.RenameTable("Filesystems", newName: "Filesystems_old");
migrationBuilder.CreateTable("Filesystems", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Filesystems", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Filesystems", x => x.Id));
if(FilesystemsExists)
if(filesystemsExists)
{
migrationBuilder.
Sql("INSERT INTO Filesystems (Id, Name, Count) SELECT Id, Name, Count FROM Filesystems_old");
@@ -223,20 +218,18 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: Filters
if(FiltersExists)
if(filtersExists)
migrationBuilder.RenameTable("Filters", newName: "Filters_old");
migrationBuilder.CreateTable("Filters", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Filters", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Filters", x => x.Id));
if(FiltersExists)
if(filtersExists)
{
migrationBuilder.Sql("INSERT INTO Filters (Id, Name, Count) SELECT Id, Name, Count FROM Filters_old");
migrationBuilder.DropTable("Filters_old");
@@ -248,16 +241,16 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
VendorID = table.Column<uint>(), ProductID = table.Column<uint>(),
Manufacturer = table.Column<string>(nullable: true), Product = table.Column<string>(nullable: true),
RemovableMedia = table.Column<bool>(), VendorIDSql = table.Column<int>(),
VendorID = table.Column<uint>(),
ProductID = table.Column<uint>(),
Manufacturer = table.Column<string>(nullable: true),
Product = table.Column<string>(nullable: true),
RemovableMedia = table.Column<bool>(),
VendorIDSql = table.Column<int>(),
ProductIDSql = table.Column<int>()
}, constraints: table =>
{
table.PrimaryKey("PK_FireWire", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_FireWire", x => x.Id));
if(FireWiresExists)
if(fireWiresExists)
{
migrationBuilder.
Sql("INSERT INTO FireWire (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql FROM FireWires");
@@ -267,20 +260,18 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: MediaFormats
if(MediaFormatsExists)
if(mediaFormatsExists)
migrationBuilder.RenameTable("MediaFormats", newName: "MediaFormats_old");
migrationBuilder.CreateTable("MediaFormats", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_MediaFormats", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_MediaFormats", x => x.Id));
if(MediaFormatsExists)
if(mediaFormatsExists)
{
migrationBuilder.
Sql("INSERT INTO MediaFormats (Id, Name, Count) SELECT Id, Name, Count FROM MediaFormats_old");
@@ -294,13 +285,12 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Type = table.Column<string>(nullable: true), Real = table.Column<bool>(), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Medias", x => x.Id);
});
Type = table.Column<string>(nullable: true),
Real = table.Column<bool>(),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Medias", x => x.Id));
if(MediaExists)
if(mediaExists)
{
migrationBuilder.
Sql("INSERT INTO Medias (`Id`, `Type`, `Real`, `Count`) SELECT `Id`, `Type`, `Real`, `Count` FROM Media");
@@ -310,7 +300,7 @@ namespace Aaru.Server.Migrations
#endregion
#region TABLE: MmcFeatures
if(MmcFeaturesExists)
if(mmcFeaturesExists)
migrationBuilder.RenameTable("MmcFeatures", newName: "MmcFeatures_old");
migrationBuilder.CreateTable("MmcFeatures", table => new
@@ -445,12 +435,9 @@ namespace Aaru.Server.Migrations
LogicalBlockSizeSql = table.Column<int>(nullable: true),
PhysicalInterfaceStandardNumberSql = table.Column<int>(nullable: true),
VolumeLevelsSql = table.Column<short>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_MmcFeatures", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_MmcFeatures", x => x.Id));
if(MmcFeaturesExists)
if(mmcFeaturesExists)
{
migrationBuilder.Sql(@"INSERT INTO MmcFeatures (AACSVersion,
AGIDs,
@@ -973,15 +960,14 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CID = table.Column<byte[]>(nullable: true), CSD = table.Column<byte[]>(nullable: true),
OCR = table.Column<byte[]>(nullable: true), SCR = table.Column<byte[]>(nullable: true),
CID = table.Column<byte[]>(nullable: true),
CSD = table.Column<byte[]>(nullable: true),
OCR = table.Column<byte[]>(nullable: true),
SCR = table.Column<byte[]>(nullable: true),
ExtendedCSD = table.Column<byte[]>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_MmcSd", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_MmcSd", x => x.Id));
if(MmcSdsExists)
if(mmcSdsExists)
{
migrationBuilder.
Sql("INSERT INTO MmcSd (Id, CID, CSD, OCR, SCR, ExtendedCSD) SELECT Id, CID, CSD, OCR, SCR, ExtendedCSD FROM MmcSds");
@@ -991,21 +977,19 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: OperatingSystems
if(OperatingSystemsExists)
if(operatingSystemsExists)
migrationBuilder.RenameTable("OperatingSystems", newName: "OperatingSystems_old");
migrationBuilder.CreateTable("OperatingSystems", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_OperatingSystems", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_OperatingSystems", x => x.Id));
if(OperatingSystemsExists)
if(operatingSystemsExists)
{
migrationBuilder.
Sql("INSERT INTO OperatingSystems (Id, Name, Version, Count) SELECT Id, Name, Version, Count FROM OperatingSystems_old");
@@ -1015,20 +999,18 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: Partitions
if(PartitionsExists)
if(partitionsExists)
migrationBuilder.RenameTable("Partitions", newName: "Partitions_old");
migrationBuilder.CreateTable("Partitions", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Partitions", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Partitions", x => x.Id));
if(PartitionsExists)
if(partitionsExists)
{
migrationBuilder.
Sql("INSERT INTO Partitions (Id, Name, Count) SELECT Id, Name, Count FROM Partitions_old");
@@ -1050,12 +1032,9 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
ProductName = table.Column<string>(nullable: true),
ManufacturerCodeSql = table.Column<short>(nullable: true),
CardCodeSql = table.Column<short>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_Pcmcia", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_Pcmcia", x => x.Id));
if(PcmciasExists)
if(pcmciasExists)
{
migrationBuilder.
Sql("INSERT INTO Pcmcia (Id, CIS, Compliance, ManufacturerCode, CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql) SELECT Id, CIS, Compliance, ManufacturerCodeSql AS ManufacturerCode, CardCodeSql AS CardCode, Manufacturer, ProductName, ManufacturerCodeSql, CardCodeSql FROM Pcmcias");
@@ -1069,16 +1048,15 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MediumType = table.Column<byte>(nullable: true), WriteProtected = table.Column<bool>(),
MediumType = table.Column<byte>(nullable: true),
WriteProtected = table.Column<bool>(),
Speed = table.Column<byte>(nullable: true),
BufferedMode = table.Column<byte>(nullable: true),
BlankCheckEnabled = table.Column<bool>(), DPOandFUA = table.Column<bool>()
}, constraints: table =>
{
table.PrimaryKey("PK_ScsiMode", x => x.Id);
});
BlankCheckEnabled = table.Column<bool>(),
DPOandFUA = table.Column<bool>()
}, constraints: table => table.PrimaryKey("PK_ScsiMode", x => x.Id));
if(ScsiModesExists)
if(scsiModesExists)
{
migrationBuilder.
Sql("INSERT INTO ScsiMode (Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA) SELECT Id, MediumType, WriteProtected, Speed, BufferedMode, BlankCheckEnabled, DPOandFUA FROM ScsiModes");
@@ -1097,12 +1075,9 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
MinBlockLength = table.Column<uint>(nullable: true),
MaxBlockLengthSql = table.Column<int>(nullable: true),
MinBlockLengthSql = table.Column<int>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_Ssc", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_Ssc", x => x.Id));
if(SscsExists)
if(sscsExists)
{
migrationBuilder.
Sql("INSERT INTO Ssc (Id, BlockSizeGranularity, MaxBlockLength, MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql) SELECT Id, BlockSizeGranularity, MaxBlockLengthSql AS MaxBlockLength, MinBlockLengthSql AS MinBlockLength, MaxBlockLengthSql, MinBlockLengthSql FROM Sscs");
@@ -1116,16 +1091,17 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
VendorID = table.Column<ushort>(), ProductID = table.Column<ushort>(),
Manufacturer = table.Column<string>(nullable: true), Product = table.Column<string>(nullable: true),
RemovableMedia = table.Column<bool>(), Descriptors = table.Column<byte[]>(nullable: true),
VendorIDSql = table.Column<short>(), ProductIDSql = table.Column<short>()
}, constraints: table =>
{
table.PrimaryKey("PK_Usb", x => x.Id);
});
VendorID = table.Column<ushort>(),
ProductID = table.Column<ushort>(),
Manufacturer = table.Column<string>(nullable: true),
Product = table.Column<string>(nullable: true),
RemovableMedia = table.Column<bool>(),
Descriptors = table.Column<byte[]>(nullable: true),
VendorIDSql = table.Column<short>(),
ProductIDSql = table.Column<short>()
}, constraints: table => table.PrimaryKey("PK_Usb", x => x.Id));
if(UsbsExists)
if(usbsExists)
{
migrationBuilder.
Sql("INSERT INTO Usb (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, Descriptors, VendorIDSql, ProductIDSql FROM Usbs WHERE VendorIDSql >= 0 AND ProductIDSql >= 0");
@@ -1144,21 +1120,20 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: UsbVendors
if(UsbVendorsExists)
if(usbVendorsExists)
migrationBuilder.RenameTable("UsbVendors", newName: "UsbVendors_old");
migrationBuilder.CreateTable("UsbVendors", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
VendorId = table.Column<int>(), Vendor = table.Column<string>(nullable: true),
AddedWhen = table.Column<DateTime>(), ModifiedWhen = table.Column<DateTime>()
}, constraints: table =>
{
table.PrimaryKey("PK_UsbVendors", x => x.Id);
});
VendorId = table.Column<int>(),
Vendor = table.Column<string>(nullable: true),
AddedWhen = table.Column<DateTime>(),
ModifiedWhen = table.Column<DateTime>()
}, constraints: table => table.PrimaryKey("PK_UsbVendors", x => x.Id));
if(UsbVendorsExists)
if(usbVendorsExists)
{
migrationBuilder.
Sql("INSERT INTO UsbVendors (Id, VendorId, Vendor, AddedWhen, ModifiedWhen) SELECT Id, VendorId, Vendor, AddedWhen, ModifiedWhen FROM UsbVendors_old");
@@ -1168,20 +1143,18 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: Versions
if(VersionsExists)
if(versionsExists)
migrationBuilder.RenameTable("Versions", newName: "Versions_old");
migrationBuilder.CreateTable("Versions", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Value = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_Versions", x => x.Id);
});
Value = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_Versions", x => x.Id));
if(VersionsExists)
if(versionsExists)
{
migrationBuilder.
Sql("INSERT INTO Versions (`Id`, `Value`, `Count`) SELECT `Id`, `Value`, `Count` FROM Versions_old");
@@ -1195,7 +1168,8 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
FeaturesId = table.Column<int>(nullable: true), ModeSense2AData = table.Column<byte[]>(nullable: true)
FeaturesId = table.Column<int>(nullable: true),
ModeSense2AData = table.Column<byte[]>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_Mmc", x => x.Id);
@@ -1204,7 +1178,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(MmcsExists)
if(mmcsExists)
{
migrationBuilder.
Sql("INSERT INTO Mmc (Id, FeaturesId, ModeSense2AData) SELECT Id, Features_Id, ModeSense2AData FROM Mmcs WHERE EXISTS(SELECT 1 FROM MmcFeatures WHERE MmcFeatures.Id = Features_Id) OR Features_Id IS NULL");
@@ -1218,9 +1192,12 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Density = table.Column<byte>(), Blocks = table.Column<ulong>(nullable: true),
BlockLength = table.Column<uint>(nullable: true), BlocksSql = table.Column<long>(nullable: true),
BlockLengthSql = table.Column<int>(nullable: true), ScsiModeId = table.Column<int>(nullable: true)
Density = table.Column<byte>(),
Blocks = table.Column<ulong>(nullable: true),
BlockLength = table.Column<uint>(nullable: true),
BlocksSql = table.Column<long>(nullable: true),
BlockLengthSql = table.Column<int>(nullable: true),
ScsiModeId = table.Column<int>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_BlockDescriptor", x => x.Id);
@@ -1229,7 +1206,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(BlockDescriptorsExists)
if(blockDescriptorsExists)
{
migrationBuilder.
Sql("INSERT INTO BlockDescriptor (Id, Density, Blocks, BlocksSql, BlockLength, BlockLengthSql, ScsiModeId) SELECT Id, Density, BlocksSql AS Blocks, BlocksSql, BlockLengthSql AS BlockLength, BlockLengthSql, ScsiMode_Id FROM BlockDescriptors");
@@ -1245,7 +1222,8 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CanReadMediaSerial = table.Column<bool>(nullable: true),
Density = table.Column<byte>(nullable: true),
Manufacturer = table.Column<string>(nullable: true), MediaIsRecognized = table.Column<bool>(),
Manufacturer = table.Column<string>(nullable: true),
MediaIsRecognized = table.Column<bool>(),
MediumType = table.Column<byte>(nullable: true),
MediumTypeName = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
@@ -1260,7 +1238,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(TestedSequentialMediasExists)
if(testedSequentialMediasExists)
{
migrationBuilder.
Sql("INSERT INTO TestedSequentialMedia (Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, SscId) SELECT Id, CanReadMediaSerial, Density, Manufacturer, MediaIsRecognized, MediumType, MediumTypeName, Model, ModeSense6Data, ModeSense10Data, Ssc_Id FROM TestedSequentialMedias");
@@ -1270,16 +1248,18 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: UsbProducts
if(UsbProductsExists)
if(usbProductsExists)
migrationBuilder.RenameTable("UsbProducts", newName: "UsbProducts_old");
migrationBuilder.CreateTable("UsbProducts", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ProductId = table.Column<int>(), Product = table.Column<string>(nullable: true),
AddedWhen = table.Column<DateTime>(), ModifiedWhen = table.Column<DateTime>(),
VendorId = table.Column<int>()
ProductId = table.Column<int>(),
Product = table.Column<string>(nullable: true),
AddedWhen = table.Column<DateTime>(),
ModifiedWhen = table.Column<DateTime>(),
VendorId = table.Column<int>()
}, constraints: table =>
{
table.PrimaryKey("PK_UsbProducts", x => x.Id);
@@ -1288,7 +1268,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Cascade);
});
if(UsbProductsExists)
if(usbProductsExists)
{
migrationBuilder.
Sql("INSERT INTO UsbProducts (Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId) SELECT Id, ProductId, Product, AddedWhen, ModifiedWhen, VendorId FROM UsbProducts_old");
@@ -1302,11 +1282,13 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MediumType = table.Column<byte>(), Width = table.Column<ushort>(),
MediumType = table.Column<byte>(),
Width = table.Column<ushort>(),
Length = table.Column<ushort>(),
Organization = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Description = table.Column<string>(nullable: true), WidthSql = table.Column<short>(),
Description = table.Column<string>(nullable: true),
WidthSql = table.Column<short>(),
LengthSql = table.Column<short>(),
SscId = table.Column<int>(nullable: true),
TestedSequentialMediaId = table.Column<int>(nullable: true)
@@ -1322,7 +1304,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(SscSupportedMediasExists)
if(sscSupportedMediasExists)
{
migrationBuilder.
Sql("INSERT INTO SscSupportedMedia (Id, MediumType, Width, Length, Organization, Name, Description, WidthSql, LengthSql, SscId, TestedSequentialMediaId) SELECT Id, MediumType, WidthSql AS Width, LengthSql AS Length, Organization, Name, Description, WidthSql, LengthSql, Ssc_Id, TestedSequentialMedia_Id FROM SscSupportedMedias");
@@ -1336,15 +1318,21 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PrimaryCode = table.Column<byte>(), SecondaryCode = table.Column<byte>(),
Writable = table.Column<bool>(), Duplicate = table.Column<bool>(),
DefaultDensity = table.Column<bool>(), BitsPerMm = table.Column<uint>(),
PrimaryCode = table.Column<byte>(),
SecondaryCode = table.Column<byte>(),
Writable = table.Column<bool>(),
Duplicate = table.Column<bool>(),
DefaultDensity = table.Column<bool>(),
BitsPerMm = table.Column<uint>(),
Width = table.Column<ushort>(),
Tracks = table.Column<ushort>(), Capacity = table.Column<uint>(),
Tracks = table.Column<ushort>(),
Capacity = table.Column<uint>(),
Organization = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Description = table.Column<string>(nullable: true), BitsPerMmSql = table.Column<int>(),
WidthSql = table.Column<short>(), TracksSql = table.Column<short>(),
Description = table.Column<string>(nullable: true),
BitsPerMmSql = table.Column<int>(),
WidthSql = table.Column<short>(),
TracksSql = table.Column<short>(),
CapacitySql = table.Column<int>(),
SscId = table.Column<int>(nullable: true),
TestedSequentialMediaId = table.Column<int>(nullable: true)
@@ -1360,7 +1348,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(SupportedDensitiesExists)
if(supportedDensitiesExists)
{
migrationBuilder.
Sql("INSERT INTO SupportedDensity (PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMm, Width, Tracks, Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, SscId, TestedSequentialMediaId) SELECT PrimaryCode, SecondaryCode, Writable, Duplicate, DefaultDensity, BitsPerMmSql AS BitsPerMm, WidthSql AS Width, TracksSql AS Tracks, CapacitySql AS Capacity, Organization, Name, Description, BitsPerMmSql, WidthSql, TracksSql, CapacitySql, Ssc_Id, TestedSequentialMedia_Id FROM SupportedDensities");
@@ -1374,7 +1362,8 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Code = table.Column<int>(), SscSupportedMediaId = table.Column<int>(nullable: true)
Code = table.Column<int>(),
SscSupportedMediaId = table.Column<int>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_DensityCode", x => x.Id);
@@ -1383,7 +1372,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
"SscSupportedMedia", "Id", onDelete: ReferentialAction.Restrict);
});
if(DensityCodesExists)
if(densityCodesExists)
{
migrationBuilder.
Sql("INSERT INTO DensityCode (Id, Code, SscSupportedMediaId) SELECT Id, Code, SscSupportedMedia_Id FROM DensityCodes");
@@ -1393,27 +1382,30 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: Devices
if(DevicesExists)
if(devicesExists)
migrationBuilder.RenameTable("Devices", newName: "Devices_old");
migrationBuilder.CreateTable("Devices", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
USBId = table.Column<int>(nullable: true),
FireWireId = table.Column<int>(nullable: true),
PCMCIAId = table.Column<int>(nullable: true), CompactFlash = table.Column<bool>(),
ATAId = table.Column<int>(nullable: true),
ATAPIId = table.Column<int>(nullable: true),
SCSIId = table.Column<int>(nullable: true),
MultiMediaCardId = table.Column<int>(nullable: true),
SecureDigitalId = table.Column<int>(nullable: true),
Manufacturer = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true), Type = table.Column<int>(),
AddedWhen = table.Column<DateTime>(),
ModifiedWhen = table.Column<DateTime>(nullable: true),
CdOffsetId = table.Column<int>(nullable: true), OptimalMultipleSectorsRead = table.Column<int>()
USBId = table.Column<int>(nullable: true),
FireWireId = table.Column<int>(nullable: true),
PCMCIAId = table.Column<int>(nullable: true),
CompactFlash = table.Column<bool>(),
ATAId = table.Column<int>(nullable: true),
ATAPIId = table.Column<int>(nullable: true),
SCSIId = table.Column<int>(nullable: true),
MultiMediaCardId = table.Column<int>(nullable: true),
SecureDigitalId = table.Column<int>(nullable: true),
Manufacturer = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true),
Type = table.Column<int>(),
AddedWhen = table.Column<DateTime>(),
ModifiedWhen = table.Column<DateTime>(nullable: true),
CdOffsetId = table.Column<int>(nullable: true),
OptimalMultipleSectorsRead = table.Column<int>()
}, constraints: table =>
{
table.PrimaryKey("PK_Devices", x => x.Id);
@@ -1437,7 +1429,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(DevicesExists)
if(devicesExists)
{
migrationBuilder.
Sql("INSERT INTO Devices (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffsetId, OptimalMultipleSectorsRead) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, AddedWhen, ModifiedWhen, CdOffset_Id, OptimalMultipleSectorsRead FROM Devices_old");
@@ -1447,15 +1439,17 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
#endregion
#region TABLE: DeviceStats
if(DeviceStatsExists)
if(deviceStatsExists)
migrationBuilder.RenameTable("DeviceStats", newName: "DeviceStats_old");
migrationBuilder.CreateTable("DeviceStats", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Manufacturer = table.Column<string>(nullable: true), Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true), Bus = table.Column<string>(nullable: true),
Manufacturer = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true),
Bus = table.Column<string>(nullable: true),
ReportId = table.Column<int>(nullable: true)
}, constraints: table =>
{
@@ -1465,7 +1459,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(DeviceStatsExists)
if(deviceStatsExists)
{
migrationBuilder.
Sql("INSERT INTO DeviceStats (Id, Manufacturer, Model, Revision, Bus, ReportId) SELECT Id, Manufacturer, Model, Revision, Bus, Report_Id FROM DeviceStats_old");
@@ -1481,14 +1475,17 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
USBId = table.Column<int>(nullable: true),
FireWireId = table.Column<int>(nullable: true),
PCMCIAId = table.Column<int>(nullable: true), CompactFlash = table.Column<bool>(),
PCMCIAId = table.Column<int>(nullable: true),
CompactFlash = table.Column<bool>(),
ATAId = table.Column<int>(nullable: true),
ATAPIId = table.Column<int>(nullable: true),
SCSIId = table.Column<int>(nullable: true),
MultiMediaCardId = table.Column<int>(nullable: true),
SecureDigitalId = table.Column<int>(nullable: true),
Manufacturer = table.Column<string>(nullable: true), Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true), Type = table.Column<int>(),
Manufacturer = table.Column<string>(nullable: true),
Model = table.Column<string>(nullable: true),
Revision = table.Column<string>(nullable: true),
Type = table.Column<int>(),
UploadedWhen = table.Column<DateTime>()
}, constraints: table =>
{
@@ -1510,7 +1507,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(UploadedReportsExists)
if(uploadedReportsExists)
{
migrationBuilder.
Sql("INSERT INTO Reports (Id, USBId, FireWireId, PCMCIAId, CompactFlash, ATAId, ATAPIId, SCSIId, MultiMediaCardId, SecureDigitalId, Manufacturer, Model, Revision, Type, UploadedWhen) SELECT Id, USB_Id, FireWire_Id, PCMCIA_Id, CompactFlash, ATA_Id, ATAPI_Id, SCSI_Id, MultiMediaCard_Id, SecureDigital_Id, Manufacturer, Model, Revision, Type, UploadedWhen FROM UploadedReports");
@@ -1703,7 +1700,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(TestedMediasExists)
if(testedMediasExists)
{
string preFormat =
@"INSERT INTO TestedMedia (Id, IdentifyData, Blocks, BlockSize, CanReadAACS, CanReadADIP,
@@ -1792,7 +1789,8 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Identify = table.Column<byte[]>(nullable: true), ReadCapabilitiesId = table.Column<int>(nullable: true)
Identify = table.Column<byte[]>(nullable: true),
ReadCapabilitiesId = table.Column<int>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_Ata", x => x.Id);
@@ -1801,7 +1799,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
"Id", onDelete: ReferentialAction.Restrict);
});
if(AtasExists)
if(atasExists)
{
migrationBuilder.
Sql("INSERT INTO Ata (Id, Identify, ReadCapabilitiesId) SELECT Id, Identify, ReadCapabilities_Id FROM Atas");
@@ -1846,7 +1844,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(ScsisExists)
if(scsisExists)
{
migrationBuilder.Sql(
"INSERT INTO Scsi (Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSenseId, MultiMediaDeviceId, ReadCapabilitiesId, SequentialDeviceId, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData) SELECT Id, InquiryData, SupportsModeSense6, SupportsModeSense10, SupportsModeSubpages, ModeSense_Id, MultiMediaDevice_Id, ReadCapabilities_Id, SequentialDevice_Id, ModeSense6Data, ModeSense10Data, ModeSense6CurrentData, ModeSense10CurrentData, ModeSense6ChangeableData, ModeSense10ChangeableData FROM Scsis WHERE EXISTS(SELECT 1 from Mmc WHERE Mmc.Id = Scsis.MultiMediaDevice_Id) OR MultiMediaDevice_Id IS NULL");
@@ -1860,8 +1858,10 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
page = table.Column<byte>(), subpage = table.Column<byte>(nullable: true),
value = table.Column<byte[]>(nullable: true), ScsiId = table.Column<int>(nullable: true),
page = table.Column<byte>(),
subpage = table.Column<byte>(nullable: true),
value = table.Column<byte[]>(nullable: true),
ScsiId = table.Column<int>(nullable: true),
ScsiModeId = table.Column<int>(nullable: true)
}, constraints: table =>
{
@@ -1874,7 +1874,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
onDelete: ReferentialAction.Restrict);
});
if(ScsiPagesExists)
if(scsiPagesExists)
{
migrationBuilder.
Sql("INSERT INTO ScsiPage (Id, page, subpage, value, ScsiId, ScsiModeId) SELECT Id, page, subpage, value, Scsi_Id, ScsiMode_Id FROM ScsiPages");
@@ -2002,7 +2002,7 @@ VolumeLevelsSql FROM MmcFeatures_old WHERE VolumeLevelsSql < 0");
migrationBuilder.AddForeignKey("FK_TestedMedia_Scsi_ScsiId", "TestedMedia", "ScsiId", "Scsi",
principalColumn: "Id", onDelete: ReferentialAction.Restrict);
if(EFExists)
if(efExists)
migrationBuilder.DropTable("__MigrationHistory");
}

View File

@@ -10,38 +10,37 @@ namespace Aaru.Server.Migrations
{
migrationBuilder.CreateTable("AspNetRoles", table => new
{
Id = table.Column<string>(), Name = table.Column<string>(maxLength: 256, nullable: true),
Id = table.Column<string>(),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
}, constraints: table => table.PrimaryKey("PK_AspNetRoles", x => x.Id));
migrationBuilder.CreateTable("AspNetUsers", table => new
{
Id = table.Column<string>(),
UserName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(), PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true), PhoneNumberConfirmed = table.Column<bool>(),
TwoFactorEnabled = table.Column<bool>(),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(), AccessFailedCount = table.Column<int>()
}, constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
Id = table.Column<string>(),
UserName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(),
PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(),
TwoFactorEnabled = table.Column<bool>(),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(),
AccessFailedCount = table.Column<int>()
}, constraints: table => table.PrimaryKey("PK_AspNetUsers", x => x.Id));
migrationBuilder.CreateTable("AspNetRoleClaims", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
RoleId = table.Column<string>(), ClaimType = table.Column<string>(nullable: true),
RoleId = table.Column<string>(),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
}, constraints: table =>
{
@@ -55,7 +54,8 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserId = table.Column<string>(), ClaimType = table.Column<string>(nullable: true),
UserId = table.Column<string>(),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
}, constraints: table =>
{
@@ -69,12 +69,14 @@ namespace Aaru.Server.Migrations
{
LoginProvider = table.Column<string>(maxLength: 128),
ProviderKey = table.Column<string>(maxLength: 128),
ProviderDisplayName = table.Column<string>(nullable: true), UserId = table.Column<string>()
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>()
}, constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new
{
x.LoginProvider, x.ProviderKey
x.LoginProvider,
x.ProviderKey
});
table.ForeignKey("FK_AspNetUserLogins_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
@@ -83,12 +85,14 @@ namespace Aaru.Server.Migrations
migrationBuilder.CreateTable("AspNetUserRoles", table => new
{
UserId = table.Column<string>(), RoleId = table.Column<string>()
UserId = table.Column<string>(),
RoleId = table.Column<string>()
}, constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new
{
x.UserId, x.RoleId
x.UserId,
x.RoleId
});
table.ForeignKey("FK_AspNetUserRoles_AspNetRoles_RoleId", x => x.RoleId, "AspNetRoles", "Id",
@@ -100,13 +104,17 @@ namespace Aaru.Server.Migrations
migrationBuilder.CreateTable("AspNetUserTokens", table => new
{
UserId = table.Column<string>(), LoginProvider = table.Column<string>(maxLength: 128),
Name = table.Column<string>(maxLength: 128), Value = table.Column<string>(nullable: true)
UserId = table.Column<string>(),
LoginProvider = table.Column<string>(maxLength: 128),
Name = table.Column<string>(maxLength: 128),
Value = table.Column<string>(nullable: true)
}, constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new
{
x.UserId, x.LoginProvider, x.Name
x.UserId,
x.LoginProvider,
x.Name
});
table.ForeignKey("FK_AspNetUserTokens_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",

View File

@@ -11,33 +11,27 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_RemoteApplications", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_RemoteApplications", x => x.Id));
migrationBuilder.CreateTable("RemoteArchitectures", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_RemoteArchitectures", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_RemoteArchitectures", x => x.Id));
migrationBuilder.CreateTable("RemoteOperatingSystems", table => new
{
Id = table.Column<int>().
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: true), Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table =>
{
table.PrimaryKey("PK_RemoteOperatingSystems", x => x.Id);
});
Name = table.Column<string>(nullable: true),
Version = table.Column<string>(nullable: true),
Count = table.Column<long>()
}, constraints: table => table.PrimaryKey("PK_RemoteOperatingSystems", x => x.Id));
}
protected override void Down(MigrationBuilder migrationBuilder)

View File

@@ -15,112 +15,113 @@ namespace Aaru.Server.Migrations
{
Id = table.Column<int>(nullable: false).
Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
RecognizedSwapDisc = table.Column<bool>(nullable: false),
SwapDiscLeadOutPMIN = table.Column<byte>(nullable: false),
SwapDiscLeadOutPSEC = table.Column<byte>(nullable: false),
SwapDiscLeadOutPFRAM = table.Column<byte>(nullable: false),
SwapDiscLeadOutStart = table.Column<int>(nullable: false),
Lba0Readable = table.Column<bool>(nullable: false), Lba0Data = table.Column<byte[]>(nullable: true),
Lba0Sense = table.Column<byte[]>(nullable: true),
Lba0DecodedSense = table.Column<string>(nullable: true),
Lba0ScrambledReadable = table.Column<bool>(nullable: false),
Lba0ScrambledData = table.Column<byte[]>(nullable: true),
Lba0ScrambledSense = table.Column<byte[]>(nullable: true),
Lba0ScrambledDecodedSense = table.Column<string>(nullable: true),
Lba44990Readable = table.Column<bool>(nullable: false),
Lba44990Data = table.Column<byte[]>(nullable: true),
Lba44990Sense = table.Column<byte[]>(nullable: true),
Lba44990DecodedSense = table.Column<string>(nullable: true),
Lba44990ReadableCluster = table.Column<int>(nullable: false),
Lba45000Readable = table.Column<bool>(nullable: false),
Lba45000Data = table.Column<byte[]>(nullable: true),
Lba45000Sense = table.Column<byte[]>(nullable: true),
Lba45000DecodedSense = table.Column<string>(nullable: true),
Lba45000ReadableCluster = table.Column<int>(nullable: false),
Lba50000Readable = table.Column<bool>(nullable: false),
Lba50000Data = table.Column<byte[]>(nullable: true),
Lba50000Sense = table.Column<byte[]>(nullable: true),
Lba50000DecodedSense = table.Column<string>(nullable: true),
Lba50000ReadableCluster = table.Column<int>(nullable: false),
Lba100000Readable = table.Column<bool>(nullable: false),
Lba100000Data = table.Column<byte[]>(nullable: true),
Lba100000Sense = table.Column<byte[]>(nullable: true),
Lba100000DecodedSense = table.Column<string>(nullable: true),
Lba100000ReadableCluster = table.Column<int>(nullable: false),
Lba400000Readable = table.Column<bool>(nullable: false),
Lba400000Data = table.Column<byte[]>(nullable: true),
Lba400000Sense = table.Column<byte[]>(nullable: true),
Lba400000DecodedSense = table.Column<string>(nullable: true),
Lba400000ReadableCluster = table.Column<int>(nullable: false),
Lba450000Readable = table.Column<bool>(nullable: false),
Lba450000Data = table.Column<byte[]>(nullable: true),
Lba450000Sense = table.Column<byte[]>(nullable: true),
Lba450000DecodedSense = table.Column<string>(nullable: true),
Lba450000ReadableCluster = table.Column<int>(nullable: false),
Lba44990PqReadable = table.Column<bool>(nullable: false),
Lba44990PqData = table.Column<byte[]>(nullable: true),
Lba44990PqSense = table.Column<byte[]>(nullable: true),
Lba44990PqDecodedSense = table.Column<string>(nullable: true),
Lba44990PqReadableCluster = table.Column<int>(nullable: false),
Lba45000PqReadable = table.Column<bool>(nullable: false),
Lba45000PqData = table.Column<byte[]>(nullable: true),
Lba45000PqSense = table.Column<byte[]>(nullable: true),
Lba45000PqDecodedSense = table.Column<string>(nullable: true),
Lba45000PqReadableCluster = table.Column<int>(nullable: false),
Lba50000PqReadable = table.Column<bool>(nullable: false),
Lba50000PqData = table.Column<byte[]>(nullable: true),
Lba50000PqSense = table.Column<byte[]>(nullable: true),
Lba50000PqDecodedSense = table.Column<string>(nullable: true),
Lba50000PqReadableCluster = table.Column<int>(nullable: false),
Lba100000PqReadable = table.Column<bool>(nullable: false),
Lba100000PqData = table.Column<byte[]>(nullable: true),
Lba100000PqSense = table.Column<byte[]>(nullable: true),
Lba100000PqDecodedSense = table.Column<string>(nullable: true),
Lba100000PqReadableCluster = table.Column<int>(nullable: false),
Lba400000PqReadable = table.Column<bool>(nullable: false),
Lba400000PqData = table.Column<byte[]>(nullable: true),
Lba400000PqSense = table.Column<byte[]>(nullable: true),
Lba400000PqDecodedSense = table.Column<string>(nullable: true),
Lba400000PqReadableCluster = table.Column<int>(nullable: false),
Lba450000PqReadable = table.Column<bool>(nullable: false),
Lba450000PqData = table.Column<byte[]>(nullable: true),
Lba450000PqSense = table.Column<byte[]>(nullable: true),
Lba450000PqDecodedSense = table.Column<string>(nullable: true),
Lba450000PqReadableCluster = table.Column<int>(nullable: false),
Lba44990RwReadable = table.Column<bool>(nullable: false),
Lba44990RwData = table.Column<byte[]>(nullable: true),
Lba44990RwSense = table.Column<byte[]>(nullable: true),
Lba44990RwDecodedSense = table.Column<string>(nullable: true),
Lba44990RwReadableCluster = table.Column<int>(nullable: false),
Lba45000RwReadable = table.Column<bool>(nullable: false),
Lba45000RwData = table.Column<byte[]>(nullable: true),
Lba45000RwSense = table.Column<byte[]>(nullable: true),
Lba45000RwDecodedSense = table.Column<string>(nullable: true),
Lba45000RwReadableCluster = table.Column<int>(nullable: false),
Lba50000RwReadable = table.Column<bool>(nullable: false),
Lba50000RwData = table.Column<byte[]>(nullable: true),
Lba50000RwSense = table.Column<byte[]>(nullable: true),
Lba50000RwDecodedSense = table.Column<string>(nullable: true),
Lba50000RwReadableCluster = table.Column<int>(nullable: false),
Lba100000RwReadable = table.Column<bool>(nullable: false),
Lba100000RwData = table.Column<byte[]>(nullable: true),
Lba100000RwSense = table.Column<byte[]>(nullable: true),
Lba100000RwDecodedSense = table.Column<string>(nullable: true),
Lba100000RwReadableCluster = table.Column<int>(nullable: false),
Lba400000RwReadable = table.Column<bool>(nullable: false),
Lba400000RwData = table.Column<byte[]>(nullable: true),
Lba400000RwSense = table.Column<byte[]>(nullable: true),
Lba400000RwDecodedSense = table.Column<string>(nullable: true),
Lba400000RwReadableCluster = table.Column<int>(nullable: false),
Lba450000RwReadable = table.Column<bool>(nullable: false),
Lba450000RwData = table.Column<byte[]>(nullable: true),
Lba450000RwSense = table.Column<byte[]>(nullable: true),
Lba450000RwDecodedSense = table.Column<string>(nullable: true),
Lba450000RwReadableCluster = table.Column<int>(nullable: false),
RecognizedSwapDisc = table.Column<bool>(nullable: false),
SwapDiscLeadOutPMIN = table.Column<byte>(nullable: false),
SwapDiscLeadOutPSEC = table.Column<byte>(nullable: false),
SwapDiscLeadOutPFRAM = table.Column<byte>(nullable: false),
SwapDiscLeadOutStart = table.Column<int>(nullable: false),
Lba0Readable = table.Column<bool>(nullable: false),
Lba0Data = table.Column<byte[]>(nullable: true),
Lba0Sense = table.Column<byte[]>(nullable: true),
Lba0DecodedSense = table.Column<string>(nullable: true),
Lba0ScrambledReadable = table.Column<bool>(nullable: false),
Lba0ScrambledData = table.Column<byte[]>(nullable: true),
Lba0ScrambledSense = table.Column<byte[]>(nullable: true),
Lba0ScrambledDecodedSense = table.Column<string>(nullable: true),
Lba44990Readable = table.Column<bool>(nullable: false),
Lba44990Data = table.Column<byte[]>(nullable: true),
Lba44990Sense = table.Column<byte[]>(nullable: true),
Lba44990DecodedSense = table.Column<string>(nullable: true),
Lba44990ReadableCluster = table.Column<int>(nullable: false),
Lba45000Readable = table.Column<bool>(nullable: false),
Lba45000Data = table.Column<byte[]>(nullable: true),
Lba45000Sense = table.Column<byte[]>(nullable: true),
Lba45000DecodedSense = table.Column<string>(nullable: true),
Lba45000ReadableCluster = table.Column<int>(nullable: false),
Lba50000Readable = table.Column<bool>(nullable: false),
Lba50000Data = table.Column<byte[]>(nullable: true),
Lba50000Sense = table.Column<byte[]>(nullable: true),
Lba50000DecodedSense = table.Column<string>(nullable: true),
Lba50000ReadableCluster = table.Column<int>(nullable: false),
Lba100000Readable = table.Column<bool>(nullable: false),
Lba100000Data = table.Column<byte[]>(nullable: true),
Lba100000Sense = table.Column<byte[]>(nullable: true),
Lba100000DecodedSense = table.Column<string>(nullable: true),
Lba100000ReadableCluster = table.Column<int>(nullable: false),
Lba400000Readable = table.Column<bool>(nullable: false),
Lba400000Data = table.Column<byte[]>(nullable: true),
Lba400000Sense = table.Column<byte[]>(nullable: true),
Lba400000DecodedSense = table.Column<string>(nullable: true),
Lba400000ReadableCluster = table.Column<int>(nullable: false),
Lba450000Readable = table.Column<bool>(nullable: false),
Lba450000Data = table.Column<byte[]>(nullable: true),
Lba450000Sense = table.Column<byte[]>(nullable: true),
Lba450000DecodedSense = table.Column<string>(nullable: true),
Lba450000ReadableCluster = table.Column<int>(nullable: false),
Lba44990PqReadable = table.Column<bool>(nullable: false),
Lba44990PqData = table.Column<byte[]>(nullable: true),
Lba44990PqSense = table.Column<byte[]>(nullable: true),
Lba44990PqDecodedSense = table.Column<string>(nullable: true),
Lba44990PqReadableCluster = table.Column<int>(nullable: false),
Lba45000PqReadable = table.Column<bool>(nullable: false),
Lba45000PqData = table.Column<byte[]>(nullable: true),
Lba45000PqSense = table.Column<byte[]>(nullable: true),
Lba45000PqDecodedSense = table.Column<string>(nullable: true),
Lba45000PqReadableCluster = table.Column<int>(nullable: false),
Lba50000PqReadable = table.Column<bool>(nullable: false),
Lba50000PqData = table.Column<byte[]>(nullable: true),
Lba50000PqSense = table.Column<byte[]>(nullable: true),
Lba50000PqDecodedSense = table.Column<string>(nullable: true),
Lba50000PqReadableCluster = table.Column<int>(nullable: false),
Lba100000PqReadable = table.Column<bool>(nullable: false),
Lba100000PqData = table.Column<byte[]>(nullable: true),
Lba100000PqSense = table.Column<byte[]>(nullable: true),
Lba100000PqDecodedSense = table.Column<string>(nullable: true),
Lba100000PqReadableCluster = table.Column<int>(nullable: false),
Lba400000PqReadable = table.Column<bool>(nullable: false),
Lba400000PqData = table.Column<byte[]>(nullable: true),
Lba400000PqSense = table.Column<byte[]>(nullable: true),
Lba400000PqDecodedSense = table.Column<string>(nullable: true),
Lba400000PqReadableCluster = table.Column<int>(nullable: false),
Lba450000PqReadable = table.Column<bool>(nullable: false),
Lba450000PqData = table.Column<byte[]>(nullable: true),
Lba450000PqSense = table.Column<byte[]>(nullable: true),
Lba450000PqDecodedSense = table.Column<string>(nullable: true),
Lba450000PqReadableCluster = table.Column<int>(nullable: false),
Lba44990RwReadable = table.Column<bool>(nullable: false),
Lba44990RwData = table.Column<byte[]>(nullable: true),
Lba44990RwSense = table.Column<byte[]>(nullable: true),
Lba44990RwDecodedSense = table.Column<string>(nullable: true),
Lba44990RwReadableCluster = table.Column<int>(nullable: false),
Lba45000RwReadable = table.Column<bool>(nullable: false),
Lba45000RwData = table.Column<byte[]>(nullable: true),
Lba45000RwSense = table.Column<byte[]>(nullable: true),
Lba45000RwDecodedSense = table.Column<string>(nullable: true),
Lba45000RwReadableCluster = table.Column<int>(nullable: false),
Lba50000RwReadable = table.Column<bool>(nullable: false),
Lba50000RwData = table.Column<byte[]>(nullable: true),
Lba50000RwSense = table.Column<byte[]>(nullable: true),
Lba50000RwDecodedSense = table.Column<string>(nullable: true),
Lba50000RwReadableCluster = table.Column<int>(nullable: false),
Lba100000RwReadable = table.Column<bool>(nullable: false),
Lba100000RwData = table.Column<byte[]>(nullable: true),
Lba100000RwSense = table.Column<byte[]>(nullable: true),
Lba100000RwDecodedSense = table.Column<string>(nullable: true),
Lba100000RwReadableCluster = table.Column<int>(nullable: false),
Lba400000RwReadable = table.Column<bool>(nullable: false),
Lba400000RwData = table.Column<byte[]>(nullable: true),
Lba400000RwSense = table.Column<byte[]>(nullable: true),
Lba400000RwDecodedSense = table.Column<string>(nullable: true),
Lba400000RwReadableCluster = table.Column<int>(nullable: false),
Lba450000RwReadable = table.Column<bool>(nullable: false),
Lba450000RwData = table.Column<byte[]>(nullable: true),
Lba450000RwSense = table.Column<byte[]>(nullable: true),
Lba450000RwDecodedSense = table.Column<string>(nullable: true),
Lba450000RwReadableCluster = table.Column<int>(nullable: false),
MinimumReadableSectorInHdArea = table.Column<uint>(nullable: false),
MaximumReadableSectorInHdArea = table.Column<uint>(nullable: false),
MaximumReadablePqInHdArea = table.Column<byte[]>(nullable: true),
MaximumReadableRwInHdArea = table.Column<byte[]>(nullable: true)
MaximumReadablePqInHdArea = table.Column<byte[]>(nullable: true),
MaximumReadableRwInHdArea = table.Column<byte[]>(nullable: true)
}, constraints: table => table.PrimaryKey("PK_GdRomSwapDiscCapabilities", x => x.Id));
migrationBuilder.CreateIndex("IX_Reports_GdRomSwapDiscCapabilitiesId", "Reports",

View File

@@ -5,7 +5,8 @@ namespace Aaru.Server.Migrations
public partial class AddCanReadGdRomUsingSwapDisc : Migration
{
protected override void Up(MigrationBuilder migrationBuilder) =>
migrationBuilder.AddColumn<bool>("CanReadGdRomUsingSwapDisc", "Devices", nullable: true, defaultValue: null);
migrationBuilder.AddColumn<bool>("CanReadGdRomUsingSwapDisc", "Devices", nullable: true,
defaultValue: null);
protected override void Down(MigrationBuilder migrationBuilder) =>
migrationBuilder.DropColumn("CanReadGdRomUsingSwapDisc", "Devices");

View File

@@ -1895,29 +1895,22 @@ namespace Aaru.Server.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata",
b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor",
b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes").
HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode",
b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).
WithMany("DensityCodes").HasForeignKey("SscSupportedMediaId").
OnDelete(DeleteBehavior.Cascade));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().HasForeignKey("FeaturesId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc",
b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().
HasForeignKey("FeaturesId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Scsi", b =>
{
@@ -1979,11 +1972,9 @@ namespace Aaru.Server.Migrations
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia",
b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.Server.Models.Device", b =>
{
@@ -2018,11 +2009,9 @@ namespace Aaru.Server.Migrations
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.Server.Models.DeviceStat", b =>
{
b.HasOne("Aaru.Server.Models.Device", "Report").WithMany().HasForeignKey("ReportId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.Server.Models.DeviceStat",
b => b.HasOne("Aaru.Server.Models.Device", "Report").WithMany().
HasForeignKey("ReportId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.Server.Models.UploadedReport", b =>
{
@@ -2054,29 +2043,21 @@ namespace Aaru.Server.Migrations
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.Server.Models.UsbProduct", b =>
{
b.HasOne("Aaru.Server.Models.UsbVendor", "Vendor").WithMany("Products").HasForeignKey("VendorId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Aaru.Server.Models.UsbProduct",
b => b.HasOne("Aaru.Server.Models.UsbVendor", "Vendor").WithMany("Products").
HasForeignKey("VendorId").OnDelete(DeleteBehavior.Cascade).IsRequired());
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null).WithMany().HasForeignKey("RoleId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
b => b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null).WithMany().
HasForeignKey("RoleId").OnDelete(DeleteBehavior.Cascade).IsRequired());
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().HasForeignKey("UserId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>",
b => b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().
HasForeignKey("UserId").OnDelete(DeleteBehavior.Cascade).IsRequired());
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().HasForeignKey("UserId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>",
b => b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().
HasForeignKey("UserId").OnDelete(DeleteBehavior.Cascade).IsRequired());
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
@@ -2087,11 +2068,9 @@ namespace Aaru.Server.Migrations
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().HasForeignKey("UserId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>",
b => b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null).WithMany().
HasForeignKey("UserId").OnDelete(DeleteBehavior.Cascade).IsRequired());
#pragma warning restore 612, 618
}
}

View File

@@ -59,7 +59,7 @@ namespace Aaru.Server.Models
public DbSet<UsbVendor> UsbVendors { get; set; }
public DbSet<UsbProduct> UsbProducts { get; set; }
public DbSet<CompactDiscOffset> CdOffsets { get; set; }
public DbSet<CommonTypes.Metadata.Ata> Ata { get; set; }
public DbSet<Ata> Ata { get; set; }
public DbSet<BlockDescriptor> BlockDescriptor { get; set; }
public DbSet<Chs> Chs { get; set; }
public DbSet<FireWire> FireWire { get; set; }
@@ -94,29 +94,22 @@ namespace Aaru.Server.Models
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata",
b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany().
HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor",
b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors").
HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes").
HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode",
b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).
WithMany("DensityCodes").HasForeignKey("SscSupportedMediaId").
OnDelete(DeleteBehavior.Cascade));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().HasForeignKey("FeaturesId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc",
b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().
HasForeignKey("FeaturesId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.CommonTypes.Metadata.Scsi", b =>
{
@@ -178,11 +171,9 @@ namespace Aaru.Server.Models
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", b =>
{
b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia",
b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").
HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.Server.Models.Device", b =>
{
@@ -214,11 +205,9 @@ namespace Aaru.Server.Models
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.Server.Models.DeviceStat", b =>
{
b.HasOne("Aaru.Server.Models.Device", "Report").WithMany().HasForeignKey("ReportId").
OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Aaru.Server.Models.DeviceStat",
b => b.HasOne("Aaru.Server.Models.Device", "Report").WithMany().
HasForeignKey("ReportId").OnDelete(DeleteBehavior.SetNull));
modelBuilder.Entity("Aaru.Server.Models.UploadedReport", b =>
{

View File

@@ -9,7 +9,7 @@ using Version = Aaru.CommonTypes.Interop.Version;
namespace Aaru.Server
{
public class Program
public sealed class Program
{
public static void Main(string[] args)
{
@@ -19,55 +19,46 @@ namespace Aaru.Server
System.Console.Clear();
System.Console.Write(
"\u001b[32m . ,,\n" +
"\u001b[32m ;,. '0d.\n" +
"\u001b[32m oc oWd \u001b[31m" +
@"__/\\\\\\\\\\\\_____/\\\\\\\\\\\________/\\\\\\\\\_ " +
"\n\u001b[0m" +
"\u001b[32m ;X. 'WN' \u001b[31m" +
@" _\/\\\////////\\\__\/////\\\///______/\\\////////__ " +
"\n\u001b[0m" +
"\u001b[32m oMo cMM: \u001b[31m" +
@" _\/\\\______\//\\\_____\/\\\_______/\\\/___________ " +
"\n\u001b[0m" +
"\u001b[32m ;MM. .MMM; \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\______/\\\_____________ " +
"\n\u001b[0m" +
"\u001b[32m NMM WMMW \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\_____\/\\\_____________ " +
"\n\u001b[0m" +
"\u001b[32m 'MMM MMMM; \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\_____\//\\\____________ " +
"\n\u001b[0m" +
"\u001b[32m ,MMM: dMMMM: \u001b[31m" +
@" _\/\\\_______/\\\______\/\\\______\///\\\__________ " +
"\n\u001b[0m" +
"\u001b[32m .MMMW. :MMMMM. \u001b[31m" +
@" _\/\\\\\\\\\\\\/____/\\\\\\\\\\\____\////\\\\\\\\\_ " +
"\n\u001b[0m" +
"\u001b[32m XMMMW: .:xKNMMMMMMN0d, lMMMMMd \u001b[31m" +
@" _\////////////_____\///////////________\/////////__" +
"\n\u001b[0m" +
"\u001b[32m :MMMMMK; cWMNkl:;;;:lxKMXc .0MMMMMO\u001b[0m\n" +
"\u001b[32m ..KMMMMMMNo,. ,OMMMMMMW:,. \u001b[37;1m Aaru Website\u001b[0m\n" +
"\u001b[32m .;d0NMMMMMMMMMMMMMMW0d:' .;lOWMMMMMMMMMMMMMXkl. \u001b[37;1m Version \u001b[0m\u001b[33m{0}\u001b[37;1m-\u001b[0m\u001b[31m{1}\u001b[0m\n" +
"\u001b[32m :KMMMMMMMMMMMMMMMMMMMMMMMMc WMMMMMMMMMMMMMMMMMMMMMMWk'\u001b[0m\n" +
"\u001b[32m . ,,\n" +
"\u001b[32m ;,. '0d.\n" +
"\u001b[32m oc oWd \u001b[31m" +
@"__/\\\\\\\\\\\\_____/\\\\\\\\\\\________/\\\\\\\\\_ " + "\n\u001b[0m" +
"\u001b[32m ;X. 'WN' \u001b[31m" +
@" _\/\\\////////\\\__\/////\\\///______/\\\////////__ " + "\n\u001b[0m" +
"\u001b[32m oMo cMM: \u001b[31m" +
@" _\/\\\______\//\\\_____\/\\\_______/\\\/___________ " + "\n\u001b[0m" +
"\u001b[32m ;MM. .MMM; \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\______/\\\_____________ " + "\n\u001b[0m" +
"\u001b[32m NMM WMMW \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\_____\/\\\_____________ " + "\n\u001b[0m" +
"\u001b[32m 'MMM MMMM; \u001b[31m" +
@" _\/\\\_______\/\\\_____\/\\\_____\//\\\____________ " + "\n\u001b[0m" +
"\u001b[32m ,MMM: dMMMM: \u001b[31m" +
@" _\/\\\_______/\\\______\/\\\______\///\\\__________ " + "\n\u001b[0m" +
"\u001b[32m .MMMW. :MMMMM. \u001b[31m" +
@" _\/\\\\\\\\\\\\/____/\\\\\\\\\\\____\////\\\\\\\\\_ " + "\n\u001b[0m" +
"\u001b[32m XMMMW: .:xKNMMMMMMN0d, lMMMMMd \u001b[31m" +
@" _\////////////_____\///////////________\/////////__" + "\n\u001b[0m" +
"\u001b[32m :MMMMMK; cWMNkl:;;;:lxKMXc .0MMMMMO\u001b[0m\n" +
"\u001b[32m ..KMMMMMMNo,. ,OMMMMMMW:,. \u001b[37;1m Aaru Website\u001b[0m\n" +
"\u001b[32m .;d0NMMMMMMMMMMMMMMW0d:' .;lOWMMMMMMMMMMMMMXkl. \u001b[37;1m Version \u001b[0m\u001b[33m{0}\u001b[37;1m-\u001b[0m\u001b[31m{1}\u001b[0m\n" +
"\u001b[32m :KMMMMMMMMMMMMMMMMMMMMMMMMc WMMMMMMMMMMMMMMMMMMMMMMWk'\u001b[0m\n" +
"\u001b[32m ;NMMMMWX0kkkkO0XMMMMMMMMMMM0' dNMMMMMMMMMMW0xl:;,;:oOWMMX; \u001b[37;1m Running under \u001b[35;1m{2}\u001b[37;1m, \u001b[35m{3}-bit\u001b[37;1m in \u001b[35m{4}-bit\u001b[37;1m mode.\u001b[0m\n" +
"\u001b[32m xMMWk:. .c0MMMMMW' OMMMMMM0c'.. .oNMO \u001b[37;1m Using \u001b[33;1m{5}\u001b[37;1m version \u001b[31;1m{6}\u001b[0m\n" +
"\u001b[32m OMNc .MNc oWMMk 'WMMNl. .MMK ;KX.\u001b[0m\n" +
"\u001b[32m xMO WMN ; ., , ': ,MMx lK\u001b[0m\n" +
"\u001b[32m ,Md cMMl .XMMMWWMMMO XMW. :\u001b[0m\n" +
"\u001b[32m Ok xMMl XMMMMMMMMc 0MW,\u001b[0m\n" +
"\u001b[32m 0 oMM0' lMMMMMMMM. :NMN'\u001b[0m\n" +
"\u001b[32m . .0MMKl ;MMMMMMMM oNMWd\u001b[0m\n" +
"\u001b[32m .dNW cMMMMMMMM, XKl\u001b[0m\n" +
"\u001b[32m 0MMMMMMMMK\u001b[0m\n" +
"\u001b[32m ;MMMMMMMMMMO \u001b[37;1m Proudly presented to you by:\u001b[0m\n" +
"\u001b[32m 'WMMMMKxMMMMM0 \u001b[34;1m Natalia Portillo\u001b[0m\n" +
"\u001b[32m oMMMMNc :WMMMMN:\u001b[0m\n" +
"\u001b[32m .dWMMM0; dWMMMMXl. \u001b[37;1m Thanks to all contributors, collaborators, translators, donators and friends.\u001b[0m\n" +
"\u001b[32m .......,cd0WMMNk: c0MMMMMWKkolc:clodc'\u001b[0m\n" +
"\u001b[32m .';loddol:'. ':oxkkOkkxoc,.\u001b[0m\n" +
"\u001b[32m xMMWk:. .c0MMMMMW' OMMMMMM0c'.. .oNMO \u001b[37;1m Using \u001b[33;1m{5}\u001b[37;1m version \u001b[31;1m{6}\u001b[0m\n" +
"\u001b[32m OMNc .MNc oWMMk 'WMMNl. .MMK ;KX.\u001b[0m\n" +
"\u001b[32m xMO WMN ; ., , ': ,MMx lK\u001b[0m\n" +
"\u001b[32m ,Md cMMl .XMMMWWMMMO XMW. :\u001b[0m\n" +
"\u001b[32m Ok xMMl XMMMMMMMMc 0MW,\u001b[0m\n" +
"\u001b[32m 0 oMM0' lMMMMMMMM. :NMN'\u001b[0m\n" +
"\u001b[32m . .0MMKl ;MMMMMMMM oNMWd\u001b[0m\n" +
"\u001b[32m .dNW cMMMMMMMM, XKl\u001b[0m\n" +
"\u001b[32m 0MMMMMMMMK\u001b[0m\n" +
"\u001b[32m ;MMMMMMMMMMO \u001b[37;1m Proudly presented to you by:\u001b[0m\n" +
"\u001b[32m 'WMMMMKxMMMMM0 \u001b[34;1m Natalia Portillo\u001b[0m\n" +
"\u001b[32m oMMMMNc :WMMMMN:\u001b[0m\n" +
"\u001b[32m .dWMMM0; dWMMMMXl. \u001b[37;1m Thanks to all contributors, collaborators, translators, donators and friends.\u001b[0m\n" +
"\u001b[32m .......,cd0WMMNk: c0MMMMMWKkolc:clodc'\u001b[0m\n" +
"\u001b[32m .';loddol:'. ':oxkkOkkxoc,.\u001b[0m\n" +
"\u001b[0m\n", Version.GetVersion(),
#if DEBUG
"DEBUG"
@@ -122,8 +113,8 @@ namespace Aaru.Server
public static IHostBuilder CreateHostBuilder(string[] args) => Host.
CreateDefaultBuilder(args).
ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
webBuilder.
UseStartup<
Startup>());
}
}

View File

@@ -26,7 +26,10 @@ namespace Aaru.Server
var user = new IdentityUser
{
Email = email, NormalizedEmail = email, EmailConfirmed = true, UserName = email,
Email = email,
NormalizedEmail = email,
EmailConfirmed = true,
UserName = email,
NormalizedUserName = email
};

View File

@@ -12,7 +12,7 @@ using Prometheus;
namespace Aaru.Server
{
public class Startup
public sealed class Startup
{
public Startup(IConfiguration configuration) => Configuration = configuration;
@@ -33,7 +33,7 @@ namespace Aaru.Server
}).AddEntityFrameworkStores<AaruServerContext>();
services.AddApplicationInsightsTelemetry();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
}

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
Aaru's code of conduct:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
How to contribute to DiscImageChef:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
Aaru list of changes:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@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

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
Aaru list of hardware and software needed:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
DiscImageChef list of information needed:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
Aaru's template for pull requests:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -36,7 +36,8 @@
// ****************************************************************************/
}
<p>
@Html.ActionLink("Return to main page.", "Index")<br />
@Html.ActionLink("Return to main page.", "Index")
<br />
Aaru list of things to do:
</p>
<div class="container">@Html.Raw(ViewBag.Markdown)</div>

View File

@@ -48,9 +48,12 @@ Aaru Report for
<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>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>
}
@@ -61,9 +64,12 @@ Aaru Report for
<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>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>
}
@@ -74,17 +80,23 @@ Aaru Report for
<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 />
<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>
<i>@kvp.Key</i>: @kvp.Value
<br /></text>
}
}
</div>
@@ -98,16 +110,19 @@ Aaru Report for
@ViewBag.AtaItem characteristics:
</b>
<br />
@ViewBag.lblAtaDeviceType<br />
@ViewBag.lblAtaDeviceType
<br />
@foreach(KeyValuePair<string, string> kvp in ViewBag.repAtaTwo)
{
<text>
<i>@kvp.Key</i>: @kvp.Value<br /></text>
<i>@kvp.Key</i>: @kvp.Value
<br /></text>
}
<br />
@foreach(string item in ViewBag.repAtaOne)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}
@@ -117,12 +132,16 @@ Aaru Report for
<br />
<b>SCSI characteristics:</b>
<br />
<i>Vendor: </i>@ViewBag.lblScsiVendor<br />
<i>Product: </i>@ViewBag.lblScsiProduct<br />
<i>Revision: </i>@ViewBag.lblScsiRevision<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 />
@Html.Raw(item)
<br />
}
@if(ViewBag.repModeSense != null)
{
@@ -180,7 +199,8 @@ Aaru Report for
<br />
@foreach(string item in ViewBag.repScsiMmcMode)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}
@@ -192,7 +212,8 @@ Aaru Report for
<br />
@foreach(string item in ViewBag.repScsiMmcFeatures)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}
@@ -202,7 +223,8 @@ Aaru Report for
<br />
<b>SCSI Streaming device capabilities:</b>
<br />
Block size granularity: @ViewBag.lblScsiSscGranularity<br />
Block size granularity: @ViewBag.lblScsiSscGranularity
<br />
Maximum block length: @ViewBag.lblScsiSscMaxBlock bytes
<br />
Minimum block length: @ViewBag.lblScsiSscMinBlock bytes
@@ -217,13 +239,19 @@ Aaru Report for
Information for supported density with primary code @($"{density.PrimaryCode:X2}h") and secondary code @($"{density.SecondaryCode:X2}h")
</b>
<br />
Drive can write this density: @density.Writable<br />
Duplicate density: @density.Duplicate<br />
Default density: @density.DefaultDensity<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 />
Name: @density.Name
<br />
Organization: @density.Organization
<br />
Description: @density.Description
<br />
Maximum capacity: @density.Capacity megabytes
<br />
</text>
@@ -240,9 +268,12 @@ Aaru Report for
</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 />
Name: @media.Name
<br />
Organization: @media.Organization
<br />
Description: @media.Description
<br />
</text>
}
}
@@ -258,7 +289,8 @@ Aaru Report for
<br />
@foreach(string item in ViewBag.repTestedMedia)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}
@@ -270,7 +302,8 @@ Aaru Report for
<br />
@foreach(string item in ViewBag.repMMC)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}
@@ -282,7 +315,8 @@ Aaru Report for
<br />
@foreach(string item in ViewBag.repSD)
{
@Html.Raw(item)<br />
@Html.Raw(item)
<br />
}
</div>
}

View File

@@ -80,16 +80,13 @@
// 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;
// 23rd July, Amiga launch
case 204:
@Html.Raw("Fonts are © 2013 <a href=\"https://github.com/rewtnull/amigafonts\" target=\"_blank\">TrueSchool Ascii</a>")
;
break;
default:
@Html.Raw("Fonts are © 2015 - 2016 <a href=\"http://int10h.org\" target=\"_blank\">VileR</a>")
;
break;
}
<br />

View File

@@ -496,13 +496,7 @@
<td>
@if(device.ReportId != 0)
{
<text>@Html.ActionLink("Yes", "View", "Report", new
{
id = device.ReportId
}, new
{
target = "_blank"
})</text>
<text>@Html.ActionLink("Yes", "View", "Report", new { id = device.ReportId }, new { target = "_blank" })</text>
}
else
{

View File

@@ -1,4 +1,5 @@
@using Aaru.Server
@using Aaru.Server.Models
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
@using Microsoft.ApplicationInsights.AspNetCore
@inject JavaScriptSnippet JavaScriptSnippet
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers