source: AE/installer2/src/net/oni2/aeinstaller/backend/DotNet.java@ 673

Last change on this file since 673 was 672, checked in by alloc, 12 years ago

AEI2 0.99q:

  • Updates dialog: Updating the to-download-size on (un)checking updates to download
  • Updates dialog: Show download size of individual updates
  • Tool execution: Support for .NET tools (Mod_Info.cfg added ExeType flag)
  • Depot backend: Ignore mod nodes with an empty package number field
File size: 1.8 KB
RevLine 
[672]1package net.oni2.aeinstaller.backend;
2
3import java.io.IOException;
4import java.lang.reflect.InvocationTargetException;
5import java.util.Map;
6import java.util.Vector;
7
8import net.oni2.aeinstaller.backend.Settings.Architecture;
9import net.oni2.aeinstaller.backend.Settings.Platform;
10
11/**
12 * @author Christian Illy
13 */
14public class DotNet {
15
16 /**
17 * @return is a .NET implementation installed?
18 */
19 public static boolean isInstalled() {
20 switch (Settings.getPlatform()) {
21 case WIN:
22 try {
23 int view = WinRegistry.KEY_WOW64_32KEY;
24 if (Settings.getArchitecture() == Architecture.AMD64)
25 view = WinRegistry.KEY_WOW64_64KEY;
26
27 Map<String, String> m = WinRegistry
28 .readStringValues(
29 WinRegistry.HKEY_LOCAL_MACHINE,
30 "Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727",
31 view);
32 return m != null;
33 } catch (IllegalArgumentException e) {
34 e.printStackTrace();
35 } catch (IllegalAccessException e) {
36 e.printStackTrace();
37 } catch (InvocationTargetException e) {
38 e.printStackTrace();
39 } catch (Exception e) {
40 if (!e.getMessage()
41 .equals("Registry access not supported (not a Windows OS?)."))
42 e.printStackTrace();
43 }
44 return false;
45 case MACOS:
46 case LINUX:
47 Vector<String> cmd = new Vector<String>();
48 cmd.add("which");
49 cmd.add("mono");
50 Vector<String> res = null;
51 try {
52 res = AppExecution.executeAndWait(cmd);
53 } catch (IOException e) {
54 e.printStackTrace();
55 }
56 if (res != null) {
57 if (res.get(0).startsWith("/")
58 && res.get(0).endsWith("mono")) {
59 return true;
60 }
61 }
62 return false;
63 default:
64 return false;
65 }
66 }
67
68 /**
69 * @return Get the .Net runtime executable name
70 */
71 public static String getRuntimeExe() {
72 if (Settings.getPlatform() != Platform.WIN)
73 return "mono";
74 return "";
75 }
76
77}
Note: See TracBrowser for help on using the repository browser.