[5984] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[12012] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[5984] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
[8632] | 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
[5984] | 20 | #endregion
|
---|
[5997] | 21 |
|
---|
[5984] | 22 | using System;
|
---|
[8632] | 23 | using System.Reflection;
|
---|
[5984] | 24 | using System.Windows.Forms;
|
---|
| 25 |
|
---|
[13338] | 26 | namespace HeuristicLab.PluginInfrastructure.UI {
|
---|
[5997] | 27 | public partial class FrameworkVersionErrorDialog : Form {
|
---|
[11631] | 28 | private const string NETVersionPath = @"Software\Microsoft\NET Framework Setup\NDP\v4\Full";
|
---|
| 29 | private const string NETVersion = "Version";
|
---|
| 30 |
|
---|
| 31 | public static bool NET4_5Installed {
|
---|
[8632] | 32 | get {
|
---|
| 33 | try {
|
---|
[11631] | 34 | var registryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(NETVersionPath);
|
---|
| 35 | if (registryKey != null) {
|
---|
| 36 | var versionKey = registryKey.GetValue(NETVersion);
|
---|
| 37 | if (versionKey != null) {
|
---|
| 38 | Version version = new Version(versionKey.ToString());
|
---|
| 39 | return version.Major >= 4 && version.Minor >= 5;
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
[8632] | 42 | }
|
---|
| 43 | catch (System.Security.SecurityException) {
|
---|
| 44 | return false;
|
---|
| 45 | }
|
---|
[11631] | 46 | return false;
|
---|
[8632] | 47 | }
|
---|
[5997] | 48 | }
|
---|
| 49 |
|
---|
[8632] | 50 | public static bool MonoInstalled {
|
---|
| 51 | get { return Type.GetType("Mono.Runtime") != null; }
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public static bool MonoCorrectVersionInstalled {
|
---|
| 55 | get {
|
---|
[8816] | 56 | var monoVersion = MonoVersion;
|
---|
[11631] | 57 | var minRequiredVersion = new Version(3, 6, 0);
|
---|
| 58 |
|
---|
| 59 | //we need at least mono version 3.6.0
|
---|
[8816] | 60 | if (monoVersion != null && monoVersion >= minRequiredVersion) {
|
---|
[8632] | 61 | return true;
|
---|
| 62 | } else {
|
---|
| 63 | return false;
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public static Version MonoVersion {
|
---|
| 69 | get {
|
---|
| 70 | Type type = Type.GetType("Mono.Runtime");
|
---|
| 71 | if (type != null) {
|
---|
| 72 | MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
|
---|
| 73 | if (dispalayName != null) {
|
---|
| 74 | string versionString = dispalayName.Invoke(null, null) as string;
|
---|
| 75 | if (versionString != null) {
|
---|
| 76 | // the version string looks something like: 2.11.4 (master/99d5e54 Thu Sep 6 15:55:44 CEST 2012)
|
---|
| 77 | var subVerStrings = versionString.Split(' ');
|
---|
| 78 | if (subVerStrings.Length > 0) {
|
---|
| 79 | try {
|
---|
| 80 | return Version.Parse(subVerStrings[0]);
|
---|
| 81 | }
|
---|
| 82 | catch { }
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 | return null;
|
---|
| 88 | }
|
---|
| 89 | }
|
---|
| 90 |
|
---|
[5997] | 91 | public FrameworkVersionErrorDialog() {
|
---|
[5984] | 92 | InitializeComponent();
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
---|
| 96 | try {
|
---|
[11631] | 97 | System.Diagnostics.Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=30653");
|
---|
[5984] | 98 | linkLabel.LinkVisited = true;
|
---|
| 99 | }
|
---|
| 100 | catch (Exception) { }
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | private void cancelButton_Click(object sender, EventArgs e) {
|
---|
| 104 | Application.Exit();
|
---|
| 105 | }
|
---|
[8632] | 106 |
|
---|
| 107 | private void linkLabelMono_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
---|
| 108 | try {
|
---|
| 109 | System.Diagnostics.Process.Start("http://www.mono-project.org");
|
---|
| 110 | linkLabelMono.LinkVisited = true;
|
---|
| 111 | }
|
---|
| 112 | catch (Exception) { }
|
---|
| 113 | }
|
---|
[5984] | 114 | }
|
---|
| 115 | } |
---|