Code restyling.

This commit is contained in:
2020-02-29 18:03:35 +00:00
parent 4ea327f0c6
commit f7e173710e
855 changed files with 43605 additions and 38045 deletions

View File

@@ -8,15 +8,14 @@ namespace Aaru.Core
{
public static string Print(int errno)
{
switch (DetectOS.GetRealPlatformID())
switch(DetectOS.GetRealPlatformID())
{
case PlatformID.Win32S:
case PlatformID.Win32Windows:
case PlatformID.Win32NT:
case PlatformID.WinCE:
case PlatformID.WindowsPhone:
case PlatformID.Xbox:
return PrintWin32Error(errno);
case PlatformID.Xbox: return PrintWin32Error(errno);
case PlatformID.Unix:
case PlatformID.MacOSX:
case PlatformID.iOS:
@@ -41,32 +40,24 @@ namespace Aaru.Core
case PlatformID.Ultrix:
case PlatformID.OpenServer:
case PlatformID.UnixWare:
case PlatformID.zOS:
return PrintUnixError(errno);
case PlatformID.Wii:
return $"Unknown error code {errno}";
case PlatformID.WiiU:
return $"Unknown error code {errno}";
case PlatformID.PlayStation3:
return $"Unknown error code {errno}";
case PlatformID.PlayStation4:
return $"Unknown error code {errno}";
case PlatformID.NonStop:
return $"Unknown error code {errno}";
case PlatformID.Unknown:
return $"Unknown error code {errno}";
default:
return $"Unknown error code {errno}";
case PlatformID.zOS: return PrintUnixError(errno);
case PlatformID.Wii: return $"Unknown error code {errno}";
case PlatformID.WiiU: return $"Unknown error code {errno}";
case PlatformID.PlayStation3: return $"Unknown error code {errno}";
case PlatformID.PlayStation4: return $"Unknown error code {errno}";
case PlatformID.NonStop: return $"Unknown error code {errno}";
case PlatformID.Unknown: return $"Unknown error code {errno}";
default: return $"Unknown error code {errno}";
}
throw new Exception("Arrived an unexpected place");
}
private static string PrintUnixError(int errno)
static string PrintUnixError(int errno)
{
switch (errno)
switch(errno)
{
case 2: // ENOENT
case 2: // ENOENT
case 19: // ENODEV
return "The specified device cannot be found.";
case 13: // EACCESS
@@ -75,14 +66,13 @@ namespace Aaru.Core
return "The specified device is in use by another process.";
case 30: // EROFS
return "Cannot open the device in writable mode, as needed by some commands.";
default:
return $"Unknown error code {errno}";
default: return $"Unknown error code {errno}";
}
}
private static string PrintWin32Error(int errno)
static string PrintWin32Error(int errno)
{
switch (errno)
switch(errno)
{
case 2: // ERROR_FILE_NOT_FOUND
case 3: // ERROR_PATH_NOT_FOUND
@@ -91,15 +81,14 @@ namespace Aaru.Core
return "Not enough permissions to open the device.";
case 19: // ERROR_WRITE_PROTECT
return "Cannot open the device in writable mode, as needed by some commands.";
case 32: // ERROR_SHARING_VIOLATION
case 33: // ERROR_LOCK_VIOLATION
case 32: // ERROR_SHARING_VIOLATION
case 33: // ERROR_LOCK_VIOLATION
case 108: // ERROR_DRIVE_LOCKED
case 170: // ERROR_BUSY
return "The specified device is in use by another process.";
case 130: // ERROR_DIRECT_ACCESS_HANDLE
return "Tried to open a file instead of a device.";
default:
return $"Unknown error code {errno}";
default: return $"Unknown error code {errno}";
}
}
}