コード例 #1
0
        private static void RemoveRelevantAddin(BitInstance excelInstance)
        {
            var view = is64BitOperatingSystem ?
                       RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64) :
                       RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);

            RegistryKey officeRegistryKey = view.OpenSubKey(excelInstance.Data, true);
            string      addIn;

            if (excelInstance.Bitness == Bitness.Bitness32)
            {
                addIn = "QuantSA.xll";
            }
            else
            {
                addIn = "QuantSA64.xll";
            }

            RemoveAddin(officeRegistryKey, addIn);
        }
コード例 #2
0
        private static void InstallRelevantAddin(string targetPath, BitInstance excelInstance)
        {
            var view = is64BitOperatingSystem ?
                       RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64) :
                       RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);

            RegistryKey officeRegistryKey = view.OpenSubKey(excelInstance.Data, true);
            FileInfo    addIn;

            if (excelInstance.Bitness == Bitness.Bitness32)
            {
                addIn = new FileInfo(Path.Combine(targetPath, "QuantSA.xll"));
            }
            else
            {
                addIn = new FileInfo(Path.Combine(targetPath, "QuantSA64.xll"));
            }

            InstallAddin(officeRegistryKey, addIn);
        }