This repository was archived by the owner on Apr 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGitBootstrap.cs
More file actions
57 lines (52 loc) · 1.87 KB
/
GitBootstrap.cs
File metadata and controls
57 lines (52 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FreedeckLauncher
{
public partial class GitBootstrap : Form
{
public GitBootstrap()
{
InitializeComponent();
}
String folder = System.Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
private void GitBootstrap_Load(object sender, EventArgs e)
{
WebClient wc = new WebClient();
wc.DownloadFileTaskAsync("https://github.com/git-for-windows/git/releases/download/v2.44.0.windows.1/Git-2.44.0-64-bit.exe", folder+"\\git-installer.exe");
wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
wc.DownloadFileCompleted += Wc_DownloadFileCompleted;
}
private void Wc_DownloadFileCompleted(object? sender, AsyncCompletedEventArgs e)
{
label2.Text = "Please follow the git installer's instructions!";
Process proc = new Process();
proc.StartInfo.WorkingDirectory = folder;
proc.StartInfo.FileName = folder + "\\git-installer.exe";
proc.EnableRaisingEvents = true;
proc.Exited += Proc_Exited;
proc.Start();
}
private void Proc_Exited(object? sender, EventArgs e)
{
Console.WriteLine("Git probably installed");
this.Invoke((MethodInvoker)delegate
{
// close the form on the forms thread
this.Close();
});
}
private void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
}
}