1 |
using System;
|
2 |
using System.Collections.Generic;
|
3 |
using System.ComponentModel;
|
4 |
using System.Data;
|
5 |
using System.Drawing;
|
6 |
using System.Linq;
|
7 |
using System.Text;
|
8 |
using System.Windows.Forms;
|
9 |
using System.Resources;
|
10 |
using System.Globalization;
|
11 |
using System.Threading;
|
12 |
using System.Reflection;
|
13 |
using System.IO;
|
14 |
|
15 |
namespace autorun
|
16 |
{
|
17 |
public partial class autorunForm : Form
|
18 |
{
|
19 |
DriveInfo[] allDrives = DriveInfo.GetDrives();
|
20 |
private ResourceManager m_ResourceManager = new ResourceManager("autorun.autorun", System.Reflection.Assembly.GetExecutingAssembly());
|
21 |
private CultureInfo m_EnglishCulture = new CultureInfo("en-US");
|
22 |
private CultureInfo m_FrenchCulture = new CultureInfo("fr-FR");
|
23 |
private CultureInfo m_GermanCulture = new CultureInfo("de-DE");
|
24 |
private CultureInfo m_SpanishCulture = new CultureInfo("es-ES");
|
25 |
private CultureInfo m_ItalianCulture = new CultureInfo("it-IT");
|
26 |
private CultureInfo m_BrazilianCulture = new CultureInfo("pt-BR");
|
27 |
private CultureInfo m_RussianCulture = new CultureInfo("ru-RU");
|
28 |
private CultureInfo m_ChineseCulture = new CultureInfo("zh-CN");
|
29 |
|
30 |
private String version;
|
31 |
private String product;
|
32 |
private String desktop;
|
33 |
|
34 |
public autorunForm()
|
35 |
{
|
36 |
InitializeComponent();
|
37 |
UpdateUI();
|
38 |
}
|
39 |
|
40 |
private void Form1_Load(object sender, EventArgs e)
|
41 |
{
|
42 |
foreach (DriveInfo d in allDrives)
|
43 |
{
|
44 |
if (d.IsReady == true && d.DriveFormat == "CDFS")
|
45 |
{
|
46 |
String[] temp = d.VolumeLabel.Split('-');
|
47 |
String tempo = temp[1].ToString().Substring(temp[1].ToString().Length - 1);
|
48 |
|
49 |
switch (temp[0].ToString())
|
50 |
{
|
51 |
case "Free":
|
52 |
product = "Free";
|
53 |
break;
|
54 |
case "One":
|
55 |
product = "One";
|
56 |
break;
|
57 |
case "PWP":
|
58 |
product = "Powerpack";
|
59 |
break;
|
60 |
default:
|
61 |
break;
|
62 |
}
|
63 |
|
64 |
if (tempo == "1")
|
65 |
{
|
66 |
product_label.Text = product + " " + temp[1].TrimEnd('1').ToString() + " Spring";
|
67 |
version = temp[1].TrimEnd('1').ToString() + ".1";
|
68 |
}
|
69 |
else
|
70 |
{
|
71 |
product_label.Text = product + " " + temp[1].ToString();
|
72 |
version = temp[1].TrimEnd('1').ToString() + ".0";
|
73 |
}
|
74 |
if (product == "One")
|
75 |
{
|
76 |
product_label.Text += " " + temp[2].ToString();
|
77 |
arch_label.Text = "32-bit";
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
switch (temp[2][0].ToString())
|
82 |
{
|
83 |
case "i":
|
84 |
arch_label.Text = "32-bit";
|
85 |
break;
|
86 |
case "x":
|
87 |
arch_label.Text = "64-bit";
|
88 |
break;
|
89 |
case "d":
|
90 |
arch_label.Text = "Dual Arch";
|
91 |
break;
|
92 |
default:
|
93 |
break;
|
94 |
}
|
95 |
}
|
96 |
}
|
97 |
}
|
98 |
UpdateUI();
|
99 |
}
|
100 |
|
101 |
private void MDVlink_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
|
102 |
{
|
103 |
String[] temp = Thread.CurrentThread.CurrentUICulture.Name.Split('-');
|
104 |
String tempo = temp[0].ToString();
|
105 |
switch (tempo)
|
106 |
{
|
107 |
case "pt":
|
108 |
tempo = "pt-br";
|
109 |
break;
|
110 |
case "zh":
|
111 |
tempo = "zh-hans";
|
112 |
break;
|
113 |
default:
|
114 |
break;
|
115 |
}
|
116 |
System.Diagnostics.Process.Start("http://mageia.org/" + tempo);
|
117 |
}
|
118 |
|
119 |
private void notes_button_Click(object sender, EventArgs e)
|
120 |
{
|
121 |
String[] temp = Thread.CurrentThread.CurrentUICulture.Name.Split('-');
|
122 |
String tempo = temp[0].ToString();
|
123 |
String url = "http://mageia.org/wiki/" + tempo + "/" + version + "_Notes";
|
124 |
System.Diagnostics.Process.Start(url);
|
125 |
}
|
126 |
|
127 |
private void community_button_Click(object sender, EventArgs e)
|
128 |
{
|
129 |
String[] temp = Thread.CurrentThread.CurrentUICulture.Name.Split('-');
|
130 |
String tempo = temp[0].ToString();
|
131 |
switch (tempo)
|
132 |
{
|
133 |
case "en":
|
134 |
tempo = ".com/" + tempo + "/community";
|
135 |
break;
|
136 |
case "fr":
|
137 |
tempo = ".com/" + tempo + "/communaute/bienvenue";
|
138 |
break;
|
139 |
case "de":
|
140 |
tempo = ".com/en/community";
|
141 |
break;
|
142 |
case "es":
|
143 |
tempo = ".com/" + tempo + "/Bienvenido";
|
144 |
break;
|
145 |
case "it":
|
146 |
tempo = ".com/en/community";
|
147 |
break;
|
148 |
case "pt":
|
149 |
tempo = ".com/en/community";
|
150 |
break;
|
151 |
case "ru":
|
152 |
tempo = ".ru/community";
|
153 |
break;
|
154 |
case "zh":
|
155 |
tempo = ".com/en/community";
|
156 |
break;
|
157 |
default:
|
158 |
break;
|
159 |
}
|
160 |
System.Diagnostics.Process.Start("http://mageia" + tempo);
|
161 |
}
|
162 |
|
163 |
private void store_button_Click(object sender, EventArgs e)
|
164 |
{
|
165 |
System.Diagnostics.Process.Start("http://mageia.org");
|
166 |
}
|
167 |
|
168 |
private void install_button_Click(object sender, EventArgs e)
|
169 |
{
|
170 |
DialogResult result = new DialogResult();
|
171 |
result = MessageBox.Show(m_ResourceManager.GetString("textWarningReboot"), m_ResourceManager.GetString("labelInstallButton"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
172 |
|
173 |
if (result == DialogResult.Yes)
|
174 |
{
|
175 |
System.Diagnostics.Process.Start("ShutDown", "-r -t 0");
|
176 |
}
|
177 |
}
|
178 |
|
179 |
private void flagGB_Click(object sender, EventArgs e)
|
180 |
{
|
181 |
Thread.CurrentThread.CurrentUICulture = m_EnglishCulture;
|
182 |
UpdateUI();
|
183 |
}
|
184 |
|
185 |
private void flagFR_Click(object sender, EventArgs e)
|
186 |
{
|
187 |
Thread.CurrentThread.CurrentUICulture = m_FrenchCulture;
|
188 |
UpdateUI();
|
189 |
}
|
190 |
|
191 |
private void flagDE_Click(object sender, EventArgs e)
|
192 |
{
|
193 |
Thread.CurrentThread.CurrentUICulture = m_GermanCulture;
|
194 |
UpdateUI();
|
195 |
}
|
196 |
|
197 |
private void flagES_Click(object sender, EventArgs e)
|
198 |
{
|
199 |
Thread.CurrentThread.CurrentUICulture = m_SpanishCulture;
|
200 |
UpdateUI();
|
201 |
}
|
202 |
|
203 |
private void flagIT_Click(object sender, EventArgs e)
|
204 |
{
|
205 |
Thread.CurrentThread.CurrentUICulture = m_ItalianCulture;
|
206 |
UpdateUI();
|
207 |
}
|
208 |
|
209 |
private void flagBR_Click(object sender, EventArgs e)
|
210 |
{
|
211 |
Thread.CurrentThread.CurrentUICulture = m_BrazilianCulture;
|
212 |
UpdateUI();
|
213 |
}
|
214 |
|
215 |
private void flagRU_Click(object sender, EventArgs e)
|
216 |
{
|
217 |
Thread.CurrentThread.CurrentUICulture = m_RussianCulture;
|
218 |
UpdateUI();
|
219 |
}
|
220 |
|
221 |
private void flagCN_Click(object sender, EventArgs e)
|
222 |
{
|
223 |
Thread.CurrentThread.CurrentUICulture = m_ChineseCulture;
|
224 |
UpdateUI();
|
225 |
}
|
226 |
|
227 |
private void UpdateUI()
|
228 |
{
|
229 |
if (product == "One")
|
230 |
{
|
231 |
install_button.Text = m_ResourceManager.GetString("labelRestartButton");
|
232 |
}
|
233 |
else
|
234 |
{
|
235 |
install_button.Text = m_ResourceManager.GetString("labelInstallButton");
|
236 |
}
|
237 |
notes_button.Text = m_ResourceManager.GetString("labelNotesButton");
|
238 |
community_button.Text = m_ResourceManager.GetString("labelCommunityButton");
|
239 |
store_button.Text = m_ResourceManager.GetString("labelStoreButton");
|
240 |
}
|
241 |
}
|
242 |
}
|