1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
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
|
---|
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 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Reflection;
|
---|
24 | using System.Windows.Forms;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.PluginInfrastructure {
|
---|
27 | public partial class FrameworkVersionErrorDialog : Form {
|
---|
28 | public static bool NET4FullProfileInstalled {
|
---|
29 | get {
|
---|
30 | try {
|
---|
31 | return Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full") != null;
|
---|
32 | }
|
---|
33 | catch (System.Security.SecurityException) {
|
---|
34 | return false;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | public static bool MonoInstalled {
|
---|
40 | get { return Type.GetType("Mono.Runtime") != null; }
|
---|
41 | }
|
---|
42 |
|
---|
43 | public static bool MonoCorrectVersionInstalled {
|
---|
44 | get {
|
---|
45 | var monoVersion = MonoVersion;
|
---|
46 | var minRequiredVersion = new Version(2, 11, 4);
|
---|
47 |
|
---|
48 | //we need at least mono version 2.11.4
|
---|
49 | if (monoVersion != null && monoVersion >= minRequiredVersion) {
|
---|
50 | return true;
|
---|
51 | } else {
|
---|
52 | return false;
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | public static Version MonoVersion {
|
---|
58 | get {
|
---|
59 | Type type = Type.GetType("Mono.Runtime");
|
---|
60 | if (type != null) {
|
---|
61 | MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
|
---|
62 | if (dispalayName != null) {
|
---|
63 | string versionString = dispalayName.Invoke(null, null) as string;
|
---|
64 | if (versionString != null) {
|
---|
65 | // the version string looks something like: 2.11.4 (master/99d5e54 Thu Sep 6 15:55:44 CEST 2012)
|
---|
66 | var subVerStrings = versionString.Split(' ');
|
---|
67 | if (subVerStrings.Length > 0) {
|
---|
68 | try {
|
---|
69 | return Version.Parse(subVerStrings[0]);
|
---|
70 | }
|
---|
71 | catch { }
|
---|
72 | }
|
---|
73 | }
|
---|
74 | }
|
---|
75 | }
|
---|
76 | return null;
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | public FrameworkVersionErrorDialog() {
|
---|
81 | InitializeComponent();
|
---|
82 | }
|
---|
83 |
|
---|
84 | private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
---|
85 | try {
|
---|
86 | System.Diagnostics.Process.Start("http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7");
|
---|
87 | linkLabel.LinkVisited = true;
|
---|
88 | }
|
---|
89 | catch (Exception) { }
|
---|
90 | }
|
---|
91 |
|
---|
92 | private void cancelButton_Click(object sender, EventArgs e) {
|
---|
93 | Application.Exit();
|
---|
94 | }
|
---|
95 |
|
---|
96 | private void linkLabelMono_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
---|
97 | try {
|
---|
98 | System.Diagnostics.Process.Start("http://www.mono-project.org");
|
---|
99 | linkLabelMono.LinkVisited = true;
|
---|
100 | }
|
---|
101 | catch (Exception) { }
|
---|
102 | }
|
---|
103 | }
|
---|
104 | } |
---|