Esempio n. 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);
        }
Esempio n. 2
0
        static bool IsOneNoteInstalled()
        {
            var isInstalled = false;
            var line        = ONENOTE_APP_NOT_FOUND;

            if (App.IsOneNoteInstalled())
            {
                var exeFilePath = App.GetExeFilePath();
                var exeFileInfo = new Utils.ExeFileInfo(exeFilePath);
#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",
                                     App.FriendlyName, exeFileInfo.ImageType);
#if WIN32
                isInstalled = exeFileInfo.Is32Bit();
#elif WIN64
                isInstalled = exeFileInfo.Is64Bit();
#endif
            }
            Tracer.WriteTraceMethodLine(line);
            return(isInstalled);
        }