ModuleAdaptiveDockingNode: Changed some if statements to switch statements, added some debug-only exception trapping, and removed some extraneous string interning.
ModuleAdaptiveDockingNode: Changed some if statements to switch statements, added some debug-only exception trapping, and removed some extraneous string interning.

--- a/ModuleAdaptiveDockingNode.cs
+++ b/ModuleAdaptiveDockingNode.cs
@@ -167,18 +167,23 @@
 					this.portGender = PortGender.MALE;
 				}
 
-				if (this.portGender == PortGender.FEMALE || this.portGender == PortGender.MALE)
-				{
-					byte[] partUID = BitConverter.GetBytes(this.part.flightID);
-					byte[] vesselUID = this.vessel.id.ToByteArray();
-					byte[] guidBytes = new byte[partUID.Length + vesselUID.Length];
-
-					partUID.CopyTo(guidBytes, 0);
-					vesselUID.CopyTo(guidBytes, partUID.Length);
-
-					this.GuidString = Convert.ToBase64String(guidBytes).TrimEnd('=');
-
-					this.defaultSize = String.Format("{0}_{1}_{2}", this.defaultSize, trimmedGender, this.GuidString);
+				switch (this.portGender)
+				{
+					case PortGender.FEMALE:
+					case PortGender.MALE:
+						byte[] partUID = BitConverter.GetBytes(this.part.flightID);
+						byte[] vesselUID = this.vessel.id.ToByteArray();
+						byte[] guidBytes = new byte[partUID.Length + vesselUID.Length];
+
+						partUID.CopyTo(guidBytes, 0);
+						vesselUID.CopyTo(guidBytes, partUID.Length);
+
+						this.GuidString = Convert.ToBase64String(guidBytes).TrimEnd('=');
+
+						this.defaultSize = String.Format("{0}_{1}_{2}", this.defaultSize, trimmedGender, this.GuidString);
+						break;
+					default:
+						break;
 				}
 			}
 
@@ -264,6 +269,11 @@
 				#endif
 
 				Tools.DebugLogger verboseLog = Tools.DebugLogger.New(this);
+
+				#if DEBUG
+				try
+				{
+				#endif
 
 				verboseLog.AppendFormat(" ({0}_{1}) on {2}",
 					this.part.partInfo.name, this.part.craftID, this.vessel.vesselName);
@@ -341,8 +351,8 @@
 
 						// If this docking node is already docked, we can't dock to it, so skip it.
 						if (
-							potentialTargetNode.state.Contains(string.Intern("Docked")) ||
-							potentialTargetNode.state.Contains(string.Intern("PreAttached")))
+							potentialTargetNode.state.Contains("Docked") ||
+							potentialTargetNode.state.Contains("PreAttached"))
 						{
 							verboseLog.Append("\nDiscarding potentialTargetNode: not ready.");
 							continue;
@@ -435,15 +445,16 @@
 										continue;
 									}
 
-
 									// ...otherwise, target the common size, obfuscating for gendered ports just in case
-									if (this.portGender == PortGender.FEMALE || this.portGender == PortGender.MALE)
+									switch (this.portGender)
 									{
-										targetSize = String.Concat(commonNodeType, "_gendered");
-									}
-									else
-									{
-										targetSize = commonNodeType;
+										case PortGender.FEMALE:
+										case PortGender.MALE:
+											targetSize = String.Concat(commonNodeType, "_gendered");
+											break;
+										default:
+											targetSize = commonNodeType;
+											break;
 									}
 
 									targetAdaptiveNode.currentSize = targetSize;
@@ -501,11 +512,6 @@
 
 				verboseLog.Append("\nFixedUpdate Finished.");
 
-				#if DEBUG
-				if (foundApproach)
-					verboseLog.Print();
-				#endif
-
 				if (foundTargetNode)
 				{
 					if (this.timeoutTimer.IsRunning)
@@ -515,6 +521,15 @@
 
 					this.timeoutTimer.Start();
 				}
+
+				#if DEBUG
+				}
+				finally
+				{
+					if (foundApproach)
+					verboseLog.Print();
+				}
+				#endif
 			}
 		}