/// <summary> /// Required method for ArcGIS Component Category unregistration - /// Do not modify the contents of this method with the code editor. /// </summary> private static void ArcGISCategoryUnregistration(Type registerType) { string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID); MxExtension.Unregister(regKey); GMxExtensions.Unregister(regKey); SxExtensions.Unregister(regKey); }
private void EsriRegasm(bool install) { try { int arcVersion = -1; string regCmd = String.Empty, args = String.Empty; RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\ESRI\ArcGIS"); object rkVal = rk.GetValue("RealVersion"); if ((rkVal == null) || !Int32.TryParse(rkVal.ToString().Split('.')[0], out arcVersion)) { arcVersion = -1; } string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", "c61db89f-7118-4a10-a5c1-d4a375867a02"); if (install) { MxExtension.Register(regKey); } else { MxExtension.Unregister(regKey); } if (arcVersion > 9) { ProcessStartInfo psi = new ProcessStartInfo(Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.CommonProgramFiles), @"ArcGIS\bin\ESRIRegasm.exe")); //psi.Arguments = String.Format(@"{0} /p:Desktop{1} /s", // Path.GetFileName(base.GetType().Assembly.Location), install ? String.Empty : @" /u"); psi.Arguments = String.Format(@"{0} /p:Desktop{1} /s", "\"" + Path.Combine(Path.GetDirectoryName(base.GetType().Assembly.Location), "HluArcMapExtension.dll") + "\"", install ? String.Empty : @" /u"); psi.WorkingDirectory = Path.GetDirectoryName(base.GetType().Assembly.Location); psi.CreateNoWindow = true; psi.UseShellExecute = false; Process p = new Process(); p.StartInfo = psi; p.Start(); p.WaitForExit(); } } catch (Exception ex) { MessageBox.Show(String.Format("{0}\n{1}", ex.Source, ex.Message), "HLU GIS Tool Installer", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void UnregisterFunction(Type registerType) { string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID); MxExtension.Unregister(regKey); }
internal static void Unregister(string registryKey) { MxExtension.Unregister(registryKey); }