OSDN Git Service

na-get-lib,ひとまず依存関係解決関数群を作った。
[applistation/AppliStation.git] / AppliStation / InstallerInfoForm.cs
1 using System;\r
2 using System.ComponentModel;\r
3 using System.Drawing;\r
4 using System.Windows.Forms;\r
5 \r
6 using NaGet.Packages;\r
7 using NaGet.Packages.Install;\r
8 using System.Reflection;\r
9 \r
10 namespace AppliStation\r
11 {\r
12         /// <summary>\r
13         /// Description of InstallerInfoForm.\r
14         /// </summary>\r
15         public partial class InstallerInfoForm : UserControl\r
16         {\r
17                 private Installer inst;\r
18                 \r
19                 public InstallerInfoForm()\r
20                 {\r
21                         //\r
22                         // The InitializeComponent() call is required for Windows Forms designer support.\r
23                         //\r
24                         InitializeComponent();\r
25                 }\r
26                 \r
27                 public Installer SelectedObject {\r
28                         get { return inst; }\r
29                         set {\r
30                                 inst = value;\r
31                                 updateInst();\r
32                         }\r
33                 }\r
34                 \r
35                 private void updateInst()\r
36                 {\r
37                         installerUrlTextBox.Text = (inst == null || inst.Url == null)?\r
38                                 string.Empty : inst.Url.Href;\r
39                         \r
40                         if (inst.Platform == null || string.IsNullOrEmpty(inst.Platform.Os)) {\r
41                                 osValueLabel.Text = "\94C\88Ó\82ÌWindows";\r
42                         } else {\r
43                                 osValueLabel.Text = inst.Platform.Os.Replace("WIN", string.Empty);\r
44                         }\r
45                         \r
46                         switch ((inst.Platform != null)? inst.Platform.Arch : System.Reflection.ProcessorArchitecture.X86) {\r
47                                 case System.Reflection.ProcessorArchitecture.Amd64:\r
48                                         archValueLabel.Text = "x64 (64\83r\83b\83g\8aÂ\8b«)";\r
49                                         break;\r
50                                 case System.Reflection.ProcessorArchitecture.IA64:\r
51                                         archValueLabel.Text = "Itanium";\r
52                                         break;\r
53                                 case System.Reflection.ProcessorArchitecture.None:\r
54                                 case System.Reflection.ProcessorArchitecture.MSIL:\r
55                                         archValueLabel.Text = "\83A\81[\83L\83e\83N\83`\83\83\88Ë\91\82È\82µ";\r
56                                         break;\r
57                                 case System.Reflection.ProcessorArchitecture.X86:\r
58                                         archValueLabel.Text = "x86 (32\83r\83b\83g\8aÂ\8b«)";\r
59                                         break;\r
60                         }\r
61                         \r
62                         cannotRunLabel.Visible = ! ((inst.Platform == null) || inst.Platform.IsRunnable());\r
63                 }\r
64         }\r
65 }\r