2 using System.Collections.Generic;
\r
3 using System.Windows.Forms;
\r
6 namespace AppliStation
\r
12 PackageListViewForm form;
\r
15 ///
\83A
\83v
\83\8a\83P
\81[
\83V
\83\87\83\93\82Ì
\83I
\83v
\83V
\83\87\83\93\r
17 Dictionary<string, object> appArgs;
\r
19 string[] restAppArgs;
\r
23 appArgs = new Dictionary<string, object>();
\r
24 appArgs["noupdate"] = false;
\r
25 appArgs["cmd"] = string.Empty;
\r
26 appArgs["pkgsref"] = string.Empty;
\r
28 form = new PackageListViewForm();
\r
33 form.Load += delegate(object sender, EventArgs e) {
\r
35 form.updateActionInvoke(((bool)appArgs["noupdate"]) != true);
\r
37 form.UpdatePackageList();
\r
39 Application.Run(form);
\r
45 NaGet.Packages.Package[] pkgs = NaGet.Utils.GetDeserializedObject<NaGet.Packages.Package[]>((string) appArgs["pkgsref"]);
\r
48 form.installActionInvoke(pkgs);
\r
49 } catch (UnauthorizedAccessException e) {
\r
50 MessageBox.Show(string.Format("
\8aÇ
\97\9d\8eÒ
\8c \8cÀ
\82É
\8f¸
\8ai
\82µ
\82Ä
\82¢
\82È
\82¢
\82©
\81A
\8eÀ
\8ds
\8c \8cÀ
\82É
\96â
\91è
\82ª
\82 \82è
\82Ü
\82·
\81B\n(
\8fÚ
\8d×:{0})", e.Message),
\r
51 Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
52 } catch (FileNotFoundException e) {
\r
53 MessageBox.Show(string.Format("
\83\
\83t
\83g
\8ew
\92è
\83t
\83@
\83C
\83\8b{0}
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ", e.FileName),
\r
54 Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
61 NaGet.Packages.Install.InstalledPackage[] pkgs = NaGet.Utils.GetDeserializedObject<NaGet.Packages.Install.InstalledPackage[]>((string) appArgs["pkgsref"]);
\r
64 form.uninstallActionInvoke(pkgs);
\r
65 } catch (UnauthorizedAccessException e) {
\r
66 MessageBox.Show(string.Format("
\8aÇ
\97\9d\8eÒ
\8c \8cÀ
\82É
\8f¸
\8ai
\82µ
\82Ä
\82¢
\82È
\82¢
\82©
\81A
\8eÀ
\8ds
\8c \8cÀ
\82É
\96â
\91è
\82ª
\82 \82è
\82Ü
\82·
\81B\n(
\8fÚ
\8d×:{0})", e.Message),
\r
67 Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
68 } catch (FileNotFoundException e) {
\r
69 MessageBox.Show(string.Format("
\83\
\83t
\83g
\8ew
\92è
\83t
\83@
\83C
\83\8b{0}
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ", e.FileName),
\r
70 Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
74 private void hideSplashScreen()
\r
76 if (splashScreen != null && splashScreen.Visible) {
\r
77 splashScreen.Hide();
\r
78 splashScreen.Dispose();
\r
82 public void Run(string[] args)
\r
86 switch ((string) appArgs["cmd"]) {
\r
99 private void parseArgs(string[] args)
\r
101 ArgParse parser = new ArgParse(appArgs);
\r
102 restAppArgs = parser.Parse(args);
\r
106 public static void Main(string[] args)
\r
108 Form splashScreen = null;
\r
111 if (args.Length <= 0) { // HACK
\88ø
\90\94\83p
\81[
\83X
\82Ì
\8e\9e\8aÔ
\82³
\82¦
\91Ò
\82Ä
\82È
\82¢
\82Ì
\82Å
\88ø
\90\94\82Ì
\97L
\96³
\82Å
\95\
\8e¦
\82ð
\94»
\92f
\r
112 splashScreen = new Form();
\r
113 splashScreen.FormBorderStyle = FormBorderStyle.None;
\r
114 splashScreen.BackgroundImage = System.Drawing.Bitmap.FromFile(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "SplashScreen.png"));
\r
115 splashScreen.Size = splashScreen.BackgroundImage.Size;
\r
116 splashScreen.ShowIcon = false;
\r
117 splashScreen.ShowInTaskbar = false;
\r
118 splashScreen.StartPosition = FormStartPosition.CenterScreen;
\r
119 splashScreen.Show();
\r
122 ToolStripManager.VisualStylesEnabled = false; // ToolStrip
\82ªLuna
\82Å
\90Â
\82
\82È
\82ç
\82È
\82¢
\82æ
\82¤
\82É
\r
123 Application.EnableVisualStyles(); // Luna
\82âVista
\82Ì
\83f
\83U
\83C
\83\93\82ð
\97L
\8cø
\82É
\r
125 Application.ThreadException += AppliStation.Util.ExceptionDialogForm.Application_ThrowException;
\r
126 System.Threading.Thread.GetDomain().UnhandledException += AppliStation.Util.ExceptionDialogForm.Application_ThrowException;
\r
128 Program prog = new Program();
\r
129 prog.splashScreen = splashScreen;
\r
131 } catch (Exception e) {
\r
132 AppliStation.Util.ExceptionDialogForm.Application_ThrowException(null, new System.Threading.ThreadExceptionEventArgs(e));
\r
134 if (splashScreen != null) {
\r
135 splashScreen.Dispose();
\r