Пример #1
0
        static bool IsOneNoteInstalled()
        {
            const string
                FriendlyAppName = "FriendlyAppName",
                SubKey          = @"Applications\onenote.exe";

            var isInstalled = false;
            var line        = ONENOTE_APP_NOT_FOUND;

            using (var k = Registry.ClassesRoot.OpenSubKey(SubKey))
            {
                if (k != null && k.GetValue(FriendlyAppName) != null)
                {
                    var filePath    = ApplicationExtensions.GetExeFilePath();
                    var exeFileInfo = new Utils.ExeFileInfo(filePath);
#if DEBUG
                    var nl      = new[] { Environment.NewLine };
                    var options = StringSplitOptions.None;
                    var args    = exeFileInfo.ToString().Split(nl, options);
                    foreach (var arg in args)
                    {
                        Tracer.WriteDebugLine(arg);
                    }
#endif
                    line = string.Format("{0} ({1}) is installed",
                                         k.GetValue(FriendlyAppName), exeFileInfo.ImageType);

                    isInstalled = exeFileInfo.Is32Bit();
                }
            }
            Tracer.WriteTraceMethodLine(line);
            return(isInstalled);
        }