code cosmetic

This commit is contained in:
2024-06-18 10:59:08 +02:00
parent deb14caf24
commit 0f3e93bfff
4 changed files with 9 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, string localPath)
public delegate void CheckingProgressUpdatedEventHandler(int toCheck, int processed);
private HttpClient httpClient = new();
private readonly HttpClient httpClient = new();
~ModpackInstaller()
{
@@ -37,7 +37,7 @@ public class ModpackInstaller(ModpackConfig updateConfig, string localPath)
return InstallInfos.Parse(content);
}
public async Task<UpdateCheckResult> Check(bool ignoreRevmoedFiles)
public async Task<UpdateCheckResult> Check()
{
var result = new UpdateCheckResult();
@@ -106,10 +106,8 @@ public class ModpackInstaller(ModpackConfig updateConfig, string localPath)
{
string destFilePath = Path.Combine(localPath, iaction.DestPath);
if (iaction is UpdateAction)
if (iaction is UpdateAction uaction)
{
UpdateAction uaction = (UpdateAction)iaction;
switch (uaction.Type)
{
case UpdateActionType.Update:

View File

@@ -7,13 +7,11 @@ public class AppConfig
public string LastMinecraftProfilePath { get; set; }
public string LastConfigFilePath { get; set; }
public List<string> KeepLocalFiles { get; set; } = [];
public bool AllowRemoveLocalFiles { get; set; }
public void Reset()
{
KeepLocalFiles.Clear();
KeepLocalFiles.Add("OptiFine_1.7.10_HD_U_E7.jar");
AllowRemoveLocalFiles = false;
}
private static AppConfig instance = null;

View File

@@ -40,7 +40,8 @@ public partial class Form1
private bool CheckStatus()
{
bool CheckStatusRet = default;
bool CheckStatusRet;
if (!IsMinecaftProfileLoaded() || !MinecraftProfileChecker.CheckProfile(GetMinecraftProfilePath()))
{
SetStatus(LangRes.StatusText_MinecraftProfileWarning, MySymbols.icons8_general_warning_sign_16px);
@@ -52,9 +53,7 @@ public partial class Form1
CheckStatusRet = false;
}
else
{
CheckStatusRet = true;
}
return CheckStatusRet;
}
@@ -91,7 +90,7 @@ public partial class Form1
if (IsUpdateConfigLoaded())
updateConfig = (ModpackConfig)ModpackConfig.LoadFromUrl(filePath);
}
catch (Exception ex)
catch
{
RadTextBoxControl_ModpackConfig.Text = string.Empty;
}
@@ -117,9 +116,9 @@ public partial class Form1
try
{
lastUpdateCheckResult = await updater.Check(!AppConfig.Instance.AllowRemoveLocalFiles);
lastUpdateCheckResult = await updater.Check();
}
catch (Exception ex)
catch
{
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px);
}

View File

@@ -57,6 +57,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pilz.Configuration" Version="3.1.2" />
<PackageReference Include="Pilz.Cryptography" Version="2.0.1" />
<PackageReference Include="Pilz.IO" Version="2.0.0" />
<PackageReference Include="Pilz.Win32" Version="2.0.0" />