-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkshopUpdater.cs
More file actions
35 lines (28 loc) · 1.01 KB
/
WorkshopUpdater.cs
File metadata and controls
35 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace NeoModLoader.AutoUpdate;
public class WorkshopUpdater : AUpdater
{
public override bool CheckUpdate()
{
return false;
}
public override bool IsAvailable()
{
return Directory.Exists(Paths.NMLWorkshopPath);
}
public override Task<UpdateResult> DownloadAndReplace()
{
var files = Directory.GetFiles(Paths.NMLWorkshopPath);
var dll_file = files.FirstOrDefault(x => x.EndsWith(".dll"));
if (!string.IsNullOrEmpty(dll_file))
if (UpdateHelper.GetDLLVersion(dll_file) > WorldBoxMod.CurrentVersion)
{
var pdb_file = files.FirstOrDefault(x => x.EndsWith(".pdb"));
if (!string.IsNullOrEmpty(pdb_file)) UpdateHelper.TryReplaceFile(Paths.NMLPdbPath, pdb_file);
return Task.FromResult(UpdateHelper.TryReplaceFile(Paths.NMLPath, dll_file));
}
return Task.FromResult(UpdateResult.NoNeedUpdate);
}
}