public static bool CheckForArcPadTools(Geoprocessor gp, bool finalCheck = false) { while (true) { string tool; List <string> tools = new List <string>(); IGpEnumList toolCollection = gp.ListToolboxes("arc*"); while ((tool = toolCollection.Next()) != null) { tools.Add(tool); } if (!tools.Contains("ArcPad Tools(ArcPad)")) { if (!finalCheck) { gp.AddToolbox(ArcPadTbxPath); finalCheck = true; continue; } else { throw new Exception("Missing ArcPad Tools."); } } break; } return(true); }