OSDN Git Service

118840d9a5895c056dfc2f0686c913a1ce6d1881
[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                         osValueLabel.Text = (inst.Platform == null || string.IsNullOrEmpty(inst.Platform.Os))?\r
41                                 "\94C\88Ó\82ÌWindows" : inst.Platform.Os;\r
42                         \r
43                         switch ((inst.Platform != null)? inst.Platform.Arch : System.Reflection.ProcessorArchitecture.X86) {\r
44                                 case System.Reflection.ProcessorArchitecture.Amd64:\r
45                                         archValueLabel.Text = "x64 (64\83r\83b\83g\8aÂ\8b«)";\r
46                                         break;\r
47                                 case System.Reflection.ProcessorArchitecture.IA64:\r
48                                         archValueLabel.Text = "Itanium";\r
49                                         break;\r
50                                 case System.Reflection.ProcessorArchitecture.None:\r
51                                 case System.Reflection.ProcessorArchitecture.MSIL:\r
52                                         archValueLabel.Text = "\83A\81[\83L\83e\83N\83`\83\83\88Ë\91\82È\82µ";\r
53                                         break;\r
54                                 case System.Reflection.ProcessorArchitecture.X86:\r
55                                         archValueLabel.Text = "x86 (32\83r\83b\83g\8aÂ\8b«)";\r
56                                         break;\r
57                         }\r
58                         \r
59                         cannotRunLabel.Visible = ! ((inst.Platform == null) || inst.Platform.IsRunnable());\r
60                 }\r
61         }\r
62 }\r