Migrated to CsWin32 #1

Merged
nefarius merged 14 commits from nefarius/bugfix/refactoring into master 2024-07-13 15:32:14 +02:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit 1915105688 - Show all commits

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ _ReSharper*/
/.tmp /.tmp
*.DotSettings *.DotSettings
/misc /misc
/.idea

View File

@ -317,11 +317,9 @@ public partial class SerialPort : IDisposable
/// <returns>Modem status object</returns> /// <returns>Modem status object</returns>
protected ModemStatus GetModemStatus() protected ModemStatus GetModemStatus()
{ {
uint f;
CheckOnline(); CheckOnline();
if (!Win32Com.GetCommModemStatus(_hPort.DangerousGetHandle(), out f)) ThrowException("Unexpected failure"); if (!Win32Com.GetCommModemStatus(_hPort.DangerousGetHandle(), out var f)) ThrowException("Unexpected failure");
return new ModemStatus(f); return new ModemStatus((MODEM_STATUS_FLAGS)f);
} }
/// <summary> /// <summary>
@ -497,7 +495,7 @@ public partial class SerialPort : IDisposable
uint f; uint f;
if (!Win32Com.GetCommModemStatus(_hPort.DangerousGetHandle(), out f)) if (!Win32Com.GetCommModemStatus(_hPort.DangerousGetHandle(), out f))
throw new CommPortException("IO Error [005]"); throw new CommPortException("IO Error [005]");
OnStatusChange(new ModemStatus(i), new ModemStatus(f)); OnStatusChange(new ModemStatus((MODEM_STATUS_FLAGS)i), new ModemStatus((MODEM_STATUS_FLAGS)f));
} }
} }
} }