/// <summary> /// Deinstallation /// </summary> /// <param name="savedState"></param> public override void Uninstall(System.Collections.IDictionary savedState) { base.Uninstall(savedState); Assembly asm = Assembly.GetExecutingAssembly(); string fullName = asm.GetModules()[0].FullyQualifiedName; string dataFolder = Toolbar.AppFolder; //try //{ // Directory.Delete(dataFolder, true); //} //catch (Exception) //{ // throw new InstallException("Failed to delete folder"); //} //try //{ // Registry.LocalMachine.DeleteSubKeyTree(IEToolbarEngine.AppKey); // Registry.CurrentUser.DeleteSubKeyTree(IEToolbarEngine.AppKey); //} //catch (Exception) //{ //} RegistrationServices regsrv = new RegistrationServices(); if (!regsrv.UnregisterAssembly(this.GetType().Assembly)) { throw new InstallException("Failed To Unregister for COM"); } }
/// <summary> /// Registers the activator type as a COM server client so that Windows can launch your activator. /// </summary> public static void RegisterActivator <T>() where T : NotificationActivator { #if NET45 var regService = new RegistrationServices(); regService.RegisterTypeForComClients( typeof(T), RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse); _registeredActivator = true; #elif NETCOREAPP3_1 //Ole32.GetRunningObjectTable(0, out IRunningObjectTable rot); //Guid id = typeof(T).GUID; //CreateClassMoniker(ref id,out IMoniker moniker); //rot.Register(1, instance, moniker); ClassFactory factory = new ClassFactory(typeof(T)); IntPtr iunknow = Marshal.GetIUnknownForObject(factory); CoRegisterClassObject( typeof(T).GUID, factory, 4, 0, out uint id); _registeredActivator = true; #endif }
public void DaServerTest() { DaServer _daServer = new DaServer(); Assert.IsNotNull(_daServer); Assert.IsTrue(File.Exists("CommServer_Main.log"), $"Cannot find the file in {Environment.CurrentDirectory}"); Assert.IsFalse(Environment.Is64BitProcess); RegistrationServices _registrationServices = new RegistrationServices(); //GetProgIdForType string _progId = _registrationServices.GetProgIdForType(typeof(DaServer)); Assert.AreEqual <string>("CAS.CommServer.DA.Server.NETServer.DaServer", _progId); //GetRegistrableTypesInAssembly Type[] _typesToRegister = _registrationServices.GetRegistrableTypesInAssembly(typeof(DaServer).Assembly); Assert.IsNotNull(_typesToRegister); Assert.AreEqual <int>(1, _typesToRegister.Length); Assert.AreEqual <string>("CAS.CommServer.DA.Server.NETServer.DaServer", _typesToRegister[0].FullName); //TypeRepresentsComType Assert.IsFalse(_registrationServices.TypeRepresentsComType(typeof(DaServer))); Assert.IsFalse(_registrationServices.TypeRepresentsComType(typeof(IOPCCommon))); Assert.IsFalse(_registrationServices.TypeRepresentsComType(typeof(IOPCCommon))); Assert.IsFalse(_registrationServices.TypeRepresentsComType(typeof(IOPCWrappedServer))); //TypeRequiresRegistration Assert.IsTrue(_registrationServices.TypeRequiresRegistration(typeof(DaServer))); object[] _attributes = typeof(DaServer).GetCustomAttributes(typeof(GuidAttribute), false); Assert.AreEqual <int>(1, _attributes.Length); Assert.AreEqual <string>("BE77A3C7-D2B7-44E7-B943-B978C1C87E5A", ((GuidAttribute)_attributes[0]).Value.ToUpper()); }
static void Main(string[] args) { const int UpgradedVersion = 76; // increment every release Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if DEBUG MessageBox.Show("Debug me", "DigiRite.exe"); #endif int settingsVersion = Properties.Settings.Default.SavedVersion; if (settingsVersion < UpgradedVersion) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.SavedVersion = UpgradedVersion; } CustomColors.CommonBackgroundColor = Properties.Settings.Default.Background; CustomColors.TxBackgroundColor = Properties.Settings.Default.TxBackground; if ((args.Length >= 1) && args[0].ToUpper() == "-EMBEDDING") { var regServices = new RegistrationServices(); int cookie = regServices.RegisterTypeForComClients( typeof(Ft8Auto), RegistrationClassContext.LocalServer, RegistrationConnectionType.SingleUse); applicationContext = new NoShowFormAppContext(); Application.Run(applicationContext); regServices.UnregisterTypeForComClients(cookie); } else { Application.Run(new MainForm(1)); } }
public override void Uninstall(System.Collections.IDictionary savedState) { base.Uninstall(savedState); RegistrationServices regSrv = new RegistrationServices(); regSrv.UnregisterAssembly(base.GetType().Assembly); }
/// <summary> /// This method register this process as the COM server for the specified /// background task class until this process exits or is terminated. /// /// The process that is responsible for handling a particular background /// task must call RegisterTypeForComClients on the IBackgroundTask /// derived class. So long as this process is registered with the /// aforementioned API, it will be the process that has instances of the /// background task invoked. /// </summary> static void RegisterProcessForBackgroundTask(Type backgroundTaskClass) { RegistrationServices registrationServices = new RegistrationServices(); registrationServices.RegisterTypeForComClients(backgroundTaskClass, RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse); }
protected override void OnAfterUninstall(IDictionary savedState) { base.OnAfterUninstall(savedState); Assembly assembly = Assembly.LoadFile(Assembly.GetExecutingAssembly().Location); RegistrationServices registrationServices = new RegistrationServices(); registrationServices.UnregisterAssembly(assembly); }
protected override void OnCommitted(IDictionary savedState) { base.OnCommitted(savedState); Assembly assembly = Assembly.LoadFile(Assembly.GetExecutingAssembly().Location); RegistrationServices registrationServices = new RegistrationServices(); registrationServices.RegisterAssembly(assembly, AssemblyRegistrationFlags.SetCodeBase); }
public static void RegisterCom() { var rs = new RegistrationServices(); var a = new MediaMonkeyAkkaProxy(); rs.RegisterAssembly(typeof(MediaMonkeyAkkaProxy).Assembly, AssemblyRegistrationFlags.SetCodeBase); }
public static void Unregist() { if (ComObject.cookie != -1) { RegistrationServices registrationServices = new RegistrationServices(); registrationServices.UnregisterTypeForComClients(ComObject.cookie); } }
public override void Install(System.Collections.IDictionary stateSaver) { base.Install(stateSaver); RegistrationServices regSrv = new RegistrationServices(); regSrv.RegisterAssembly(base.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase); }
public static void Unregister() { try { RegistrationServices svc = new RegistrationServices(); svc.UnregisterAssembly(typeof(Program).Assembly); } catch (Exception e) { throw new ApplicationException(e.Message, e); } }
public static void Register() { try { RegistrationServices svc = new RegistrationServices(); svc.RegisterAssembly(typeof(Program).Assembly, AssemblyRegistrationFlags.SetCodeBase); } catch (Exception e) { throw new ApplicationException(e.Message, e); } }
public void DLLRegisterServer(int regMode) { //register dll //same as: //post build event: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe $(TargetPath) /codebase RegistrationServices regAsm = new RegistrationServices(); bool bResult = regAsm.RegisterAssembly(ComponentConfig.typeToRegister.Assembly, AssemblyRegistrationFlags.SetCodeBase); }
private static void RegisterCOMAssemblies(ComRegistration comReg) { RegistrationServices RegistrationServices = new RegistrationServices(); foreach (var fileName in comReg.ComAssemblies) { RegisterCOMAssembly(RegistrationServices, comReg.DllDirectory + fileName); } }
public BaseAppService() { this.registrationMappers = new RegistrationMappers(); this.dtoToEntityMapper = this.registrationMappers.Container.Resolve <IMapper>(); this.registrationServices = new RegistrationServices(); this.registrationAppServices = new RegistrationAppServices(); this.databaseConnectionFactory = this.registrationAppServices.Instance.Container.Resolve <IDatabaseConnectionFactory>(); }
public static void Enable() { RegistrationServices = new RegistrationServices(); Cookie = RegistrationServices.RegisterTypeForComClients( typeof(NotificationActivator), RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse ); }
public static void Initialize() { var regService = new RegistrationServices(); int cookie = regService.RegisterTypeForComClients( typeof(NotificationActivator), RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse); }
public static void RegisterServer(Assembly assemblyToRegister) { if (ComRegister != null) { RegistrationServices reg = new RegistrationServices(); reg.RegisterAssembly(assemblyToRegister, AssemblyRegistrationFlags.SetCodeBase); ComRegister(); } }
public static void UnregisterServer(Assembly assemblyToRegister) { if (ComUnregister != null) { RegistrationServices reg = new RegistrationServices(); reg.UnregisterAssembly(assemblyToRegister); ComUnregister(); } }
public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); // Call RegistrationServices.UnregisterAssembly to unregister the classes // in the current managed assembly. RegistrationServices regService = new RegistrationServices(); regService.UnregisterAssembly(this.GetType().Assembly); }
public static void UnregisterSelf() { RegistrationServices aRS = new RegistrationServices(); Assembly thisAssembly = Assembly.GetExecutingAssembly(); if (thisAssembly != null) { aRS.UnregisterAssembly(thisAssembly); } }
public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); // Call RegistrationServices.UnregisterAssembly to unregister the classes // in the current managed assembly. RegistrationServices regService = new RegistrationServices(); regService.UnregisterAssembly(Assembly.LoadFrom(@"AobaContextMenu.dll")); }
public override void Install(IDictionary stateSaver) { base.Install(stateSaver); // Call RegistrationServices.RegisterAssembly to register the classes in // the current managed assembly to enable creation from COM. var regService = new RegistrationServices(); regService.RegisterAssembly(GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase); }
public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); RegistrationServices regsrv = new RegistrationServices(); if (!regsrv.UnregisterAssembly(this.GetType().Assembly)) { throw new InstallException("Failed to unregister."); } }
private static void RegisterActivator(Type activatorType) { // Register type var regService = new RegistrationServices(); regService.RegisterTypeForComClients( activatorType, RegistrationClassContext.LocalServer, RegistrationConnectionType.MultipleUse); }
public override void Uninstall(System.Collections.IDictionary savedState) { base.Uninstall(savedState); RegistrationServices regsrv = new RegistrationServices(); if (!regsrv.UnregisterAssembly(this.GetType().Assembly)) { throw new InstallException("libronツールバーの登録解除に失敗しました"); } }
/// <summary> /// Регистрация сборки /// </summary> /// <param name="asmFile">Ссылка на файл сборки</param> /// <param name="codebase">Флаг регистрации codebase</param> /// <returns>Возвращает результат регистрации: Installed или Fail</returns> public static RegistrationResult Install(FileInfo asmFile, bool codebase = false) { var assembly = ResolveAssembly(asmFile); var services = new RegistrationServices(); bool regResult = services.RegisterAssembly(assembly, codebase ? AssemblyRegistrationFlags.SetCodeBase : AssemblyRegistrationFlags.None); return(regResult ? RegistrationResult.Installed : RegistrationResult.Fail); }
public override void Install(IDictionary stateSaver) { try { new System.EnterpriseServices.Internal.Publish().GacInstall("WhereMyImplant.dll"); base.Install(stateSaver); RegistrationServices registrationServices = new RegistrationServices(); } catch { } }
/// <summary> /// Unregister the assembly /// </summary> /// <param name="savedState">An IDictionary that contains the state of /// the computer after the installation was complete.</param> /// <exception cref="ArgumentException">The stateSaver parameter is a /// null reference (<b>Nothing</b> in Visual Basic).</exception> /// <exception cref="Exception"> /// An exception occurred in the BeforeInstall event handler of one /// of the installers in the collection. /// -or- /// An exception occurred in the AfterInstall event handler of one /// of the installers in the collection.</exception> public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); RegistrationServices regSrv = new RegistrationServices(); System.Reflection.Assembly assembly = base.GetType().Assembly; regSrv.UnregisterAssembly(assembly); }