コード例 #1
0
        static public string  checkPrereqs()
        {
            string str          = "";
            string path         = Directory.GetDirectoryRoot(Directory.GetCurrentDirectory());
            string absolutepath = Path.GetFullPath("Exchange.dll");

            bool bitness = CompatibilityChk.UnmanagedDllIs64Bit(absolutepath).Value;

            string InstallPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook", "Bitness", null);

            if (InstallPath == null)
            {
                InstallPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Outlook", "Bitness", null);
            }

            if (InstallPath != null)
            {
                //its 64 bit outlook and 64 bit migration

                if (bitness == true)
                {
                    if (InstallPath == "x64")
                    {
                        //64 bit mapi and 64 bit migration perfect
                    }
                    else
                    {
                        if (InstallPath == "x86")
                        {
                            //32 bit mapi and 64 bit migration cannot continue
                            str = "The 64 bit Migration wizard is not compatible with MAPI 32 bit libraries.  Please run the 32 bit Migration wizard.";
                            return(str);
                        }
                    }
                }
                else
                {
                    if (InstallPath == "x64")
                    {
                        //64 bit mapi and 32 bit bit migration cannot continue
                        str = "The 32 bit Migration wizard is not compatible with MAPI 64 bit libraries.  Please run the 64 bit Migration wizard.";
                        return(str);
                    }
                    else
                    {
                        if (InstallPath == "x86")
                        {
                            //32 bit mapi and 32 bit migration perfect
                        }
                    }
                }
            }
            else
            {
                if (bitness == true)
                {
                    //32 bit mapi and 64 bitmigration
                    str = "Older versions of Outlook are not compatible with the 64 bit Migration wizard.  Please run the 32 bit Migration wizard.";
                    return(str);
                }
                else
                {
                    //32 bit mapi and 32 bit migration.
                }
            }


            return(str);
        }
コード例 #2
0
        static public string  checkPrereqs()
        {
            using (LogBlock logblock = Log.NotTracing()?null: new LogBlock(/*GetType() + "." + */ System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                string str          = "";
                string path         = Directory.GetDirectoryRoot(Directory.GetCurrentDirectory());
                string absolutepath = Path.GetFullPath("Exchange.dll");

                bool bitness = CompatibilityChk.UnmanagedDllIs64Bit(absolutepath).Value;

                string      registryValue = string.Empty;
                RegistryKey localKey      = null;
                if (Environment.Is64BitOperatingSystem)
                {
                    localKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
                }
                else
                {
                    localKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
                }

                try
                {
                    localKey = localKey.OpenSubKey(@"Software\\Microsoft\Office\\");
                    // registryValue = localKey.GetValue("TestKey").ToString();
                    if (localKey.SubKeyCount > 0)
                    {
                        if ((localKey.GetSubKeyNames()).Contains(@"Outlook"))
                        {
                        }
                        else
                        {
                            str = "Outlook is not installed on this system.Please Install Outlook"; // Still need this?
                            return(str);
                        }
                    }
                }
                catch (Exception e)
                {
                    str = "Execption in reading regsitry for outlook prereq " + e.Message;
                    return(str);
                }



                string InstallPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook", "Bitness", null);
                if (InstallPath == null)
                {
                    InstallPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Outlook", "Bitness", null);
                }
                if (InstallPath == null)
                {
                    InstallPath = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook", "Bitness", null);
                }

                if (InstallPath != null)
                {
                    //its 64 bit outlook and 64 bit migration
                    if (bitness == true)
                    {
                        if (InstallPath == "x64")
                        {
                            //64 bit mapi and 64 bit migration perfect
                        }
                        else
                        {
                            if (InstallPath == "x86")
                            {
                                //32 bit mapi and 64 bit migration cannot continue
                                str = "The 64 bit Migration wizard is not compatible with MAPI 32 bit libraries.  Please run the 32 bit Migration wizard.";
                                return(str);
                            }
                        }
                    }
                    else
                    {
                        if (InstallPath == "x64")
                        {
                            //64 bit mapi and 32 bit bit migration cannot continue
                            str = "The 32 bit Migration wizard is not compatible with MAPI 64 bit libraries.  Please run the 64 bit Migration wizard.";
                            return(str);
                        }
                        else
                        {
                            if (InstallPath == "x86")
                            {
                                //32 bit mapi and 32 bit migration perfect
                            }
                        }
                    }
                }
                else
                {
                    if (bitness == true)
                    {
                        //32 bit mapi and 64 bitmigration
                        str = "Older versions of Outlook are not compatible with the 64 bit Migration wizard.  Please run the 32 bit Migration wizard.";
                        return(str);
                    }
                    else
                    {
                        //32 bit mapi and 32 bit migration.
                    }
                }
                return(str);
            }
        }