Skip to content

Commit d8386d8

Browse files
committed
Add function summaries
1 parent 303cb79 commit d8386d8

4 files changed

Lines changed: 58 additions & 11 deletions

File tree

app/Project Tracker Installer/Project Tracker Installer/Installer.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010
namespace Project_Tracker_Installer {
1111
class Installer {
12+
/// <summary>
13+
/// Installs the latest Project Tracker program to the user's computer.
14+
/// </summary>
15+
/// <param name="PROGRAM_PATH">The path of the unzipped program.</param>
16+
/// <param name="INSTALL_DIRECTORY">The directory to install to.</param>
17+
/// <param name="ONLINE_PROGRAM_LINK">The URL to the program download.</param>
18+
/// <param name="ZIP_PATH">The zip path to download to and extract from.</param>
19+
/// <returns></returns>
1220
public bool InstallProgram(string PROGRAM_PATH, string INSTALL_DIRECTORY, string ONLINE_PROGRAM_LINK, string ZIP_PATH) {
1321
if (System.IO.File.Exists(PROGRAM_PATH)) {
1422
System.IO.File.Delete(PROGRAM_PATH);
@@ -32,6 +40,16 @@ public bool InstallProgram(string PROGRAM_PATH, string INSTALL_DIRECTORY, string
3240

3341
}
3442

43+
/// <summary>
44+
/// Creates a program uninstall registry and a shortcut.
45+
/// </summary>
46+
/// <param name="REGISTRY">The title of the registry entry to create.</param>
47+
/// <param name="PROGRAM_TITLE">The title of the program.</param>
48+
/// <param name="PROGRAM_VERSION">The version of the program we're installing.</param>
49+
/// <param name="ICON_PATH">The path to the icon.</param>
50+
/// <param name="PROGRAM_PATH">The path to the installed program.</param>
51+
/// <param name="INSTALL_DIRECTORY">The directory of the installed program.</param>
52+
/// <param name="SHORTCUT_LOCATION">The path for the shortcut.</param>
3553
public void CreateUninstaller(string REGISTRY, string PROGRAM_TITLE, string PROGRAM_VERSION, string ICON_PATH, string PROGRAM_PATH, string INSTALL_DIRECTORY, string SHORTCUT_LOCATION) {
3654
RegistryKey keyCheck = Registry.CurrentUser.OpenSubKey(REGISTRY);
3755

app/Project Tracker Installer/Project Tracker Installer/MainWindow.xaml.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public MainWindow() {
4242
startup();
4343
}
4444

45+
/// <summary>
46+
/// Retrieves the latest available version from the server.
47+
/// </summary>
4548
private void GetVersion(object sender, AsyncCompletedEventArgs e) {
4649
try {
4750
PROGRAM_VERSION = File.ReadAllText(VERSION_PATH);
@@ -66,6 +69,9 @@ private void GetVersion(object sender, AsyncCompletedEventArgs e) {
6669
}
6770
}
6871

72+
/// <summary>
73+
/// Startup method, runs when code execution begins.
74+
/// </summary>
6975
void startup() {
7076
subTitle.Content = "Version: " + PROGRAM_VERSION;
7177

@@ -168,9 +174,9 @@ void startup() {
168174
}
169175
}
170176

171-
/*
172-
* When the user clicks to open the Projet Tracker program
173-
*/
177+
/// <summary>
178+
/// Launches the program from PROGRAM_PATH.
179+
/// </summary>
174180
private void LaunchButtonClick(object sender, RoutedEventArgs e) {
175181
ProcessStartInfo start = new ProcessStartInfo {
176182
// Enter the executable to run, including the complete path
@@ -183,10 +189,10 @@ private void LaunchButtonClick(object sender, RoutedEventArgs e) {
183189
Environment.Exit(0);
184190
}
185191

186-
187-
/* When the user clicks the reinstall button
188-
* This runs the same install button procedure, just deletes the contents of the program first and sets uninstall to false
189-
*/
192+
/// <summary>
193+
/// Runs when the user clicks on the reinstall button.
194+
/// Uninstalls and then installs the program.
195+
/// </summary>
190196
private void ReinstallButtonClick(object sender, RoutedEventArgs e) {
191197
reinstallButton.Visibility = Visibility.Hidden;
192198
installButton.Visibility = Visibility.Hidden;
@@ -218,9 +224,11 @@ private void ReinstallButtonClick(object sender, RoutedEventArgs e) {
218224

219225
FinalResult("Project Tracker has been installed!");
220226
}
221-
/*
222-
* When the user clicks on the install button
223-
*/
227+
228+
/// <summary>
229+
/// Runs when the user clicks on the install button.
230+
/// If the program is already installed, it becomes an uninstall button.
231+
/// </summary>
224232
private void InstallButtonClick(object sender, RoutedEventArgs e) {
225233
if (retrying == true) {
226234
installButton.Content = "Install";
@@ -329,11 +337,15 @@ private void InstallButtonClick(object sender, RoutedEventArgs e) {
329337

330338
FinalResult("Successfully uninstalled!");
331339
}));
332-
333340
}
334341

335342
}
336343

344+
/// <summary>
345+
/// A final display presented to the user after code execution has finished.
346+
/// Used to display the success or failure of the installation.
347+
/// </summary>
348+
/// <param name="main">The main title text.</param>
337349
public void FinalResult(string main) {
338350
Dispatcher.Invoke(new Action(() => {
339351
installBar.Visibility = Visibility.Hidden;
@@ -366,6 +378,9 @@ public void FinalResult(string main) {
366378
}));
367379
}
368380

381+
/// <summary>
382+
/// Runs before window is closed after the user closes the program.
383+
/// </summary>
369384
private void Window_Closing(object sender, CancelEventArgs e) {
370385
Environment.Exit(0);
371386
}

app/Project Tracker Installer/Project Tracker Installer/Uninstaller.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
namespace Project_Tracker_Installer {
77
class Uninstaller {
8+
/// <summary>
9+
/// Main uninstall function.
10+
/// Prompts user to delete data and deletes every other file.
11+
/// </summary>
12+
/// <param name="DATA_DIRECTORY_PATH">The directory where the user's data lies.</param>
13+
/// <param name="INSTALLER_PATH">The path of the installer to not delete.</param>
14+
/// <param name="INSTALL_DIRECTORY">The path of the install program directory.</param>
15+
/// <param name="REGISTRY">The title of the registry entry to remove.</param>
16+
/// <param name="SHORTCUT_LOCATION">The path of the shortcut to delete.</param>
817
public void Uninstall(string DATA_DIRECTORY_PATH, string INSTALLER_PATH, string INSTALL_DIRECTORY, string REGISTRY = "", string SHORTCUT_LOCATION = "") {
918
if (Directory.Exists(DATA_DIRECTORY_PATH)) {
1019
var deleteData = MessageBox.Show("Do you wish to delete your projects data?", "Project Tracker Installer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
@@ -30,6 +39,11 @@ public void Uninstall(string DATA_DIRECTORY_PATH, string INSTALLER_PATH, string
3039

3140
}
3241

42+
/// <summary>
43+
/// Deletes the registry value for the program.
44+
/// </summary>
45+
/// <param name="REGISTRY">The title of the registry entry to remove.</param>
46+
/// <param name="SHORTCUT_LOCATION">The path of the shortcut to delete.</param>
3347
private void RemoveRegistry(string REGISTRY, string SHORTCUT_LOCATION) {
3448
Registry.CurrentUser.DeleteSubKey(REGISTRY);
3549
File.Delete(SHORTCUT_LOCATION);
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)