diff --git a/MinecraftLauncher/MainWindow.xaml b/MinecraftLauncher/MainWindow.xaml
index 562653c..2747705 100644
--- a/MinecraftLauncher/MainWindow.xaml
+++ b/MinecraftLauncher/MainWindow.xaml
@@ -176,7 +176,7 @@
-
+
@@ -210,7 +210,7 @@
-
+
@@ -225,12 +225,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -242,25 +242,25 @@
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
-
+
diff --git a/MinecraftLauncher/MainWindow.xaml.vb b/MinecraftLauncher/MainWindow.xaml.vb
index bd86efb..b419f87 100644
--- a/MinecraftLauncher/MainWindow.xaml.vb
+++ b/MinecraftLauncher/MainWindow.xaml.vb
@@ -255,44 +255,6 @@ Public Class MainWindow
myKey.SetValue(Nothing, Chr(34) & applicationPath & Chr(34) & " %1")
End Sub
- Sub Get_Profiles()
- Profiles.Load()
- Dim jo As JObject = Profiles.profilesjo
- Dim i As Integer = 0
- Profiles.Load()
- Dim selectedprofile As String = jo("selectedProfile").ToString
- cb_profiles.Items.Clear()
- cb_mods_profilename.Items.Clear()
- For Each Profile As String In Profiles.List
- cb_profiles.Items.Add(Profile)
- cb_mods_profilename.Items.Add(Profile)
- Next
- If jo.Properties.Select(Function(p) p.Name).Contains("selectedProfile") = True Then
- cb_profiles.SelectedItem = selectedprofile
- cb_mods_profilename.SelectedItem = selectedprofile
- Else
- jo.Add(New JProperty("selectedProfile"))
- cb_profiles.SelectedIndex = 0
- cb_mods_profilename.SelectedIndex = 0
- End If
-
- If Profiles.List.Count = 0 Then
- 'StandartProfile schreiben
- Dim standartprofile As New JObject(
- New JProperty("profiles",
- New JObject(
- New JProperty("Default",
- New JObject(
- New JProperty("name", "Default"))))),
- New JProperty("selectedProfile", "Default"))
- IO.File.WriteAllText(launcher_profiles_json.FullName, standartprofile.ToString)
-
- Get_Profiles()
-
- End If
-
- End Sub
-
Async Sub Download_Resources()
If Startinfos.Versionsinfo Is Nothing Then
Await Parse_VersionsInfo(Startinfos.Version)
@@ -436,7 +398,7 @@ Public Class MainWindow
destination.Delete()
End If
resourcefile(item.hash).CopyTo(destination.FullName)
- Catch
+ Catch ex As Exception
End Try
Next
End If
@@ -495,110 +457,134 @@ Public Class MainWindow
Async Sub Download_Version()
Dim versionid As String = Startinfos.Version.id
Dim VersionsURl As String = "https://s3.amazonaws.com/Minecraft.Download/versions/" & versionid & "/" & versionid & ".jar"
- Dim VersionsJSONURL As String = "https://s3.amazonaws.com/Minecraft.Download/versions/" & versionid & "/" & versionid & ".json"
- Dim Outputfile As String = Path.Combine(versionsfolder.FullName, versionid, versionid & ".jar")
- Dim CacheOutputfile As String = Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".jar")
- Dim OutputfileJSON As String = Path.Combine(versionsfolder.FullName, versionid, versionid & ".json")
- Dim CacheOutputfileJSON As String = Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".json")
- Dim CacheDirectoryname As String = IO.Path.GetDirectoryName(CacheOutputfile)
- Dim Directoryname As String = IO.Path.GetDirectoryName(Outputfile)
- Dim downloaderror As Boolean = False
- Dim jsondownloaderror As Boolean = False
+ Dim Outputfile As New FileInfo(Path.Combine(versionsfolder.FullName, versionid, versionid & ".jar"))
+ Dim CacheOutputfile As New FileInfo(Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".jar"))
'Jar File download
Write("Prüfe, ob die Version aktuell ist")
Dim todownload As Boolean = False
- If IO.File.Exists(Outputfile) = False Then
+ If Outputfile.Exists = False Then
todownload = True
Else
- Try
- Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(VersionsURl), HttpWebRequest)
- Dim Response As WebResponse = Await Request.GetResponseAsync
- Dim etag As String = Response.Headers("ETag")
- Dim md5 As String = MD5FileHash(Outputfile).ToLower
- If etag <> Chr(34) & md5 & Chr(34) Then
- todownload = True
- End If
- Catch
+ If Versions.versions.Where(Function(p) p.custom = False).Select(Function(p) p.id).Contains(versionid) Then
+ Try
+ Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(VersionsURl), HttpWebRequest)
+ Dim Response As WebResponse = Await Request.GetResponseAsync
+ Dim etag As String = Response.Headers("ETag")
+ Dim md5 As String = MD5FileHash(Outputfile.FullName).ToLower
+ If etag <> Chr(34) & md5 & Chr(34) Then
+ todownload = True
+ End If
+ Catch
+ todownload = False
+ End Try
+ Else
todownload = False
- End Try
+ End If
End If
If todownload = True Then
Write("Lade Minecraft Version " & versionid & " herunter")
Try
- If IO.Directory.Exists(CacheDirectoryname) = False Then
- IO.Directory.CreateDirectory(CacheDirectoryname)
+ If CacheOutputfile.Directory.Exists = False Then
+ CacheOutputfile.Directory.Create()
End If
wcversionsdownload = New WebClient
- Await wcversionsdownload.DownloadFileTaskAsync(New Uri(VersionsURl), CacheOutputfile)
+ AddHandler wcversionsdownload.DownloadFileCompleted, AddressOf versiondownloadfinished
+ Await wcversionsdownload.DownloadFileTaskAsync(New Uri(VersionsURl), CacheOutputfile.FullName)
Catch ex As Exception
Write("Fehler beim herunterladen von Minecraft " & versionid & " :" & Environment.NewLine & ex.Message, LogLevel.ERROR)
- downloaderror = True
+ Startinfos.IsStarting = False
End Try
- If IO.Directory.Exists(Directoryname) = False Then
- IO.Directory.CreateDirectory(Directoryname)
- End If
- ElseIf todownload = False And File.Exists(Outputfile) = False Then
- Write("Minecraft " & versionid & " existiert nicht und konnte nicht heruntergeladen werden", LogLevel.ERROR)
- downloaderror = True
+ Else
+ Await downloadverisonsjson()
End If
- If downloaderror = False And File.Exists(CacheOutputfile) = True Then
- If IO.File.Exists(Outputfile) Then
- IO.File.Delete(Outputfile)
+ End Sub
+
+ Public Async Sub versiondownloadfinished(sender As Object, e As ComponentModel.AsyncCompletedEventArgs)
+ Dim versionid As String = Startinfos.Version.id
+ Dim Outputfile As New FileInfo(Path.Combine(versionsfolder.FullName, versionid, versionid & ".jar"))
+ Dim CacheOutputfile As New FileInfo(Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".jar"))
+
+ If e.Error Is Nothing And e.Cancelled = False Then
+ If Outputfile.Exists Then
+ Outputfile.Delete()
End If
- IO.File.Move(CacheOutputfile, Outputfile)
- ElseIf downloaderror = True Then
+ If Outputfile.Directory.Exists = False Then
+ Outputfile.Directory.Create()
+ End If
+ CacheOutputfile.MoveTo(Outputfile.FullName)
+ Await downloadverisonsjson()
+ Else
+ Write("Fehler beim herunterladen von Minecraft " & Startinfos.Version.id & " :" & Environment.NewLine & e.Error.Message, LogLevel.ERROR)
Startinfos.IsStarting = False
- Exit Sub
End If
+ End Sub
-
+ Async Function downloadverisonsjson() As Task
+ Dim versionid As String = Startinfos.Version.id
+ Dim VersionsJSONURL As String = "https://s3.amazonaws.com/Minecraft.Download/versions/" & versionid & "/" & versionid & ".json"
+ Dim OutputfileJSON As New FileInfo(Path.Combine(versionsfolder.FullName, versionid, versionid & ".json"))
+ Dim CacheOutputfileJSON As New FileInfo(Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".json"))
'Json File download
Dim jsontodownload As Boolean = False
- If IO.File.Exists(OutputfileJSON) = False Then
+ If OutputfileJSON.Exists = False Then
jsontodownload = True
Else
- Try
- Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(VersionsJSONURL), HttpWebRequest)
- Dim Response As WebResponse = Await Request.GetResponseAsync
- Dim etag As String = Response.Headers("ETag")
- Dim md5 As String = MD5FileHash(OutputfileJSON).ToLower
- If etag <> Chr(34) & md5 & Chr(34) Then
- jsontodownload = True
- End If
- Catch
+ If Versions.versions.Where(Function(p) p.custom = False).Select(Function(p) p.id).Contains(versionid) Then
+ Try
+ Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(VersionsJSONURL), HttpWebRequest)
+ Dim Response As WebResponse = Await Request.GetResponseAsync
+ Dim etag As String = Response.Headers("ETag")
+ Dim md5 As String = MD5FileHash(OutputfileJSON.FullName).ToLower
+ If etag <> Chr(34) & md5 & Chr(34) Then
+ jsontodownload = True
+ End If
+ Catch
+ jsontodownload = False
+ End Try
+ Else
jsontodownload = False
- End Try
+ End If
End If
If jsontodownload = True Then
- If IO.Directory.Exists(CacheDirectoryname) = False Then
- IO.Directory.CreateDirectory(CacheDirectoryname)
+ If CacheOutputfileJSON.Directory.Exists = False Then
+ CacheOutputfileJSON.Directory.Create()
End If
pb_download_Maximum(100)
Try
- wcversionsdownload = New WebClient
- Await wcversionsdownload.DownloadFileTaskAsync(New Uri(VersionsJSONURL), CacheOutputfileJSON)
+ Using a As New WebClient
+ AddHandler a.DownloadFileCompleted, AddressOf jsondownloadfinished
+ a.DownloadFileAsync(New Uri(VersionsJSONURL), CacheOutputfileJSON.FullName)
+ End Using
Catch ex As Exception
Write("Fehler beim herunterladen von Minecraft " & versionid & " :" & Environment.NewLine & ex.Message, LogLevel.ERROR)
- jsondownloaderror = True
+ Startinfos.IsStarting = False
End Try
- If IO.Directory.Exists(Directoryname) = False Then
- IO.Directory.CreateDirectory(Directoryname)
- End If
- ElseIf jsontodownload = False And File.Exists(OutputfileJSON) = False Then
- Write("Minecraft " & versionid & " existiert nicht und konnte nicht heruntergeladen werden", LogLevel.ERROR)
- jsondownloaderror = True
+ Else
+ Await Versiondownloadfinished_start()
End If
- If jsondownloaderror = False And File.Exists(CacheOutputfileJSON) = True Then
- If IO.File.Exists(OutputfileJSON) Then
- IO.File.Delete(OutputfileJSON)
+ End Function
+
+ Public Async Sub jsondownloadfinished(sender As Object, e As ComponentModel.AsyncCompletedEventArgs)
+ Dim versionid As String = Startinfos.Version.id
+ Dim OutputfileJSON As New FileInfo(Path.Combine(versionsfolder.FullName, versionid, versionid & ".json"))
+ Dim CacheOutputfileJSON As New FileInfo(Path.Combine(cachefolder.FullName, "versions", versionid, versionid & ".json"))
+ If e.Error Is Nothing And e.Cancelled = False Then
+ If OutputfileJSON.Exists Then
+ OutputfileJSON.Delete()
+ End If
+ If OutputfileJSON.Directory.Exists = False Then
+ OutputfileJSON.Directory.Create()
End If
- IO.File.Move(CacheOutputfileJSON, OutputfileJSON)
- ElseIf jsondownloaderror = True Then
+ CacheOutputfileJSON.MoveTo(OutputfileJSON.FullName)
+ Await Versiondownloadfinished_start()
+ ElseIf e.Error IsNot Nothing Then
+ Write("Ein Fehler ist beim herunterladen der Version aufgetreten: " & e.Error.Message, LogLevel.ERROR)
Startinfos.IsStarting = False
- Exit Sub
End If
+ End Sub
+ Async Function Versiondownloadfinished_start() As Task
'Start
If Startinfos.Versionsinfo Is Nothing Then
Await Parse_VersionsInfo(Startinfos.Version)
@@ -609,7 +595,7 @@ Public Class MainWindow
If Startinfos.IsStarting = True Then
Download_Resources()
End If
- End Sub
+ End Function
Function Login(username As String, password As String) As Session
Dim session As Session = Client.Session.DoLogin(username, password)
@@ -633,7 +619,8 @@ Public Class MainWindow
Dim o As String = File.ReadAllText(versionsJSON(Version))
Dim javaarch As Integer = Await GetJavaArch()
o = o.Replace("${arch}", javaarch.ToString)
- Startinfos.Versionsinfo = Await JsonConvert.DeserializeObjectAsync(Of VersionsInfo)(o)
+ 'Converter because some Forge Versions(10.12.0.1054) has Double as minimumlauncherversion, expected integer. It rounds the double to an integer
+ Startinfos.Versionsinfo = Await JsonConvert.DeserializeObjectAsync(Of VersionsInfo)(o, New JsonSerializerSettings() With {.NullValueHandling = NullValueHandling.Ignore, .Converters = New List(Of JsonConverter) From {New CustomIntConverter()}})
Startinfos.Versionsinfo.JObject = JObject.Parse(o)
End Function
@@ -667,13 +654,13 @@ Public Class MainWindow
If allowdownload = True Then
Dim todownload As Boolean = True
Dim url As String = Nothing
- If Startinfos.Versionsinfo.JObject("libraries").Item(librariesdownloadindex).Value(Of JObject).Properties.Select(Function(p) p.Name).Contains("url") = False Then
+ If Startinfos.Versionsinfo.libraries.ElementAt(librariesdownloadindex).url = Nothing Then
url = librariesurl & Currentlibrary.path
Else
- Dim customurl As String = Startinfos.Versionsinfo.JObject("libraries").Item(librariesdownloadindex).Value(Of String)("url")
+ Dim customurl As String = Startinfos.Versionsinfo.libraries.ElementAt(librariesdownloadindex).url
url = customurl & Currentlibrary.path
End If
- Dim librarypath As New FileInfo(IO.Path.Combine(librariesfolder.FullName, Currentlibrary.path.Replace("/", "\")))
+ Dim librarypath As New FileInfo(IO.Path.Combine(librariesfolder.FullName, Currentlibrary.path))
Dim a As New WebClient()
If librarypath.Directory.Exists = False Then
librarypath.Directory.Create()
@@ -685,13 +672,16 @@ Public Class MainWindow
End Try
Currentlibrarysha1 = File.ReadAllText(librarypath.FullName & ".sha1")
If librarypath.Exists Then
- If SHA1FileHash(librarypath.FullName).ToLower = Currentlibrarysha1 Then
+ If String.IsNullOrWhiteSpace(Currentlibrarysha1) Then
todownload = False
Else
- todownload = True
+ If SHA1FileHash(librarypath.FullName).ToLower = Currentlibrarysha1 Then
+ todownload = False
+ Else
+ todownload = True
+ End If
End If
Else
- '*********************************************************Wenn library nicht existiert und library url ist files.minecraftforge.net, dann Meldung zum erneuten installireren von Forge zeigen.
todownload = True
End If
If todownload = True Then
@@ -699,46 +689,48 @@ Public Class MainWindow
If librarypath.Directory.Exists = False Then
librarypath.Directory.Create()
End If
- If String.IsNullOrWhiteSpace(Currentlibrarysha1) Then
- If librarypath.Exists Then
- Write("Library konnte nicht auf Hash überprüft werden und wird übersprungen, in der Annahme, dass die lokale Datei gut ist: " & librarypath.FullName, LogLevel.WARNING)
- librariesdownloadindex += 1
- DownloadLibraries()
+ 'Falls es ein MinecraftForge Build ist, url ändern
+ downloadforgelib = False
+ Dim forgeuniversal As Boolean = False
+ Dim version As String = Currentlibrary.name.Split(CChar(":"))(2)
+ 'legacy = "minecraftforge", new versions = "forge"
+ If Currentlibrary.name.Split(CChar(":"))(1) = "minecraftforge" And Forge.ForgeList.Select(Function(p) p.version).Contains(version) Then
+ Dim mcversion As String = Forge.ForgeList.Where(Function(p) p.version = version).First.mcversion
+ 'Buildlist durchsuchen
+ downloadforgelib = True
+ forgeuniversal = True
+ url = String.Format("http://files.minecraftforge.net/minecraftforge/minecraftforge-universal-{1}-{0}.jar", version, mcversion)
+ ElseIf Currentlibrary.name.Split(CChar(":"))(1) = "forge" Then
+ Dim mcversion As String = Forge.ForgeList.Where(Function(p) p.version = version).First.mcversion
+ downloadforgelib = True
+ forgeuniversal = True
+ url = String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{1}-{0}/forge-{1}-{0}-universal.jar", version, mcversion)
+ End If
+ Dim outputfile As String = librarypath.FullName
+ 'Auser bei forge universal lib
+ If url.Contains("files.minecraftforge.net") And forgeuniversal = False Then
+ downloadforgelib = True
+ Tounpack = True
+ url = url.Insert(url.Length, ".pack.xz")
+ outputfile = outputfile.Insert(outputfile.Length, ".pack.xz")
+ Write("Library wird von den Forge Servern heruntergeladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
+ Else
+ If forgeuniversal = True Then
+ Write("Minecraft Forge Library wird automatisch heruntergeladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
Else
- 'Falls es ein MinecraftForge Build ist, url ändern
- downloadforgelib = False
- Dim version As String = Currentlibrary.name.Split(CChar(":"))(2)
- If Currentlibrary.name.Split(CChar(":"))(1) = "minecraftforge" And Forge.ForgeList.Select(Function(p) p.version).Contains(version) Then
- 'Buildlist durchsuchen
- Dim mcversion As String = Forge.ForgeList.Where(Function(p) p.version = version).First.mcversion
- downloadforgelib = True
- url = String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{1}-{0}/forge-{1}-{0}-universal.jar", version, mcversion)
- ElseIf Currentlibrary.name.Split(CChar(":"))(1) = "forge" Then
- downloadforgelib = True
- url = String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}/forge-{0}-universal.jar", version)
- End If
- Dim outputfile As String = librarypath.FullName
- 'Auser bei forge universal lib
- If url.Contains("files.minecraftforge.net") And downloadforgelib = False Then
- Tounpack = True
- url = url.Insert(url.Length, ".pack.xz")
- outputfile = outputfile.Insert(outputfile.Length, ".pack.xz")
- Write("Library wird von den Forge Servern heruntergeladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
- Else
- If downloadforgelib = True Then
- Write("Minecraft Forge Library wird automatisch heruntergeladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
- Else
- Write("Versuche Library von alternativer Quelle herunterzuladen herunterzuladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
- End If
- End If
- wc_libraries.DownloadFileAsync(New Uri(url), outputfile)
+ Write("Versuche Library von alternativer Quelle herunterzuladen herunterzuladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
End If
- Else
- wc_libraries.DownloadFileAsync(New Uri(url), librarypath.FullName)
- Write("Library wird heruntergeladen (Versuch " & librariesdownloadtry & "): " & librarypath.FullName)
End If
+ If downloadforgelib = False Then
+ Write("Library wird heruntergeladen (Versuch " & librariesdownloadtry & "): " & outputfile)
+ End If
+ wc_libraries.DownloadFileAsync(New Uri(url), outputfile)
Else
- Write("Library existiert bereits: " & librarypath.FullName)
+ If String.IsNullOrWhiteSpace(Currentlibrarysha1) Then
+ Write("Library konnte nicht auf Hash überprüft werden und wird übersprungen, in der Annahme, dass die lokale Datei gut ist: " & librarypath.FullName, LogLevel.WARNING)
+ Else
+ Write("Library existiert bereits: " & librarypath.FullName)
+ End If
librariesdownloadindex += 1
DownloadLibraries()
End If
@@ -751,7 +743,7 @@ Public Class MainWindow
DownloadLibrariesfinished()
End If
Catch Ex As Exception
- Write("Fehler:" & Ex.Message, LogLevel.ERROR)
+ Write(Ex.Message & Environment.NewLine & Ex.StackTrace, LogLevel.ERROR)
Startinfos.IsStarting = False
End Try
End Sub
@@ -772,7 +764,7 @@ Public Class MainWindow
If e.Cancelled = False And e.Error Is Nothing Then
Dim libpath As String = Path.Combine(librariesfolder.FullName, Currentlibrary.path)
If Tounpack = True Then
- Dim input As New FileInfo(libpath.Insert(libpath.Length, ".pack.xz"))
+ Dim input As New FileInfo(libpath & ".pack.xz")
Dim output As New FileInfo(libpath)
Write("Library wird entpackt: " & libpath)
If Await Unpack.Unpack(input, output) = False Then
@@ -787,7 +779,7 @@ Public Class MainWindow
Startinfos.IsStarting = False
librariesdownloading = False
Else
- If Tounpack = True Or downloadforgelib = True Then
+ If Tounpack = True Then
Tounpack = False
'Nächste Library Downloaden
librariesdownloadindex += 1
@@ -858,10 +850,9 @@ Public Class MainWindow
End If
Try
Using zip1 As ZipFile = ZipFile.Read(librarypath.FullName)
- Dim e As ZipEntry
' here, we extract every entry, but we could extract conditionally,
' based on entry name, size, date, checkbox status, etc.
- For Each e In zip1
+ For Each e As ZipEntry In zip1
Dim ls As IList(Of String) = .extract.exclude
For Each file As String In ls
If e.FileName.StartsWith(file) = False Then
@@ -1040,8 +1031,9 @@ Public Class MainWindow
Await Me.ShowMessageAsync(Nothing, "Gib bitte einen Usernamen ein!", MessageDialogStyle.Affirmative, New MetroDialogSettings() With {.AffirmativeButtonText = "Ok", .ColorScheme = MetroDialogColorScheme.Accented})
Else
If Startinfos.Profile Is Nothing Then
- Startinfos.Profile = Await Profiles.FromName(selectedprofile)
+ Startinfos.Profile = Await Profiles.FromName(ViewModel.selectedprofile)
End If
+ Await Versions_Load()
tabitem_console.IsSelected = True
mc = New Process
'If cb_online_mode.IsChecked = True Then
@@ -1088,6 +1080,7 @@ Public Class MainWindow
If Versions.versions.Select(Function(p) p.id).Contains(Startinfos.Profile.lastVersionId) Then
Startinfos.Version = Versions.versions.Where(Function(p) p.id = Startinfos.Profile.lastVersionId).First
Else
+ Startinfos.Profile = Nothing
Write(Startinfos.Profile.lastVersionId & ".jar und/oder " & Startinfos.Profile.lastVersionId & ".json existiert nicht" & Environment.NewLine & "---Wähle eine andere Version aus oder, falls du gerade Forge gestartet hast, installiere es erneut!", LogLevel.ERROR)
Exit Sub
End If
@@ -1158,6 +1151,17 @@ Public Class MainWindow
Case MainWindow.LogLevel.ERROR
Dispatcher.Invoke(New WriteColored(AddressOf Append), "[ERROR] " & Line, tb_ausgabe, Brushes.Red)
End Select
+ '-Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
+
+ 'Error:
+
+ '2014-04-08 16:06:25 [Schwerwiegend] [ForgeModLoader] Technical information: The class net.minecraft.client.ClientBrandRetriever should have been associated with the minecraft jar file,
+ 'and should have returned us a valid, intact minecraft jar location. This did not work. Either you have modified the minecraft jar file (if so run the forge installer again),
+ 'or you are using a base editing jar that is changing this class (and likely others too). If you REALLY want to run minecraft in this configuration,
+ 'add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile.
+ If Line.Contains("add the flag -Dfml.ignoreInvalidMinecraftCertificates=true to the 'JVM settings' in your launcher profile") Then
+ Write("Ein Fehler ist aufgetreten. Bitte versuche, im ProfileEditor bei den ""JVM Argumenten"" folgendes hinzuzufügen: "" -Dfml.ignoreInvalidMinecraftCertificates=true""", MainWindow.LogLevel.ERROR)
+ End If
End Sub
Public Enum LogLevel
INFO
@@ -1184,7 +1188,7 @@ Public Class MainWindow
If Startinfos.IsStarting = True Then
profile = Startinfos.Profile
Else
- profile = Await Profiles.FromName(selectedprofile)
+ profile = Await Profiles.FromName(ViewModel.selectedprofile)
End If
Dim procStartInfo As New System.Diagnostics.ProcessStartInfo(Startcmd(profile), "-version")
@@ -1229,51 +1233,22 @@ Public Class MainWindow
End Sub
Private Sub btn_new_profile_Click(sender As Object, e As RoutedEventArgs) Handles btn_new_profile.Click
- Dim result As Boolean?
Newprofile = True
Dim frm_ProfileEditor As New ProfileEditor
- Dim Profiles As New Profiles
frm_ProfileEditor.ShowDialog()
- result = frm_ProfileEditor.DialogResult
- If result = True Then
- Get_Profiles()
- End If
-
End Sub
Private Sub btn_edit_profile_Click(sender As Object, e As RoutedEventArgs) Handles btn_edit_profile.Click
- Dim result As Boolean?
Newprofile = False
Dim frm_ProfileEditor As New ProfileEditor
- Dim Profiles As New Profiles
frm_ProfileEditor.ShowDialog()
- result = frm_ProfileEditor.DialogResult
- If result = True Then
- Get_Profiles()
- End If
- End Sub
-
- Private Sub cb_profiles_DropDownClosed(sender As Object, e As EventArgs) Handles cb_profiles.DropDownClosed
- Get_Profiles()
- End Sub
-
- Private Sub cb_profiles_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles cb_profiles.SelectionChanged
- Try
- selectedprofile = cb_profiles.SelectedItem.ToString
- Dim o As String = IO.File.ReadAllText(launcher_profiles_json.FullName)
- Dim jo As JObject = JObject.Parse(o)
- jo("selectedProfile") = selectedprofile
- IO.File.WriteAllText(launcher_profiles_json.FullName, jo.ToString)
- cb_mods_profilename.SelectedItem = cb_profiles.SelectedItem
- Catch
- End Try
End Sub
Private Async Sub btn_delete_profile_Click(sender As Object, e As RoutedEventArgs) Handles btn_delete_profile.Click
- If cb_profiles.Items.Count > 1 Then
- Profiles.Remove(cb_profiles.SelectedItem.ToString)
- cb_profiles.SelectedIndex = 0
- Get_Profiles()
+ If ViewModel.Profiles.Count > 1 Then
+ Profiles.Remove(ViewModel.selectedprofile)
+ ViewModel.selectedprofile = ViewModel.Profiles.First
+ Profiles.Get_Profiles()
Else
Await Me.ShowMessageAsync("Fehler", "Das letzte Profil kann nicht gelöscht werden!", MessageDialogStyle.Affirmative, New MetroDialogSettings() With {.AffirmativeButtonText = "Ok", .ColorScheme = MetroDialogColorScheme.Accented})
End If
@@ -1816,7 +1791,7 @@ Public Class MainWindow
Private Sub forge_installer()
Dim frg As New Forge_installer
- frg.ShowDialog()
+ frg.Show()
End Sub
Sub liteloader_installer()
diff --git a/MinecraftLauncher/McMetroLauncher.vbproj b/MinecraftLauncher/McMetroLauncher.vbproj
index 0421eb5..f9fa476 100644
--- a/MinecraftLauncher/McMetroLauncher.vbproj
+++ b/MinecraftLauncher/McMetroLauncher.vbproj
@@ -216,6 +216,9 @@
Forge_installer.xaml
+
+ Forge_ProfileEditor.xaml
+ LiteLoader_installer.xaml
@@ -258,6 +261,10 @@
Application.xamlCode
+
+ Designer
+ MSBuild:Compile
+ DesignerMSBuild:Compile
diff --git a/MinecraftLauncher/Models/Converters.vb b/MinecraftLauncher/Models/Converters.vb
index c457e9a..3470397 100644
--- a/MinecraftLauncher/Models/Converters.vb
+++ b/MinecraftLauncher/Models/Converters.vb
@@ -1,5 +1,7 @@
Imports System.IO
Imports Craft.Net
+Imports Newtonsoft.Json
+Imports Newtonsoft.Json.Linq
#Region "Converters"
Public Structure ImageConvert
@@ -103,7 +105,7 @@ Public Class Playerlist_Namesstring_Converter
Dim s As IList(Of ServerStatus.PlayerList.Player) = TryCast(value, IList(Of ServerStatus.PlayerList.Player))
If s Is Nothing Then Return Nothing
Dim playernames As IList(Of String) = s.Select(Function(p) p.Name).ToList
- Dim returnstring As String = "Players:" & Environment.NewLine & String.Join(Environment.NewLine, playernames)
+ Dim returnstring As String = resManager.GetString("Players") & ":" & Environment.NewLine & String.Join(Environment.NewLine, playernames)
Return returnstring
End Function
@@ -149,4 +151,30 @@ Public Class Modified_Date_Converter
End Class
+#End Region
+
+#Region "JsonConverters"
+Class CustomIntConverter
+ Inherits JsonConverter
+ Public Overrides Function CanConvert(objectType As Type) As Boolean
+ Return (objectType = GetType(Integer))
+ End Function
+
+ Public Overrides Function ReadJson(reader As JsonReader, objectType As Type, existingValue As Object, serializer As JsonSerializer) As Object
+ Dim jsonValue As JValue = serializer.Deserialize(Of JValue)(reader)
+
+ If jsonValue.Type = JTokenType.Float Then
+ Return CInt(Math.Round(CDbl(jsonValue.Value)))
+ ElseIf jsonValue.Type = JTokenType.[Integer] Then
+ Return CInt(jsonValue.Value)
+ End If
+
+ Throw New FormatException()
+ End Function
+
+ Public Overrides Sub WriteJson(writer As JsonWriter, value As Object, serializer As JsonSerializer)
+ Throw New NotImplementedException()
+ End Sub
+End Class
+
#End Region
\ No newline at end of file
diff --git a/MinecraftLauncher/Models/CryptedTextAnimation.vb b/MinecraftLauncher/Models/CryptedTextAnimation.vb
index 3b63225..87809ed 100644
--- a/MinecraftLauncher/Models/CryptedTextAnimation.vb
+++ b/MinecraftLauncher/Models/CryptedTextAnimation.vb
@@ -28,8 +28,9 @@ Namespace JBou.Animations
SetValue(CryptedTextAnimation.TextProperty, value)
End Set
End Property
+ Private Const CHARACTERS As String = "abcdeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-:;_!§$%&/()=?{[]}\<>|#*~^°"
- Private Const CHARACTERS As String = "abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"
+ Private Const bigCHARACTERS As String = "abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"
'+#\-/()<>€@$^&%=?
Private Const lenght4Chars As String = "k{}f"
Private Const narrowCHARACTERS As String = "iltI.,;:!|"
diff --git a/MinecraftLauncher/Models/GlobalInfos.vb b/MinecraftLauncher/Models/GlobalInfos.vb
index 4768ff6..3fd271d 100644
--- a/MinecraftLauncher/Models/GlobalInfos.vb
+++ b/MinecraftLauncher/Models/GlobalInfos.vb
@@ -36,7 +36,8 @@ Public Module GlobalInfos
.id = jo("id").ToString,
.type = jo("type").ToString,
.time = jo("time").ToString,
- .releaseTime = jo("releaseTime").ToString}
+ .releaseTime = jo("releaseTime").ToString,
+ .custom = True}
GlobalInfos.Versions.versions.Add(versionitem)
Else
'Falsche id wurde gefunden
@@ -194,7 +195,6 @@ Public Module GlobalInfos
Public changelog As String = Nothing
Public resources_dir As New DirectoryInfo(Path.Combine(mcpfad.FullName, "resources"))
Public librariesurl As String = "https://libraries.minecraft.net/"
- Public selectedprofile As String
Public ReadOnly Property indexesurl(index_name As String) As String
Get
Return "http://s3.amazonaws.com/Minecraft.Download/indexes/" & index_name & ".json"
diff --git a/MinecraftLauncher/Models/MainViewModel.vb b/MinecraftLauncher/Models/MainViewModel.vb
index be7a918..52c6122 100644
--- a/MinecraftLauncher/Models/MainViewModel.vb
+++ b/MinecraftLauncher/Models/MainViewModel.vb
@@ -1,8 +1,21 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Runtime.CompilerServices
+Imports Newtonsoft.Json.Linq
Public Class MainViewModel
+ Implements INotifyPropertyChanged
+ Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
+
+ '''
+ ''' Raises the PropertyChanged event if needed.
+ '''
+ ''' The name of the property that changed.
+ Protected Overridable Sub OnPropertyChanged(propertyName As String)
+ RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
+ End Sub
+
+
Private ReadOnly _ram As ObservableCollection(Of Ram) = New ObservableCollection(Of Ram)
Public ReadOnly Property Ram As ObservableCollection(Of Ram)
Get
@@ -15,6 +28,28 @@ Public Class MainViewModel
Return _cpu
End Get
End Property
+ Private ReadOnly _profiles As ObservableCollection(Of String) = New ObservableCollection(Of String)
+ Public ReadOnly Property Profiles As ObservableCollection(Of String)
+ Get
+ Return _profiles
+ End Get
+ End Property
+ Private _selectedprofile As String
+ Public Property selectedprofile() As String
+ Get
+ Return _selectedprofile
+ End Get
+ Set(value As String)
+ _selectedprofile = value
+ OnPropertyChanged("selectedprofile")
+ Dim o As String = IO.File.ReadAllText(launcher_profiles_json.FullName)
+ Dim jo As JObject = JObject.Parse(o)
+ jo("selectedProfile") = ViewModel.selectedprofile
+ IO.File.WriteAllText(launcher_profiles_json.FullName, jo.ToString)
+ End Set
+ End Property
+
+
Private CPUCounter As PerformanceCounter = New PerformanceCounter("Processor", "% Processor Time", "_Total")
Private MemCounter As PerformanceCounter = New PerformanceCounter("Memory", "Available MBytes")
Private totalram As ULong = My.Computer.Info.TotalPhysicalMemory()
@@ -40,7 +75,6 @@ Public Class MainViewModel
dispatcherTimer.Start()
End Sub
-
Private Sub dispatcherTimer_Tick(sender As Object, e As EventArgs)
Dim totalram As ULong = My.Computer.Info.TotalPhysicalMemory()
Dim avaiableram As ULong = My.Computer.Info.AvailablePhysicalMemory
@@ -50,6 +84,7 @@ Public Class MainViewModel
_ram.Item(0).Count = percentage
'_ram.Item(0).Count = CInt(theMemCounter.NextValue)
End Sub
+
End Class
Public Class Ram
diff --git a/MinecraftLauncher/Models/Profiles.vb b/MinecraftLauncher/Models/Profiles.vb
index e910faf..1ab9255 100644
--- a/MinecraftLauncher/Models/Profiles.vb
+++ b/MinecraftLauncher/Models/Profiles.vb
@@ -100,6 +100,33 @@ Public Class Profiles
IO.File.WriteAllText(launcher_profiles_json.FullName, profilesjo.ToString)
End Sub
+ Public Shared Sub Get_Profiles()
+ Profiles.Load()
+ Dim jo As JObject = Profiles.profilesjo
+ ViewModel.Profiles.Clear()
+ For Each Profile As String In Profiles.List
+ ViewModel.Profiles.Add(Profile)
+ Next
+ If jo.Properties.Select(Function(p) p.Name).Contains("selectedProfile") = True Then
+ ViewModel.selectedprofile = jo("selectedProfile").ToString
+ Else
+ jo.Add(New JProperty("selectedProfile", ViewModel.Profiles.First))
+ ViewModel.selectedprofile = ViewModel.Profiles.First
+ End If
+ If Profiles.List.Count = 0 Then
+ 'StandartProfile schreiben
+ Dim standartprofile As New JObject(
+ New JProperty("profiles",
+ New JObject(
+ New JProperty("Default",
+ New JObject(
+ New JProperty("name", "Default"))))),
+ New JProperty("selectedProfile", "Default"))
+ IO.File.WriteAllText(launcher_profiles_json.FullName, standartprofile.ToString)
+ Get_Profiles()
+ End If
+ End Sub
+
Public Class Profile
Private _name As String, _gameDir As String, _lastVersionId As String, _javaDir As String,
_javaArgs As String, _resolution As cls_Resolution, _allowedReleaseTypes As IList(Of String),
diff --git a/MinecraftLauncher/Models/Versions.vb b/MinecraftLauncher/Models/Versions.vb
index bca6f69..2ffe5ad 100644
--- a/MinecraftLauncher/Models/Versions.vb
+++ b/MinecraftLauncher/Models/Versions.vb
@@ -96,6 +96,15 @@ Public Class Versionslist
End Set
End Property
Private m_type As String
+ Public Property custom As Boolean
+ Get
+ Return m_custom
+ End Get
+ Set(value As Boolean)
+ m_custom = value
+ End Set
+ End Property
+ Private m_custom As Boolean
End Class
End Class
diff --git a/MinecraftLauncher/Models/VersionsInfo.vb b/MinecraftLauncher/Models/VersionsInfo.vb
index 200e33e..df81d4b 100644
--- a/MinecraftLauncher/Models/VersionsInfo.vb
+++ b/MinecraftLauncher/Models/VersionsInfo.vb
@@ -1,4 +1,5 @@
Imports Newtonsoft.Json.Linq
+Imports Newtonsoft.Json
Public Class Natives
Public Property linux() As String
@@ -85,6 +86,15 @@ Public Class Library
End Set
End Property
Private m_name As String
+ Public Property url As String
+ Get
+ Return m_url
+ End Get
+ Set(value As String)
+ m_url = value
+ End Set
+ End Property
+ Private m_url As String
Public Property natives As Natives
Get
Return m_natives
@@ -218,6 +228,7 @@ Public Class VersionsInfo
End Set
End Property
Private m_assets As String
+
Public Property JObject As JObject
Get
Return m_jobject
diff --git a/MinecraftLauncher/My Project/AssemblyInfo.vb b/MinecraftLauncher/My Project/AssemblyInfo.vb
index 0288295..63fec7e 100644
--- a/MinecraftLauncher/My Project/AssemblyInfo.vb
+++ b/MinecraftLauncher/My Project/AssemblyInfo.vb
@@ -55,5 +55,5 @@ Imports System.Windows
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/MinecraftLauncher/Resources/Resource.de.resx b/MinecraftLauncher/Resources/Resource.de.resx
index 26a50bd..05ba727 100644
--- a/MinecraftLauncher/Resources/Resource.de.resx
+++ b/MinecraftLauncher/Resources/Resource.de.resx
@@ -17,13 +17,14 @@
2.0System.Resources.ResXResourceReader, System.Windows.Forms, ...System.Resources.ResXResourceWriter, System.Windows.Forms, ...
- this is my long string
+ this is my long stringthis is a comment
Blue
- [base64 mime encoded serialized .NET Framework object]
+ [base64 mime encoded serialized .NET Framework object]
- [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ This is a comment
There are any number of "resheader" rows that contain simple
@@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -59,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -67,9 +69,16 @@
-
+
+
+
+
+
+
+
+
@@ -78,9 +87,10 @@
-
+
+
@@ -102,9 +112,13 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Spieler
+ Players Converter
+
\ No newline at end of file
diff --git a/MinecraftLauncher/Resources/Resource.en.resx b/MinecraftLauncher/Resources/Resource.en.resx
index 26a50bd..87c8168 100644
--- a/MinecraftLauncher/Resources/Resource.en.resx
+++ b/MinecraftLauncher/Resources/Resource.en.resx
@@ -17,13 +17,14 @@
2.0System.Resources.ResXResourceReader, System.Windows.Forms, ...System.Resources.ResXResourceWriter, System.Windows.Forms, ...
- this is my long string
+ this is my long stringthis is a comment
Blue
- [base64 mime encoded serialized .NET Framework object]
+ [base64 mime encoded serialized .NET Framework object]
- [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ This is a comment
There are any number of "resheader" rows that contain simple
@@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -59,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -67,9 +69,16 @@
-
+
+
+
+
+
+
+
+
@@ -78,9 +87,10 @@
-
+
+
@@ -102,9 +112,13 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Players
+ Players Converter
+
\ No newline at end of file
diff --git a/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml b/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml
new file mode 100644
index 0000000..b2fbcbd
--- /dev/null
+++ b/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml.vb b/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml.vb
new file mode 100644
index 0000000..dc97f5d
--- /dev/null
+++ b/MinecraftLauncher/Windows/Forge_ProfileEditor.xaml.vb
@@ -0,0 +1,35 @@
+Imports MahApps.Metro.Controls.Dialogs
+Imports MahApps.Metro
+
+Public Class Forge_ProfileEditor
+ Public Versionname As String = Nothing
+
+ Private Sub Forge_ProfileEditor_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
+ Me.DataContext = ViewModel
+ lbl_header.Content = Versionname
+ tb_newprofilename.Text = Versionname
+ End Sub
+
+ Private Async Sub btn_save_Click(sender As Object, e As RoutedEventArgs) Handles btn_save.Click
+ If rb_existingprofile.IsChecked Then
+ Dim selectedprofile As Profiles.Profile = Await Profiles.FromName(cb_profiles.SelectedItem.ToString)
+ selectedprofile.lastVersionId = Versionname
+ Profiles.Edit(selectedprofile.name, selectedprofile)
+ Profiles.Get_Profiles()
+ Me.Close()
+ Else
+ If Profiles.List.Contains(tb_newprofilename.Text) Then
+ Await Me.ShowMessageAsync("Fehler", "Profil existiert bereits: " & tb_newprofilename.Text)
+ Else
+ Profiles.Add(New Profiles.Profile With {.name = tb_newprofilename.Text, .lastVersionId = Versionname})
+ Profiles.Get_Profiles()
+ Me.Close()
+ End If
+ End If
+ End Sub
+
+ Private Sub btn_skip_Click(sender As Object, e As RoutedEventArgs) Handles btn_skip.Click
+ Me.Close()
+ End Sub
+
+End Class
diff --git a/MinecraftLauncher/Windows/Forge_installer.xaml b/MinecraftLauncher/Windows/Forge_installer.xaml
index f9fb0fe..6e619c2 100644
--- a/MinecraftLauncher/Windows/Forge_installer.xaml
+++ b/MinecraftLauncher/Windows/Forge_installer.xaml
@@ -7,20 +7,24 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
GlowBrush="{DynamicResource AccentColorBrush}"
- Title="Minecraft Forge" Height="448" Width="660" Icon="../images/favicon.ico" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
-
+ Title="Minecraft Forge" Height="450" Width="680" MinHeight="450" MinWidth="680" Icon="../images/favicon.ico" ResizeMode="CanResizeWithGrip" WindowStartupLocation="CenterScreen">
+
-
+
-
+
+
+
+
+
@@ -29,10 +33,11 @@
-
+
+
-
+
diff --git a/MinecraftLauncher/Windows/Forge_installer.xaml.vb b/MinecraftLauncher/Windows/Forge_installer.xaml.vb
index 533724f..d090a1c 100644
--- a/MinecraftLauncher/Windows/Forge_installer.xaml.vb
+++ b/MinecraftLauncher/Windows/Forge_installer.xaml.vb
@@ -2,17 +2,29 @@
Imports Ionic.Zip
Imports MahApps.Metro.Controls.Dialogs
Imports MahApps.Metro
+Imports System.IO
+Imports Newtonsoft.Json
+Imports Newtonsoft.Json.Linq
Class Forge_installer
WithEvents wc As New WebClient
+ Dim wcauto As New WebClient
Private filename As String
+ Dim version As String
+ Dim mcversion As String
+ Dim Legacyforge As Boolean = False
+ Dim stripmeta As Boolean = False
+ Dim liblist As List(Of Library) = New List(Of Library)
+ Dim libdownloadindex As Integer
+ Dim libpath As FileInfo
+ Dim controller As ProgressDialogController
Public Sub Load_Forge()
lst.Items.Clear()
Dim list As IList(Of Forge.ForgeBuild) = New List(Of Forge.ForgeBuild)
For Each item As Forge.ForgeBuild In Forge.ForgeList
Dim lstitems As IList(Of String) = list.Select(Function(p) p.version).ToList
- If item.files.Select(Function(o) o.type).Contains("installer") And lstitems.Contains(item.version) = False Then
+ If item.files.Select(Function(o) o.type).Contains("universal") And lstitems.Contains(item.version) = False Then
list.Add(item)
End If
Next
@@ -22,6 +34,10 @@ Class Forge_installer
Next
End Sub
+ Private Sub Forge_installer_Closed(sender As Object, e As EventArgs) Handles Me.Closed
+ Profiles.Get_Profiles()
+ End Sub
+
Private Sub ForgeManager_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Try
Dim theme = ThemeManager.DetectAppStyle(Application.Current)
@@ -43,19 +59,16 @@ Class Forge_installer
ElseIf wc.IsBusy = True Then
wc.CancelAsync()
Else
+ btn_download_auto.IsEnabled = False
pb_download.IsIndeterminate = False
forge_anleitung.IsSelected = True
- Dim version As String = DirectCast(lst.SelectedItem, Forge.ForgeBuild).version
- Dim mcversion As String = DirectCast(lst.SelectedItem, Forge.ForgeBuild).mcversion
Dim Legacyforgefile As Boolean = False
If Forge.LegacyBuildList.Select(Function(p) p.version).Contains(version) Then
Legacyforgefile = True
End If
- Dim url As Uri = Nothing
+ Dim url As New Uri(String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}/forge-{0}-{1}-installer.jar", mcversion, version))
If Legacyforgefile = True Then
url = New Uri(String.Format("http://files.minecraftforge.net/minecraftforge/minecraftforge-installer-{0}-{1}.jar", mcversion, version))
- Else
- url = New Uri(String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}/forge-{0}-{1}-installer.jar", mcversion, version))
End If
filename = IO.Path.Combine(cachefolder.FullName, String.Format("forge-{0}-{1}-installer.jar", mcversion, version))
wc.DownloadFileAsync(url, filename)
@@ -74,10 +87,304 @@ Class Forge_installer
pb_download.IsIndeterminate = True
Process.Start(filename)
End If
+ btn_download_auto.IsEnabled = True
btn_download.Content = "Herunterladen und Installieren"
End Sub
Private Sub wc_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc.DownloadProgressChanged
pb_download.Value = e.ProgressPercentage
End Sub
+
+ Private Async Sub btn_download_auto_Click(sender As Object, e As RoutedEventArgs) Handles btn_download_auto.Click
+ Try
+ If lst.SelectedIndex = -1 Then
+ Await Me.ShowMessageAsync(Nothing, "Bitte wähle eine Forge Version Aus!", MessageDialogStyle.Affirmative, New MetroDialogSettings() With {.AffirmativeButtonText = "Ok", .ColorScheme = MetroDialogColorScheme.Accented})
+ Else
+ stripmeta = False
+ controller = Await Me.ShowProgressAsync("Forge wird installiert", "Bitte warten", False, New MetroDialogSettings() With {.ColorScheme = MetroDialogColorScheme.Theme})
+ Legacyforge = False
+ If Forge.LegacyBuildList.Select(Function(p) p.version).Contains(version) Then
+ Legacyforge = True
+ End If
+ 'Download Universal
+ Dim extension As String = Forge.ForgeList.Where(Function(p) p.version = version).First.files.Where(Function(p) p.type = "universal").First.extension
+ If extension = "zip" Then
+ stripmeta = True
+ End If
+ Dim url As New Uri(String.Format("http://files.minecraftforge.net/maven/net/minecraftforge/forge/{1}-{0}/forge-{1}-{0}-universal.jar", version, mcversion, extension))
+ If Legacyforge = True Then
+ url = New Uri(String.Format("http://files.minecraftforge.net/minecraftforge/minecraftforge-universal-{1}-{0}.{2}", version, mcversion, extension))
+ End If
+ filename = IO.Path.Combine(cachefolder.FullName, String.Format("forge-{0}-{1}-universal.jar", mcversion, version))
+ wcauto.DownloadFileAsync(url, filename)
+ AddHandler wcauto.DownloadFileCompleted, AddressOf Install_Version
+ AddHandler wcauto.DownloadProgressChanged, Sub(sender2 As Object, e2 As Net.DownloadProgressChangedEventArgs)
+ Dim progress As Double = e2.ProgressPercentage / 100 / 3
+ If progress <= 1 Then
+ controller.SetProgress(progress)
+ End If
+ End Sub
+
+ End If
+ Catch ex As Exception
+ MsgBox(ex.Message & Environment.NewLine & ex.StackTrace)
+ controller.CloseAsync()
+ End Try
+ End Sub
+ Async Sub Install_Version(sender As Object, e As ComponentModel.AsyncCompletedEventArgs)
+ Try
+ Dim versionsname As String = mcversion & "-Forge" & version
+ If e.Cancelled = False And e.Error Is Nothing Then
+ Dim legacyinstallation As Boolean = False
+ 'Extract version.json and copy to versionsfolder
+ Try
+ Using zip1 As ZipFile = ZipFile.Read(filename)
+ If zip1.Entries.Select(Function(p) p.FileName).Contains("version.json") Then
+ ' here, we extract every entry, but we could extract conditionally,
+ ' based on entry name, size, date, checkbox status, etc.
+ For Each i As ZipEntry In zip1
+ If i.FileName = "version.json" Then
+ i.Extract(IO.Path.GetDirectoryName(filename), ExtractExistingFileAction.OverwriteSilently)
+ With New FileInfo(Path.Combine(versionsfolder.FullName, versionsname, versionsname & ".json"))
+ If .Directory.Exists = False Then
+ .Directory.Create()
+ End If
+ File.Copy(Path.Combine(Path.GetDirectoryName(filename), "version.json"), .FullName, True)
+ Exit For
+ End With
+ End If
+ Next
+ Else
+ legacyinstallation = True
+ End If
+ End Using
+ Catch ex As ZipException
+ 'ShowError
+ 'Write("Fehler beim entpacken der natives: " & ex.Message, LogLevel.ERROR)
+ End Try
+ 'Copy verisons.jar and download if doesn't exist
+ With New FileInfo(Path.Combine(versionsfolder.FullName, mcversion, mcversion & ".jar"))
+ Dim jsonfile As New FileInfo(Path.Combine(versionsfolder.FullName, mcversion, mcversion & ".json"))
+ Dim output As String = .FullName
+ Dim jsonoutput As String = jsonfile.FullName
+ Dim VersionsURl As String = "https://s3.amazonaws.com/Minecraft.Download/versions/" & mcversion & "/" & mcversion
+ Try
+ If .Exists = False Then
+ 'Download
+ wcauto = New WebClient
+ controller.SetMessage("Lade Version herunter...")
+ AddHandler wcauto.DownloadProgressChanged, Sub(sender2 As Object, e2 As Net.DownloadProgressChangedEventArgs)
+ Dim progress As Double = 1 / 3 + e2.ProgressPercentage / 100 / 3
+ If progress <= 1 Then
+ controller.SetProgress(progress)
+ End If
+ End Sub
+ If .Directory.Exists = False Then
+ .Directory.Create()
+ End If
+ Await wcauto.DownloadFileTaskAsync(New Uri(VersionsURl & ".jar"), output)
+ End If
+ If jsonfile.Exists = False Then
+ If .Directory.Exists = False Then
+ .Directory.Create()
+ End If
+ Await New WebClient().DownloadFileTaskAsync(New Uri(VersionsURl & ".json"), jsonoutput)
+ End If
+ Catch ex As Exception
+ 'Show Error
+ End Try
+ 'Copy
+ controller.SetMessage("Installiere Version...")
+ Dim targetpath As New FileInfo(Path.Combine(versionsfolder.FullName, versionsname, versionsname & ".jar"))
+ If targetpath.Directory.Exists = False Then
+ targetpath.Directory.Create()
+ End If
+ If stripmeta = True Then
+ CopyandStrip(New FileInfo(output), targetpath)
+ Else
+ File.Copy(output, targetpath.FullName, True)
+ End If
+ If legacyinstallation Then
+ 'Patch jar with Forge:
+ Copytojar(New FileInfo(filename), targetpath)
+ 'Copy json and change the id:
+ Dim targetoutput As String = Path.Combine(versionsfolder.FullName, versionsname, versionsname & ".json")
+ File.Copy(jsonoutput, targetoutput, True)
+ Dim text As String = File.ReadAllText(targetoutput)
+ Dim versioninfo As VersionsInfo = Await JsonConvert.DeserializeObjectAsync(Of VersionsInfo)(text)
+ versioninfo.id = versionsname
+ File.WriteAllText(targetoutput, Await JsonConvert.SerializeObjectAsync(versioninfo, Formatting.Indented))
+ End If
+ controller.SetProgress(2 / 3)
+ 'Copy universal to corresponding library
+ Dim o As String = File.ReadAllText(Path.Combine(versionsfolder.FullName, versionsname, versionsname & ".json"))
+ 'Converter because some Forge Versions(10.12.0.1054) has Double as minimumlauncherversion, expected integer. It rounds the double to an integer
+ Dim Versionsinfos As VersionsInfo = Await JsonConvert.DeserializeObjectAsync(Of VersionsInfo)(o, New JsonSerializerSettings() With {.NullValueHandling = NullValueHandling.Ignore, .Converters = New List(Of JsonConverter) From {New CustomIntConverter()}})
+ Dim libpath As String = Nothing
+ If Versionsinfos.libraries.Select(Function(p) p.name.Split(CChar(":"))(1)).Contains("forge") Then
+ libpath = String.Format(Path.Combine(librariesfolder.FullName, "net", "minecraftforge", "{2}\{1}-{0}\{2}-{1}-{0}.jar"), version, mcversion, "forge")
+ Else
+ libpath = String.Format(Path.Combine(librariesfolder.FullName, "net", "minecraftforge", "{1}\{0}\{1}-{0}.jar"), version, "minecraftforge")
+ End If
+ With New FileInfo(libpath)
+ If .Directory.Exists = False Then
+ .Directory.Create()
+ End If
+ File.Copy(filename, .FullName, True)
+ End With
+ 'Download other Libraries
+ liblist.Clear()
+ For Each item As Library In Versionsinfos.libraries.Where(Function(p) p.url <> Nothing)
+ If item.url.Contains("files.minecraftforge.net") And item.name.Split(CChar(":"))(1) <> "forge" And item.name.Split(CChar(":"))(1) <> "minecraftforge" Then
+ liblist.Add(item)
+ End If
+ Next
+ libdownloadindex = 0
+ Await Downloadlibs()
+ End With
+ ElseIf e.Error IsNot Nothing Then
+ controller.SetMessage("Fehler beim herunterladen: " & e.Error.Message & Environment.NewLine & libpath.FullName)
+ controller.SetCancelable(True)
+ While controller.IsCanceled = False
+ Await Task.Delay(10)
+ End While
+ Await controller.CloseAsync()
+ End If
+ Catch ex As Exception
+ MsgBox(ex.Message & Environment.NewLine & ex.StackTrace)
+ controller.CloseAsync()
+ End Try
+ End Sub
+
+ Async Function Downloadlibs() As Task
+ If mcversion = "1.5.2" Then
+ controller.SetMessage("Bitte warten, erforderliche Libraries werden heruntergeladen")
+ controller.SetIndeterminate()
+ Try
+ Await New WebClient().DownloadFileTaskAsync("http://files.minecraftforge.net/fmllibs/bcprov-jdk15on-148.jar.stash", Path.Combine(mcpfad.FullName, "lib", "bcprov-jdk15on-148.jar"))
+ Await New WebClient().DownloadFileTaskAsync("http://files.minecraftforge.net/fmllibs/scala-library.jar.stash", Path.Combine(mcpfad.FullName, "lib", "scala-library.jar"))
+ Catch ex As Exception
+ MsgBox(ex.Message & Environment.NewLine & ex.StackTrace)
+ File.Delete(Path.Combine(mcpfad.FullName, "lib", "bcprov-jdk15on-148.jar"))
+ File.Delete(Path.Combine(mcpfad.FullName, "lib", "scala-library.jar"))
+ controller.CloseAsync()
+ End Try
+ End If
+
+
+ If libdownloadindex < liblist.Count Then
+ Using a As New WebClient
+ With liblist.ElementAt(libdownloadindex)
+ libpath = New FileInfo(IO.Path.Combine(librariesfolder.FullName, .path))
+ Dim customurl As String = .url
+ Dim url As String = customurl & .path
+ controller.SetMessage("Lade Library herunter: " & libpath.FullName)
+ a.DownloadFileAsync(New Uri(url & ".pack.xz"), libpath.FullName & ".pack.xz")
+ AddHandler a.DownloadFileCompleted, AddressOf Downloadlibcompleted
+ AddHandler a.DownloadProgressChanged, Sub(sender2 As Object, e2 As Net.DownloadProgressChangedEventArgs)
+ Dim progress As Double = 2 / 3 + (libdownloadindex + e2.ProgressPercentage / 100) / 3 / liblist.Count
+ If progress <= 1 Then
+ controller.SetProgress(progress)
+ End If
+ End Sub
+ End With
+ End Using
+ Else
+ 'Install Finfished
+ Await controller.CloseAsync()
+ Me.Hide()
+ Dim profileedit As New Forge_ProfileEditor With {.Versionname = mcversion & "-Forge" & version}
+ profileedit.ShowDialog()
+ Me.Close()
+ End If
+ End Function
+
+ Sub CopyandStrip(sourcejar As FileInfo, targetjar As FileInfo)
+ Dim input As ZipFile = New ZipFile(sourcejar.FullName)
+ Dim output As ZipFile = New ZipFile
+ Using fs As New FileStream(targetjar.FullName, FileMode.Create, FileAccess.ReadWrite)
+ For Each e As ZipEntry In input.Entries
+ If e.IsDirectory Then
+ Dim ms As New MemoryStream
+ e.Extract(ms)
+ ms.Seek(0, SeekOrigin.Begin)
+ output.AddEntry(e.FileName, ms)
+ ElseIf e.FileName.StartsWith("META-INF") Then
+
+ Else
+ Dim n As ZipEntry = e
+ n.SetEntryTimes(e.CreationTime, e.AccessedTime, e.ModifiedTime)
+ Dim ms As New MemoryStream
+ n.Extract(ms)
+ ms.Seek(0, SeekOrigin.Begin)
+ output.AddEntry(n.FileName, ms)
+ End If
+ Next
+ output.Save(fs)
+ fs.Close()
+ End Using
+ End Sub
+
+
+ Sub Copytojar(sourcejar As FileInfo, targetjar As FileInfo)
+ Dim input As ZipFile = ZipFile.Read(sourcejar.FullName)
+ Dim output As ZipFile = ZipFile.Read(targetjar.FullName)
+ For Each e As ZipEntry In input.Entries
+ If e.IsDirectory = False Then
+ Dim ms As New MemoryStream
+ If output.Entries.Select(Function(p) p.FileName).Contains(e.FileName) Then
+ output.RemoveEntry(e.FileName)
+ End If
+ e.Extract(ms)
+ ms.Seek(0, SeekOrigin.Begin)
+ output.AddEntry(e.FileName, ms)
+ End If
+ Next
+ output.Save()
+ End Sub
+
+ Async Sub Downloadlibcompleted(sender As Object, e As ComponentModel.AsyncCompletedEventArgs)
+ If e.Cancelled = False And e.Error Is Nothing Then
+ Dim input As New FileInfo(libpath.FullName & ".pack.xz")
+ controller.SetMessage("Entpacke Library : " & libpath.FullName)
+ If Await Unpack.Unpack(input, libpath) = False Then
+ controller.SetMessage("Fehler beim entpacken: " & libpath.FullName)
+ controller.SetCancelable(True)
+ While controller.IsCanceled = False
+ Await Task.Delay(10)
+ End While
+ Await controller.CloseAsync()
+ Else
+ libdownloadindex += 1
+ Await Downloadlibs()
+ End If
+ input.Delete()
+ ElseIf e.Error IsNot Nothing Then
+ controller.SetMessage("Fehler beim herunterladen: " & e.Error.Message & Environment.NewLine & libpath.FullName)
+ controller.SetCancelable(True)
+ While controller.IsCanceled = False
+ Await Task.Delay(10)
+ End While
+ Await controller.CloseAsync()
+ End If
+ End Sub
+
+ Private Sub lst_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles lst.SelectionChanged
+ version = DirectCast(lst.SelectedItem, Forge.ForgeBuild).version
+ mcversion = DirectCast(lst.SelectedItem, Forge.ForgeBuild).mcversion
+ If DirectCast(lst.SelectedItem, Forge.ForgeBuild).files.Select(Function(p) p.type).Contains("universal") Then
+ If mcversion <> "1.6.1" And mcversion <> "1.6.2" Then
+ btn_download_auto.IsEnabled = True
+ Else
+ btn_download_auto.IsEnabled = False
+ End If
+ Else
+ btn_download_auto.IsEnabled = False
+ End If
+ If DirectCast(lst.SelectedItem, Forge.ForgeBuild).files.Select(Function(p) p.type).Contains("installer") Then
+ btn_download.IsEnabled = True
+ Else
+ btn_download.IsEnabled = False
+ End If
+ End Sub
End Class
diff --git a/MinecraftLauncher/Windows/ProfileEditor.xaml.vb b/MinecraftLauncher/Windows/ProfileEditor.xaml.vb
index 966561e..baa102b 100644
--- a/MinecraftLauncher/Windows/ProfileEditor.xaml.vb
+++ b/MinecraftLauncher/Windows/ProfileEditor.xaml.vb
@@ -85,7 +85,11 @@ Public Class ProfileEditor
End If
End If
Get_Versions()
- cb_versions.SelectedItem = cb_versions.Items.OfType(Of Versionslist.Version).ToList.Where(Function(p) p.id = profile.lastVersionId).FirstOrDefault
+ If cb_versions.Items.OfType(Of Versionslist.Version).ToList.Select(Function(p) p.id).Contains(profile.lastVersionId) Then
+ cb_versions.SelectedItem = cb_versions.Items.OfType(Of Versionslist.Version).ToList.Where(Function(p) p.id = profile.lastVersionId).FirstOrDefault
+ Else
+ cb_versions.SelectedIndex = 0
+ End If
If profile.javaDir = Nothing Then
tb_java_executable.Text = MainWindow.Startcmd(Await Profiles.FromName(loadedprofile))
Else
@@ -154,7 +158,7 @@ Public Class ProfileEditor
Try
Await Versions_Load()
Get_Versions()
- loadedprofile = selectedprofile
+ loadedprofile = ViewModel.selectedprofile
If Newprofile = True Then
Await StandardValues()
Else
@@ -257,7 +261,7 @@ Public Class ProfileEditor
End If
End If
- Me.DialogResult = True
+ Profiles.Get_Profiles()
Me.Close()
End If
End Sub
diff --git a/MinecraftLauncher/Windows/SplashScreen.xaml.vb b/MinecraftLauncher/Windows/SplashScreen.xaml.vb
index 8b76c29..29e876e 100644
--- a/MinecraftLauncher/Windows/SplashScreen.xaml.vb
+++ b/MinecraftLauncher/Windows/SplashScreen.xaml.vb
@@ -12,10 +12,13 @@ Imports System.Windows.Threading
Public Class SplashScreen
- Public Function internetconnection() As Boolean
+ Public Async Function internetconnection() As Task(Of Boolean)
Try
- My.Computer.Network.Ping("www.google.com")
- Return True
+ Using client As New WebClient
+ Using stream As Stream = Await client.OpenReadTaskAsync("http://www.google.com")
+ Return True
+ End Using
+ End Using
Catch ex As Exception
Return False
End Try
@@ -51,7 +54,7 @@ Public Class SplashScreen
End If
- If internetconnection() = True Then
+ If Await internetconnection() = True Then
If GetJavaPath() = Nothing OrElse New FileInfo(Path.Combine(GetJavaPath(), "bin", "java.exe")).Exists = False Then
Dim result As MessageDialogResult = Await ShowMessageAsync("Java nicht vorhanden", "Du musst Java installieren, um den McMetroLauncher und Minecraft nutzen zu können." & Environment.NewLine & "Ansonsten werden einige Funktionen nicht funktionieren!!" & Environment.NewLine & "Jetzt herunterladen?", MessageDialogStyle.AffirmativeAndNegative)
If result = MessageDialogResult.Affirmative Then
@@ -211,7 +214,7 @@ Public Class SplashScreen
Main.Webcontrol_news.Visibility = Windows.Visibility.Collapsed
Main.tb_modsfolder.Text = modsfolder.FullName
Await Main.Load_ModVersions()
- Main.Get_Profiles()
+ Profiles.Get_Profiles()
Main.Menuitem_accent.ItemsSource = AccentColors
Main.Menuitem_theme.ItemsSource = AppThemes
Main.cb_direct_join.IsChecked = Settings.Settings.DirectJoin
@@ -230,13 +233,13 @@ Public Class SplashScreen
Main.Ping_servers()
Main.Check_Tools_Downloaded()
Me.Hide()
- If Settings.Settings.Accent <> Nothing Then
+ If Settings.Settings.Accent <> Nothing And ThemeManager.Accents.Select(Function(p) p.Name).Contains(Settings.Settings.Accent) Then
Dim theme = ThemeManager.DetectAppStyle(Application.Current)
Dim accent = ThemeManager.Accents.Where(Function(p) p.Name = Settings.Settings.Accent).FirstOrDefault
If accent Is Nothing Then accent = ThemeManager.Accents.First
ThemeManager.ChangeAppStyle(Application.Current, accent, theme.Item1)
End If
- If Settings.Settings.Theme <> Nothing Then
+ If Settings.Settings.Theme <> Nothing And ThemeManager.AppThemes.Select(Function(p) p.Name).Contains(Settings.Settings.Theme) Then
Dim theme = ThemeManager.DetectAppStyle(Application.Current)
Dim appTheme = ThemeManager.AppThemes.Where(Function(p) p.Name = Settings.Settings.Theme).FirstOrDefault
If appTheme Is Nothing Then appTheme = ThemeManager.AppThemes.First