Refactor and code cleanup.

This commit is contained in:
2016-07-28 22:25:26 +01:00
parent c93d469da9
commit a63ba13b6b
199 changed files with 3614 additions and 3744 deletions

View File

@@ -1,3 +1,7 @@
2016-07-28 Natalia Portillo <claunia@claunia.com>
* DetectOS.cs: Refactor and code cleanup.
2015-10-19 Natalia Portillo <claunia@claunia.com>
* DiscImageChef.Interop.csproj:

View File

@@ -82,18 +82,18 @@ namespace DiscImageChef.Interop
[DllImport("libc", SetLastError = true, EntryPoint = "sysctlbyname", CharSet = CharSet.Ansi)]
static extern int OSX_sysctlbyname(string name, IntPtr oldp, IntPtr oldlenp, IntPtr newp, uint newlen);
public static Interop.PlatformID GetRealPlatformID()
public static PlatformID GetRealPlatformID()
{
if((int)Environment.OSVersion.Platform < 4 ||
(int)Environment.OSVersion.Platform == 5)
{
return (Interop.PlatformID)((int)Environment.OSVersion.Platform);
return (PlatformID)((int)Environment.OSVersion.Platform);
}
utsname unixname;
int error = uname(out unixname);
if(error != 0)
throw new Exception(String.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
switch(unixname.sysname)
{
@@ -116,7 +116,7 @@ namespace DiscImageChef.Interop
{
Marshal.FreeHGlobal(pLen);
throw new Exception(String.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
}
int length = Marshal.ReadInt32(pLen);
@@ -127,7 +127,7 @@ namespace DiscImageChef.Interop
Marshal.FreeHGlobal(pStr);
Marshal.FreeHGlobal(pLen);
throw new Exception(String.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
}
string machine = Marshal.PtrToStringAnsi(pStr);