diff --git a/Enums/DeviceType.cs b/Enums/DeviceType.cs
index d8b37fd..49efef2 100644
--- a/Enums/DeviceType.cs
+++ b/Enums/DeviceType.cs
@@ -35,6 +35,7 @@
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
+
namespace DiscImageChef.CommonTypes.Enums
{
public enum DeviceType
diff --git a/Extents/ExtentsByte.cs b/Extents/ExtentsByte.cs
index bbd65ea..6227129 100644
--- a/Extents/ExtentsByte.cs
+++ b/Extents/ExtentsByte.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsInt.cs b/Extents/ExtentsInt.cs
index 7eb64c1..5c1fd40 100644
--- a/Extents/ExtentsInt.cs
+++ b/Extents/ExtentsInt.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsLong.cs b/Extents/ExtentsLong.cs
index b137cbc..cda536f 100644
--- a/Extents/ExtentsLong.cs
+++ b/Extents/ExtentsLong.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsSByte.cs b/Extents/ExtentsSByte.cs
index f7f2bca..31a23e0 100644
--- a/Extents/ExtentsSByte.cs
+++ b/Extents/ExtentsSByte.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsShort.cs b/Extents/ExtentsShort.cs
index 13491ed..5e09cd3 100644
--- a/Extents/ExtentsShort.cs
+++ b/Extents/ExtentsShort.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsUInt.cs b/Extents/ExtentsUInt.cs
index 5892fe7..2c80f79 100644
--- a/Extents/ExtentsUInt.cs
+++ b/Extents/ExtentsUInt.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsULong.cs b/Extents/ExtentsULong.cs
index 683de42..8540a0a 100644
--- a/Extents/ExtentsULong.cs
+++ b/Extents/ExtentsULong.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Extents/ExtentsUShort.cs b/Extents/ExtentsUShort.cs
index a2ee9a1..cec53bb 100644
--- a/Extents/ExtentsUShort.cs
+++ b/Extents/ExtentsUShort.cs
@@ -228,10 +228,7 @@ namespace DiscImageChef.CommonTypes.Extents
/// last element
///
/// Array of
- public Tuple[] ToArray()
- {
- return backend.ToArray();
- }
+ public Tuple[] ToArray() => backend.ToArray();
///
/// Gets the first element of the extent that contains the specified item
diff --git a/Filters.cs b/Filters.cs
index 642ffc6..297c438 100644
--- a/Filters.cs
+++ b/Filters.cs
@@ -106,9 +106,6 @@ namespace DiscImageChef.CommonTypes
/// Gets all known filters
///
/// Known filters
- public SortedDictionary GetFiltersList()
- {
- return Filters;
- }
+ public SortedDictionary GetFiltersList() => Filters;
}
}
\ No newline at end of file
diff --git a/Geometry.cs b/Geometry.cs
index 3e1f1ca..6ea5509 100644
--- a/Geometry.cs
+++ b/Geometry.cs
@@ -117,21 +117,18 @@ namespace DiscImageChef.CommonTypes
public static MediaType GetMediaType(
(ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool
- variableSectorsPerTrack) geometry)
- {
- return (from geom in KnownGeometries
- where geom.cylinders == geometry.cylinders && geom.heads == geometry.heads &&
- geom.sectorsPerTrack == geometry.sectorsPerTrack &&
- geom.bytesPerSector == geometry.bytesPerSector &&
- geom.encoding == geometry.encoding &&
- geom.variableSectorsPerTrack == geometry.variableSectorsPerTrack
- select geom.type).FirstOrDefault();
- }
+ variableSectorsPerTrack) geometry) =>
+ (from geom in KnownGeometries
+ where geom.cylinders == geometry.cylinders &&
+ geom.heads == geometry.heads &&
+ geom.sectorsPerTrack == geometry.sectorsPerTrack &&
+ geom.bytesPerSector == geometry.bytesPerSector &&
+ geom.encoding == geometry.encoding &&
+ geom.variableSectorsPerTrack == geometry.variableSectorsPerTrack
+ select geom.type).FirstOrDefault();
public static (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding
- , bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType)
- {
- return (from geom in KnownGeometries where geom.type == mediaType select geom).FirstOrDefault();
- }
+ , bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType) =>
+ (from geom in KnownGeometries where geom.type == mediaType select geom).FirstOrDefault();
}
}
\ No newline at end of file
diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs
index 711e70b..e95f72c 100644
--- a/Interfaces/IPluginRegister.cs
+++ b/Interfaces/IPluginRegister.cs
@@ -44,55 +44,55 @@ namespace DiscImageChef.CommonTypes.Interfaces
public interface IPluginRegister
{
///
- /// Gets all checksum plugins
+ /// Gets all checksum plugins
///
/// List of checksum plugins
List GetAllChecksumPlugins();
///
- /// Gets all filesystem plugins
+ /// Gets all filesystem plugins
///
/// List of filesystem plugins
List GetAllFilesystemPlugins();
///
- /// Gets all filter plugins
+ /// Gets all filter plugins
///
/// List of filter plugins
List GetAllFilterPlugins();
///
- /// Gets all floppy image plugins
+ /// Gets all floppy image plugins
///
/// List of floppy image plugins
List GetAllFloppyImagePlugins();
///
- /// Gets all media image plugins
+ /// Gets all media image plugins
///
/// List of media image plugins
List GetAllMediaImagePlugins();
///
- /// Gets all partition plugins
+ /// Gets all partition plugins
///
/// List of partition plugins
List GetAllPartitionPlugins();
///
- /// Gets all read-only filesystem plugins
+ /// Gets all read-only filesystem plugins
///
/// List of read-only filesystem plugins
List GetAllReadOnlyFilesystemPlugins();
///
- /// Gets all writable floppy image plugins
+ /// Gets all writable floppy image plugins
///
/// List of writable floppy image plugins
List GetAllWritableFloppyImagePlugins();
///
- /// Gets all writable media image plugins
+ /// Gets all writable media image plugins
///
/// List of writable media image plugins
List GetAllWritableImagePlugins();
diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs
index c51ecd9..350034e 100644
--- a/Interop/DetectOS.cs
+++ b/Interop/DetectOS.cs
@@ -63,6 +63,28 @@ namespace DiscImageChef.CommonTypes.Interop
GetRealPlatformID() == PlatformID.Win32Windows || GetRealPlatformID() == PlatformID.WinCE ||
GetRealPlatformID() == PlatformID.WindowsPhone || GetRealPlatformID() == PlatformID.Xbox;
+ public static bool IsAdmin
+ {
+ get
+ {
+ if(!IsWindows) return Environment.UserName == "root";
+
+ bool isAdmin;
+ WindowsIdentity user = null;
+ try
+ {
+ user = WindowsIdentity.GetCurrent();
+ WindowsPrincipal principal = new WindowsPrincipal(user);
+ isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
+ }
+ catch(UnauthorizedAccessException ex) { isAdmin = false; }
+ catch(Exception ex) { isAdmin = false; }
+ finally { user?.Dispose(); }
+
+ return isAdmin;
+ }
+ }
+
[DllImport("libc", SetLastError = true)]
static extern int uname(out utsname name);
@@ -276,28 +298,6 @@ namespace DiscImageChef.CommonTypes.Interop
}
}
- public static bool IsAdmin
- {
- get
- {
- if(!IsWindows) return Environment.UserName == "root";
-
- bool isAdmin;
- WindowsIdentity user = null;
- try
- {
- user = WindowsIdentity.GetCurrent();
- WindowsPrincipal principal = new WindowsPrincipal(user);
- isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
- }
- catch(UnauthorizedAccessException ex) { isAdmin = false; }
- catch(Exception ex) { isAdmin = false; }
- finally { user?.Dispose(); }
-
- return isAdmin;
- }
- }
-
///
/// POSIX uname structure, size from OSX, big enough to handle extra fields
///
diff --git a/Interop/Version.cs b/Interop/Version.cs
index c50a26d..3dfbe4f 100644
--- a/Interop/Version.cs
+++ b/Interop/Version.cs
@@ -48,10 +48,7 @@ namespace DiscImageChef.CommonTypes.Interop
/// Gets version string
///
/// Version
- public static string GetVersion()
- {
- return typeof(Version).Assembly.GetName().Version.ToString();
- }
+ public static string GetVersion() => typeof(Version).Assembly.GetName().Version.ToString();
public static string GetNetCoreVersion()
{
diff --git a/MediaType.cs b/MediaType.cs
index a58c0fd..465c38b 100644
--- a/MediaType.cs
+++ b/MediaType.cs
@@ -269,7 +269,7 @@ namespace DiscImageChef.CommonTypes
/// Sega/Yamaha recordable Gigabyte Disc
GDR = 153,
SegaCard = 154,
- MilCD = 155,
+ MilCD = 155,
#endregion Sega game media, types 150 to 169
#region Other game media, types 170 to 179
diff --git a/Metadata/Statistics.cs b/Metadata/Statistics.cs
index 8363d4d..236996f 100644
--- a/Metadata/Statistics.cs
+++ b/Metadata/Statistics.cs
@@ -68,15 +68,15 @@ namespace DiscImageChef.CommonTypes.Metadata
public class StatsDto
{
- public List Commands { get; set; }
- public List OperatingSystems { get; set; }
- public List Versions { get; set; }
- public List Filesystems { get; set; }
- public List Partitions { get; set; }
- public List MediaFormats { get; set; }
- public List Filters { get; set; }
- public List Devices { get; set; }
- public List Medias { get; set; }
+ public List Commands { get; set; }
+ public List OperatingSystems { get; set; }
+ public List Versions { get; set; }
+ public List Filesystems { get; set; }
+ public List Partitions { get; set; }
+ public List MediaFormats { get; set; }
+ public List Filters { get; set; }
+ public List Devices { get; set; }
+ public List Medias { get; set; }
}
public class CommandsStats
diff --git a/Metadata/Version.cs b/Metadata/Version.cs
index b9b7117..0284f60 100644
--- a/Metadata/Version.cs
+++ b/Metadata/Version.cs
@@ -47,14 +47,12 @@ namespace DiscImageChef.CommonTypes.Metadata
/// Gets XML software type for the running version
///
/// XML software type
- public static SoftwareType GetSoftwareType()
- {
- return new SoftwareType
+ public static SoftwareType GetSoftwareType() =>
+ new SoftwareType
{
Name = "DiscImageChef",
OperatingSystem = DetectOS.GetRealPlatformID().ToString(),
Version = typeof(Version).Assembly.GetName().Version.ToString()
};
- }
}
}
\ No newline at end of file
diff --git a/Partition.cs b/Partition.cs
index f28b0a4..f933081 100644
--- a/Partition.cs
+++ b/Partition.cs
@@ -71,20 +71,11 @@ namespace DiscImageChef.CommonTypes
///
/// Partition to compare with
/// 0 if both partitions start and end at the same sector
- public bool Equals(Partition other)
- {
- return Start == other.Start && Length == other.Length;
- }
+ public bool Equals(Partition other) => Start == other.Start && Length == other.Length;
- public override bool Equals(object obj)
- {
- return obj is Partition partition && Equals(partition);
- }
+ public override bool Equals(object obj) => obj is Partition partition && Equals(partition);
- public override int GetHashCode()
- {
- return Start.GetHashCode() + End.GetHashCode();
- }
+ public override int GetHashCode() => Start.GetHashCode() + End.GetHashCode();
///
/// Compares this partition with another and returns an integer that indicates whether the current partition precedes,
@@ -102,39 +93,21 @@ namespace DiscImageChef.CommonTypes
}
// Define the equality operator.
- public static bool operator ==(Partition operand1, Partition operand2)
- {
- return operand1.Equals(operand2);
- }
+ public static bool operator ==(Partition operand1, Partition operand2) => operand1.Equals(operand2);
// Define the inequality operator.
- public static bool operator !=(Partition operand1, Partition operand2)
- {
- return !operand1.Equals(operand2);
- }
+ public static bool operator !=(Partition operand1, Partition operand2) => !operand1.Equals(operand2);
// Define the is greater than operator.
- public static bool operator >(Partition operand1, Partition operand2)
- {
- return operand1.CompareTo(operand2) == 1;
- }
+ public static bool operator >(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == 1;
// Define the is less than operator.
- public static bool operator <(Partition operand1, Partition operand2)
- {
- return operand1.CompareTo(operand2) == -1;
- }
+ public static bool operator <(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == -1;
// Define the is greater than or equal to operator.
- public static bool operator >=(Partition operand1, Partition operand2)
- {
- return operand1.CompareTo(operand2) >= 0;
- }
+ public static bool operator >=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) >= 0;
// Define the is less than or equal to operator.
- public static bool operator <=(Partition operand1, Partition operand2)
- {
- return operand1.CompareTo(operand2) <= 0;
- }
+ public static bool operator <=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) <= 0;
}
}
\ No newline at end of file