Repository: louislam/uptime-kuma
File: extra/exe-builder/Program.cs (C#)

Code before:
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                });

            } catch (Exception e) {
                MessageBox.Show("Startup failed: " + e.Message, "Uptime Kuma Error");
            }
        }

        void StopProcess() {
            process?.Kill();
        }

        void Open(object sender, EventArgs e) {
            Process.Start("http://localhost:3001");
        }

        void DebugConsole(object sender, EventArgs e) {

        }

        void CheckForUpdate(object sender, EventArgs e) {
            if (intranetOnly)
            {
                MessageBox.Show("You have parsed in --intranet so we will not try to access the internet.");
                return;
            }

            // Check version.json exists
            if (File.Exists("version.json")) {
                // Load version.json and compare with the latest version from GitHub
                var currentVersionObj = JsonConvert.DeserializeObject<Version>(File.ReadAllText("version.json"));

                var versionJson = new WebClient().DownloadString("https://uptime.kuma.pet/version");
                var latestVersionObj = JsonConvert.DeserializeObject<Version>(versionJson);

                // Compare version, if the latest version is newer, then update
                if (new System.Version(latestVersionObj.latest).CompareTo(new System.Version(currentVersionObj.latest)) > 0) {
                    var result = MessageBox.Show("A new version is available. Do you want to update?", "Update", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes) {
                        // Create a empty file `update`, so the app will download the core files again at startup
                        File.Create("update").Close();

                        trayIcon.Visible = false;
                        process?.Kill();

                        // Restart the app, it will download the core files again at startup
                        Application.Restart();
                    }
                } else {

Review comment (suggestion):
`The --intranet argument was provided, so we will not try to access the internet.` should already be in the log => I don't see why logging this again has additional value

```suggestion
```

Code after:

            } catch (Exception e) {
                MessageBox.Show("Startup failed: " + e.Message, "Uptime Kuma Error");
            }
        }

        void StopProcess() {
            process?.Kill();
        }

        void Open(object sender, EventArgs e) {
            Process.Start("http://localhost:3001");
        }

        void DebugConsole(object sender, EventArgs e) {

        }

        void CheckForUpdate(object sender, EventArgs e) {
            if (intranetOnly) {
                return;
            }

            // Check version.json exists
            if (File.Exists("version.json")) {
                // Load version.json and compare with the latest version from GitHub
                var currentVersionObj = JsonConvert.DeserializeObject<Version>(File.ReadAllText("version.json"));

                var versionJson = new WebClient().DownloadString("https://uptime.kuma.pet/version");
                var latestVersionObj = JsonConvert.DeserializeObject<Version>(versionJson);

                // Compare version, if the latest version is newer, then update
                if (new System.Version(latestVersionObj.latest).CompareTo(new System.Version(currentVersionObj.latest)) > 0) {
                    var result = MessageBox.Show("A new version is available. Do you want to update?", "Update", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes) {
                        // Create a empty file `update`, so the app will download the core files again at startup
                        File.Create("update").Close();

                        trayIcon.Visible = false;
                        process?.Kill();

                        // Restart the app, it will download the core files again at startup
                        Application.Restart();
                    }
                } else {
                    MessageBox.Show("You are using the latest version.");
                }
            }


        }