Repository: Kyome22/RunCat_for_windows
File: RunCat365/Program.cs (C#)

Code before:
                bool changeCheck = false;
                if (startupTask is null) startupTask = await StartupTask.GetAsync("RunCatStartup");
                if (active) {
                    switch (startupTask.State) {
                        case StartupTaskState.Enabled:
                            changeCheck = true;
                            break;
                        case StartupTaskState.Disabled:
                            StartupTaskState newState = await startupTask.RequestEnableAsync();
                            if (newState == StartupTaskState.Enabled) {
                                changeCheck = true;
                            } else {
                                MessageBox.Show("Launch at Startup could not be activated.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                changeCheck = false;
                            }
                            break;
                        case StartupTaskState.DisabledByUser:
                            MessageBox.Show("Launch at startup was disabled by the user, enable it in Task Manager > Startup, search RunCat365 and enable it.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            changeCheck = false;
                            break;
                        case StartupTaskState.DisabledByPolicy:
                            MessageBox.Show("Launch at startup was disabled by policy.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            changeCheck = false;
                            break;
                    }
                } else if (!active) {
                    if (startupTask.State == StartupTaskState.Enabled) startupTask.Disable();
                    changeCheck = true;
                }
                return changeCheck;
            } else {
                var productName = Application.ProductName;
                if (productName is null) return false;
                var keyName = @"Software\Microsoft\Windows\CurrentVersion\Run";
                using var rKey = Registry.CurrentUser.OpenSubKey(keyName, true);
                if (rKey is null) return false;
                if (isChecked) {
                    rKey.DeleteValue(productName, false);
                } else {
                    var fileName = Environment.ProcessPath;
                    if (fileName != null) {
                        rKey.SetValue(productName, fileName);
                    }
                }
                rKey.Close();
                return true;
            }
        }

        private static bool IsRunningAsPackaged() {
            try {

Review comment (suggestion):
This can be simplified to just `else`, since `active` is a boolean.
```suggestion
                } else {
```

Code after:
        private static void OpenRepository()
        {
            try
            {
                Process.Start(new ProcessStartInfo()
                {
                    FileName = "https://github.com/Kyome22/RunCat365.git",
                    UseShellExecute = true
                });
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e.Message}");
            }
        }

        private void Exit()
        {
            cpuRepository.Close();
            animateTimer.Stop();
            fetchTimer.Stop();
            contextMenuManager.HideNotifyIcon();
            Application.Exit();
        }

        private void OnApplicationExit(object? sender, EventArgs e)
        {
            UserSettings.Default.Runner = runner.ToString();
            UserSettings.Default.Theme = manualTheme.ToString();
            UserSettings.Default.FPSMaxLimit = fpsMaxLimit.ToString();
            UserSettings.Default.Save();
        }

        private void AnimationTick(object? sender, EventArgs e)
        {
            contextMenuManager.AdvanceFrame();
        }

        private void FetchSystemInfo(
            CPUInfo cpuInfo,
            MemoryInfo memoryInfo,
            List<StorageInfo> storageValue
        )
        {
            contextMenuManager.SetNotifyIconText(cpuInfo.GetDescription());

            var systemInfoValues = new List<string>();
            systemInfoValues.AddRange(cpuInfo.GenerateIndicator());
            systemInfoValues.AddRange(memoryInfo.GenerateIndicator());
            systemInfoValues.AddRange(storageValue.GenerateIndicator());
            contextMenuManager.SetSystemInfoMenuText(string.Join("\n", [.. systemInfoValues]));