31 lines
949 B
C#
31 lines
949 B
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PoEco.Net.Web
|
|
{
|
|
internal class PoBLua
|
|
{
|
|
public class LuaRoot
|
|
{
|
|
public List<string> lua { get; set; }
|
|
}
|
|
public static void GetLatestLUA()
|
|
{
|
|
if (!Directory.Exists(@"data\lua")) { Directory.CreateDirectory(@"data\lua"); }
|
|
WebClient wc = new WebClient();
|
|
LuaRoot lr = JsonConvert.DeserializeObject<LuaRoot>(File.ReadAllText(@"data\lua.json"));
|
|
foreach (var l in lr.lua)
|
|
{
|
|
if(File.Exists($@"data\lua\{l}.lua")) { File.Delete($@"data\lua\{l}.lua"); }
|
|
wc.DownloadFile($"https://github.com/PathOfBuildingCommunity/PathOfBuilding/raw/dev/src/Data/Bases/{l}.lua", $@"data\lua\{l}.lua");
|
|
}
|
|
}
|
|
}
|
|
}
|