Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.cs @ 10429

Last change on this file since 10429 was 8660, checked in by gkronber, 12 years ago

#1847 merged r8205:8635 from trunk into branch

File size: 3.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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
22using System;
23using System.Reflection;
24using System.Windows.Forms;
25
26namespace 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 version = MonoVersion;
46
47        //we need at least mono version 2.11.4
48        if (version != null && version.Major >= 2 && version.Minor >= 11 && version.Build >= 4) {
49          return true;
50        } else {
51          return false;
52        }
53      }
54    }
55
56    public static Version MonoVersion {
57      get {
58        Type type = Type.GetType("Mono.Runtime");
59        if (type != null) {
60          MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
61          if (dispalayName != null) {
62            string versionString = dispalayName.Invoke(null, null) as string;
63            if (versionString != null) {
64              // the version string looks something like: 2.11.4 (master/99d5e54 Thu Sep  6 15:55:44 CEST 2012)
65              var subVerStrings = versionString.Split(' ');
66              if (subVerStrings.Length > 0) {
67                try {
68                  return Version.Parse(subVerStrings[0]);
69                }
70                catch { }
71              }
72            }
73          }
74        }
75        return null;
76      }
77    }
78
79    public FrameworkVersionErrorDialog() {
80      InitializeComponent();
81    }
82
83    private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
84      try {
85        System.Diagnostics.Process.Start("http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7");
86        linkLabel.LinkVisited = true;
87      }
88      catch (Exception) { }
89    }
90
91    private void cancelButton_Click(object sender, EventArgs e) {
92      Application.Exit();
93    }
94
95    private void linkLabelMono_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
96      try {
97        System.Diagnostics.Process.Start("http://www.mono-project.org");
98        linkLabelMono.LinkVisited = true;
99      }
100      catch (Exception) { }
101    }
102  }
103}
Note: See TracBrowser for help on using the repository browser.