Code inspections

This commit is contained in:
2019-09-29 22:43:48 +01:00
parent 7465260354
commit 970b1f1571
3 changed files with 19 additions and 23 deletions
+6 -9
View File
@@ -160,22 +160,19 @@ namespace ASCOM.Meade.net
return i == 0; return i == 0;
} }
public bool RevokeClassObject() public void RevokeClassObject()
{ {
int i = CoRevokeClassObject(_mCookie); CoRevokeClassObject(_mCookie);
return i == 0;
} }
public static bool ResumeClassObjects() public static void ResumeClassObjects()
{ {
int i = CoResumeClassObjects(); CoResumeClassObjects();
return i == 0;
} }
public static bool SuspendClassObjects() public static void SuspendClassObjects()
{ {
int i = CoSuspendClassObjects(); CoSuspendClassObjects();
return i == 0;
} }
#endregion #endregion
+10 -11
View File
@@ -92,17 +92,17 @@ namespace ASCOM.Meade.net
} }
// This method performs a thread-safe incrementation of the objects count. // This method performs a thread-safe incrementation of the objects count.
public static int CountObject() public static void CountObject()
{ {
// Increment the global count of objects. // Increment the global count of objects.
return Interlocked.Increment(ref _objsInUse); Interlocked.Increment(ref _objsInUse);
} }
// This method performs a thread-safe decrementation the objects count. // This method performs a thread-safe decrementation the objects count.
public static int UncountObject() public static void UncountObject()
{ {
// Decrement the global count of objects. // Decrement the global count of objects.
return Interlocked.Decrement(ref _objsInUse); Interlocked.Decrement(ref _objsInUse);
} }
// Returns the current server lock count. // Returns the current server lock count.
@@ -119,18 +119,18 @@ namespace ASCOM.Meade.net
// This method performs a thread-safe incrementation the // This method performs a thread-safe incrementation the
// server lock count. // server lock count.
public static int CountLock() public static void CountLock()
{ {
// Increment the global lock count of this server. // Increment the global lock count of this server.
return Interlocked.Increment(ref _serverLocks); Interlocked.Increment(ref _serverLocks);
} }
// This method performs a thread-safe decrementation the // This method performs a thread-safe decrementation the
// server lock count. // server lock count.
public static int UncountLock() public static void UncountLock()
{ {
// Decrement the global lock count of this server. // Decrement the global lock count of this server.
return Interlocked.Decrement(ref _serverLocks); Interlocked.Decrement(ref _serverLocks);
} }
// AttemptToTerminateServer() will check to see if the objects count and the server // AttemptToTerminateServer() will check to see if the objects count and the server
@@ -456,7 +456,7 @@ namespace ASCOM.Meade.net
// that we serve. This requires the class facgtory name to be // that we serve. This requires the class facgtory name to be
// equal to the served class name + "ClassFactory". // equal to the served class name + "ClassFactory".
// //
private static bool RegisterClassFactories() private static void RegisterClassFactories()
{ {
_sClassFactories = new ArrayList(); _sClassFactories = new ArrayList();
foreach (Type type in _sComObjectTypes) foreach (Type type in _sComObjectTypes)
@@ -467,11 +467,10 @@ namespace ASCOM.Meade.net
{ {
MessageBox.Show(string.Format(Resources.Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_, type.Name), MessageBox.Show(string.Format(Resources.Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_, type.Name),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop); DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false; return;
} }
} }
ClassFactory.ResumeClassObjects(); // Served objects now go live ClassFactory.ResumeClassObjects(); // Served objects now go live
return true;
} }
private static void RevokeClassFactories() private static void RevokeClassFactories()
+3 -3
View File
@@ -24,7 +24,7 @@ namespace ASCOM.Meade.net.Wrapper
void SetupDialog(); void SetupDialog();
void WriteProfile(ProfileProperties profileProperties); void WriteProfile(ProfileProperties profileProperties);
string ReadCharacters(int throwAwayCharacters); void ReadCharacters(int throwAwayCharacters);
} }
public class SharedResourcesWrapper : ISharedResourcesWrapper public class SharedResourcesWrapper : ISharedResourcesWrapper
@@ -73,9 +73,9 @@ namespace ASCOM.Meade.net.Wrapper
return SharedResources.ReadTerminated(); return SharedResources.ReadTerminated();
} }
public string ReadCharacters(int throwAwayCharacters) public void ReadCharacters(int throwAwayCharacters)
{ {
return SharedResources.ReadCharacters(throwAwayCharacters); SharedResources.ReadCharacters(throwAwayCharacters);
} }
public ProfileProperties ReadProfile() public ProfileProperties ReadProfile()