Esempio n. 1
0
        public static string GetOperaVersion(string prefix = "OPERA: ")
        {
            FileVersionInfo version = null;

            try
            {
                using (
                    var regKey =
                        Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\Opera.exe"))
                {
                    string sOperaPath;

                    if ((regKey != null) && !string.IsNullOrEmpty(sOperaPath = (regKey.GetValue(string.Empty) as string)))
                    {
                        if (File.Exists(sOperaPath))
                        {
                            version = FileVersionInfo.GetVersionInfo(sOperaPath);
                        }
                    }
                }
            }
            catch (Exception)
            {
                //throw;
            }

            return(string.Format("{0}{1}", prefix, version != null ? version.FormatToString() : null));
        }