mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
auto update model list
This commit is contained in:
@@ -70,6 +70,7 @@ namespace Flowframes
|
||||
GetWebInfo.LoadNews(newsLabel);
|
||||
GetWebInfo.LoadPatronListCsv(patronsLabel);
|
||||
Updater.AsyncUpdateCheck();
|
||||
Updater.UpdateModelList();
|
||||
Python.CheckCompression();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
using Flowframes.Forms;
|
||||
using Flowframes.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -132,5 +129,26 @@ namespace Flowframes.OS
|
||||
|
||||
Logger.Log($"You are running Flowframes {installed}. The latest Patreon version is {latestPat}, the latest free version is {latestFree}.");
|
||||
}
|
||||
|
||||
public static async Task UpdateModelList()
|
||||
{
|
||||
try
|
||||
{
|
||||
Networks.networks.ForEach(ai =>
|
||||
{
|
||||
var client = new WebClient();
|
||||
string aiName = Path.GetFileNameWithoutExtension(ai.pkg.fileName);
|
||||
string url = $"https://raw.githubusercontent.com/n00mkrad/flowframes/main/Pkgs/{aiName}/models.txt";
|
||||
string savePath = Path.Combine(Paths.GetPkgPath(), aiName, "models.txt");
|
||||
if(File.Exists(savePath)) File.Delete(savePath);
|
||||
client.DownloadFile(url, savePath);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log("Non-critical error while performing model list update. See logs for details.");
|
||||
Logger.Log($"{e.Message}\n{e.StackTrace}", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user