diff --git a/Cursed.Base/MainForm.fs b/Cursed.Base/MainForm.fs index 7c7a4b4..e0acfd3 100644 --- a/Cursed.Base/MainForm.fs +++ b/Cursed.Base/MainForm.fs @@ -126,16 +126,6 @@ type MainForm(app: Application) = layout do - job { - let! isLatest = Startup.IsLatest - - app.Invoke (fun () -> - if isLatest then - app.MainForm.Title <- sprintf "Cursed - Update Available" - ) - } - |> start - DataAccess.LoadCache () let dynamicLayout = @@ -167,3 +157,13 @@ type MainForm(app: Application) = base.ClientSize <- new Size(900, 600) base.Content <- dynamicLayout base.DataContext <- modpack + + job { + let! isLatest = Startup.IsLatest + + if not isLatest then + app.Invoke (fun () -> + app.MainForm.Title <- sprintf "Cursed - Update Available" + ) + } + |> start diff --git a/Cursed.Base/MainFormController.fs b/Cursed.Base/MainFormController.fs index cb06af8..7ed6b55 100644 --- a/Cursed.Base/MainFormController.fs +++ b/Cursed.Base/MainFormController.fs @@ -38,7 +38,7 @@ module MainFormController = let manifest = ModpackManifest.Parse(manifestFile) let forge = CreateMultiMc location manifestFile - manifest.Files.[..3] + manifest.Files |> List.ofSeq |> List.map (modpack.DownloadMod location) |> Job.conCollect diff --git a/Cursed.Base/Modpack.fs b/Cursed.Base/Modpack.fs index c2dd1d1..ca33b5e 100644 --- a/Cursed.Base/Modpack.fs +++ b/Cursed.Base/Modpack.fs @@ -98,6 +98,13 @@ type Modpack(app: Application) as this = Save cache job { + let cachedModName = + let cache = CacheActor.FileLoop.PostAndReply GetCache + cache + |> List.tryFind (fun p -> + p.Id = file.ProjectId + ) + let projectResponse = Request.create Get (Uri <| sprintf "http://minecraft.curseforge.com/projects/%i" file.ProjectId) |> getResponse @@ -107,13 +114,16 @@ type Modpack(app: Application) as this = let html = HtmlDocument.Load(link) let modName = - let modNameHtml = (html.CssSelect("h1.project-title > a > span")).[0].InnerText - modNameHtml () + match cachedModName with + | Some project -> project.Name + | None -> + let modNameHtml = (html.CssSelect("h1.project-title > a > span")).[0].InnerText + modNameHtml () this.AddMod (modName, file.ProjectId) let fileUrl = sprintf "%A/files/%i/download" projectResponse.responseUri file.FileId - + using(Request.create Get (Uri fileUrl) |> getResponse |> run) (fun r -> let fileName = Uri.UnescapeDataString(r.responseUri.Segments |> Array.last)