diff --git a/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj b/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj deleted file mode 100644 index 36ae3a6..0000000 --- a/ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - ModpackUpdater.GitLab - net8.0 - - - - - - - diff --git a/ModpackUpdater.GitLab/UpdateConfigExt.vb b/ModpackUpdater.GitLab/UpdateConfigExt.vb deleted file mode 100644 index be312ed..0000000 --- a/ModpackUpdater.GitLab/UpdateConfigExt.vb +++ /dev/null @@ -1,33 +0,0 @@ -Imports System.Net.Http - -Imports ModpackUpdater.Model - -Imports Newtonsoft.Json - -Public Class UpdateConfigExt - - ' - 'Public Sub SaveToSnippet(config As UpdateConfig, gitlabUrl As String, gitlabToken As String, projectId As Integer, snippetId As Integer, snippetFilePath As String) - ' Dim client As New GitLabClient(gitlabUrl, gitlabToken) - ' Dim update As New SnippetProjectUpdate With { - ' .Visibility = VisibilityLevel.Public, - ' .ProjectId = projectId, - ' .SnippetId = snippetId, - ' .Files = { - ' New SnippetUpdateFile With { - ' .Action = SnippetUpdateFileAction.Update.Create, - ' .FilePath = snippetFilePath, - ' .Content = JsonConvert.SerializeObject(config) - ' } - ' } - ' } - ' client.Snippets.Update(update) - 'End Sub - - Public Shared Function LoadFromSnippet(url As String) As ModpackConfig - Dim client As New HttpClient - Dim result = client.GetStringAsync(url).Result - Return JsonConvert.DeserializeObject(Of ModpackConfig)(result) - End Function - -End Class diff --git a/ModpackUpdater.Manager/Extensions.cs b/ModpackUpdater.Manager/Extensions.cs new file mode 100644 index 0000000..3c6c9f8 --- /dev/null +++ b/ModpackUpdater.Manager/Extensions.cs @@ -0,0 +1,40 @@ +namespace ModpackUpdater.Manager; + + +public static class Extensions +{ + + public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive) + { + // Get information about the source directory + var dir = new DirectoryInfo(sourceDir); + + // Check if the source directory exists + if (!dir.Exists) + throw new DirectoryNotFoundException($"Source directory not found: {dir.FullName}"); + + // Cache directories before we start copying + DirectoryInfo[] dirs = dir.GetDirectories(); + + // Create the destination directory + Directory.CreateDirectory(destinationDir); + + // Get the files in the source directory and copy to the destination directory + foreach (FileInfo @file in dir.GetFiles()) + { + string targetFilePath = Path.Combine(destinationDir, @file.Name); + @file.CopyTo(targetFilePath); + } + + // If recursive and copying subdirectories, recursively call this method + if (recursive) + { + foreach (DirectoryInfo subDir in dirs) + { + string newDestinationDir = Path.Combine(destinationDir, subDir.Name); + CopyDirectory(subDir.FullName, newDestinationDir, true); + } + } + } + +} \ No newline at end of file diff --git a/ModpackUpdater.Manager/Extensions.vb b/ModpackUpdater.Manager/Extensions.vb deleted file mode 100644 index 3654c35..0000000 --- a/ModpackUpdater.Manager/Extensions.vb +++ /dev/null @@ -1,35 +0,0 @@ -Imports System.IO - -Public Module Extensions - - Public Sub CopyDirectory(sourceDir As String, destinationDir As String, recursive As Boolean) - ' Get information about the source directory - Dim dir As New DirectoryInfo(sourceDir) - - ' Check if the source directory exists - If Not dir.Exists Then - Throw New DirectoryNotFoundException($"Source directory not found: {dir.FullName}") - End If - - ' Cache directories before we start copying - Dim dirs As DirectoryInfo() = dir.GetDirectories() - - ' Create the destination directory - Directory.CreateDirectory(destinationDir) - - ' Get the files in the source directory and copy to the destination directory - For Each file As FileInfo In dir.GetFiles() - Dim targetFilePath As String = Path.Combine(destinationDir, file.Name) - file.CopyTo(targetFilePath) - Next - - ' If recursive and copying subdirectories, recursively call this method - If recursive Then - For Each subDir As DirectoryInfo In dirs - Dim newDestinationDir As String = Path.Combine(destinationDir, subDir.Name) - CopyDirectory(subDir.FullName, newDestinationDir, True) - Next - End If - End Sub - -End Module diff --git a/ModpackUpdater.Manager/MinecraftProfileChecker.cs b/ModpackUpdater.Manager/MinecraftProfileChecker.cs new file mode 100644 index 0000000..e7deed7 --- /dev/null +++ b/ModpackUpdater.Manager/MinecraftProfileChecker.cs @@ -0,0 +1,11 @@ + +namespace ModpackUpdater.Manager; + +public class MinecraftProfileChecker +{ + public static bool CheckProfile(string folderPath) + { + // Todo: Adds some checks to verify, if the current folder is a minecraft folder. + return true; + } +} \ No newline at end of file diff --git a/ModpackUpdater.Manager/MinecraftProfileChecker.vb b/ModpackUpdater.Manager/MinecraftProfileChecker.vb deleted file mode 100644 index 3bf389e..0000000 --- a/ModpackUpdater.Manager/MinecraftProfileChecker.vb +++ /dev/null @@ -1,8 +0,0 @@ -Public Class MinecraftProfileChecker - - Public Shared Function CheckProfile(folderPath As string) As Boolean - 'Todo: Adds some checks to verify, if the current folder is a minecraft folder. - Return True - End Function - -End Class diff --git a/ModpackUpdater.Manager/ModpackInstaller.cs b/ModpackUpdater.Manager/ModpackInstaller.cs new file mode 100644 index 0000000..ed1e0d9 --- /dev/null +++ b/ModpackUpdater.Manager/ModpackInstaller.cs @@ -0,0 +1,211 @@ +using ModpackUpdater.Model; +using System.IO.Compression; + +namespace ModpackUpdater.Manager; + +public class ModpackInstaller(ModpackConfig updateConfig, string localPath) +{ + private class LocalZipCacheEntry + { + public string DownloadUrl { get; set; } + public string ExtractedZipPath { get; set; } + } + + public event InstallProgessUpdatedEventHandler InstallProgessUpdated; + + public delegate void InstallProgessUpdatedEventHandler(UpdateCheckResult result, int processedSyncs); + public event CheckingProgressUpdatedEventHandler CheckingProgressUpdated; + + public delegate void CheckingProgressUpdatedEventHandler(int toCheck, int processed); + + private HttpClient httpClient = new(); + + ~ModpackInstaller() + { + httpClient.Dispose(); + } + + private async Task DownloadUpdateInfos() + { + var content = await httpClient.GetStringAsync(updateConfig.UpdateUrl); + return UpdateInfos.Parse(content); + } + + private async Task DownloadInstallInfos() + { + var content = await httpClient.GetStringAsync(updateConfig.InstallUrl); + return InstallInfos.Parse(content); + } + + public async Task Check(bool ignoreRevmoedFiles) + { + var result = new UpdateCheckResult(); + + if (ModpackInfo.HasModpackInfo(localPath)) + { + var infos = await DownloadUpdateInfos(); + var modpackInfo = ModpackInfo.Load(localPath); + + if (infos is not null && infos.Updates.Count != 0) + { + var updatesOrderes = infos.Updates.OrderByDescending(n => n.Version); + result.LatestVersion = updatesOrderes.First().Version; + result.CurrentVersion = modpackInfo.Version; + result.IsInstalled = true; + + var checkingVersionIndex = 0; + var checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex); + + while (checkingVersion is not null && checkingVersion.Version > result.CurrentVersion) + { + var actionsToAdd = new List(); + + foreach (var action in checkingVersion.Actions) + { + if (!result.Actions.Any(n => n.DestPath == action.DestPath)) + actionsToAdd.Add(action); + } + + result.Actions.InsertRange(0, actionsToAdd); + + checkingVersionIndex += 1; + checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex); + } + } + else + result.HasError = true; + } + + if (!result.IsInstalled) + { + var infos = await DownloadInstallInfos(); + + if (infos is not null && infos.Actions.Count != 0) + result.Actions.AddRange(infos.Actions); + else + result.HasError = true; + } + + return result; + } + + public async Task Install(UpdateCheckResult checkResult) + { + ModpackInfo modpackInfo; + int processed = 0; + var localZipCache = new List(); + + if (ModpackInfo.HasModpackInfo(localPath)) + modpackInfo = ModpackInfo.Load(localPath); + else + { + modpackInfo = new ModpackInfo(); + } + + foreach (InstallAction iaction in checkResult.Actions) + { + string destFilePath = Path.Combine(localPath, iaction.DestPath); + + if (iaction is UpdateAction) + { + UpdateAction uaction = (UpdateAction)iaction; + + switch (uaction.Type) + { + case UpdateActionType.Update: + await InstallFile(destFilePath, uaction.DownloadUrl, uaction.IsZip, uaction.ZipPath, localZipCache); + break; + case UpdateActionType.Delete: + { + if (uaction.IsDirectory) + { + if (Directory.Exists(destFilePath)) + Directory.Delete(destFilePath, true); + } + else if (File.Exists(destFilePath)) + File.Delete(destFilePath); + } + break; + case UpdateActionType.Copy: + { + var srcFilePath = Path.Combine(localPath, uaction.SrcPath); + if (uaction.IsDirectory) + { + if (Directory.Exists(srcFilePath)) + Extensions.CopyDirectory(srcFilePath, destFilePath, true); + } + else if (File.Exists(srcFilePath)) + { + Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)); + File.Copy(srcFilePath, destFilePath, true); + } + } + break; + case UpdateActionType.Move: + { + var srcFilePath = Path.Combine(localPath, uaction.SrcPath); + if (uaction.IsDirectory) + { + if (Directory.Exists(srcFilePath)) + Directory.Move(srcFilePath, destFilePath); + } + else if (File.Exists(srcFilePath)) + { + Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)); + File.Move(srcFilePath, destFilePath, true); + } + } + break; + } + } + else + await InstallFile(destFilePath, iaction.DownloadUrl, iaction.IsZip, iaction.ZipPath, localZipCache); + + processed += 1; + InstallProgessUpdated?.Invoke(checkResult, processed); + } + + // Save new modpack info + modpackInfo.Version = checkResult.LatestVersion; + modpackInfo.Save(localPath); + + // Delete cached zip files + foreach (var task in localZipCache) + Directory.Delete(task.ExtractedZipPath, true); + + return true; + } + + private async Task InstallFile(string destFilePath, string sourceUrl, bool isZip, string zipPath, List localZipCache) + { + Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)); + + // Download + var fsDestinationPath = isZip ? Path.Combine(Path.GetTempPath(), $"mc_update_file_{DateTime.Now.ToBinary()}.zip") : destFilePath; + var sRemote = await httpClient.GetStreamAsync(sourceUrl); + var fs = new FileStream(destFilePath, FileMode.Create, FileAccess.ReadWrite); + await sRemote.CopyToAsync(fs); + sRemote.Close(); + fs.Close(); + + // Handle zip file + if (isZip) + { + // Extract + var zipDir = $"{Path.GetFileNameWithoutExtension(fsDestinationPath)}_extracted"; + ZipFile.ExtractToDirectory(fsDestinationPath, zipDir); + + // Copy content + var zipSrc = Path.Combine(zipDir, zipPath); + Extensions.CopyDirectory(zipSrc, destFilePath, true); + + // Delete/cache temporary files + File.Delete(fsDestinationPath); + localZipCache?.Add(new LocalZipCacheEntry + { + DownloadUrl = sourceUrl, + ExtractedZipPath = zipDir + }); + } + } +} \ No newline at end of file diff --git a/ModpackUpdater.Manager/ModpackInstaller.vb b/ModpackUpdater.Manager/ModpackInstaller.vb deleted file mode 100644 index 874360b..0000000 --- a/ModpackUpdater.Manager/ModpackInstaller.vb +++ /dev/null @@ -1,194 +0,0 @@ -Imports System.IO -Imports System.IO.Compression -Imports System.Net.Http - -Imports ModpackUpdater.Model - -Public Class ModpackInstaller - - Private Class LocalZipCacheEntry - Public Property DownloadUrl As String - Public Property ExtractedZipPath As String - End Class - - Public Event InstallProgessUpdated(result As UpdateCheckResult, processedSyncs As Integer) - Public Event CheckingProgressUpdated(toCheck As Integer, processed As Integer) - - Private ReadOnly updateConfig As ModpackConfig - Private ReadOnly localPath As String - Private httpClient As New HttpClient - - Public Sub New(updateConfig As ModpackConfig, localPath As String) - Me.updateConfig = updateConfig - Me.localPath = localPath - End Sub - - Protected Overrides Sub Finalize() - httpClient.Dispose() - MyBase.Finalize() - End Sub - - Private Async Function DownloadUpdateInfos() As Task(Of UpdateInfos) - Dim content As String = Await httpClient.GetStringAsync(updateConfig.UpdateUrl) - Return UpdateInfos.Parse(content) - End Function - - Private Async Function DownloadInstallInfos() As Task(Of InstallInfos) - Dim content As String = Await httpClient.GetStringAsync(updateConfig.InstallUrl) - Return InstallInfos.Parse(content) - End Function - - Public Async Function Check(ignoreRevmoedFiles As Boolean) As Task(Of UpdateCheckResult) - Dim result As New UpdateCheckResult - - If ModpackInfo.HasModpackInfo(localPath) Then - Dim infos As UpdateInfos = Await DownloadUpdateInfos() - Dim modpackInfo As ModpackInfo = ModpackInfo.Load(localPath) - - If infos IsNot Nothing AndAlso infos.Updates.Count <> 0 Then - Dim updatesOrderes = infos.Updates.OrderByDescending(Function(n) n.Version) - result.LatestVersion = updatesOrderes.First.Version - result.CurrentVersion = modpackInfo.Version - result.IsInstalled = True - - Dim checkingVersionIndex As Integer = 0 - Dim checkingVersion As UpdateInfo = updatesOrderes(checkingVersionIndex) - - Do While checkingVersion IsNot Nothing AndAlso checkingVersion.Version > result.CurrentVersion - Dim actionsToAdd As New List(Of UpdateAction) - - For Each action In checkingVersion.Actions - If Not result.Actions.Any(Function(n) n.DestPath = action.DestPath) Then - actionsToAdd.Add(action) - End If - Next - - result.Actions.InsertRange(0, actionsToAdd) - - checkingVersionIndex += 1 - checkingVersion = updatesOrderes.ElementAtOrDefault(checkingVersionIndex) - Loop - Else - result.HasError = True - End If - End If - - If Not result.IsInstalled Then - Dim infos As InstallInfos = Await DownloadInstallInfos() - - If infos IsNot Nothing AndAlso infos.Actions.Count <> 0 Then - result.Actions.AddRange(infos.Actions) - Else - result.HasError = True - End If - End If - - Return result - End Function - - Public Async Function Install(checkResult As UpdateCheckResult) As Task(Of Boolean?) - Dim modpackInfo As ModpackInfo - Dim processed As Integer = 0 - Dim localZipCache As New List(Of LocalZipCacheEntry) - - If ModpackInfo.HasModpackInfo(localPath) Then - modpackInfo = ModpackInfo.Load(localPath) - Else - modpackInfo = New ModpackInfo - End If - - For Each iaction As InstallAction In checkResult.Actions - Dim destFilePath As String = Path.Combine(localPath, iaction.DestPath) - - If TypeOf iaction Is UpdateAction Then - Dim uaction As UpdateAction = iaction - - Select Case uaction.Type - Case UpdateActionType.Update - Await InstallFile(destFilePath, uaction.DownloadUrl, uaction.IsZip, uaction.ZipPath, localZipCache) - Case UpdateActionType.Delete - If uaction.IsDirectory Then - If Directory.Exists(destFilePath) Then - Directory.Delete(destFilePath, True) - End If - Else - If File.Exists(destFilePath) Then - File.Delete(destFilePath) - End If - End If - Case UpdateActionType.Copy - Dim srcFilePath As String = Path.Combine(localPath, uaction.SrcPath) - If uaction.IsDirectory Then - If Directory.Exists(srcFilePath) Then - CopyDirectory(srcFilePath, destFilePath, True) - End If - Else - If File.Exists(srcFilePath) Then - Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)) - File.Copy(srcFilePath, destFilePath, True) - End If - End If - Case UpdateActionType.Move - Dim srcFilePath As String = Path.Combine(localPath, uaction.SrcPath) - If uaction.IsDirectory Then - If Directory.Exists(srcFilePath) Then - Directory.Move(srcFilePath, destFilePath) - End If - Else - If File.Exists(srcFilePath) Then - Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)) - File.Move(srcFilePath, destFilePath, True) - End If - End If - End Select - Else - Await InstallFile(destFilePath, iaction.DownloadUrl, iaction.IsZip, iaction.ZipPath, localZipCache) - End If - - processed += 1 - RaiseEvent InstallProgessUpdated(checkResult, processed) - Next - - 'Save new modpack info - modpackInfo.Version = checkResult.LatestVersion - modpackInfo.Save(localPath) - - 'Delete cached zip files - For Each task In localZipCache - Directory.Delete(task.ExtractedZipPath, True) - Next - - Return True - End Function - - Private Async Function InstallFile(destFilePath As String, sourceUrl As String, isZip As Boolean, zipPath As String, localZipCache As List(Of LocalZipCacheEntry)) As Task - Directory.CreateDirectory(Path.GetDirectoryName(destFilePath)) - - 'Download - Dim fsDestinationPath As String = If(isZip, Path.Combine(Path.GetTempPath(), $"mc_update_file_{Date.Now.ToBinary}.zip"), destFilePath) - Dim sRemote As Stream = Await httpClient.GetStreamAsync(sourceUrl) - Dim fs As New FileStream(destFilePath, FileMode.Create, FileAccess.ReadWrite) - Await sRemote.CopyToAsync(fs) - sRemote.Close() - fs.Close() - - 'Handle zip file - If isZip Then - 'Extract - Dim zipDir As String = $"{Path.GetFileNameWithoutExtension(fsDestinationPath)}_extracted" - ZipFile.ExtractToDirectory(fsDestinationPath, zipDir) - - 'Copy content - Dim zipSrc As String = Path.Combine(zipDir, zipPath) - CopyDirectory(zipSrc, destFilePath, True) - - 'Delete/cache temporary files - File.Delete(fsDestinationPath) - localZipCache?.Add(New LocalZipCacheEntry With { - .DownloadUrl = sourceUrl, - .ExtractedZipPath = zipDir - }) - End If - End Function - -End Class diff --git a/ModpackUpdater.Manager/ModpackUpdater.Manager.vbproj b/ModpackUpdater.Manager/ModpackUpdater.Manager.csproj similarity index 77% rename from ModpackUpdater.Manager/ModpackUpdater.Manager.vbproj rename to ModpackUpdater.Manager/ModpackUpdater.Manager.csproj index c976e8f..5fc9312 100644 --- a/ModpackUpdater.Manager/ModpackUpdater.Manager.vbproj +++ b/ModpackUpdater.Manager/ModpackUpdater.Manager.csproj @@ -1,16 +1,16 @@  - + - ModpackUpdater.Manager net8.0 + true - + - + - + - - + + \ No newline at end of file diff --git a/ModpackUpdater.Manager/UpdateCheckResult.cs b/ModpackUpdater.Manager/UpdateCheckResult.cs new file mode 100644 index 0000000..77c8335 --- /dev/null +++ b/ModpackUpdater.Manager/UpdateCheckResult.cs @@ -0,0 +1,13 @@ +using ModpackUpdater.Model; + +namespace ModpackUpdater.Manager; + +public class UpdateCheckResult +{ + public Version CurrentVersion { get; set; } + public Version LatestVersion { get; set; } + public List Actions { get; private set; } = []; + public bool IsInstalled { get; set; } + public bool HasError { get; set; } + public bool HasUpdates => !IsInstalled || CurrentVersion < LatestVersion; +} \ No newline at end of file diff --git a/ModpackUpdater.Manager/UpdateCheckResult.vb b/ModpackUpdater.Manager/UpdateCheckResult.vb deleted file mode 100644 index 09b33fd..0000000 --- a/ModpackUpdater.Manager/UpdateCheckResult.vb +++ /dev/null @@ -1,17 +0,0 @@ -Imports ModpackUpdater.Model - -Public Class UpdateCheckResult - - Public Property CurrentVersion As Version - Public Property LatestVersion As Version - Public ReadOnly Property Actions As New List(Of InstallAction) - Public Property IsInstalled As Boolean - Public Property HasError As Boolean - - Public ReadOnly Property HasUpdates As Boolean - Get - Return Not IsInstalled OrElse CurrentVersion < LatestVersion - End Get - End Property - -End Class diff --git a/ModpackUpdater.Model/InstallAction.cs b/ModpackUpdater.Model/InstallAction.cs new file mode 100644 index 0000000..b7e3283 --- /dev/null +++ b/ModpackUpdater.Model/InstallAction.cs @@ -0,0 +1,9 @@ +namespace ModpackUpdater.Model; + +public class InstallAction +{ + public bool IsZip { get; set; } + public string ZipPath { get; set; } + public string DestPath { get; set; } + public string DownloadUrl { get; set; } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/InstallAction.vb b/ModpackUpdater.Model/InstallAction.vb deleted file mode 100644 index 16aecd9..0000000 --- a/ModpackUpdater.Model/InstallAction.vb +++ /dev/null @@ -1,8 +0,0 @@ -Public Class InstallAction - - Public Property IsZip As Boolean - Public Property ZipPath As String - Public Property DestPath As String - Public Property DownloadUrl As String - -End Class diff --git a/ModpackUpdater.Model/InstallInfos.cs b/ModpackUpdater.Model/InstallInfos.cs new file mode 100644 index 0000000..fc543d3 --- /dev/null +++ b/ModpackUpdater.Model/InstallInfos.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace ModpackUpdater.Model; + +public class InstallInfos +{ + public List Actions { get; private set; } = []; + + public static InstallInfos Parse(string content) + { + return JsonConvert.DeserializeObject(content); + } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/InstallInfos.vb b/ModpackUpdater.Model/InstallInfos.vb deleted file mode 100644 index 9642120..0000000 --- a/ModpackUpdater.Model/InstallInfos.vb +++ /dev/null @@ -1,11 +0,0 @@ -Imports Newtonsoft.Json - -Public Class InstallInfos - - Public ReadOnly Property Actions As New List(Of InstallAction) - - Public Shared Function Parse(content As String) As InstallInfos - Return JsonConvert.DeserializeObject(Of InstallInfos)(content) - End Function - -End Class diff --git a/ModpackUpdater.Model/ModpackConfig.cs b/ModpackUpdater.Model/ModpackConfig.cs new file mode 100644 index 0000000..30191a9 --- /dev/null +++ b/ModpackUpdater.Model/ModpackConfig.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace ModpackUpdater.Model; + +public class ModpackConfig +{ + public string Name { get; set; } + public string UpdateUrl { get; set; } + public string InstallUrl { get; set; } + + public static object LoadFromUrl(string url) + { + string result = new HttpClient().GetStringAsync(url).Result; + return JsonConvert.DeserializeObject(result); + } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/ModpackConfig.vb b/ModpackUpdater.Model/ModpackConfig.vb deleted file mode 100644 index 4d411b6..0000000 --- a/ModpackUpdater.Model/ModpackConfig.vb +++ /dev/null @@ -1,16 +0,0 @@ -Imports System.Net.Http - -Imports Newtonsoft.Json - -Public Class ModpackConfig - - Public Property Name As String - Public Property UpdateUrl As String - Public Property InstallUrl As String - - Public Shared Function LoadFromUrl(url As String) - Dim result As String = New HttpClient().GetStringAsync(url).Result - Return JsonConvert.DeserializeObject(Of ModpackConfig)(result) - End Function - -End Class diff --git a/ModpackUpdater.Model/ModpackInfo.cs b/ModpackUpdater.Model/ModpackInfo.cs new file mode 100644 index 0000000..7aba881 --- /dev/null +++ b/ModpackUpdater.Model/ModpackInfo.cs @@ -0,0 +1,33 @@ +using Microsoft.VisualBasic.CompilerServices; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace ModpackUpdater.Model; + +public class ModpackInfo +{ + private const string FILENAME_MODPACKINFO = "modpack-info.json"; + + [JsonConverter(typeof(VersionConverter))] + public Version Version { get; set; } + + public void Save(string mcRoot) + { + File.WriteAllText(Conversions.ToString(GetFilePath(mcRoot)), JsonConvert.SerializeObject(this)); + } + + public static ModpackInfo Load(string mcRoot) + { + return JsonConvert.DeserializeObject(File.ReadAllText(Conversions.ToString(GetFilePath(mcRoot)))); + } + + public static bool HasModpackInfo(string mcRoot) + { + return File.Exists(Conversions.ToString(GetFilePath(mcRoot))); + } + + private static object GetFilePath(string mcRoot) + { + return Path.Combine(mcRoot, FILENAME_MODPACKINFO); + } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/ModpackInfo.vb b/ModpackUpdater.Model/ModpackInfo.vb deleted file mode 100644 index 35fd3ac..0000000 --- a/ModpackUpdater.Model/ModpackInfo.vb +++ /dev/null @@ -1,29 +0,0 @@ -Imports System.IO - -Imports Newtonsoft.Json -Imports Newtonsoft.Json.Converters - -Public Class ModpackInfo - - Private Const FILENAME_MODPACKINFO = "modpack-info.json" - - - Public Property Version As Version - - Public Sub Save(mcRoot As String) - File.WriteAllText(GetFilePath(mcRoot), JsonConvert.SerializeObject(Me)) - End Sub - - Public Shared Function Load(mcRoot As String) As ModpackInfo - Return JsonConvert.DeserializeObject(Of ModpackInfo)(File.ReadAllText(GetFilePath(mcRoot))) - End Function - - Public Shared Function HasModpackInfo(mcRoot As String) As Boolean - Return File.Exists(GetFilePath(mcRoot)) - End Function - - Private Shared Function GetFilePath(mcRoot As String) - Return Path.Combine(mcRoot, FILENAME_MODPACKINFO) - End Function - -End Class diff --git a/ModpackUpdater.Model/ModpackUpdater.Model.vbproj b/ModpackUpdater.Model/ModpackUpdater.Model.csproj similarity index 76% rename from ModpackUpdater.Model/ModpackUpdater.Model.vbproj rename to ModpackUpdater.Model/ModpackUpdater.Model.csproj index f65a20d..d3204d0 100644 --- a/ModpackUpdater.Model/ModpackUpdater.Model.vbproj +++ b/ModpackUpdater.Model/ModpackUpdater.Model.csproj @@ -1,12 +1,12 @@  - + - ModpackUpdater.Model net8.0 + true - + - + \ No newline at end of file diff --git a/ModpackUpdater.Model/UpdateAction.cs b/ModpackUpdater.Model/UpdateAction.cs new file mode 100644 index 0000000..e1de794 --- /dev/null +++ b/ModpackUpdater.Model/UpdateAction.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace ModpackUpdater.Model; + +public class UpdateAction : InstallAction +{ + [JsonConverter(typeof(StringEnumConverter))] + public UpdateActionType Type { get; set; } + public string SrcPath { get; set; } + public bool IsDirectory { get; set; } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/UpdateAction.vb b/ModpackUpdater.Model/UpdateAction.vb deleted file mode 100644 index 0de1622..0000000 --- a/ModpackUpdater.Model/UpdateAction.vb +++ /dev/null @@ -1,12 +0,0 @@ -Imports Newtonsoft.Json -Imports Newtonsoft.Json.Converters - -Public Class UpdateAction - Inherits InstallAction - - - Public Property Type As UpdateActionType - Public Property SrcPath As String - Public Property IsDirectory As Boolean - -End Class diff --git a/ModpackUpdater.Model/UpdateActionType.cs b/ModpackUpdater.Model/UpdateActionType.cs new file mode 100644 index 0000000..329030d --- /dev/null +++ b/ModpackUpdater.Model/UpdateActionType.cs @@ -0,0 +1,10 @@ +namespace ModpackUpdater.Model; + +public enum UpdateActionType +{ + None, + Update, + Delete, + Move, + Copy +} \ No newline at end of file diff --git a/ModpackUpdater.Model/UpdateActionType.vb b/ModpackUpdater.Model/UpdateActionType.vb deleted file mode 100644 index 2408c01..0000000 --- a/ModpackUpdater.Model/UpdateActionType.vb +++ /dev/null @@ -1,7 +0,0 @@ -Public Enum UpdateActionType - None - Update - Delete - Move - Copy -End Enum diff --git a/ModpackUpdater.Model/UpdateInfo.cs b/ModpackUpdater.Model/UpdateInfo.cs new file mode 100644 index 0000000..853b6ad --- /dev/null +++ b/ModpackUpdater.Model/UpdateInfo.cs @@ -0,0 +1,11 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace ModpackUpdater.Model; + +public class UpdateInfo +{ + [JsonConverter(typeof(VersionConverter))] + public Version Version { get; set; } + public List Actions { get; private set; } = []; +} \ No newline at end of file diff --git a/ModpackUpdater.Model/UpdateInfo.vb b/ModpackUpdater.Model/UpdateInfo.vb deleted file mode 100644 index 1e09bc6..0000000 --- a/ModpackUpdater.Model/UpdateInfo.vb +++ /dev/null @@ -1,10 +0,0 @@ -Imports Newtonsoft.Json -Imports Newtonsoft.Json.Converters - -Public Class UpdateInfo - - - Public Property Version As Version - Public ReadOnly Property Actions As New List(Of UpdateAction) - -End Class diff --git a/ModpackUpdater.Model/UpdateInfos.cs b/ModpackUpdater.Model/UpdateInfos.cs new file mode 100644 index 0000000..b583bfb --- /dev/null +++ b/ModpackUpdater.Model/UpdateInfos.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace ModpackUpdater.Model; + +public class UpdateInfos +{ + public List Updates { get; private set; } = []; + + public static UpdateInfos Parse(string content) + { + return JsonConvert.DeserializeObject(content); + } +} \ No newline at end of file diff --git a/ModpackUpdater.Model/UpdateInfos.vb b/ModpackUpdater.Model/UpdateInfos.vb deleted file mode 100644 index 04e4256..0000000 --- a/ModpackUpdater.Model/UpdateInfos.vb +++ /dev/null @@ -1,11 +0,0 @@ -Imports Newtonsoft.Json - -Public Class UpdateInfos - - Public ReadOnly Property Updates As New List(Of UpdateInfo) - - Public Shared Function Parse(content As String) As UpdateInfos - Return JsonConvert.DeserializeObject(Of UpdateInfos)(content) - End Function - -End Class diff --git a/ModpackUpdater.sln b/ModpackUpdater.sln index 0009289..1e4a085 100644 --- a/ModpackUpdater.sln +++ b/ModpackUpdater.sln @@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32526.322 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater", "ModpackUpdater\ModpackUpdater.vbproj", "{33DD239C-1F33-40F9-908F-54BC02FBA420}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater", "ModpackUpdater\ModpackUpdater.csproj", "{81F9A2F7-D36B-0F08-12D7-9EC2606C9080}" EndProject -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater.Model", "ModpackUpdater.Model\ModpackUpdater.Model.vbproj", "{BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Model", "ModpackUpdater.Model\ModpackUpdater.Model.csproj", "{0E6B6470-8C1D-0CDD-3681-461297A01960}" EndProject -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater.Manager", "ModpackUpdater.Manager\ModpackUpdater.Manager.vbproj", "{618DAFD6-3336-4621-82F9-EA5C783D2D2E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Manager", "ModpackUpdater.Manager\ModpackUpdater.Manager.csproj", "{D3A92EBD-FF6E-09D0-00A1-20221AAA198E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,18 +15,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {33DD239C-1F33-40F9-908F-54BC02FBA420}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33DD239C-1F33-40F9-908F-54BC02FBA420}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33DD239C-1F33-40F9-908F-54BC02FBA420}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33DD239C-1F33-40F9-908F-54BC02FBA420}.Release|Any CPU.Build.0 = Release|Any CPU - {BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BC4FE51B-4045-432C-B4D9-8C6CF5372DC0}.Release|Any CPU.Build.0 = Release|Any CPU - {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {618DAFD6-3336-4621-82F9-EA5C783D2D2E}.Release|Any CPU.Build.0 = Release|Any CPU + {81F9A2F7-D36B-0F08-12D7-9EC2606C9080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81F9A2F7-D36B-0F08-12D7-9EC2606C9080}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81F9A2F7-D36B-0F08-12D7-9EC2606C9080}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81F9A2F7-D36B-0F08-12D7-9EC2606C9080}.Release|Any CPU.Build.0 = Release|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Release|Any CPU.Build.0 = Release|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ModpackUpdater.sln.bak b/ModpackUpdater.sln.bak new file mode 100644 index 0000000..a701e48 --- /dev/null +++ b/ModpackUpdater.sln.bak @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32526.322 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ModpackUpdater", "ModpackUpdater\ModpackUpdater.vbproj", "{33DD239C-1F33-40F9-908F-54BC02FBA420}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Model", "ModpackUpdater.Model\ModpackUpdater.Model.csproj", "{0E6B6470-8C1D-0CDD-3681-461297A01960}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModpackUpdater.Manager", "ModpackUpdater.Manager\ModpackUpdater.Manager.csproj", "{D3A92EBD-FF6E-09D0-00A1-20221AAA198E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {33DD239C-1F33-40F9-908F-54BC02FBA420}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33DD239C-1F33-40F9-908F-54BC02FBA420}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33DD239C-1F33-40F9-908F-54BC02FBA420}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33DD239C-1F33-40F9-908F-54BC02FBA420}.Release|Any CPU.Build.0 = Release|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E6B6470-8C1D-0CDD-3681-461297A01960}.Release|Any CPU.Build.0 = Release|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3A92EBD-FF6E-09D0-00A1-20221AAA198E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {322E6A6B-9F3E-4E88-8945-C98A9EF613BF} + EndGlobalSection +EndGlobal diff --git a/ModpackUpdater/AppConfig.cs b/ModpackUpdater/AppConfig.cs new file mode 100644 index 0000000..329d1ca --- /dev/null +++ b/ModpackUpdater/AppConfig.cs @@ -0,0 +1,69 @@ +using Newtonsoft.Json; + +namespace ModpackUpdater; + +public class AppConfig +{ + public string LastMinecraftProfilePath { get; set; } + public string LastConfigFilePath { get; set; } + public List 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; + + public static AppConfig Instance + { + get + { + + if (instance is null) + { + if (File.Exists(SettingsPath)) + instance = LoadConfig(SettingsPath); + else + { + instance = new AppConfig(); + instance.Reset(); + } + } + + return instance; + } + } + private static string settingsPath = string.Empty; + + private static string SettingsPath + { + get + { + const string AppDataDirectoryName = "MinecraftModpackUpdater"; + const string SettingsFileName = "Settings.json"; + + if (string.IsNullOrEmpty(settingsPath)) + { + settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppDataDirectoryName); + Directory.CreateDirectory(settingsPath); + settingsPath = Path.Combine(settingsPath, SettingsFileName); + } + + return settingsPath; + } + } + + public void SaveConfig() + { + File.WriteAllText(SettingsPath, JsonConvert.SerializeObject(this)); + } + + private static AppConfig LoadConfig(string filePath) + { + return JsonConvert.DeserializeObject(File.ReadAllText(filePath)); + } +} \ No newline at end of file diff --git a/ModpackUpdater/AppConfig.vb b/ModpackUpdater/AppConfig.vb deleted file mode 100644 index 5752e1f..0000000 --- a/ModpackUpdater/AppConfig.vb +++ /dev/null @@ -1,59 +0,0 @@ -Imports System.IO - -Imports Newtonsoft.Json.Linq - -Public Class AppConfig - - Public Property LastMinecraftProfilePath As String - Public Property LastConfigFilePath As String - Public Property KeepLocalFiles As New List(Of String) - Public Property AllowRemoveLocalFiles As Boolean - - Public Sub Reset() - KeepLocalFiles.Clear() - KeepLocalFiles.Add("OptiFine_1.7.10_HD_U_E7.jar") - AllowRemoveLocalFiles = False - End Sub - - Public Shared ReadOnly Property Instance As AppConfig - Get - Static myInstance As AppConfig = Nothing - - If myInstance Is Nothing Then - If File.Exists(SettingsPath) Then - myInstance = LoadConfig(SettingsPath) - Else - myInstance = New AppConfig - myInstance.Reset() - End If - End If - - Return myInstance - End Get - End Property - - Private Shared ReadOnly Property SettingsPath As string - Get - Static myPath As String = String.Empty - Const AppDataDirectoryName As String = "MinecraftModpackUpdater" - Const SettingsFileName As String = "Settings.json" - - If String.IsNullOrEmpty(myPath) Then - myPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppDataDirectoryName) - Directory.CreateDirectory(myPath) - myPath = Path.Combine(myPath, SettingsFileName) - End If - - Return myPath - End Get - End Property - - Public Sub SaveConfig() - File.WriteAllText(SettingsPath, JObject.FromObject(Me).ToString) - End Sub - - Private Shared Function LoadConfig(filePath As String) As AppConfig - Return JObject.Parse(File.ReadAllText(filePath)).ToObject(Of AppConfig) - End Function - -End Class diff --git a/ModpackUpdater/AppUpdater.cs b/ModpackUpdater/AppUpdater.cs new file mode 100644 index 0000000..3488926 --- /dev/null +++ b/ModpackUpdater/AppUpdater.cs @@ -0,0 +1,78 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Reflection; + +namespace ModpackUpdater; + +public class AppUpdater +{ + private class UpdateInfo + { + [JsonConverter(typeof(VersionConverter))] + public Version Version { get; set; } + public string DownloadUrl { get; set; } + } + + private const string UPDATE_URL = "https://git.pilzinsel64.de/gaming/minecraft/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json"; + private readonly HttpClient httpClient = new(); + private UpdateInfo info; + + public async Task Check() + { + var hasUpdate = false; + + try + { + var appVersion = Assembly.GetExecutingAssembly().GetName().Version; + string result = await httpClient.GetStringAsync(UPDATE_URL); + info = JsonConvert.DeserializeObject(result); + + if (info is not null && info.Version < appVersion) + hasUpdate = true; + } + catch + { + } + + return hasUpdate; + } + + public async Task Install() + { + var client = new HttpClient(); + var tempFileName = Path.GetTempFileName(); + var appFileName = Pilz.IO.Extensions.GetExecutablePath(); + var oldFileName = appFileName + ".old"; + + // Delete old file + try + { + File.Delete(oldFileName); + } + catch + { + } + + // Download the new file + using (var tempFileStream = new FileStream(tempFileName, FileMode.Create, FileAccess.ReadWrite)) + { + Stream downloadStream = null; + try + { + downloadStream = await client.GetStreamAsync(info.DownloadUrl); + await downloadStream.CopyToAsync(tempFileStream); + } + catch + { + } + finally + { + downloadStream?.Dispose(); + } + } + + // Replace current application file with new file + File.Move(appFileName, oldFileName, true); + File.Move(tempFileName, appFileName); + } +} \ No newline at end of file diff --git a/ModpackUpdater/AppUpdater.vb b/ModpackUpdater/AppUpdater.vb deleted file mode 100644 index d132e51..0000000 --- a/ModpackUpdater/AppUpdater.vb +++ /dev/null @@ -1,67 +0,0 @@ -Imports System.IO -Imports System.Net.Http -Imports System.Reflection - -Imports Newtonsoft.Json -Imports Newtonsoft.Json.Converters - -Public Class AppUpdater - - Private Class UpdateInfo - - Public Property Version As Version - Public Property DownloadUrl As String - End Class - - Private Const UPDATE_URL As String = "https://git.pilzinsel64.de/gaming/minecraft/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json" - Private ReadOnly httpClient As New HttpClient - Private info As UpdateInfo - - Public Async Function Check() As Task(Of Boolean) - Dim appFileName = Pilz.IO.Extensions.GetExecutablePath() - Dim hasUpdate As Boolean = False - - Try - Dim appVersion As Version = Assembly.GetExecutingAssembly().GetName().Version - Dim result = Await httpClient.GetStringAsync(UPDATE_URL) - info = JsonConvert.DeserializeObject(Of UpdateInfo)(result) - - If info IsNot Nothing AndAlso info.Version < appVersion Then - hasUpdate = True - End If - Catch ex As Exception - End Try - - Return hasUpdate - End Function - - Public Async Function Install() As Task - Dim client As New HttpClient - Dim tempFileName = Path.GetTempFileName - Dim appFileName = Pilz.IO.Extensions.GetExecutablePath() - Dim oldFileName = appFileName & ".old" - - 'Delete old file - Try - File.Delete(oldFileName) - Catch ex As Exception - End Try - - 'Download the new file - Using tempFileStream As New FileStream(tempFileName, FileMode.Create, FileAccess.ReadWrite) - Dim downloadStream As Stream = Nothing - Try - downloadStream = Await client.GetStreamAsync(info.DownloadUrl) - Await downloadStream.CopyToAsync(tempFileStream) - Catch - Finally - downloadStream?.Dispose() - End Try - End Using - - 'Replace current application file with new file - File.Move(appFileName, oldFileName, True) - File.Move(tempFileName, appFileName) - End Function - -End Class diff --git a/ModpackUpdater/ApplicationEvents.vb b/ModpackUpdater/ApplicationEvents.vb deleted file mode 100644 index f5dc3fb..0000000 --- a/ModpackUpdater/ApplicationEvents.vb +++ /dev/null @@ -1,40 +0,0 @@ -Imports Microsoft.VisualBasic.ApplicationServices - -Imports Telerik.WinControls - -Namespace My - ' The following events are available for MyApplication: - ' Startup: Raised when the application starts, before the startup form is created. - ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. - ' UnhandledException: Raised if the application encounters an unhandled exception. - ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. - ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected. - - ' **NEW** ApplyApplicationDefaults: Raised when the application queries default values to be set for the application. - - ' Example: - ' Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults - ' - ' ' Setting the application-wide default Font: - ' e.Font = New Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular) - ' - ' ' Setting the HighDpiMode for the Application: - ' e.HighDpiMode = HighDpiMode.PerMonitorV2 - ' - ' ' If a splash dialog is used, this sets the minimum display time: - ' e.MinimumSplashScreenDisplayTime = 4000 - ' End Sub - - Partial Friend Class MyApplication - - Private Sub MyApplication_ApplyApplicationDefaults(sender As Object, e As ApplyApplicationDefaultsEventArgs) Handles Me.ApplyApplicationDefaults - Dim validTheme As Boolean = - ThemeResolutionService.LoadPackageResource("ModpackUpdater.Office2019DarkBluePurple.tssp") - - If validTheme Then - ThemeResolutionService.ApplicationThemeName = "Office2019DarkBluePurple" - End If - End Sub - - End Class -End Namespace diff --git a/ModpackUpdater/FiledialogFilters.Designer.cs b/ModpackUpdater/FiledialogFilters.Designer.cs new file mode 100644 index 0000000..b6de0b4 --- /dev/null +++ b/ModpackUpdater/FiledialogFilters.Designer.cs @@ -0,0 +1,95 @@ +// ------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +// ------------------------------------------------------------------------------ + + +using System.Diagnostics; + +namespace ModpackUpdater.My.Resources +{ + + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + [System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [DebuggerNonUserCode()] + [System.Runtime.CompilerServices.CompilerGenerated()] + internal class FiledialogFilters + { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal FiledialogFilters() : base() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager + { + get + { + if (ReferenceEquals(resourceMan, null)) + { + var temp = new System.Resources.ResourceManager("ModpackUpdater.FiledialogFilters", typeof(FiledialogFilters).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Json files (*.json) ähnelt. + /// + internal static string JSON_Display + { + get + { + return ResourceManager.GetString("JSON_Display", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die *.json ähnelt. + /// + internal static string JSON_Filter + { + get + { + return ResourceManager.GetString("JSON_Filter", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/ModpackUpdater/FiledialogFilters.Designer.vb b/ModpackUpdater/FiledialogFilters.Designer.vb deleted file mode 100644 index 78e35f1..0000000 --- a/ModpackUpdater/FiledialogFilters.Designer.vb +++ /dev/null @@ -1,85 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - ''' - ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - ''' - _ - Friend Class FiledialogFilters - - Private Shared resourceMan As Global.System.Resources.ResourceManager - - Private Shared resourceCulture As Global.System.Globalization.CultureInfo - - _ - Friend Sub New() - MyBase.New - End Sub - - ''' - ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - ''' - _ - Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ModpackUpdater.FiledialogFilters", GetType(FiledialogFilters).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - ''' - _ - Friend Shared Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Json files (*.json) ähnelt. - ''' - Friend Shared ReadOnly Property JSON_Display() As String - Get - Return ResourceManager.GetString("JSON_Display", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die *.json ähnelt. - ''' - Friend Shared ReadOnly Property JSON_Filter() As String - Get - Return ResourceManager.GetString("JSON_Filter", resourceCulture) - End Get - End Property - End Class -End Namespace diff --git a/ModpackUpdater/Form1.Designer.cs b/ModpackUpdater/Form1.Designer.cs new file mode 100644 index 0000000..150ffd3 --- /dev/null +++ b/ModpackUpdater/Form1.Designer.cs @@ -0,0 +1,274 @@ +using System; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; + +namespace ModpackUpdater +{ + [Microsoft.VisualBasic.CompilerServices.DesignerGenerated()] + + public partial class Form1 : Telerik.WinControls.UI.RadForm + { + + // Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + [DebuggerNonUserCode()] + protected override void Dispose(bool disposing) + { + try + { + if (disposing && components is not null) + components.Dispose(); + } + finally + { + base.Dispose(disposing); + } + } + + // Wird vom Windows Form-Designer benötigt. + private System.ComponentModel.IContainer components = new System.ComponentModel.Container(); + + // Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + // Das Bearbeiten ist mit dem Windows Form-Designer möglich. + // Das Bearbeiten mit dem Code-Editor ist nicht möglich. + [DebuggerStepThrough()] + private void InitializeComponent() + { + var resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + RadLabel1 = new Telerik.WinControls.UI.RadLabel(); + RadLabel2 = new Telerik.WinControls.UI.RadLabel(); + RadLabel3 = new Telerik.WinControls.UI.RadLabel(); + RadLabel_Status = new Telerik.WinControls.UI.RadLabel(); + RadTextBoxControl_MinecraftProfileFolder = new Telerik.WinControls.UI.RadTextBoxControl(); + RadTextBoxControl_ModpackConfig = new Telerik.WinControls.UI.RadTextBoxControl(); + Panel1 = new Panel(); + RadButton_Install = new Telerik.WinControls.UI.RadButton(); + RadButton_Install.Click += new EventHandler(ButtonX_StartUpdate_Click); + RadButton_CheckForUpdates = new Telerik.WinControls.UI.RadButton(); + RadButton_CheckForUpdates.Click += new EventHandler(ButtonX_CheckForUpdates_Click); + RadButton_EditModpackConfig = new Telerik.WinControls.UI.RadButton(); + RadButton_PasteModpackConfig = new Telerik.WinControls.UI.RadButton(); + RadButton_PasteModpackConfig.Click += new EventHandler(RadButton_PasteModpackConfig_Click); + RadButton_SearchModpackConfig = new Telerik.WinControls.UI.RadButton(); + RadButton_SearchModpackConfig.Click += new EventHandler(ButtonX_SearchUpdateConfig_Click); + RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton(); + RadButton_SearchMinecraftProfileFolder.Click += new EventHandler(ButtonX_SearchMinecraftProfile_Click); + ((System.ComponentModel.ISupportInitialize)RadLabel1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel3).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel_Status).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadTextBoxControl_MinecraftProfileFolder).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadTextBoxControl_ModpackConfig).BeginInit(); + Panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)RadButton_Install).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_EditModpackConfig).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_PasteModpackConfig).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_SearchModpackConfig).BeginInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit(); + ((System.ComponentModel.ISupportInitialize)this).BeginInit(); + SuspendLayout(); + // + // RadLabel1 + // + RadLabel1.Location = new Point(3, 5); + RadLabel1.Name = "RadLabel1"; + RadLabel1.Size = new Size(124, 18); + RadLabel1.TabIndex = 0; + RadLabel1.Text = "Minecraft profile folder:"; + // + // RadLabel2 + // + RadLabel2.Location = new Point(3, 63); + RadLabel2.Name = "RadLabel2"; + RadLabel2.Size = new Size(90, 18); + RadLabel2.TabIndex = 1; + RadLabel2.Text = "Modpack config:"; + // + // RadLabel3 + // + RadLabel3.Location = new Point(3, 121); + RadLabel3.Name = "RadLabel3"; + RadLabel3.Size = new Size(39, 18); + RadLabel3.TabIndex = 2; + RadLabel3.Text = "Status:"; + // + // RadLabel_Status + // + RadLabel_Status.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + RadLabel_Status.AutoSize = false; + RadLabel_Status.Location = new Point(144, 119); + RadLabel_Status.Name = "RadLabel_Status"; + RadLabel_Status.Size = new Size(273, 22); + RadLabel_Status.TabIndex = 3; + RadLabel_Status.Text = "-"; + RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // RadTextBoxControl_MinecraftProfileFolder + // + RadTextBoxControl_MinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + RadTextBoxControl_MinecraftProfileFolder.IsReadOnly = true; + RadTextBoxControl_MinecraftProfileFolder.Location = new Point(144, 3); + RadTextBoxControl_MinecraftProfileFolder.Name = "RadTextBoxControl_MinecraftProfileFolder"; + RadTextBoxControl_MinecraftProfileFolder.NullText = "No file loaded!"; + RadTextBoxControl_MinecraftProfileFolder.Size = new Size(273, 22); + RadTextBoxControl_MinecraftProfileFolder.TabIndex = 4; + // + // RadTextBoxControl_ModpackConfig + // + RadTextBoxControl_ModpackConfig.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + RadTextBoxControl_ModpackConfig.IsReadOnly = true; + RadTextBoxControl_ModpackConfig.Location = new Point(144, 61); + RadTextBoxControl_ModpackConfig.Name = "RadTextBoxControl_ModpackConfig"; + RadTextBoxControl_ModpackConfig.NullText = "No file loaded!"; + RadTextBoxControl_ModpackConfig.Size = new Size(273, 22); + RadTextBoxControl_ModpackConfig.TabIndex = 5; + // + // Panel1 + // + Panel1.BackColor = Color.Transparent; + Panel1.Controls.Add(RadButton_Install); + Panel1.Controls.Add(RadButton_CheckForUpdates); + Panel1.Controls.Add(RadButton_EditModpackConfig); + Panel1.Controls.Add(RadButton_PasteModpackConfig); + Panel1.Controls.Add(RadButton_SearchModpackConfig); + Panel1.Controls.Add(RadButton_SearchMinecraftProfileFolder); + Panel1.Controls.Add(RadLabel1); + Panel1.Controls.Add(RadTextBoxControl_ModpackConfig); + Panel1.Controls.Add(RadLabel2); + Panel1.Controls.Add(RadTextBoxControl_MinecraftProfileFolder); + Panel1.Controls.Add(RadLabel3); + Panel1.Controls.Add(RadLabel_Status); + Panel1.Dock = DockStyle.Fill; + Panel1.Location = new Point(0, 0); + Panel1.Name = "Panel1"; + Panel1.Size = new Size(420, 176); + Panel1.TabIndex = 6; + // + // RadButton_Install + // + RadButton_Install.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + RadButton_Install.Image = My.Resources.MySymbols.icons8_software_installer_16px; + RadButton_Install.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_Install.Location = new Point(337, 149); + RadButton_Install.Name = "RadButton_Install"; + RadButton_Install.Size = new Size(80, 24); + RadButton_Install.TabIndex = 10; + RadButton_Install.Text = "Install"; + RadButton_Install.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_Install.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // RadButton_CheckForUpdates + // + RadButton_CheckForUpdates.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + RadButton_CheckForUpdates.Image = My.Resources.MySymbols.icons8_update_16px; + RadButton_CheckForUpdates.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_CheckForUpdates.Location = new Point(191, 149); + RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates"; + RadButton_CheckForUpdates.Size = new Size(140, 24); + RadButton_CheckForUpdates.TabIndex = 0; + RadButton_CheckForUpdates.Text = "Check for Updates"; + RadButton_CheckForUpdates.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_CheckForUpdates.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // RadButton_EditModpackConfig + // + RadButton_EditModpackConfig.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + RadButton_EditModpackConfig.Image = My.Resources.MySymbols.icons8_wrench_16px; + RadButton_EditModpackConfig.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_EditModpackConfig.Location = new Point(3, 149); + RadButton_EditModpackConfig.Name = "RadButton_EditModpackConfig"; + RadButton_EditModpackConfig.Size = new Size(150, 24); + RadButton_EditModpackConfig.TabIndex = 8; + RadButton_EditModpackConfig.Text = "Edit modpack config"; + RadButton_EditModpackConfig.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_EditModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText; + RadButton_EditModpackConfig.Visible = false; + // + // RadButton_PasteModpackConfig + // + RadButton_PasteModpackConfig.Anchor = AnchorStyles.Top | AnchorStyles.Right; + RadButton_PasteModpackConfig.Image = (Image)resources.GetObject("RadButton_PasteModpackConfig.Image"); + RadButton_PasteModpackConfig.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_PasteModpackConfig.Location = new Point(231, 89); + RadButton_PasteModpackConfig.Name = "RadButton_PasteModpackConfig"; + RadButton_PasteModpackConfig.Size = new Size(90, 24); + RadButton_PasteModpackConfig.TabIndex = 7; + RadButton_PasteModpackConfig.Text = "Paste"; + RadButton_PasteModpackConfig.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_PasteModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // RadButton_SearchModpackConfig + // + RadButton_SearchModpackConfig.Anchor = AnchorStyles.Top | AnchorStyles.Right; + RadButton_SearchModpackConfig.Image = (Image)resources.GetObject("RadButton_SearchModpackConfig.Image"); + RadButton_SearchModpackConfig.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_SearchModpackConfig.Location = new Point(327, 89); + RadButton_SearchModpackConfig.Name = "RadButton_SearchModpackConfig"; + RadButton_SearchModpackConfig.Size = new Size(90, 24); + RadButton_SearchModpackConfig.TabIndex = 7; + RadButton_SearchModpackConfig.Text = "Search"; + RadButton_SearchModpackConfig.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_SearchModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // RadButton_SearchMinecraftProfileFolder + // + RadButton_SearchMinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Right; + RadButton_SearchMinecraftProfileFolder.Image = (Image)resources.GetObject("RadButton_SearchMinecraftProfileFolder.Image"); + RadButton_SearchMinecraftProfileFolder.ImageAlignment = ContentAlignment.MiddleRight; + RadButton_SearchMinecraftProfileFolder.Location = new Point(327, 31); + RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder"; + RadButton_SearchMinecraftProfileFolder.Size = new Size(90, 24); + RadButton_SearchMinecraftProfileFolder.TabIndex = 6; + RadButton_SearchMinecraftProfileFolder.Text = "Search"; + RadButton_SearchMinecraftProfileFolder.TextAlignment = ContentAlignment.MiddleLeft; + RadButton_SearchMinecraftProfileFolder.TextImageRelation = TextImageRelation.ImageBeforeText; + // + // Form1 + // + AutoScaleBaseSize = new Size(7, 15); + AutoScaleDimensions = new SizeF(7f, 15f); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(420, 176); + Controls.Add(Panel1); + Icon = (Icon)resources.GetObject("$this.Icon"); + MaximizeBox = false; + Name = "Form1"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Minecraft Modpack Updater"; + ((System.ComponentModel.ISupportInitialize)RadLabel1).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel2).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel3).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadLabel_Status).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadTextBoxControl_MinecraftProfileFolder).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadTextBoxControl_ModpackConfig).EndInit(); + Panel1.ResumeLayout(false); + Panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)RadButton_Install).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_EditModpackConfig).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_PasteModpackConfig).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_SearchModpackConfig).EndInit(); + ((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).EndInit(); + ((System.ComponentModel.ISupportInitialize)this).EndInit(); + FormClosing += new FormClosingEventHandler(Form1_FormClosing); + Load += new EventHandler(Form1_Load); + Shown += new EventHandler(Form1_Shown); + ResumeLayout(false); + + } + internal Telerik.WinControls.UI.RadLabel RadLabel1; + internal Telerik.WinControls.UI.RadLabel RadLabel2; + internal Telerik.WinControls.UI.RadLabel RadLabel3; + internal Telerik.WinControls.UI.RadLabel RadLabel_Status; + internal Telerik.WinControls.UI.RadTextBoxControl RadTextBoxControl_MinecraftProfileFolder; + internal Telerik.WinControls.UI.RadTextBoxControl RadTextBoxControl_ModpackConfig; + internal Panel Panel1; + internal Telerik.WinControls.UI.RadButton RadButton_Install; + internal Telerik.WinControls.UI.RadButton RadButton_CheckForUpdates; + internal Telerik.WinControls.UI.RadButton RadButton_EditModpackConfig; + internal Telerik.WinControls.UI.RadButton RadButton_SearchModpackConfig; + internal Telerik.WinControls.UI.RadButton RadButton_SearchMinecraftProfileFolder; + internal Telerik.WinControls.UI.RadButton RadButton_PasteModpackConfig; + } +} \ No newline at end of file diff --git a/ModpackUpdater/Form1.Designer.vb b/ModpackUpdater/Form1.Designer.vb deleted file mode 100644 index bb5427c..0000000 --- a/ModpackUpdater/Form1.Designer.vb +++ /dev/null @@ -1,254 +0,0 @@ - _ -Partial Class Form1 - - Inherits Telerik.WinControls.UI.RadForm - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As System.ComponentModel.IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - _ - Private Sub InitializeComponent() - Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) - RadLabel1 = New Telerik.WinControls.UI.RadLabel() - RadLabel2 = New Telerik.WinControls.UI.RadLabel() - RadLabel3 = New Telerik.WinControls.UI.RadLabel() - RadLabel_Status = New Telerik.WinControls.UI.RadLabel() - RadTextBoxControl_MinecraftProfileFolder = New Telerik.WinControls.UI.RadTextBoxControl() - RadTextBoxControl_ModpackConfig = New Telerik.WinControls.UI.RadTextBoxControl() - Panel1 = New Panel() - RadButton_Install = New Telerik.WinControls.UI.RadButton() - RadButton_CheckForUpdates = New Telerik.WinControls.UI.RadButton() - RadButton_EditModpackConfig = New Telerik.WinControls.UI.RadButton() - RadButton_PasteModpackConfig = New Telerik.WinControls.UI.RadButton() - RadButton_SearchModpackConfig = New Telerik.WinControls.UI.RadButton() - RadButton_SearchMinecraftProfileFolder = New Telerik.WinControls.UI.RadButton() - CType(RadLabel1, ComponentModel.ISupportInitialize).BeginInit() - CType(RadLabel2, ComponentModel.ISupportInitialize).BeginInit() - CType(RadLabel3, ComponentModel.ISupportInitialize).BeginInit() - CType(RadLabel_Status, ComponentModel.ISupportInitialize).BeginInit() - CType(RadTextBoxControl_MinecraftProfileFolder, ComponentModel.ISupportInitialize).BeginInit() - CType(RadTextBoxControl_ModpackConfig, ComponentModel.ISupportInitialize).BeginInit() - Panel1.SuspendLayout() - CType(RadButton_Install, ComponentModel.ISupportInitialize).BeginInit() - CType(RadButton_CheckForUpdates, ComponentModel.ISupportInitialize).BeginInit() - CType(RadButton_EditModpackConfig, ComponentModel.ISupportInitialize).BeginInit() - CType(RadButton_PasteModpackConfig, ComponentModel.ISupportInitialize).BeginInit() - CType(RadButton_SearchModpackConfig, ComponentModel.ISupportInitialize).BeginInit() - CType(RadButton_SearchMinecraftProfileFolder, ComponentModel.ISupportInitialize).BeginInit() - CType(Me, ComponentModel.ISupportInitialize).BeginInit() - SuspendLayout() - ' - ' RadLabel1 - ' - RadLabel1.Location = New Point(3, 5) - RadLabel1.Name = "RadLabel1" - RadLabel1.Size = New Size(124, 18) - RadLabel1.TabIndex = 0 - RadLabel1.Text = "Minecraft profile folder:" - ' - ' RadLabel2 - ' - RadLabel2.Location = New Point(3, 63) - RadLabel2.Name = "RadLabel2" - RadLabel2.Size = New Size(90, 18) - RadLabel2.TabIndex = 1 - RadLabel2.Text = "Modpack config:" - ' - ' RadLabel3 - ' - RadLabel3.Location = New Point(3, 121) - RadLabel3.Name = "RadLabel3" - RadLabel3.Size = New Size(39, 18) - RadLabel3.TabIndex = 2 - RadLabel3.Text = "Status:" - ' - ' RadLabel_Status - ' - RadLabel_Status.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right - RadLabel_Status.AutoSize = False - RadLabel_Status.Location = New Point(144, 119) - RadLabel_Status.Name = "RadLabel_Status" - RadLabel_Status.Size = New Size(273, 22) - RadLabel_Status.TabIndex = 3 - RadLabel_Status.Text = "-" - RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' RadTextBoxControl_MinecraftProfileFolder - ' - RadTextBoxControl_MinecraftProfileFolder.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right - RadTextBoxControl_MinecraftProfileFolder.IsReadOnly = True - RadTextBoxControl_MinecraftProfileFolder.Location = New Point(144, 3) - RadTextBoxControl_MinecraftProfileFolder.Name = "RadTextBoxControl_MinecraftProfileFolder" - RadTextBoxControl_MinecraftProfileFolder.NullText = "No file loaded!" - RadTextBoxControl_MinecraftProfileFolder.Size = New Size(273, 22) - RadTextBoxControl_MinecraftProfileFolder.TabIndex = 4 - ' - ' RadTextBoxControl_ModpackConfig - ' - RadTextBoxControl_ModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right - RadTextBoxControl_ModpackConfig.IsReadOnly = True - RadTextBoxControl_ModpackConfig.Location = New Point(144, 61) - RadTextBoxControl_ModpackConfig.Name = "RadTextBoxControl_ModpackConfig" - RadTextBoxControl_ModpackConfig.NullText = "No file loaded!" - RadTextBoxControl_ModpackConfig.Size = New Size(273, 22) - RadTextBoxControl_ModpackConfig.TabIndex = 5 - ' - ' Panel1 - ' - Panel1.BackColor = Color.Transparent - Panel1.Controls.Add(RadButton_Install) - Panel1.Controls.Add(RadButton_CheckForUpdates) - Panel1.Controls.Add(RadButton_EditModpackConfig) - Panel1.Controls.Add(RadButton_PasteModpackConfig) - Panel1.Controls.Add(RadButton_SearchModpackConfig) - Panel1.Controls.Add(RadButton_SearchMinecraftProfileFolder) - Panel1.Controls.Add(RadLabel1) - Panel1.Controls.Add(RadTextBoxControl_ModpackConfig) - Panel1.Controls.Add(RadLabel2) - Panel1.Controls.Add(RadTextBoxControl_MinecraftProfileFolder) - Panel1.Controls.Add(RadLabel3) - Panel1.Controls.Add(RadLabel_Status) - Panel1.Dock = DockStyle.Fill - Panel1.Location = New Point(0, 0) - Panel1.Name = "Panel1" - Panel1.Size = New Size(420, 176) - Panel1.TabIndex = 6 - ' - ' RadButton_Install - ' - RadButton_Install.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right - RadButton_Install.Image = My.Resources.MySymbols.icons8_software_installer_16px - RadButton_Install.ImageAlignment = ContentAlignment.MiddleRight - RadButton_Install.Location = New Point(337, 149) - RadButton_Install.Name = "RadButton_Install" - RadButton_Install.Size = New Size(80, 24) - RadButton_Install.TabIndex = 10 - RadButton_Install.Text = "Install" - RadButton_Install.TextAlignment = ContentAlignment.MiddleLeft - RadButton_Install.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' RadButton_CheckForUpdates - ' - RadButton_CheckForUpdates.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right - RadButton_CheckForUpdates.Image = My.Resources.MySymbols.icons8_update_16px - RadButton_CheckForUpdates.ImageAlignment = ContentAlignment.MiddleRight - RadButton_CheckForUpdates.Location = New Point(191, 149) - RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates" - RadButton_CheckForUpdates.Size = New Size(140, 24) - RadButton_CheckForUpdates.TabIndex = 0 - RadButton_CheckForUpdates.Text = "Check for Updates" - RadButton_CheckForUpdates.TextAlignment = ContentAlignment.MiddleLeft - RadButton_CheckForUpdates.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' RadButton_EditModpackConfig - ' - RadButton_EditModpackConfig.Anchor = AnchorStyles.Bottom Or AnchorStyles.Left - RadButton_EditModpackConfig.Image = My.Resources.MySymbols.icons8_wrench_16px - RadButton_EditModpackConfig.ImageAlignment = ContentAlignment.MiddleRight - RadButton_EditModpackConfig.Location = New Point(3, 149) - RadButton_EditModpackConfig.Name = "RadButton_EditModpackConfig" - RadButton_EditModpackConfig.Size = New Size(150, 24) - RadButton_EditModpackConfig.TabIndex = 8 - RadButton_EditModpackConfig.Text = "Edit modpack config" - RadButton_EditModpackConfig.TextAlignment = ContentAlignment.MiddleLeft - RadButton_EditModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText - RadButton_EditModpackConfig.Visible = False - ' - ' RadButton_PasteModpackConfig - ' - RadButton_PasteModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Right - RadButton_PasteModpackConfig.Image = CType(resources.GetObject("RadButton_PasteModpackConfig.Image"), Image) - RadButton_PasteModpackConfig.ImageAlignment = ContentAlignment.MiddleRight - RadButton_PasteModpackConfig.Location = New Point(231, 89) - RadButton_PasteModpackConfig.Name = "RadButton_PasteModpackConfig" - RadButton_PasteModpackConfig.Size = New Size(90, 24) - RadButton_PasteModpackConfig.TabIndex = 7 - RadButton_PasteModpackConfig.Text = "Paste" - RadButton_PasteModpackConfig.TextAlignment = ContentAlignment.MiddleLeft - RadButton_PasteModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' RadButton_SearchModpackConfig - ' - RadButton_SearchModpackConfig.Anchor = AnchorStyles.Top Or AnchorStyles.Right - RadButton_SearchModpackConfig.Image = CType(resources.GetObject("RadButton_SearchModpackConfig.Image"), Image) - RadButton_SearchModpackConfig.ImageAlignment = ContentAlignment.MiddleRight - RadButton_SearchModpackConfig.Location = New Point(327, 89) - RadButton_SearchModpackConfig.Name = "RadButton_SearchModpackConfig" - RadButton_SearchModpackConfig.Size = New Size(90, 24) - RadButton_SearchModpackConfig.TabIndex = 7 - RadButton_SearchModpackConfig.Text = "Search" - RadButton_SearchModpackConfig.TextAlignment = ContentAlignment.MiddleLeft - RadButton_SearchModpackConfig.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' RadButton_SearchMinecraftProfileFolder - ' - RadButton_SearchMinecraftProfileFolder.Anchor = AnchorStyles.Top Or AnchorStyles.Right - RadButton_SearchMinecraftProfileFolder.Image = CType(resources.GetObject("RadButton_SearchMinecraftProfileFolder.Image"), Image) - RadButton_SearchMinecraftProfileFolder.ImageAlignment = ContentAlignment.MiddleRight - RadButton_SearchMinecraftProfileFolder.Location = New Point(327, 31) - RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder" - RadButton_SearchMinecraftProfileFolder.Size = New Size(90, 24) - RadButton_SearchMinecraftProfileFolder.TabIndex = 6 - RadButton_SearchMinecraftProfileFolder.Text = "Search" - RadButton_SearchMinecraftProfileFolder.TextAlignment = ContentAlignment.MiddleLeft - RadButton_SearchMinecraftProfileFolder.TextImageRelation = TextImageRelation.ImageBeforeText - ' - ' Form1 - ' - AutoScaleBaseSize = New Size(7, 15) - AutoScaleDimensions = New SizeF(7F, 15F) - AutoScaleMode = AutoScaleMode.Font - ClientSize = New Size(420, 176) - Controls.Add(Panel1) - Icon = CType(resources.GetObject("$this.Icon"), Icon) - MaximizeBox = False - Name = "Form1" - StartPosition = FormStartPosition.CenterScreen - Text = "Minecraft Modpack Updater" - CType(RadLabel1, ComponentModel.ISupportInitialize).EndInit() - CType(RadLabel2, ComponentModel.ISupportInitialize).EndInit() - CType(RadLabel3, ComponentModel.ISupportInitialize).EndInit() - CType(RadLabel_Status, ComponentModel.ISupportInitialize).EndInit() - CType(RadTextBoxControl_MinecraftProfileFolder, ComponentModel.ISupportInitialize).EndInit() - CType(RadTextBoxControl_ModpackConfig, ComponentModel.ISupportInitialize).EndInit() - Panel1.ResumeLayout(False) - Panel1.PerformLayout() - CType(RadButton_Install, ComponentModel.ISupportInitialize).EndInit() - CType(RadButton_CheckForUpdates, ComponentModel.ISupportInitialize).EndInit() - CType(RadButton_EditModpackConfig, ComponentModel.ISupportInitialize).EndInit() - CType(RadButton_PasteModpackConfig, ComponentModel.ISupportInitialize).EndInit() - CType(RadButton_SearchModpackConfig, ComponentModel.ISupportInitialize).EndInit() - CType(RadButton_SearchMinecraftProfileFolder, ComponentModel.ISupportInitialize).EndInit() - CType(Me, ComponentModel.ISupportInitialize).EndInit() - ResumeLayout(False) - - End Sub - Friend WithEvents RadLabel1 As Telerik.WinControls.UI.RadLabel - Friend WithEvents RadLabel2 As Telerik.WinControls.UI.RadLabel - Friend WithEvents RadLabel3 As Telerik.WinControls.UI.RadLabel - Friend WithEvents RadLabel_Status As Telerik.WinControls.UI.RadLabel - Friend WithEvents RadTextBoxControl_MinecraftProfileFolder As Telerik.WinControls.UI.RadTextBoxControl - Friend WithEvents RadTextBoxControl_ModpackConfig As Telerik.WinControls.UI.RadTextBoxControl - Friend WithEvents Panel1 As System.Windows.Forms.Panel - Friend WithEvents RadButton_Install As Telerik.WinControls.UI.RadButton - Friend WithEvents RadButton_CheckForUpdates As Telerik.WinControls.UI.RadButton - Friend WithEvents RadButton_EditModpackConfig As Telerik.WinControls.UI.RadButton - Friend WithEvents RadButton_SearchModpackConfig As Telerik.WinControls.UI.RadButton - Friend WithEvents RadButton_SearchMinecraftProfileFolder As Telerik.WinControls.UI.RadButton - Friend WithEvents RadButton_PasteModpackConfig As Telerik.WinControls.UI.RadButton -End Class diff --git a/ModpackUpdater/Form1.cs b/ModpackUpdater/Form1.cs new file mode 100644 index 0000000..b77f481 --- /dev/null +++ b/ModpackUpdater/Form1.cs @@ -0,0 +1,248 @@ +using ModpackUpdater.Manager; +using ModpackUpdater.Model; +using ModpackUpdater.My.Resources; +using Telerik.WinControls; +using Telerik.WinControls.UI; + +namespace ModpackUpdater; + +public partial class Form1 +{ + private ModpackConfig updateConfig = new(); + private bool currentUpdating = false; + private UpdateCheckResult lastUpdateCheckResult = null; + + public Form1() + { + InitializeComponent(); + Text = $"{Text} (v{Application.ProductVersion})"; + } + + private bool IsMinecaftProfileLoaded() + { + return !string.IsNullOrEmpty(GetMinecraftProfilePath()); + } + + private string GetMinecraftProfilePath() + { + return RadTextBoxControl_MinecraftProfileFolder.Text.Trim(); + } + + private bool IsUpdateConfigLoaded() + { + return !string.IsNullOrEmpty(GetUpdateconfigPath()); + } + + private string GetUpdateconfigPath() + { + return RadTextBoxControl_ModpackConfig.Text.Trim(); + } + + private bool CheckStatus() + { + bool CheckStatusRet = default; + if (!IsMinecaftProfileLoaded() || !MinecraftProfileChecker.CheckProfile(GetMinecraftProfilePath())) + { + SetStatus(LangRes.StatusText_MinecraftProfileWarning, MySymbols.icons8_general_warning_sign_16px); + CheckStatusRet = false; + } + else if (!IsUpdateConfigLoaded()) + { + SetStatus(LangRes.StatusText_MinecraftProfileWarning, MySymbols.icons8_general_warning_sign_16px); + CheckStatusRet = false; + } + else + { + CheckStatusRet = true; + } + + return CheckStatusRet; + } + + private void SetStatus(string statusText, Image image) + { + RadLabel_Status.Text = statusText; + RadLabel_Status.Image = image; + } + + private void ClearStatus() + { + RadLabel_Status.Text = "-"; + RadLabel_Status.Image = null; + } + + private void LoadMinecraftProfile(string folderPath) + { + RadTextBoxControl_MinecraftProfileFolder.Text = folderPath; + + if (IsUpdateConfigLoaded()) + RadButton_CheckForUpdates.PerformClick(); + else + { + ClearStatus(); + } + } + + private void LoadUpdateConfigFile(string filePath) + { + RadTextBoxControl_ModpackConfig.Text = filePath; + try + { + if (IsUpdateConfigLoaded()) + updateConfig = (ModpackConfig)ModpackConfig.LoadFromUrl(filePath); + } + catch (Exception ex) + { + RadTextBoxControl_ModpackConfig.Text = string.Empty; + } + + if (IsMinecaftProfileLoaded()) + RadButton_CheckForUpdates.PerformClick(); + else + { + ClearStatus(); + } + } + + private async Task ExecuteUpdate(bool doInstall) + { + var updater = new ModpackInstaller(updateConfig, GetMinecraftProfilePath()); + updater.InstallProgessUpdated += Update_InstallProgessUpdated; + updater.CheckingProgressUpdated += Updated_CheckingProgresssUpdated; + + // Check only if not pressed "install", not really needed otherwise. + if (lastUpdateCheckResult is null || !doInstall) + { + SetStatus(LangRes.StatusText_CheckingForUpdates, MySymbols.icons8_update_16px); + + try + { + lastUpdateCheckResult = await updater.Check(!AppConfig.Instance.AllowRemoveLocalFiles); + } + catch (Exception ex) + { + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px); + } + finally + { + } + } + + if (lastUpdateCheckResult is null || lastUpdateCheckResult.HasError) + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px); + else if (lastUpdateCheckResult.HasUpdates) + { + if (doInstall) + { + SetStatus(LangRes.StatusText_Installing, MySymbols.icons8_software_installer_16px); + currentUpdating = true; + + try + { + if (await updater.Install(lastUpdateCheckResult) == true) + { + lastUpdateCheckResult = null; // Reset last update check, a new one would be needed now. + SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px); + } + else + { + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px); + } + } + catch + { + SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px); + } + finally + { + currentUpdating = false; + } + } + else + { + SetStatus(LangRes.StatusText_UpdateAvailable, MySymbols.icons8_software_installer_16px); + } + } + else + { + SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px); + } + } + + private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs) + { + int actionCount = result.Actions.Count; + SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", MySymbols.icons8_software_installer_16px); + } + + private void Updated_CheckingProgresssUpdated(int toCheck, int processed) + { + SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", MySymbols.icons8_update_16px); + } + + private void ButtonX_SearchMinecraftProfile_Click(object sender, EventArgs e) + { + var ofd = new RadOpenFolderDialog(); + + if (ofd.ShowDialog(this) == DialogResult.OK) + LoadMinecraftProfile(ofd.FileName); + } + + private void ButtonX_SearchUpdateConfig_Click(object sender, EventArgs e) + { + var ofd = new RadOpenFileDialog() { Filter = FiledialogFilters.JSON_Display + "|" + FiledialogFilters.JSON_Filter }; + + if (ofd.ShowDialog(this) == DialogResult.OK) + LoadUpdateConfigFile(ofd.FileName); + } + + private void RadButton_PasteModpackConfig_Click(object sender, EventArgs e) + { + string text = Clipboard.GetText(); + if (text.StartsWith("http")) + LoadUpdateConfigFile(text); + } + + private async void ButtonX_CheckForUpdates_Click(object sender, EventArgs e) + { + ClearStatus(); + if (CheckStatus()) + await ExecuteUpdate(false); + } + + private async void ButtonX_StartUpdate_Click(object sender, EventArgs e) + { + if (!currentUpdating) + { + ClearStatus(); + if (CheckStatus()) + await ExecuteUpdate(true); + } + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + AppConfig.Instance.LastMinecraftProfilePath = RadTextBoxControl_MinecraftProfileFolder.Text; + AppConfig.Instance.LastConfigFilePath = RadTextBoxControl_ModpackConfig.Text; + AppConfig.Instance.SaveConfig(); + } + + private void Form1_Load(object sender, EventArgs e) + { + if (Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath)) + LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath); + LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath); + } + + private async void Form1_Shown(object sender, EventArgs e) + { + var updater = new AppUpdater(); + if (await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) == DialogResult.Yes) + { + SetStatus(LangRes.StatusText_InstallingAppUpdate, MySymbols.icons8_software_installer_16px); + Enabled = false; + await updater.Install(); + Application.Restart(); + } + } +} \ No newline at end of file diff --git a/ModpackUpdater/Form1.vb b/ModpackUpdater/Form1.vb deleted file mode 100644 index 667fe03..0000000 --- a/ModpackUpdater/Form1.vb +++ /dev/null @@ -1,205 +0,0 @@ -Imports System.IO - -Imports ModpackUpdater.Manager - -Imports ModpackUpdater.Model - -Imports ModpackUpdater.My.Resources - -Imports Telerik.WinControls -Imports Telerik.WinControls.UI - -Public Class Form1 - - Private updateConfig As New ModpackConfig - Private currentUpdating As Boolean = False - Private lastUpdateCheckResult As UpdateCheckResult = Nothing - - Public Sub New() - InitializeComponent() - Text = $"{Text} (v{Application.ProductVersion})" - End Sub - - Private Function IsMinecaftProfileLoaded() As Boolean - Return Not String.IsNullOrEmpty(GetMinecraftProfilePath) - End Function - - Private Function GetMinecraftProfilePath() As String - Return RadTextBoxControl_MinecraftProfileFolder.Text.Trim - End Function - - Private Function IsUpdateConfigLoaded() As Boolean - Return Not String.IsNullOrEmpty(GetUpdateconfigPath) - End Function - - Private Function GetUpdateconfigPath() As String - Return RadTextBoxControl_ModpackConfig.Text.Trim - End Function - - Private Function CheckStatus() As Boolean - If Not IsMinecaftProfileLoaded() OrElse Not MinecraftProfileChecker.CheckProfile(GetMinecraftProfilePath) Then - SetStatus(LangRes.StatusText_MinecraftProfileWarning, MySymbols.icons8_general_warning_sign_16px) - CheckStatus = False - ElseIf Not IsUpdateConfigLoaded() Then - SetStatus(LangRes.StatusText_MinecraftProfileWarning, MySymbols.icons8_general_warning_sign_16px) - CheckStatus = False - Else - CheckStatus = True - End If - End Function - - Private Sub SetStatus(statusText As String, image As Image) - RadLabel_Status.Text = statusText - RadLabel_Status.Image = image - End Sub - - Private Sub ClearStatus() - RadLabel_Status.Text = "-" - RadLabel_Status.Image = Nothing - End Sub - - Private Sub LoadMinecraftProfile(folderPath As String) - RadTextBoxControl_MinecraftProfileFolder.Text = folderPath - - If IsUpdateConfigLoaded() Then - RadButton_CheckForUpdates.PerformClick() - Else - ClearStatus() - End If - End Sub - - Private Sub LoadUpdateConfigFile(filePath As String) - RadTextBoxControl_ModpackConfig.Text = filePath - Try - If IsUpdateConfigLoaded() Then - updateConfig = ModpackConfig.LoadFromUrl(filePath) - End If - Catch ex As Exception - RadTextBoxControl_ModpackConfig.Text = String.Empty - End Try - - If IsMinecaftProfileLoaded() Then - RadButton_CheckForUpdates.PerformClick() - Else - ClearStatus() - End If - End Sub - - Private Async Function ExecuteUpdate(doInstall As Boolean) As Task - Dim updater As New ModpackInstaller(updateConfig, GetMinecraftProfilePath) - AddHandler updater.InstallProgessUpdated, AddressOf Update_InstallProgessUpdated - AddHandler updater.CheckingProgressUpdated, AddressOf Updated_CheckingProgresssUpdated - - 'Check only if not pressed "install", not really needed otherwise. - If lastUpdateCheckResult Is Nothing OrElse Not doInstall Then - SetStatus(LangRes.StatusText_CheckingForUpdates, MySymbols.icons8_update_16px) - - Try - lastUpdateCheckResult = Await updater.Check(Not AppConfig.Instance.AllowRemoveLocalFiles) - Catch ex As Exception - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px) - Finally - End Try - End If - - If lastUpdateCheckResult Is Nothing OrElse lastUpdateCheckResult.HasError Then - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px) - ElseIf lastUpdateCheckResult.HasUpdates Then - If doInstall Then - SetStatus(LangRes.StatusText_Installing, MySymbols.icons8_software_installer_16px) - currentUpdating = True - - Try - If Await updater.Install(lastUpdateCheckResult) Then - lastUpdateCheckResult = Nothing 'Reset last update check, a new one would be needed now. - SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px) - Else - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px) - End If - Catch - SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, MySymbols.icons8_delete_16px) - Finally - currentUpdating = False - End Try - Else - SetStatus(LangRes.StatusText_UpdateAvailable, MySymbols.icons8_software_installer_16px) - End If - Else - SetStatus(LangRes.StatusTest_EverythingOk, MySymbols.icons8_checkmark_16px) - End If - End Function - - Private Sub Update_InstallProgessUpdated(result As UpdateCheckResult, processedSyncs As Integer) - Dim actionCount = result.Actions.Count - SetStatus(Math.Round(processedSyncs / actionCount * 100, 1) & "%", MySymbols.icons8_software_installer_16px) - End Sub - - Private Sub Updated_CheckingProgresssUpdated(toCheck As Integer, processed As Integer) - SetStatus(Math.Round(processed / toCheck * 100, 1) & "%", MySymbols.icons8_update_16px) - End Sub - - Private Sub ButtonX_SearchMinecraftProfile_Click(sender As Object, e As EventArgs) Handles RadButton_SearchMinecraftProfileFolder.Click - Dim ofd As New RadOpenFolderDialog - - If ofd.ShowDialog(Me) = DialogResult.OK Then - LoadMinecraftProfile(ofd.FileName) - End If - End Sub - - Private Sub ButtonX_SearchUpdateConfig_Click(sender As Object, e As EventArgs) Handles RadButton_SearchModpackConfig.Click - Dim ofd As New RadOpenFileDialog With { - .Filter = FiledialogFilters.JSON_Display & "|" & FiledialogFilters.JSON_Filter - } - - If ofd.ShowDialog(Me) = DialogResult.OK Then - LoadUpdateConfigFile(ofd.FileName) - End If - End Sub - - Private Sub RadButton_PasteModpackConfig_Click(sender As Object, e As EventArgs) Handles RadButton_PasteModpackConfig.Click - Dim text = Clipboard.GetText - If text.StartsWith("http") Then - LoadUpdateConfigFile(text) - End If - End Sub - - Private Async Sub ButtonX_CheckForUpdates_Click(sender As Object, e As EventArgs) Handles RadButton_CheckForUpdates.Click - ClearStatus() - If CheckStatus() Then - Await ExecuteUpdate(False) - End If - End Sub - - Private Async Sub ButtonX_StartUpdate_Click(sender As Object, e As EventArgs) Handles RadButton_Install.Click - If Not currentUpdating Then - ClearStatus() - If CheckStatus() Then - Await ExecuteUpdate(True) - End If - End If - End Sub - - Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - AppConfig.Instance.LastMinecraftProfilePath = RadTextBoxControl_MinecraftProfileFolder.Text - AppConfig.Instance.LastConfigFilePath = RadTextBoxControl_ModpackConfig.Text - AppConfig.Instance.SaveConfig() - End Sub - - Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load - If Directory.Exists(AppConfig.Instance.LastMinecraftProfilePath) Then - LoadMinecraftProfile(AppConfig.Instance.LastMinecraftProfilePath) - End If - LoadUpdateConfigFile(AppConfig.Instance.LastConfigFilePath) - End Sub - - Private Async Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown - Dim updater As New AppUpdater - If Await updater.Check AndAlso RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info) = DialogResult.Yes Then - SetStatus(LangRes.StatusText_InstallingAppUpdate, MySymbols.icons8_software_installer_16px) - Enabled = False - Await updater.Install - Application.Restart() - End If - End Sub - -End Class diff --git a/ModpackUpdater/LangRes.Designer.cs b/ModpackUpdater/LangRes.Designer.cs new file mode 100644 index 0000000..78993dd --- /dev/null +++ b/ModpackUpdater/LangRes.Designer.cs @@ -0,0 +1,183 @@ +// ------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +// ------------------------------------------------------------------------------ + + +using System.Diagnostics; + +namespace ModpackUpdater.My.Resources +{ + + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + [System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [DebuggerNonUserCode()] + [System.Runtime.CompilerServices.CompilerGenerated()] + internal class LangRes + { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal LangRes() : base() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager + { + get + { + if (ReferenceEquals(resourceMan, null)) + { + var temp = new System.Resources.ResourceManager("ModpackUpdater.LangRes", typeof(LangRes).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue? ähnelt. + /// + internal static string MsgBox_UpdateAvailable + { + get + { + return ResourceManager.GetString("MsgBox_UpdateAvailable", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die New program version available ähnelt. + /// + internal static string MsgBox_UpdateAvailable_Title + { + get + { + return ResourceManager.GetString("MsgBox_UpdateAvailable_Title", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Everything is right and up-to-date. ähnelt. + /// + internal static string StatusTest_EverythingOk + { + get + { + return ResourceManager.GetString("StatusTest_EverythingOk", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Checking for Updates... ähnelt. + /// + internal static string StatusText_CheckingForUpdates + { + get + { + return ResourceManager.GetString("StatusText_CheckingForUpdates", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Config incomplete or not loaded! ähnelt. + /// + internal static string StatusText_ConfigIncompleteOrNotLoaded + { + get + { + return ResourceManager.GetString("StatusText_ConfigIncompleteOrNotLoaded", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Error on update check or while updating! ähnelt. + /// + internal static string StatusText_ErrorWhileUpdateCheckOrUpdate + { + get + { + return ResourceManager.GetString("StatusText_ErrorWhileUpdateCheckOrUpdate", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Installing... ähnelt. + /// + internal static string StatusText_Installing + { + get + { + return ResourceManager.GetString("StatusText_Installing", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Downloading program update... ähnelt. + /// + internal static string StatusText_InstallingAppUpdate + { + get + { + return ResourceManager.GetString("StatusText_InstallingAppUpdate", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Minecraft profile folder seems to be not valid. ähnelt. + /// + internal static string StatusText_MinecraftProfileWarning + { + get + { + return ResourceManager.GetString("StatusText_MinecraftProfileWarning", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die An update is available! ähnelt. + /// + internal static string StatusText_UpdateAvailable + { + get + { + return ResourceManager.GetString("StatusText_UpdateAvailable", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/ModpackUpdater/LangRes.Designer.vb b/ModpackUpdater/LangRes.Designer.vb deleted file mode 100644 index 40c1e7a..0000000 --- a/ModpackUpdater/LangRes.Designer.vb +++ /dev/null @@ -1,157 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - ''' - ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - ''' - _ - Friend Class LangRes - - Private Shared resourceMan As Global.System.Resources.ResourceManager - - Private Shared resourceCulture As Global.System.Globalization.CultureInfo - - _ - Friend Sub New() - MyBase.New - End Sub - - ''' - ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - ''' - _ - Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ModpackUpdater.LangRes", GetType(LangRes).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - ''' - _ - Friend Shared Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue? ähnelt. - ''' - Friend Shared ReadOnly Property MsgBox_UpdateAvailable() As String - Get - Return ResourceManager.GetString("MsgBox_UpdateAvailable", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die New program version available ähnelt. - ''' - Friend Shared ReadOnly Property MsgBox_UpdateAvailable_Title() As String - Get - Return ResourceManager.GetString("MsgBox_UpdateAvailable_Title", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Everything is right and up-to-date. ähnelt. - ''' - Friend Shared ReadOnly Property StatusTest_EverythingOk() As String - Get - Return ResourceManager.GetString("StatusTest_EverythingOk", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Checking for Updates... ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_CheckingForUpdates() As String - Get - Return ResourceManager.GetString("StatusText_CheckingForUpdates", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Config incomplete or not loaded! ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_ConfigIncompleteOrNotLoaded() As String - Get - Return ResourceManager.GetString("StatusText_ConfigIncompleteOrNotLoaded", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Error on update check or while updating! ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_ErrorWhileUpdateCheckOrUpdate() As String - Get - Return ResourceManager.GetString("StatusText_ErrorWhileUpdateCheckOrUpdate", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Installing... ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_Installing() As String - Get - Return ResourceManager.GetString("StatusText_Installing", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Downloading program update... ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_InstallingAppUpdate() As String - Get - Return ResourceManager.GetString("StatusText_InstallingAppUpdate", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die Minecraft profile folder seems to be not valid. ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_MinecraftProfileWarning() As String - Get - Return ResourceManager.GetString("StatusText_MinecraftProfileWarning", resourceCulture) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Zeichenfolge, die An update is available! ähnelt. - ''' - Friend Shared ReadOnly Property StatusText_UpdateAvailable() As String - Get - Return ResourceManager.GetString("StatusText_UpdateAvailable", resourceCulture) - End Get - End Property - End Class -End Namespace diff --git a/ModpackUpdater/ModpackUpdater.vbproj b/ModpackUpdater/ModpackUpdater.csproj similarity index 59% rename from ModpackUpdater/ModpackUpdater.vbproj rename to ModpackUpdater/ModpackUpdater.csproj index cfdc1cd..527da51 100644 --- a/ModpackUpdater/ModpackUpdater.vbproj +++ b/ModpackUpdater/ModpackUpdater.csproj @@ -1,75 +1,60 @@  + WinExe net8.0-windows - Sub Main true - WindowsForms icons8_download_from_ftp.ico Minecraft Modpack Updater + true true 1.4.1.0 - - true - embedded - + + + - - - - - - + True True FiledialogFilters.resx - + True True LangRes.resx - - True - True - Application.myapp - - + True True MySymbols.resx - - - MyApplicationCodeGenerator - Application.Designer.vb - - + ResXFileCodeGenerator - My.Resources - FiledialogFilters.Designer.vb + ModpackUpdater.My.Resources + FiledialogFilters.Designer.cs ResXFileCodeGenerator - My.Resources - LangRes.Designer.vb + ModpackUpdater.My.Resources + LangRes.Designer.cs ResXFileCodeGenerator - My.Resources - MySymbols.Designer.vb + ModpackUpdater.My.Resources + MySymbols.Designer.cs + @@ -77,8 +62,10 @@ + - - + + + \ No newline at end of file diff --git a/ModpackUpdater/My Project/Application.Designer.vb b/ModpackUpdater/My Project/Application.Designer.vb deleted file mode 100644 index 7296a3c..0000000 --- a/ModpackUpdater/My Project/Application.Designer.vb +++ /dev/null @@ -1,38 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - 'HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten - ' oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer. - ' (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im - ' Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor. - ' - Partial Friend Class MyApplication - - _ - Public Sub New() - MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) - Me.IsSingleInstance = false - Me.EnableVisualStyles = true - Me.SaveMySettingsOnExit = true - Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses - End Sub - - _ - Protected Overrides Sub OnCreateMainForm() - Me.MainForm = Global.ModpackUpdater.Form1 - End Sub - End Class -End Namespace diff --git a/ModpackUpdater/My Project/Application.myapp b/ModpackUpdater/My Project/Application.myapp deleted file mode 100644 index 0f12f32..0000000 --- a/ModpackUpdater/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - true - Form1 - false - 0 - true - 0 - true - \ No newline at end of file diff --git a/ModpackUpdater/MySymbols.Designer.cs b/ModpackUpdater/MySymbols.Designer.cs new file mode 100644 index 0000000..ca7dc7f --- /dev/null +++ b/ModpackUpdater/MySymbols.Designer.cs @@ -0,0 +1,182 @@ +// ------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +// ------------------------------------------------------------------------------ + + +using System.Diagnostics; +using System.Drawing; + +namespace ModpackUpdater.My.Resources +{ + + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + [System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [DebuggerNonUserCode()] + [System.Runtime.CompilerServices.CompilerGenerated()] + internal class MySymbols + { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MySymbols() : base() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager + { + get + { + if (ReferenceEquals(resourceMan, null)) + { + var temp = new System.Resources.ResourceManager("ModpackUpdater.MySymbols", typeof(MySymbols).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_checkmark_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_checkmark_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_delete_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_delete_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_download_from_ftp_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_download_from_ftp_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_general_warning_sign_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_general_warning_sign_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_opened_folder_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_opened_folder_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_save_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_save_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_software_installer_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_software_installer_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_update_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_update_16px", resourceCulture); + return (Bitmap)obj; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static Bitmap icons8_wrench_16px + { + get + { + var obj = ResourceManager.GetObject("icons8_wrench_16px", resourceCulture); + return (Bitmap)obj; + } + } + } +} \ No newline at end of file diff --git a/ModpackUpdater/MySymbols.Designer.vb b/ModpackUpdater/MySymbols.Designer.vb deleted file mode 100644 index d6b4b8e..0000000 --- a/ModpackUpdater/MySymbols.Designer.vb +++ /dev/null @@ -1,157 +0,0 @@ -'------------------------------------------------------------------------------ -' -' Dieser Code wurde von einem Tool generiert. -' Laufzeitversion:4.0.30319.42000 -' -' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -' der Code erneut generiert wird. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - ''' - ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - ''' - _ - Friend Class MySymbols - - Private Shared resourceMan As Global.System.Resources.ResourceManager - - Private Shared resourceCulture As Global.System.Globalization.CultureInfo - - _ - Friend Sub New() - MyBase.New - End Sub - - ''' - ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - ''' - _ - Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ModpackUpdater.MySymbols", GetType(MySymbols).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - ''' - _ - Friend Shared Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_checkmark_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_checkmark_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_delete_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_delete_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_download_from_ftp_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_download_from_ftp_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_general_warning_sign_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_general_warning_sign_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_opened_folder_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_opened_folder_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_save_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_save_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_software_installer_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_software_installer_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_update_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_update_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - - ''' - ''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. - ''' - Friend Shared ReadOnly Property icons8_wrench_16px() As System.Drawing.Bitmap - Get - Dim obj As Object = ResourceManager.GetObject("icons8_wrench_16px", resourceCulture) - Return CType(obj,System.Drawing.Bitmap) - End Get - End Property - End Class -End Namespace diff --git a/ModpackUpdater/Program.cs b/ModpackUpdater/Program.cs new file mode 100644 index 0000000..3c1e48c --- /dev/null +++ b/ModpackUpdater/Program.cs @@ -0,0 +1,18 @@ +using Telerik.WinControls; + +namespace ModpackUpdater; + +internal static class Program +{ + public static void Main(string[] args) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); + + if (ThemeResolutionService.LoadPackageResource("ModpackUpdater.CustomThemes.Office2019DarkBluePurple.tssp")) + ThemeResolutionService.ApplicationThemeName = "Office2019DarkBluePurple"; + + Application.Run(new Form1()); + } +}