Code refactor and cleanup.

This commit is contained in:
2023-10-04 00:09:19 +01:00
parent 34b5db9173
commit e953155bd3
156 changed files with 1730 additions and 1282 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderMarkupStore">
<option name="version" value="-2154046885505616848" />
</component>
</project>

View File

@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Server task" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru.Server.Task/bin/Debug/netcoreapp3.0/Aaru.Server.Task.dll" />
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru.Server.Task/bin/Debug/net6.0/Aaru.Server.Task" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Aaru.Server.Task/bin/Debug/netcoreapp3.0" />
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
@@ -10,9 +10,9 @@
<option name="PROJECT_PATH" value="$PROJECT_DIR$/Aaru.Server.Task/Aaru.Server.Task.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.0" />
<option name="PROJECT_TFM" value="net6.0" />
<method v="2">
<option name="Build" />
</method>

View File

@@ -44,12 +44,12 @@ using Microsoft.EntityFrameworkCore;
namespace Aaru.Server.Task;
internal class Program
class Program
{
public static void Main(string[] args)
{
DateTime start, end;
int counter = 0;
var counter = 0;
start = DateTime.UtcNow;
System.Console.WriteLine("{0}: Connecting to database...", DateTime.UtcNow);
@@ -75,10 +75,10 @@ internal class Program
System.Console.WriteLine("{0}: Took {1:F2} seconds", end, (end - start).TotalSeconds);
UsbVendor vendor = null;
int newVendors = 0;
int newProducts = 0;
int modifiedVendors = 0;
int modifiedProducts = 0;
var newVendors = 0;
var newProducts = 0;
var modifiedVendors = 0;
var modifiedProducts = 0;
start = DateTime.UtcNow;
System.Console.WriteLine("{0}: Adding and updating database entries...", DateTime.UtcNow);
@@ -142,7 +142,8 @@ internal class Program
else if(name != product.Product)
{
System.Console.
WriteLine("{0}: Will modify product with ID {1:X4} and vendor {2} ({3:X4}) from \"{4}\" to \"{5}\"",
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);
@@ -276,10 +277,10 @@ internal class Program
doc.LoadHtml(html);
HtmlNode firstTable = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]");
bool firstRow = true;
var firstRow = true;
int addedOffsets = 0;
int modifiedOffsets = 0;
var addedOffsets = 0;
var modifiedOffsets = 0;
System.Console.WriteLine("{0}: Processing offsets...", DateTime.UtcNow);
start = DateTime.UtcNow;
@@ -542,8 +543,8 @@ internal class Program
System.Console.WriteLine("{0}: Reading iNES/NES 2.0 headers...", DateTime.UtcNow);
start = DateTime.UtcNow;
int newHeaders = 0;
int updatedHeaders = 0;
var newHeaders = 0;
var updatedHeaders = 0;
counter = 0;
foreach(string file in Directory.GetFiles("nes"))
@@ -555,8 +556,8 @@ internal class Program
if(fs.Length <= 16)
continue;
byte[] header = new byte[16];
byte[] data = new byte[fs.Length - 16];
var header = new byte[16];
var data = new byte[fs.Length - 16];
fs.Read(header, 0, 16);
fs.Read(data, 0, data.Length);
@@ -607,15 +608,15 @@ internal class Program
var hasher = SHA256.Create();
byte[] hashBytes = hasher.ComputeHash(data);
char[] hashChars = new char[64];
var hashChars = new char[64];
for(int i = 0; i < 32; i++)
for(var i = 0; i < 32; i++)
{
int a = hashBytes[i] >> 4;
int b = hashBytes[i] & 0xF;
hashChars[i * 2] = a > 9 ? (char)(a + 0x57) : (char)(a + 0x30);
hashChars[(i * 2) + 1] = b > 9 ? (char)(b + 0x57) : (char)(b + 0x30);
hashChars[i * 2 + 1] = b > 9 ? (char)(b + 0x57) : (char)(b + 0x30);
}
info.Sha256 = new string(hashChars);
@@ -632,7 +633,7 @@ internal class Program
continue;
}
bool modified = false;
var modified = false;
if(existing.NametableMirroring != info.NametableMirroring)
{

View File

@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "server=localhost;port=3306;database=discimagechef;uid=dic;password=dicpass"
"DefaultConnection": "server=zeus.claunia.com;port=3306;database=discimagechef;uid=dic;password=dicpass"
},
"Logging": {
"LogLevel": {

View File

@@ -24,25 +24,25 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aaru.CommonTypes" Version="6.0.0-alpha8" />
<PackageReference Include="Aaru.Decoders" Version="6.0.0-alpha8" />
<PackageReference Include="Aaru.Dto" Version="6.0.0-alpha8" />
<PackageReference Include="Aaru.Helpers" Version="6.0.0-alpha8" />
<PackageReference Include="ChoPGP" Version="1.0.1.5" />
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
<PackageReference Include="MimeKit" Version="2.15.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
<PackageReference Include="prometheus-net.AspNetCore" Version="5.0.2" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2" PrivateAssets="all" />
<PackageReference Include="Aaru.CommonTypes" Version="6.0.0-alpha8"/>
<PackageReference Include="Aaru.Decoders" Version="6.0.0-alpha8"/>
<PackageReference Include="Aaru.Dto" Version="6.0.0-alpha8"/>
<PackageReference Include="Aaru.Helpers" Version="6.0.0-alpha8"/>
<PackageReference Include="ChoPGP" Version="1.0.1.5"/>
<PackageReference Include="MailKit" Version="2.15.0"/>
<PackageReference Include="Markdig" Version="0.26.0"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0"/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0"/>
<PackageReference Include="MimeKit" Version="2.15.1"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2"/>
<PackageReference Include="prometheus-net.AspNetCore" Version="5.0.2"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
@@ -76,60 +76,60 @@
<None Update="aaru-server.service">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="wwwroot\favicon.ico" />
<None Include="wwwroot\fonts\.htaccess" />
<None Include="wwwroot\fonts\ChicagoFLF.eot" />
<None Include="wwwroot\fonts\ChicagoFLF.ttf" />
<None Include="wwwroot\fonts\ChicagoFLF.woff" />
<None Include="wwwroot\fonts\ChicagoFLF.woff2" />
<None Include="wwwroot\fonts\Topaz_a500_v1.0.eot" />
<None Include="wwwroot\fonts\Topaz_a500_v1.0.ttf" />
<None Include="wwwroot\fonts\Topaz_a500_v1.0.woff" />
<None Include="wwwroot\fonts\Topaz_a500_v1.0.woff2" />
<None Include="wwwroot\fonts\vga_squarepx.eot" />
<None Include="wwwroot\fonts\vga_squarepx.ttf" />
<None Include="wwwroot\fonts\vga_squarepx.woff" />
<None Include="wwwroot\fonts\vga_squarepx.woff2" />
<None Include="wwwroot\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js" />
<None Include="wwwroot\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js" />
<None Include="wwwroot\jquery-validation-unobtrusive\LICENSE.txt" />
<None Include="wwwroot\jquery-validation\dist\additional-methods.js" />
<None Include="wwwroot\jquery-validation\dist\additional-methods.min.js" />
<None Include="wwwroot\jquery-validation\dist\jquery.validate.js" />
<None Include="wwwroot\jquery-validation\dist\jquery.validate.min.js" />
<None Include="wwwroot\jquery-validation\LICENSE.md" />
<None Include="wwwroot\favicon.ico"/>
<None Include="wwwroot\fonts\.htaccess"/>
<None Include="wwwroot\fonts\ChicagoFLF.eot"/>
<None Include="wwwroot\fonts\ChicagoFLF.ttf"/>
<None Include="wwwroot\fonts\ChicagoFLF.woff"/>
<None Include="wwwroot\fonts\ChicagoFLF.woff2"/>
<None Include="wwwroot\fonts\Topaz_a500_v1.0.eot"/>
<None Include="wwwroot\fonts\Topaz_a500_v1.0.ttf"/>
<None Include="wwwroot\fonts\Topaz_a500_v1.0.woff"/>
<None Include="wwwroot\fonts\Topaz_a500_v1.0.woff2"/>
<None Include="wwwroot\fonts\vga_squarepx.eot"/>
<None Include="wwwroot\fonts\vga_squarepx.ttf"/>
<None Include="wwwroot\fonts\vga_squarepx.woff"/>
<None Include="wwwroot\fonts\vga_squarepx.woff2"/>
<None Include="wwwroot\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js"/>
<None Include="wwwroot\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js"/>
<None Include="wwwroot\jquery-validation-unobtrusive\LICENSE.txt"/>
<None Include="wwwroot\jquery-validation\dist\additional-methods.js"/>
<None Include="wwwroot\jquery-validation\dist\additional-methods.min.js"/>
<None Include="wwwroot\jquery-validation\dist\jquery.validate.js"/>
<None Include="wwwroot\jquery-validation\dist\jquery.validate.min.js"/>
<None Include="wwwroot\jquery-validation\LICENSE.md"/>
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\js\site.js" />
<_ContentIncludedByDefault Remove="wwwroot\css\js\colors\dos.js" />
<_ContentIncludedByDefault Remove="wwwroot\css\js\colors\mac.js" />
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\Error.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_CookieConsentPartial.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_Layout.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_LoginPartial.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_ValidationScriptsPartial.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Create.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Delete.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Details.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Edit.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Index.cshtml" />
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Atas\EditorTemplates\IdHashModel.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\Changelog.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\CODE_OF_CONDUCT.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\CONTRIBUTING.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\ISSUE_TEMPLATE.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\NEEDED.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\NEEDINFO.cshtml" />
<_ContentIncludedByDefault Remove="Views\Home\PULL_REQUEST_TEMPLATE.cshtml" />
<_ContentIncludedByDefault Remove="wwwroot\js\site.js"/>
<_ContentIncludedByDefault Remove="wwwroot\css\js\colors\dos.js"/>
<_ContentIncludedByDefault Remove="wwwroot\css\js\colors\mac.js"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\Error.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_CookieConsentPartial.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_Layout.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_LoginPartial.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Shared\_ValidationScriptsPartial.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Create.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Delete.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Details.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Edit.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Device\Index.cshtml"/>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\Atas\EditorTemplates\IdHashModel.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\Changelog.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\CODE_OF_CONDUCT.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\CONTRIBUTING.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\ISSUE_TEMPLATE.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\NEEDED.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\NEEDINFO.cshtml"/>
<_ContentIncludedByDefault Remove="Views\Home\PULL_REQUEST_TEMPLATE.cshtml"/>
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Areas\Admin\Shared\Error.cshtml" />
<UpToDateCheckInput Remove="Areas\Admin\Shared\_CookieConsentPartial.cshtml" />
<UpToDateCheckInput Remove="Areas\Admin\Shared\_Layout.cshtml" />
<UpToDateCheckInput Remove="Areas\Admin\Shared\_LoginPartial.cshtml" />
<UpToDateCheckInput Remove="Areas\Admin\Shared\_ValidationScriptsPartial.cshtml" />
<UpToDateCheckInput Remove="Areas\Admin\Shared\Error.cshtml"/>
<UpToDateCheckInput Remove="Areas\Admin\Shared\_CookieConsentPartial.cshtml"/>
<UpToDateCheckInput Remove="Areas\Admin\Shared\_Layout.cshtml"/>
<UpToDateCheckInput Remove="Areas\Admin\Shared\_LoginPartial.cshtml"/>
<UpToDateCheckInput Remove="Areas\Admin\Shared\_ValidationScriptsPartial.cshtml"/>
</ItemGroup>
<ItemGroup>

View File

@@ -7,7 +7,8 @@ using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class AtasController : Controller
{
readonly AaruServerContext _context;
@@ -22,16 +23,12 @@ public sealed class AtasController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
return NotFound();
}
return View(ata);
}
@@ -40,22 +37,20 @@ public sealed class AtasController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Ata ata = await _context.Ata.FirstOrDefaultAsync(m => m.Id == id);
if(ata == null)
{
return NotFound();
}
return View(ata);
}
// POST: Admin/Atas/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Ata ata = await _context.Ata.FindAsync(id);
@@ -67,12 +62,12 @@ public sealed class AtasController : Controller
public IActionResult Consolidate()
{
List<IdHashModel> hashes = _context.Ata.Select(m => new IdHashModel(m.Id, Hash.Sha512(m.Identify))).ToList();
var hashes = _context.Ata.Select(m => new IdHashModel(m.Id, Hash.Sha512(m.Identify))).ToList();
List<IdHashModel> dups = hashes.GroupBy(x => x.Hash).Where(g => g.Count() > 1).
var dups = hashes.GroupBy(x => x.Hash).Where(g => g.Count() > 1).
Select(x => hashes.FirstOrDefault(y => y.Hash == x.Key)).ToList();
for(int i = 0; i < dups.Count; i++)
for(var i = 0; i < dups.Count; i++)
{
Ata unique = _context.Ata.First(a => a.Id == dups[i].Id);
@@ -87,7 +82,9 @@ public sealed class AtasController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
IdHashModel[] duplicates;
@@ -119,24 +116,16 @@ public sealed class AtasController : Controller
continue;
foreach(Device ataDevice in _context.Devices.Where(d => d.ATA.Id == duplicateId))
{
ataDevice.ATA = master;
}
foreach(Device atapiDevice in _context.Devices.Where(d => d.ATAPI.Id == duplicateId))
{
atapiDevice.ATAPI = master;
}
foreach(UploadedReport ataReport in _context.Reports.Where(d => d.ATA.Id == duplicateId))
{
ataReport.ATA = master;
}
foreach(UploadedReport atapiReport in _context.Reports.Where(d => d.ATAPI.Id == duplicateId))
{
atapiReport.ATAPI = master;
}
foreach(TestedMedia testedMedia in _context.TestedMedia.Where(d => d.AtaId == duplicateId))
{
@@ -162,40 +151,36 @@ public sealed class AtasController : Controller
Ata master = _context.Ata.FirstOrDefault(m => m.Id == masterId);
if(master is null)
{
return RedirectToAction(nameof(Compare), new
{
id = masterId,
rightId = slaveId
});
}
Ata slave = _context.Ata.FirstOrDefault(m => m.Id == slaveId);
if(slave is null)
{
return RedirectToAction(nameof(Compare), new
{
id = masterId,
rightId = slaveId
});
}
foreach(Device ataDevice in _context.Devices.Where(d => d.ATA.Id == slaveId))
{
ataDevice.ATA = master;
}
foreach(Device atapiDevice in _context.Devices.Where(d => d.ATAPI.Id == slaveId))
{
atapiDevice.ATAPI = master;
}
foreach(UploadedReport ataReport in _context.Reports.Where(d => d.ATA.Id == slaveId))
{
ataReport.ATA = master;
}
foreach(UploadedReport atapiReport in _context.Reports.Where(d => d.ATAPI.Id == slaveId))
{
atapiReport.ATAPI = master;
}
foreach(TestedMedia testedMedia in _context.TestedMedia.Where(d => d.AtaId == slaveId))
{
@@ -289,7 +274,8 @@ public sealed class AtasController : Controller
switch(la)
{
case null when ra is null: continue;
case null when ra is null:
continue;
case null:
model.ValueNames.Add(fieldInfo.Name);
model.LeftValues.Add("null");
@@ -307,10 +293,10 @@ public sealed class AtasController : Controller
continue;
}
List<object> ll = la.Cast<object>().ToList();
List<object> rl = ra.Cast<object>().ToList();
var ll = la.Cast<object>().ToList();
var rl = ra.Cast<object>().ToList();
for(int i = 0; i < ll.Count; i++)
for(var i = 0; i < ll.Count; i++)
{
if(ll[i].Equals(rl[i]))
continue;
@@ -422,10 +408,8 @@ public sealed class AtasController : Controller
if(tmp.All(b => b > 0x20) &&
tmp.All(b => b <= 0x5F))
{
havePrivacy.Add(ata);
}
}
return View(havePrivacy);
}
@@ -438,16 +422,16 @@ public sealed class AtasController : Controller
return RedirectToAction(nameof(CheckPrivate));
// Serial number
for(int i = 0; i < 20; i++)
ata.Identify[(10 * 2) + i] = 0x20;
for(var i = 0; i < 20; i++)
ata.Identify[10 * 2 + i] = 0x20;
// Media serial number
for(int i = 0; i < 40; i++)
ata.Identify[(176 * 2) + i] = 0x20;
for(var i = 0; i < 40; i++)
ata.Identify[176 * 2 + i] = 0x20;
// WWN and WWN Extension
for(int i = 0; i < 16; i++)
ata.Identify[(108 * 2) + i] = 0;
for(var i = 0; i < 16; i++)
ata.Identify[108 * 2 + i] = 0;
// We need to tell EFCore the entity has changed
_context.Update(ata);
@@ -464,24 +448,24 @@ public sealed class AtasController : Controller
return RedirectToAction(nameof(CheckPrivate));
// ReservedWords121
for(int i = 0; i < 10; i++)
ata.Identify[(121 * 2) + i] = 0;
for(var i = 0; i < 10; i++)
ata.Identify[121 * 2 + i] = 0;
// ReservedWords129
for(int i = 0; i < 40; i++)
ata.Identify[(129 * 2) + i] = 0;
for(var i = 0; i < 40; i++)
ata.Identify[129 * 2 + i] = 0;
// ReservedCFA
for(int i = 0; i < 14; i++)
ata.Identify[(161 * 2) + i] = 0;
for(var i = 0; i < 14; i++)
ata.Identify[161 * 2 + i] = 0;
// ReservedCEATA224
for(int i = 0; i < 12; i++)
ata.Identify[(224 * 2) + i] = 0;
for(var i = 0; i < 12; i++)
ata.Identify[224 * 2 + i] = 0;
// ReservedWords
for(int i = 0; i < 14; i++)
ata.Identify[(161 * 2) + i] = 0;
for(var i = 0; i < 14; i++)
ata.Identify[161 * 2 + i] = 0;
// We need to tell EFCore the entity has changed
_context.Update(ata);
@@ -498,16 +482,16 @@ public sealed class AtasController : Controller
return RedirectToAction(nameof(CheckPrivate));
// Serial number
for(int i = 0; i < 20; i++)
ata.Identify[(10 * 2) + i] = 0x20;
for(var i = 0; i < 20; i++)
ata.Identify[10 * 2 + i] = 0x20;
// Media serial number
for(int i = 0; i < 40; i++)
ata.Identify[(176 * 2) + i] = 0x20;
for(var i = 0; i < 40; i++)
ata.Identify[176 * 2 + i] = 0x20;
// WWN and WWN Extension
for(int i = 0; i < 16; i++)
ata.Identify[(108 * 2) + i] = 0;
for(var i = 0; i < 16; i++)
ata.Identify[108 * 2 + i] = 0;
// We need to tell EFCore the entity has changed
_context.Update(ata);
@@ -523,24 +507,24 @@ public sealed class AtasController : Controller
foreach(Ata ata in _context.Ata)
{
// ReservedWords121
for(int i = 0; i < 10; i++)
ata.Identify[(121 * 2) + i] = 0;
for(var i = 0; i < 10; i++)
ata.Identify[121 * 2 + i] = 0;
// ReservedWords129
for(int i = 0; i < 40; i++)
ata.Identify[(129 * 2) + i] = 0;
for(var i = 0; i < 40; i++)
ata.Identify[129 * 2 + i] = 0;
// ReservedCFA
for(int i = 0; i < 14; i++)
ata.Identify[(161 * 2) + i] = 0;
for(var i = 0; i < 14; i++)
ata.Identify[161 * 2 + i] = 0;
// ReservedCEATA224
for(int i = 0; i < 12; i++)
ata.Identify[(224 * 2) + i] = 0;
for(var i = 0; i < 12; i++)
ata.Identify[224 * 2 + i] = 0;
// ReservedWords
for(int i = 0; i < 14; i++)
ata.Identify[(161 * 2) + i] = 0;
for(var i = 0; i < 14; i++)
ata.Identify[161 * 2 + i] = 0;
// We need to tell EFCore the entity has changed
_context.Update(ata);

View File

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

View File

@@ -3,7 +3,8 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class ChsController : Controller
{
readonly AaruServerContext _context;
@@ -16,7 +17,7 @@ public sealed class ChsController : Controller
public IActionResult Consolidate()
{
List<ChsModel> dups = _context.Chs.GroupBy(x => new
var dups = _context.Chs.GroupBy(x => new
{
x.Cylinders,
x.Heads,
@@ -35,7 +36,9 @@ public sealed class ChsController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
ChsModel[] duplicates;
@@ -65,14 +68,10 @@ public sealed class ChsController : Controller
Skip(1).ToArray())
{
foreach(TestedMedia media in _context.TestedMedia.Where(d => d.CHS.Id == chs.Id))
{
media.CHS = master;
}
foreach(TestedMedia media in _context.TestedMedia.Where(d => d.CurrentCHS.Id == chs.Id))
{
media.CurrentCHS = master;
}
_context.Chs.Remove(chs);
}

View File

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

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class CompactDiscOffsetsController : Controller
{
readonly AaruServerContext _context;
@@ -16,16 +17,12 @@ public sealed class CompactDiscOffsetsController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
CompactDiscOffset compactDiscOffset = await _context.CdOffsets.FindAsync(id);
if(compactDiscOffset == null)
{
return NotFound();
}
return View(compactDiscOffset);
}
@@ -33,7 +30,8 @@ public sealed class CompactDiscOffsetsController : Controller
// POST: Admin/CompactDiscOffsets/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id, [Bind("Id,Manufacturer,Model,Offset,Submissions,Agreement")] CompactDiscOffset changedModel)
{
@@ -72,22 +70,20 @@ public sealed class CompactDiscOffsetsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
CompactDiscOffset compactDiscOffset = await _context.CdOffsets.FirstOrDefaultAsync(m => m.Id == id);
if(compactDiscOffset == null)
{
return NotFound();
}
return View(compactDiscOffset);
}
// POST: Admin/CompactDiscOffsets/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
CompactDiscOffset compactDiscOffset = await _context.CdOffsets.FindAsync(id);

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class DeviceStatsController : Controller
{
readonly AaruServerContext _context;
@@ -16,16 +17,12 @@ public sealed class DeviceStatsController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
DeviceStat deviceStat = await _context.DeviceStats.FindAsync(id);
if(deviceStat == null)
{
return NotFound();
}
return View(deviceStat);
}
@@ -33,7 +30,8 @@ public sealed class DeviceStatsController : Controller
// POST: Admin/DeviceStats/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,Manufacturer,Model,Revision,Bus")] DeviceStat changedModel)
{
if(id != changedModel.Id)
@@ -69,22 +67,20 @@ public sealed class DeviceStatsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
DeviceStat deviceStat = await _context.DeviceStats.FirstOrDefaultAsync(m => m.Id == id);
if(deviceStat == null)
{
return NotFound();
}
return View(deviceStat);
}
// POST: Admin/DeviceStats/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
DeviceStat deviceStat = await _context.DeviceStats.FindAsync(id);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class DevicesController : Controller
{
readonly AaruServerContext _context;
@@ -19,9 +20,7 @@ public sealed class DevicesController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
var model = new DeviceDetails
{
@@ -29,9 +28,7 @@ public sealed class DevicesController : Controller
};
if(model.Report is null)
{
return NotFound();
}
model.ReportAll = _context.Reports.
Where(d => d.Manufacturer == model.Report.Manufacturer &&
@@ -90,16 +87,12 @@ public sealed class DevicesController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
Device device = await _context.Devices.FindAsync(id);
if(device == null)
{
return NotFound();
}
return View(device);
}
@@ -107,10 +100,12 @@ public sealed class DevicesController : Controller
// POST: Admin/Devices/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id,
[Bind("OptimalMultipleSectorsRead,Id,CompactFlash,Manufacturer,Model,Revision,Type")] Device changedModel)
[Bind("OptimalMultipleSectorsRead,Id,CompactFlash,Manufacturer,Model,Revision,Type")]
Device changedModel)
{
if(id != changedModel.Id)
return NotFound();
@@ -149,22 +144,20 @@ public sealed class DevicesController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Device device = await _context.Devices.FirstOrDefaultAsync(m => m.Id == id);
if(device == null)
{
return NotFound();
}
return View(device);
}
// POST: Admin/Devices/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Device device = await _context.Devices.FindAsync(id);

View File

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

View File

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

View File

@@ -3,7 +3,8 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class FireWiresController : Controller
{
readonly AaruServerContext _context;
@@ -18,16 +19,12 @@ public sealed class FireWiresController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
FireWire fireWire = await _context.FireWire.FindAsync(id);
if(fireWire == null)
{
return NotFound();
}
return View(fireWire);
}
@@ -35,7 +32,8 @@ public sealed class FireWiresController : Controller
// POST: Admin/FireWires/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id, [Bind("Id,VendorID,ProductID,Manufacturer,Product,RemovableMedia")] FireWire changedModel)
{
@@ -73,22 +71,20 @@ public sealed class FireWiresController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
FireWire fireWire = await _context.FireWire.FirstOrDefaultAsync(m => m.Id == id);
if(fireWire == null)
{
return NotFound();
}
return View(fireWire);
}
// POST: Admin/FireWires/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
FireWire fireWire = await _context.FireWire.FindAsync(id);
@@ -102,7 +98,7 @@ public sealed class FireWiresController : Controller
public IActionResult Consolidate()
{
List<FireWireModel> dups = _context.FireWire.GroupBy(x => new
var dups = _context.FireWire.GroupBy(x => new
{
x.VendorID,
x.ProductID,
@@ -125,7 +121,9 @@ public sealed class FireWiresController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
FireWireModel[] duplicates;
@@ -161,14 +159,10 @@ public sealed class FireWiresController : Controller
Skip(1).ToArray())
{
foreach(Device device in _context.Devices.Where(d => d.FireWire.Id == firewire.Id))
{
device.FireWire = master;
}
foreach(UploadedReport report in _context.Reports.Where(d => d.FireWire.Id == firewire.Id))
{
report.FireWire = master;
}
_context.FireWire.Remove(firewire);
}

View File

@@ -6,7 +6,8 @@ using Aaru.Helpers;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class GdRomSwapDiscCapabilitiesController : Controller
{
readonly AaruServerContext _context;
@@ -17,16 +18,12 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
GdRomSwapDiscCapabilities caps = await _context.GdRomSwapDiscCapabilities.FirstOrDefaultAsync(m => m.Id == id);
if(caps == null)
{
return NotFound();
}
return View(caps);
}
@@ -35,22 +32,20 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
GdRomSwapDiscCapabilities caps = await _context.GdRomSwapDiscCapabilities.FirstOrDefaultAsync(m => m.Id == id);
if(caps == null)
{
return NotFound();
}
return View(caps);
}
// POST: Admin/GdRomSwapDiscCapabilities/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
GdRomSwapDiscCapabilities caps = await _context.GdRomSwapDiscCapabilities.FindAsync(id);
@@ -68,9 +63,7 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
GdRomSwapDiscCapabilities caps = _context.GdRomSwapDiscCapabilities.FirstOrDefault(m => m.Id == id);
if(caps == null)
{
return NotFound();
}
var model = new TestedMediaDataModel
{
@@ -80,13 +73,13 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
byte[] buffer;
var sb = new StringBuilder();
byte[] sector = new byte[2352];
byte[] subq = new byte[16];
byte[] fullsub = new byte[96];
var sector = new byte[2352];
var subq = new byte[16];
var fullsub = new byte[96];
bool audio = true;
bool pq = false;
bool rw = false;
var audio = true;
var pq = false;
var rw = false;
switch(data)
{
@@ -285,7 +278,8 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
rw = true;
break;
default: return NotFound();
default:
return NotFound();
}
if(pq &&
@@ -312,12 +306,10 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
if(buffer == null)
return View(model);
for(int i = 0; i < buffer.Length; i += blockSize)
for(var i = 0; i < buffer.Length; i += blockSize)
{
if(audio)
{
sb.AppendLine("Audio or scrambled data sector.");
}
else
{
Array.Copy(buffer, i, sector, 0, 2352);
@@ -351,10 +343,10 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
{
byte[] deint = Subchannel.Deinterleave(sub);
bool validP = true;
bool validRw = true;
var validP = true;
var validRw = true;
for(int i = 0; i < 12; i++)
for(var i = 0; i < 12; i++)
{
if(deint[i] == 0x00 ||
deint[i] == 0xFF)
@@ -365,7 +357,7 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
break;
}
for(int i = 24; i < 96; i++)
for(var i = 24; i < 96; i++)
{
if(deint[i] == 0x00)
continue;
@@ -375,7 +367,7 @@ public sealed class GdRomSwapDiscCapabilitiesController : Controller
break;
}
byte[] q = new byte[12];
var q = new byte[12];
Array.Copy(deint, 12, q, 0, 12);
return Subchannel.PrettifyQ(q, deint[21] > 0x10, 16, !validP, false, validRw);

View File

@@ -32,7 +32,8 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class HomeController : Controller
{
public ActionResult Index() => View();

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class MediaFormatsController : Controller
{
readonly AaruServerContext _context;
@@ -14,22 +15,20 @@ public sealed class MediaFormatsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
MediaFormat mediaFormat = await _context.MediaFormats.FirstOrDefaultAsync(m => m.Id == id);
if(mediaFormat == null)
{
return NotFound();
}
return View(mediaFormat);
}
// POST: Admin/MediaFormats/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
MediaFormat mediaFormat = await _context.MediaFormats.FindAsync(id);

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class MediasController : Controller
{
readonly AaruServerContext _context;
@@ -25,22 +26,20 @@ public sealed class MediasController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Media media = await _context.Medias.FirstOrDefaultAsync(m => m.Id == id);
if(media == null)
{
return NotFound();
}
return View(media);
}
// POST: Admin/Medias/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Media media = await _context.Medias.FindAsync(id);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class MmcController : Controller
{
readonly AaruServerContext _context;
@@ -28,16 +29,12 @@ public sealed class MmcController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
Mmc mmc = await _context.Mmc.FirstOrDefaultAsync(m => m.Id == id);
if(mmc == null)
{
return NotFound();
}
return View(mmc);
}
@@ -46,22 +43,20 @@ public sealed class MmcController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Mmc mmc = await _context.Mmc.FirstOrDefaultAsync(m => m.Id == id);
if(mmc == null)
{
return NotFound();
}
return View(mmc);
}
// POST: Admin/Mmc/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Mmc mmc = await _context.Mmc.FindAsync(id);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class MmcFeaturesController : Controller
{
readonly AaruServerContext _context;
@@ -16,16 +17,12 @@ public sealed class MmcFeaturesController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
MmcFeatures mmcFeatures = await _context.MmcFeatures.FirstOrDefaultAsync(m => m.Id == id);
if(mmcFeatures == null)
{
return NotFound();
}
return View(mmcFeatures);
}

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class MmcSdsController : Controller
{
readonly AaruServerContext _context;
@@ -16,16 +17,12 @@ public sealed class MmcSdsController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
MmcSd mmcSd = await _context.MmcSd.FirstOrDefaultAsync(m => m.Id == id);
if(mmcSd == null)
{
return NotFound();
}
return View(mmcSd);
}
@@ -34,22 +31,20 @@ public sealed class MmcSdsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
MmcSd mmcSd = await _context.MmcSd.FirstOrDefaultAsync(m => m.Id == id);
if(mmcSd == null)
{
return NotFound();
}
return View(mmcSd);
}
// POST: Admin/MmcSds/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
MmcSd mmcSd = await _context.MmcSd.FindAsync(id);

View File

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

View File

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

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class PcmciasController : Controller
{
readonly AaruServerContext _context;
@@ -16,22 +17,20 @@ public sealed class PcmciasController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Pcmcia pcmcia = await _context.Pcmcia.FirstOrDefaultAsync(m => m.Id == id);
if(pcmcia == null)
{
return NotFound();
}
return View(pcmcia);
}
// POST: Admin/Pcmcias/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Pcmcia pcmcia = await _context.Pcmcia.FindAsync(id);

View File

@@ -3,7 +3,8 @@ using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class ReportsController : Controller
{
readonly AaruServerContext _context;
@@ -20,9 +21,7 @@ public sealed class ReportsController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
var model = new UploadedReportDetails
{
@@ -30,9 +29,7 @@ public sealed class ReportsController : Controller
};
if(model.Report is null)
{
return NotFound();
}
model.ReportAll = _context.Devices.
Where(d => d.Manufacturer == model.Report.Manufacturer &&
@@ -80,16 +77,12 @@ public sealed class ReportsController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
UploadedReport uploadedReport = await _context.Reports.FindAsync(id);
if(uploadedReport == null)
{
return NotFound();
}
return View(uploadedReport);
}
@@ -97,7 +90,8 @@ public sealed class ReportsController : Controller
// POST: Admin/Reports/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id, [Bind("Id,CompactFlash,Manufacturer,Model,Revision,Type")] UploadedReport changedModel)
{
@@ -135,22 +129,20 @@ public sealed class ReportsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
UploadedReport uploadedReport = await _context.Reports.FirstOrDefaultAsync(m => m.Id == id);
if(uploadedReport == null)
{
return NotFound();
}
return View(uploadedReport);
}
// POST: Admin/Reports/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
UploadedReport uploadedReport = await _context.Reports.FindAsync(id);
@@ -163,16 +155,12 @@ public sealed class ReportsController : Controller
public IActionResult Promote(int? id)
{
if(id == null)
{
return NotFound();
}
UploadedReport uploadedReport = _context.Reports.FirstOrDefault(m => m.Id == id);
if(uploadedReport == null)
{
return NotFound();
}
var device = new Device(uploadedReport.ATAId, uploadedReport.ATAPIId, uploadedReport.FireWireId,
uploadedReport.MultiMediaCardId, uploadedReport.PCMCIAId,

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class ScsiModesController : Controller
{
readonly AaruServerContext _context;
@@ -16,22 +17,20 @@ public sealed class ScsiModesController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
ScsiMode scsiMode = await _context.ScsiMode.FirstOrDefaultAsync(m => m.Id == id);
if(scsiMode == null)
{
return NotFound();
}
return View(scsiMode);
}
// POST: Admin/ScsiModes/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
ScsiMode scsiMode = await _context.ScsiMode.FindAsync(id);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class ScsiPagesController : Controller
{
readonly AaruServerContext _context;
@@ -16,22 +17,20 @@ public sealed class ScsiPagesController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
ScsiPage scsiPage = await _context.ScsiPage.FirstOrDefaultAsync(m => m.Id == id);
if(scsiPage == null)
{
return NotFound();
}
return View(scsiPage);
}
// POST: Admin/ScsiPages/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
ScsiPage scsiPage = await _context.ScsiPage.FindAsync(id);

View File

@@ -8,7 +8,8 @@ using TestedMedia = Aaru.CommonTypes.Metadata.TestedMedia;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class ScsisController : Controller
{
readonly AaruServerContext _context;
@@ -30,16 +31,12 @@ public sealed class ScsisController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
Scsi scsi = await _context.Scsi.FirstOrDefaultAsync(m => m.Id == id);
if(scsi == null)
{
return NotFound();
}
return View(scsi);
}
@@ -48,22 +45,20 @@ public sealed class ScsisController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Scsi scsi = await _context.Scsi.FirstOrDefaultAsync(m => m.Id == id);
if(scsi == null)
{
return NotFound();
}
return View(scsi);
}
// POST: Admin/Scsis/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Scsi scsi = await _context.Scsi.FindAsync(id);
@@ -75,13 +70,13 @@ public sealed class ScsisController : Controller
public IActionResult Consolidate()
{
List<IdHashModel> hashes = _context.Scsi.Where(m => m.InquiryData != null).
var hashes = _context.Scsi.Where(m => m.InquiryData != null).
Select(m => new IdHashModel(m.Id, Hash.Sha512(m.InquiryData))).ToList();
List<IdHashModel> dups = hashes.GroupBy(x => x.Hash).Where(g => g.Count() > 1).
var dups = hashes.GroupBy(x => x.Hash).Where(g => g.Count() > 1).
Select(x => hashes.FirstOrDefault(y => y.Hash == x.Key)).ToList();
for(int i = 0; i < dups.Count; i++)
for(var i = 0; i < dups.Count; i++)
{
Scsi unique = _context.Scsi.First(a => a.Id == dups[i].Id);
@@ -98,7 +93,9 @@ public sealed class ScsisController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
IdHashModel[] duplicates;
@@ -130,14 +127,10 @@ public sealed class ScsisController : Controller
continue;
foreach(Device scsiDevice in _context.Devices.Where(d => d.SCSI.Id == duplicateId))
{
scsiDevice.SCSI = master;
}
foreach(UploadedReport scsiReport in _context.Reports.Where(d => d.SCSI.Id == duplicateId))
{
scsiReport.SCSI = master;
}
foreach(TestedMedia testedMedia in _context.TestedMedia.Where(d => d.ScsiId == duplicateId))
{
@@ -233,7 +226,8 @@ public sealed class ScsisController : Controller
switch(la)
{
case null when ra is null: continue;
case null when ra is null:
continue;
case null:
model.ValueNames.Add(fieldInfo.Name);
model.LeftValues.Add("null");
@@ -251,10 +245,10 @@ public sealed class ScsisController : Controller
continue;
}
List<object> ll = la.Cast<object>().ToList();
List<object> rl = ra.Cast<object>().ToList();
var ll = la.Cast<object>().ToList();
var rl = ra.Cast<object>().ToList();
for(int i = 0; i < ll.Count; i++)
for(var i = 0; i < ll.Count; i++)
{
if(ll[i].Equals(rl[i]))
continue;
@@ -269,13 +263,13 @@ public sealed class ScsisController : Controller
case nameof(Inquiry.Seagate_DriveSerialNumber):
case nameof(Inquiry.Seagate_ServoPROMPartNo):
case nameof(Inquiry.VendorIdentification):
byte[] lb = new byte[ll.Count];
byte[] rb = new byte[rl.Count];
var lb = new byte[ll.Count];
var rb = new byte[rl.Count];
for(int j = 0; j < ll.Count; j++)
for(var j = 0; j < ll.Count; j++)
lb[j] = (byte)ll[j];
for(int j = 0; j < ll.Count; j++)
for(var j = 0; j < ll.Count; j++)
rb[j] = (byte)rl[j];
model.ValueNames.Add(fieldInfo.Name);
@@ -329,30 +323,30 @@ public sealed class ScsisController : Controller
Scsi master = _context.Scsi.FirstOrDefault(m => m.Id == masterId);
if(master is null)
{
return RedirectToAction(nameof(Compare), new
{
id = masterId,
rightId = slaveId
});
}
Scsi slave = _context.Scsi.FirstOrDefault(m => m.Id == slaveId);
if(slave is null)
{
return RedirectToAction(nameof(Compare), new
{
id = masterId,
rightId = slaveId
});
}
foreach(Device scsiDevice in _context.Devices.Where(d => d.SCSI.Id == slaveId))
{
scsiDevice.SCSI = master;
}
foreach(UploadedReport scsiReport in _context.Reports.Where(d => d.SCSI.Id == slaveId))
{
scsiReport.SCSI = master;
}
foreach(TestedMedia testedMedia in _context.TestedMedia.Where(d => d.ScsiId == slaveId))
{

View File

@@ -3,7 +3,8 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class SscsController : Controller
{
readonly AaruServerContext _context;
@@ -19,22 +20,20 @@ public sealed class SscsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Ssc ssc = await _context.Ssc.FirstOrDefaultAsync(m => m.Id == id);
if(ssc == null)
{
return NotFound();
}
return View(ssc);
}
// POST: Admin/Sscs/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Ssc ssc = await _context.Ssc.FindAsync(id);
@@ -46,7 +45,7 @@ public sealed class SscsController : Controller
public IActionResult Consolidate()
{
List<SscModel> dups = _context.Ssc.GroupBy(x => new
var dups = _context.Ssc.GroupBy(x => new
{
x.BlockSizeGranularity,
x.MaxBlockLength,
@@ -65,7 +64,9 @@ public sealed class SscsController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
SscModel[] duplicates;
@@ -96,9 +97,7 @@ public sealed class SscsController : Controller
m.MinBlockLength == duplicate.MinBlockLength).Skip(1).ToArray())
{
foreach(TestedSequentialMedia media in _context.TestedSequentialMedia.Where(d => d.SscId == ssc.Id))
{
media.SscId = master.Id;
}
_context.Ssc.Update(ssc);
_context.Ssc.Remove(ssc);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class SupportedDensitiesController : Controller
{
readonly AaruServerContext _context;
@@ -23,22 +24,20 @@ public sealed class SupportedDensitiesController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
SupportedDensity supportedDensity = await _context.SupportedDensity.FirstOrDefaultAsync(m => m.Id == id);
if(supportedDensity == null)
{
return NotFound();
}
return View(supportedDensity);
}
// POST: Admin/SupportedDensities/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
SupportedDensity supportedDensity = await _context.SupportedDensity.FindAsync(id);

View File

@@ -15,7 +15,8 @@ using Spare = Aaru.Decoders.Bluray.Spare;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class TestedMediasController : Controller
{
readonly AaruServerContext _context;
@@ -34,16 +35,12 @@ public sealed class TestedMediasController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
TestedMedia testedMedia = await _context.TestedMedia.FirstOrDefaultAsync(m => m.Id == id);
if(testedMedia == null)
{
return NotFound();
}
return View(testedMedia);
}
@@ -52,16 +49,12 @@ public sealed class TestedMediasController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
TestedMedia testedMedia = await _context.TestedMedia.FindAsync(id);
if(testedMedia == null)
{
return NotFound();
}
return View(testedMedia);
}
@@ -69,7 +62,8 @@ public sealed class TestedMediasController : Controller
// POST: Admin/TestedMedias/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id, [Bind("Id,Blocks,BlockSize,LongBlockSize,Manufacturer,MediumTypeName,Model")] TestedMedia changedModel)
{
@@ -108,22 +102,20 @@ public sealed class TestedMediasController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
TestedMedia testedMedia = await _context.TestedMedia.FirstOrDefaultAsync(m => m.Id == id);
if(testedMedia == null)
{
return NotFound();
}
return View(testedMedia);
}
// POST: Admin/TestedMedias/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
TestedMedia testedMedia = await _context.TestedMedia.FindAsync(id);
@@ -141,9 +133,7 @@ public sealed class TestedMediasController : Controller
TestedMedia testedMedia = _context.TestedMedia.FirstOrDefault(m => m.Id == id);
if(testedMedia == null)
{
return NotFound();
}
var model = new TestedMediaDataModel
{
@@ -152,11 +142,11 @@ public sealed class TestedMediasController : Controller
};
byte[] buffer;
byte[] sector = new byte[2352];
byte[] subq = new byte[16];
byte[] fullsub = new byte[96];
bool c2Errors = false;
bool scrambled = false;
var sector = new byte[2352];
var subq = new byte[16];
var fullsub = new byte[96];
var c2Errors = false;
var scrambled = false;
switch(data)
{
@@ -205,7 +195,7 @@ public sealed class TestedMediasController : Controller
model.Decoded = Sector.Prettify(sector);
for(int i = 2352; i < buffer.Length; i++)
for(var i = 2352; i < buffer.Length; i++)
{
if(buffer[i] == 0x00)
continue;
@@ -258,7 +248,7 @@ public sealed class TestedMediasController : Controller
if(buffer.Length < 2448)
break;
for(int i = 2352; i < 2616; i++)
for(var i = 2352; i < 2616; i++)
{
if(buffer[i] == 0x00)
continue;
@@ -428,7 +418,7 @@ public sealed class TestedMediasController : Controller
model.Decoded += "\n" + GetPrettySub(fullsub);
for(int i = 2352; i < 2646; i++)
for(var i = 2352; i < 2646; i++)
{
if(buffer[i] == 0x00)
continue;
@@ -582,7 +572,7 @@ public sealed class TestedMediasController : Controller
model.Decoded += "\n" + GetPrettySub(fullsub);
for(int i = 2448; i < buffer.Length; i++)
for(var i = 2448; i < buffer.Length; i++)
{
if(buffer[i] != 0x00)
{
@@ -639,7 +629,7 @@ public sealed class TestedMediasController : Controller
model.Decoded += "\n" + GetPrettySub(fullsub);
for(int i = 2468; i < 2762; i++)
for(var i = 2468; i < 2762; i++)
{
if(buffer[i] == 0x00)
continue;
@@ -681,7 +671,7 @@ public sealed class TestedMediasController : Controller
model.Decoded += "\n" + GetPrettySub(fullsub);
for(int i = 2468; i < 2762; i++)
for(var i = 2468; i < 2762; i++)
{
if(buffer[i] == 0x00)
continue;
@@ -694,7 +684,8 @@ public sealed class TestedMediasController : Controller
model.Decoded += "\n" + (c2Errors ? "C2 errors found." : "No C2 errors.");
break;
default: return NotFound();
default:
return NotFound();
}
model.RawDataAsHex = PrintHex.ByteArrayToHexArrayString(buffer);
@@ -712,10 +703,10 @@ public sealed class TestedMediasController : Controller
{
byte[] deint = Subchannel.Deinterleave(sub);
bool validP = true;
bool validRw = true;
var validP = true;
var validRw = true;
for(int i = 0; i < 12; i++)
for(var i = 0; i < 12; i++)
{
if(deint[i] == 0x00 ||
deint[i] == 0xFF)
@@ -726,7 +717,7 @@ public sealed class TestedMediasController : Controller
break;
}
for(int i = 24; i < 96; i++)
for(var i = 24; i < 96; i++)
{
if(deint[i] == 0x00)
continue;
@@ -736,7 +727,7 @@ public sealed class TestedMediasController : Controller
break;
}
byte[] q = new byte[12];
var q = new byte[12];
Array.Copy(deint, 12, q, 0, 12);
return Subchannel.PrettifyQ(q, deint[21] > 0x10, 16, !validP, false, validRw);

View File

@@ -2,7 +2,8 @@ using Aaru.CommonTypes.Metadata;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class TestedSequentialMediasController : Controller
{
readonly AaruServerContext _context;
@@ -18,16 +19,12 @@ public sealed class TestedSequentialMediasController : Controller
public async Task<IActionResult> Edit(int? id)
{
if(id == null)
{
return NotFound();
}
TestedSequentialMedia testedSequentialMedia = await _context.TestedSequentialMedia.FindAsync(id);
if(testedSequentialMedia == null)
{
return NotFound();
}
return View(testedSequentialMedia);
}
@@ -35,7 +32,8 @@ public sealed class TestedSequentialMediasController : Controller
// POST: Admin/TestedSequentialMedias/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost, ValidateAntiForgeryToken]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(
int id, [Bind("Id,Manufacturer,MediumTypeName,Model")] TestedSequentialMedia changedModel)
{
@@ -71,23 +69,21 @@ public sealed class TestedSequentialMediasController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
TestedSequentialMedia testedSequentialMedia =
await _context.TestedSequentialMedia.FirstOrDefaultAsync(m => m.Id == id);
if(testedSequentialMedia == null)
{
return NotFound();
}
return View(testedSequentialMedia);
}
// POST: Admin/TestedSequentialMedias/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
TestedSequentialMedia testedSequentialMedia = await _context.TestedSequentialMedia.FindAsync(id);

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class UsbProductsController : Controller
{
readonly AaruServerContext _context;

View File

@@ -1,6 +1,7 @@
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class UsbVendorsController : Controller
{
readonly AaruServerContext _context;
@@ -15,16 +16,12 @@ public sealed class UsbVendorsController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
UsbVendor usbVendor = await _context.UsbVendors.FirstOrDefaultAsync(m => m.Id == id);
if(usbVendor == null)
{
return NotFound();
}
return View(new UsbVendorModel
{

View File

@@ -3,7 +3,8 @@ using Newtonsoft.Json;
namespace Aaru.Server.Areas.Admin.Controllers;
[Area("Admin"), Authorize]
[Area("Admin")]
[Authorize]
public sealed class UsbsController : Controller
{
readonly AaruServerContext _context;
@@ -19,16 +20,12 @@ public sealed class UsbsController : Controller
public async Task<IActionResult> Details(int? id)
{
if(id == null)
{
return NotFound();
}
Usb usb = await _context.Usb.FirstOrDefaultAsync(m => m.Id == id);
if(usb == null)
{
return NotFound();
}
return View(usb);
}
@@ -37,22 +34,20 @@ public sealed class UsbsController : Controller
public async Task<IActionResult> Delete(int? id)
{
if(id == null)
{
return NotFound();
}
Usb usb = await _context.Usb.FirstOrDefaultAsync(m => m.Id == id);
if(usb == null)
{
return NotFound();
}
return View(usb);
}
// POST: Admin/Usbs/Delete/5
[HttpPost, ActionName("Delete"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
Usb usb = await _context.Usb.FindAsync(id);
@@ -64,7 +59,7 @@ public sealed class UsbsController : Controller
public IActionResult Consolidate()
{
List<UsbModel> dups = _context.Usb.GroupBy(x => new
var dups = _context.Usb.GroupBy(x => new
{
x.Manufacturer,
x.Product,
@@ -85,7 +80,9 @@ public sealed class UsbsController : Controller
});
}
[HttpPost, ActionName("Consolidate"), ValidateAntiForgeryToken]
[HttpPost]
[ActionName("Consolidate")]
[ValidateAntiForgeryToken]
public IActionResult ConsolidateConfirmed(string models)
{
UsbModel[] duplicates;
@@ -125,14 +122,10 @@ public sealed class UsbsController : Controller
}
foreach(Device device in _context.Devices.Where(d => d.USB.Id == slave.Id))
{
device.USB = master;
}
foreach(UploadedReport report in _context.Reports.Where(d => d.USB.Id == slave.Id))
{
report.USB = master;
}
if(master.Descriptors is null &&
slave.Descriptors != null)

View File

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

View File

@@ -1,4 +1,5 @@
@using System.Text
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.Ata>
@{
@@ -91,7 +92,7 @@ ATA IDENTIFY DEVICE responses with possible private data
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Ata item in Model)
{
<tr>
<td>

View File

@@ -10,7 +10,7 @@
<table class="table">
<thead>
<tbody>
@foreach(var item in Model.List)
@foreach(IdHashModel item in Model.List)
{
<tr>
<td>
@@ -24,8 +24,8 @@
<div>
Do you want to remove the duplicates?
<form asp-action="Consolidate" enctype="multipart/form-data">
<input asp-for="Json" name="models" type="hidden" />
<input asp-for="Json" name="models" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Consolidate" />
<input class="btn btn-danger" type="submit" value="Consolidate"/>
</form>
</div>

View File

@@ -38,13 +38,13 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>ATA IDENTIFY DEVICE / ATAPI IDENTIFY PACKET DEVICE - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Identify.Prettify(Model.Identify)))
</div>
<div>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -37,15 +37,15 @@
}
<div>
<h4>ATA IDENTIFY DEVICE / ATAPI IDENTIFY PACKET DEVICE - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Identify.Prettify(Model.Identify)))
</div>
<div>
<form asp-action="Compare">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
Compare to:
<input name="RightId" type="number" />
<input name="RightId" type="number"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
<input class="btn btn-primary" type="submit" value="Compare" />
<input class="btn btn-primary" type="submit" value="Compare"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.Ata>
@{
@@ -54,7 +55,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Ata item in Model)
{
<tr>
<td>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.BlockDescriptor>
@{
@@ -49,7 +50,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(BlockDescriptor item in Model)
{
<tr>
<td>

View File

@@ -10,7 +10,7 @@
<table class="table">
<thead>
<tbody>
@foreach(var item in Model.List)
@foreach(ChsModel item in Model.List)
{
<tr>
<td>
@@ -24,8 +24,8 @@
<div>
Do you want to remove the duplicates?
<form asp-action="Consolidate" enctype="multipart/form-data">
<input asp-for="Json" name="models" type="hidden" />
<input asp-for="Json" name="models" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Consolidate" />
<input class="btn btn-danger" type="submit" value="Consolidate"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.Chs>
@{
@@ -51,7 +52,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Chs item in Model)
{
<tr>
<td>

View File

@@ -47,7 +47,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Command item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Compact disc offset</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.AddedWhen)
@@ -82,8 +82,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -34,39 +34,39 @@
// ****************************************************************************/
}
<h4>Compact disc offset</h4>
<hr />
<hr/>
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<div class="form-group">
<label asp-for="Manufacturer" class="control-label"></label>
<input asp-for="Manufacturer" class="form-control" />
<input asp-for="Manufacturer" class="form-control"/>
<span asp-validation-for="Manufacturer" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Model" class="control-label"></label>
<input asp-for="Model" class="form-control" />
<input asp-for="Model" class="form-control"/>
<span asp-validation-for="Model" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Offset" class="control-label"></label>
<input asp-for="Offset" class="form-control" />
<input asp-for="Offset" class="form-control"/>
<span asp-validation-for="Offset" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Submissions" class="control-label"></label>
<input asp-for="Submissions" class="form-control" />
<input asp-for="Submissions" class="form-control"/>
<span asp-validation-for="Submissions" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Agreement" class="control-label"></label>
<input asp-for="Agreement" class="form-control" />
<input asp-for="Agreement" class="form-control"/>
<span asp-validation-for="Agreement" class="text-danger"></span>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<input class="btn btn-primary" type="submit" value="Save"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>

View File

@@ -63,7 +63,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(CompactDiscOffset item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Device statistic</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Manufacturer)
@@ -64,8 +64,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -34,34 +34,34 @@
// ****************************************************************************/
}
<h4>Device statistic</h4>
<hr />
<hr/>
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<div class="form-group">
<label asp-for="Manufacturer" class="control-label"></label>
<input asp-for="Manufacturer" class="form-control" />
<input asp-for="Manufacturer" class="form-control"/>
<span asp-validation-for="Manufacturer" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Model" class="control-label"></label>
<input asp-for="Model" class="form-control" />
<input asp-for="Model" class="form-control"/>
<span asp-validation-for="Model" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Revision" class="control-label"></label>
<input asp-for="Revision" class="form-control" />
<input asp-for="Revision" class="form-control"/>
<span asp-validation-for="Revision" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Bus" class="control-label"></label>
<input asp-for="Bus" class="form-control" />
<input asp-for="Bus" class="form-control"/>
<span asp-validation-for="Bus" class="text-danger"></span>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<input class="btn btn-primary" type="submit" value="Save"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>

View File

@@ -56,7 +56,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(DeviceStat item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Device report</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.AddedWhen)
@@ -94,8 +94,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model DeviceDetails
@{
@@ -35,7 +36,7 @@
}
<div>
<h4>Device report</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Report.AddedWhen)
@@ -171,7 +172,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.SameAll)
@foreach(int item in Model.SameAll)
{
<tr>
<td>
@@ -201,7 +202,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.SameButManufacturer)
@foreach(int item in Model.SameButManufacturer)
{
<tr>
<td>
@@ -231,7 +232,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.ReportAll)
@foreach(int item in Model.ReportAll)
{
<tr>
<td>
@@ -261,7 +262,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.ReportButManufacturer)
@foreach(int item in Model.ReportButManufacturer)
{
<tr>
<td>
@@ -303,7 +304,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.StatsAll)
@foreach(DeviceStat item in Model.StatsAll)
{
<tr>
<td>
@@ -370,7 +371,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.StatsButManufacturer)
@foreach(DeviceStat item in Model.StatsButManufacturer)
{
<tr>
<td>
@@ -424,7 +425,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.TestedMedias)
@foreach(TestedMedia item in Model.TestedMedias)
{
<tr>
<td>
@@ -465,7 +466,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.TestedSequentialMedias)
@foreach(TestedSequentialMedia item in Model.TestedSequentialMedias)
{
<tr>
<td>

View File

@@ -35,40 +35,40 @@
// ****************************************************************************/
}
<h4>Device report</h4>
<hr />
<hr/>
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<div class="form-group">
<label asp-for="Manufacturer" class="control-label"></label>
<input asp-for="Manufacturer" class="form-control" />
<input asp-for="Manufacturer" class="form-control"/>
<span asp-validation-for="Manufacturer" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Model" class="control-label"></label>
<input asp-for="Model" class="form-control" />
<input asp-for="Model" class="form-control"/>
<span asp-validation-for="Model" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Revision" class="control-label"></label>
<input asp-for="Revision" class="form-control" />
<input asp-for="Revision" class="form-control"/>
<span asp-validation-for="Revision" class="text-danger"></span>
</div>
<div class="form-check form-group">
<label class="form-check-label">
<input asp-for="CompactFlash" class="form-check-input" /> @Html.DisplayNameFor(model => model.CompactFlash)
<input asp-for="CompactFlash" class="form-check-input"/> @Html.DisplayNameFor(model => model.CompactFlash)
</label>
</div>
<div class="form-group">
<label asp-for="OptimalMultipleSectorsRead" class="control-label"></label>
<input asp-for="OptimalMultipleSectorsRead" class="form-control" />
<input asp-for="OptimalMultipleSectorsRead" class="form-control"/>
<span asp-validation-for="OptimalMultipleSectorsRead" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CanReadGdRomUsingSwapDisc" class="control-label"></label>
<input asp-for="CanReadGdRomUsingSwapDisc" class="form-control" />
<input asp-for="CanReadGdRomUsingSwapDisc" class="form-control"/>
<span asp-validation-for="CanReadGdRomUsingSwapDisc" class="text-danger"></span>
</div>
<div class="form-group">
@@ -77,7 +77,7 @@
<span asp-validation-for="Type" class="text-danger"></span>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<input class="btn btn-primary" type="submit" value="Save"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>

View File

@@ -35,7 +35,7 @@
}
<div>
<h4>Found device reports with similar data</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Manufacturer)
@@ -91,7 +91,7 @@ else
</tr>
</thead>
<tbody>
@foreach(var item in Model.LikeDevices)
@foreach(Device item in Model.LikeDevices)
{
<tr>
<td>

View File

@@ -62,7 +62,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Device item in Model)
{
<tr>
<td>

View File

@@ -46,7 +46,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Filesystem item in Model)
{
<tr>
<td>

View File

@@ -46,7 +46,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Filter item in Model)
{
<tr>
<td>

View File

@@ -28,7 +28,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.List)
@foreach(FireWireModel item in Model.List)
{
<tr>
<td>
@@ -54,8 +54,8 @@
<div>
Do you want to remove the duplicates?
<form asp-action="Consolidate" enctype="multipart/form-data">
<input asp-for="Json" name="models" type="hidden" />
<input asp-for="Json" name="models" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Consolidate" />
<input class="btn btn-danger" type="submit" value="Consolidate"/>
</form>
</div>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>FireWire registers</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.VendorID)
@@ -70,8 +70,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -34,39 +34,39 @@
// ****************************************************************************/
}
<h4>FireWire registers</h4>
<hr />
<hr/>
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<div class="form-group">
<label asp-for="VendorID" class="control-label"></label>
<input asp-for="VendorID" class="form-control" />
<input asp-for="VendorID" class="form-control"/>
<span asp-validation-for="VendorID" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="ProductID" class="control-label"></label>
<input asp-for="ProductID" class="form-control" />
<input asp-for="ProductID" class="form-control"/>
<span asp-validation-for="ProductID" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Manufacturer" class="control-label"></label>
<input asp-for="Manufacturer" class="form-control" />
<input asp-for="Manufacturer" class="form-control"/>
<span asp-validation-for="Manufacturer" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Product" class="control-label"></label>
<input asp-for="Product" class="form-control" />
<input asp-for="Product" class="form-control"/>
<span asp-validation-for="Product" class="text-danger"></span>
</div>
<div class="form-check form-group">
<label class="form-check-label">
<input asp-for="RemovableMedia" class="form-check-input" /> @Html.DisplayNameFor(model => model.RemovableMedia)
<input asp-for="RemovableMedia" class="form-check-input"/> @Html.DisplayNameFor(model => model.RemovableMedia)
</label>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<input class="btn btn-primary" type="submit" value="Save"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.FireWire>
@{
@@ -57,7 +58,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(FireWire item in Model)
{
<tr>
<td>

View File

@@ -37,7 +37,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h2>GD-ROM swap-trick capabilities report</h2>
<hr />
<hr/>
@if(Model.TestCrashed)
{
<h4>Computer crashed while testing.</h4>
@@ -45,7 +45,7 @@
else if(Model.RecognizedSwapDisc)
{
<h4>Swap disc Lead-Out starts at @($"{Model.SwapDiscLeadOutPMIN:X2}"):@($"{Model.SwapDiscLeadOutPSEC:X2}"):@($"{Model.SwapDiscLeadOutPFRAM:X2}") (@($"{Model.SwapDiscLeadOutStart}") sectors).</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-4">Minimum readable sector in HD area:</dt>
<dd class="col-sm-8">@Model.MinimumReadableSectorInHdArea</dd>
@@ -1145,7 +1145,7 @@ else
<h4>Swap disc not recognized, or firmware reset after tray opened.</h4>
}
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input class="btn btn-danger" type="submit" value="Delete" />
<input asp-for="Id" type="hidden"/>
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -36,7 +36,7 @@
}
<div>
<h2>GD-ROM swap-trick capabilities report</h2>
<hr />
<hr/>
@if(Model.TestCrashed)
{
<h4>Computer crashed while testing.</h4>
@@ -44,7 +44,7 @@
else if(Model.RecognizedSwapDisc)
{
<h4>Swap disc Lead-Out starts at @($"{Model.SwapDiscLeadOutPMIN:X2}"):@($"{Model.SwapDiscLeadOutPSEC:X2}"):@($"{Model.SwapDiscLeadOutPFRAM:X2}") (@($"{Model.SwapDiscLeadOutStart}") sectors).</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-4">Minimum readable sector in HD area:</dt>
<dd class="col-sm-8">@Model.MinimumReadableSectorInHdArea</dd>

View File

@@ -32,66 +32,66 @@
// ****************************************************************************/
}
<a asp-action="Index" asp-controller="Atas">ATA IDENTIFY DEVICE / ATAPI IDENTIFY PACKET DEVICE responses</a>
<br />
<br/>
<a asp-action="Index" asp-controller="BlockDescriptors">SCSI Streaming Devices Block Descriptors</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Chs">Cylinders / Heads / Sectors triplets</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Commands">Commands used</a>
<br />
<br/>
<a asp-action="Index" asp-controller="CompactDiscOffsets">Compact Disc Offsets</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Devices">Device reports</a>
<br />
<br/>
<a asp-action="Index" asp-controller="DeviceStats">Device statistics</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Filesystems">Filesystems detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Filters">Filters detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="FireWires">FireWire devices reported</a>
<br />
<br/>
<a asp-action="Index" asp-controller="MediaFormats">Media image formats detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Medias">Media types detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Medias" asp-route-real="true">Media types detected in real devices</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Medias" asp-route-real="false">Media types detected in images</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Mmc">MODE SENSE page 2Ah responses</a>
<br />
<br/>
<a asp-action="Index" asp-controller="MmcFeatures">MMC GET FEATURES responses</a>
<br />
<br/>
<a asp-action="Index" asp-controller="MmcSds">MultiMediaCard / SecureDigital registers</a>
<br />
<br/>
<a asp-action="Index" asp-controller="OperatingSystems">Operating systems detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Partitions">Partitioning schemes detected</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Pcmcias">PCMCIA card registers</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Reports">Uploaded reports</a>
<br />
<br/>
<a asp-action="Index" asp-controller="ScsiModes">SCSI MODE SENSE responses</a>
<br />
<br/>
<a asp-action="Index" asp-controller="ScsiPages">SCSI MODE SENSE pages</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Scsis">SCSI INQUIRY responses</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Sscs">SCSI STREAMING COMMANDS limits</a>
<br />
<br/>
<a asp-action="Index" asp-controller="SupportedDensities">SCSI supported densities</a>
<br />
<br/>
<a asp-action="Index" asp-controller="TestedMedias">Tested media</a>
<br />
<br/>
<a asp-action="Index" asp-controller="TestedSequentialMedias">Tested media on SCSI streaming devices</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Usbs">USB devices</a>
<br />
<br/>
<a asp-action="Index" asp-controller="UsbProducts">USB products</a>
<br />
<br/>
<a asp-action="Index" asp-controller="UsbVendors">USB vendors</a>
<br />
<br/>
<a asp-action="Index" asp-controller="Versions">Aaru versions used</a>
<br/>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Media image format</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Name)
@@ -52,8 +52,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -47,7 +47,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(MediaFormat item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Media</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Type)
@@ -58,8 +58,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Media item in Model)
{
<tr>
<td>

View File

@@ -38,11 +38,11 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>SCSI CD-ROM capabilities page - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Modes.PrettifyModePage_2A(Model.ModeSense2AData)))
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -37,7 +37,7 @@
}
<div>
<h4>SCSI CD-ROM capabilities page - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Modes.PrettifyModePage_2A(Model.ModeSense2AData)))
</div>
<div>

View File

@@ -51,7 +51,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(MmcModelForView item in Model)
{
<tr>
<td>

View File

@@ -35,7 +35,7 @@
}
<div>
<h4>MMC FEATURES</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.AACSVersion)

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.MmcFeatures>
@{
@@ -410,7 +411,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(MmcFeatures item in Model)
{
<tr>
<td>

View File

@@ -38,7 +38,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>MultiMediaCard / SecureDigital registers</h4>
<hr />
<hr/>
<dl class="row">
@if(Model.SCR != null)
{
@@ -119,8 +119,8 @@
}
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -37,7 +37,7 @@
}
<div>
<h4>MultiMediaCard / SecureDigital registers</h4>
<hr />
<hr/>
<dl class="row">
@if(Model.SCR != null)
{

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.MmcSd>
@{
@@ -44,7 +45,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(MmcSd item in Model)
{
<tr>
<td>

View File

@@ -1,3 +1,4 @@
@using OperatingSystem = Aaru.Server.Models.OperatingSystem
@model IEnumerable<Aaru.Server.Models.OperatingSystem>
@{
@@ -49,7 +50,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(OperatingSystem item in Model)
{
<tr>
<td>

View File

@@ -46,7 +46,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Partition item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>PCMCIA data</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.CIS)
@@ -76,8 +76,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.Pcmcia>
@{
@@ -59,7 +60,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Pcmcia item in Model)
{
<tr>
<td>

View File

@@ -6,7 +6,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Uploaded report</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.UploadedWhen)
@@ -46,8 +46,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model UploadedReportDetails
@{
@@ -5,7 +6,7 @@
}
<div>
<h4>Uploaded report</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Report.UploadedWhen)
@@ -124,7 +125,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.SameAll)
@foreach(int item in Model.SameAll)
{
<tr>
<td>
@@ -154,7 +155,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.SameButManufacturer)
@foreach(int item in Model.SameButManufacturer)
{
<tr>
<td>
@@ -184,7 +185,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.ReportAll)
@foreach(int item in Model.ReportAll)
{
<tr>
<td>
@@ -214,7 +215,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.ReportButManufacturer)
@foreach(int item in Model.ReportButManufacturer)
{
<tr>
<td>
@@ -250,7 +251,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.TestedMedias)
@foreach(TestedMedia item in Model.TestedMedias)
{
<tr>
<td>
@@ -291,7 +292,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.TestedSequentialMedias)
@foreach(TestedSequentialMedia item in Model.TestedSequentialMedias)
{
<tr>
<td>

View File

@@ -5,30 +5,30 @@
ViewData["Title"] = "Edit";
}
<h4>Uploaded report</h4>
<hr />
<hr/>
<div class="row">
<div class="col-md-4">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<div class="form-group">
<label asp-for="Manufacturer" class="control-label"></label>
<input asp-for="Manufacturer" class="form-control" />
<input asp-for="Manufacturer" class="form-control"/>
<span asp-validation-for="Manufacturer" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Model" class="control-label"></label>
<input asp-for="Model" class="form-control" />
<input asp-for="Model" class="form-control"/>
<span asp-validation-for="Model" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Revision" class="control-label"></label>
<input asp-for="Revision" class="form-control" />
<input asp-for="Revision" class="form-control"/>
<span asp-validation-for="Revision" class="text-danger"></span>
</div>
<div class="form-check form-group">
<label class="form-check-label">
<input asp-for="CompactFlash" class="form-check-input" /> @Html.DisplayNameFor(model => model.CompactFlash)
<input asp-for="CompactFlash" class="form-check-input"/> @Html.DisplayNameFor(model => model.CompactFlash)
</label>
</div>
<div class="form-group">
@@ -37,7 +37,7 @@
<span asp-validation-for="Type" class="text-danger"></span>
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" />
<input class="btn btn-primary" type="submit" value="Save"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
</div>
</form>

View File

@@ -26,7 +26,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(UploadedReport item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>SCSI MODE SENSE response</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.MediumType)
@@ -76,8 +76,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.ScsiMode>
@{
@@ -59,7 +60,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(ScsiMode item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>ScsiPage</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.page)
@@ -58,8 +58,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.ScsiPage>
@{
@@ -47,7 +48,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(ScsiPage item in Model)
{
<tr>
<td>

View File

@@ -10,7 +10,7 @@
<table class="table">
<thead>
<tbody>
@foreach(var item in Model.List)
@foreach(IdHashModel item in Model.List)
{
<tr>
<td>
@@ -24,8 +24,8 @@
<div>
Do you want to remove the duplicates?
<form asp-action="Consolidate" enctype="multipart/form-data">
<input asp-for="Json" name="models" type="hidden" />
<input asp-for="Json" name="models" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Consolidate" />
<input class="btn btn-danger" type="submit" value="Consolidate"/>
</form>
</div>

View File

@@ -38,11 +38,11 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>SCSI INQUIRY - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Inquiry.Prettify(Model.InquiryData)))
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -37,15 +37,15 @@
}
<div>
<h4>SCSI INQUIRY - ID = @Model.Id</h4>
<hr />
<hr/>
@Html.Raw(Html.EncodedMultiLineText(Inquiry.Prettify(Model.InquiryData)))
</div>
<div>
<form asp-action="Compare">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
Compare to:
<input name="RightId" type="number" />
<input name="RightId" type="number"/>
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
<input class="btn btn-primary" type="submit" value="Compare" />
<input class="btn btn-primary" type="submit" value="Compare"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@using Aaru.Helpers
@model IEnumerable<Aaru.CommonTypes.Metadata.Scsi>
@@ -66,7 +67,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Scsi item in Model)
{
<tr>
<td>

View File

@@ -42,20 +42,20 @@
{
// 24th January, Macintosh launch
case 24:
<link href="~/css/mac/aaruserver.css" rel="stylesheet" type="text/css" />
<link href="~/css/mac/aaruserver.css" rel="stylesheet" type="text/css"/>
<script src="~/js/colors/mac.js"></script>
break;
// 23rd July, Amiga launch
case 204:
<link href="~/css/amiga/aaruserver.css" rel="stylesheet" type="text/css" />
<link href="~/css/amiga/aaruserver.css" rel="stylesheet" type="text/css"/>
<script src="~/js/colors/amiga.js"></script>
break;
default:
<link href="~/css/dos/aaruserver.css" rel="stylesheet" type="text/css" />
<link href="~/css/dos/aaruserver.css" rel="stylesheet" type="text/css"/>
<script src="~/js/colors/dos.js"></script>
break;
}
<meta charset="utf-8" />
<meta charset="utf-8"/>
<title>@ViewBag.Title</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
@@ -100,7 +100,7 @@
<a href="http://www.claunia.com" target="_blank">
Claunia.com
</a>
<br />
<br/>
@switch(DateTime.UtcNow.DayOfYear)
{
// 24th January, Macintosh launch
@@ -115,7 +115,7 @@
@Html.Raw("Fonts are © 2015 - 2016 <a href=\"http://int10h.org\" target=\"_blank\">VileR</a>")
break;
}
<br />
<br/>
CSS © 2018-2019
<a href="https://getbootstrap.com/" target="_blank">
Bootstrap

View File

@@ -22,7 +22,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model.List)
@foreach(SscModel item in Model.List)
{
<tr>
<td>
@@ -42,8 +42,8 @@
<div>
Do you want to remove the duplicates?
<form asp-action="Consolidate" enctype="multipart/form-data">
<input asp-for="Json" name="models" type="hidden" />
<input asp-for="Json" name="models" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Consolidate" />
<input class="btn btn-danger" type="submit" value="Consolidate"/>
</form>
</div>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>SSC</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.BlockSizeGranularity)
@@ -58,8 +58,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

View File

@@ -1,3 +1,4 @@
@using Aaru.CommonTypes.Metadata
@model IEnumerable<Aaru.CommonTypes.Metadata.Ssc>
@{
@@ -53,7 +54,7 @@
</tr>
</thead>
<tbody>
@foreach(var item in Model)
@foreach(Ssc item in Model)
{
<tr>
<td>

View File

@@ -36,7 +36,7 @@
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Supported density</h4>
<hr />
<hr/>
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.PrimaryCode)
@@ -112,8 +112,8 @@
</dd>
</dl>
<form asp-action="Delete">
<input asp-for="Id" type="hidden" />
<input asp-for="Id" type="hidden"/>
<a asp-action="Index" class="btn btn-primary">Back to List</a>
<input class="btn btn-danger" type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete"/>
</form>
</div>

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