Exemplo n.º 1
0
        static bool ProcessRegistroy(Guid serverClassGuid, Options options)
        {
            var exePath = Process.GetCurrentProcess().MainModule.FileName;

#if false
            ProgIdAttribute progId = Attribute.GetCustomAttribute(typeof(HidemaruLspBackEndServer), typeof(ProgIdAttribute)) as ProgIdAttribute;
#else
            ProgIdAttribute progId = null;
#endif
            switch (options.Mode)
            {
            case Options.RegistryMode.RegServer:
                return(LocalServer.RegisterToLocalMachine(serverClassGuid, progId, exePath, tlbPath));

            case Options.RegistryMode.RegServerPerUser:
                return(LocalServer.RegisterToCurrentUser(serverClassGuid, progId, exePath, tlbPath));

            case Options.RegistryMode.UnRegServer:
                LocalServer.UnregisterFromLocalMachine(serverClassGuid, progId, tlbPath);
                return(true);

            case Options.RegistryMode.UnRegServerPerUser:
                LocalServer.UnregisterToCurrentUser(serverClassGuid, progId, tlbPath);
                return(true);

            case Options.RegistryMode.Unknown:
                return(true);

            default:
                Trace.TraceError($"Unknown mode. mode={options.Mode}");
                return(false);
            }
        }