Repository navigation
Expand file tree
/
Copy pathModels.cs
More file actions
76 lines (68 loc) · 2.72 KB
/
Copy pathModels.cs
File metadata and controls
76 lines (68 loc) · 2.72 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
namespace ModUpdater
{
// ── Remote JSON schema ──────────────────────────────────────────────
// Matches the JSON served from your GitHub-hosted manifest.
[Serializable]
public class RemoteModEntry
{
public string Name;
public string UUID;
public string URL; // Raw URL to a .zip file
public string ModNumber; // Semver string, e.g. "1.2.3"
}
// ── Per-mod status for the tracker ─────────────────────────────────
public enum ModStatus
{
Installed,
Queued,
Downloading,
Downloaded,
Skipped,
Failed
}
// ── Per-mod download outcome ────────────────────────────────────────
public enum DownloadResult
{
Success,
Unreachable,
Failed
}
// ── Outcome categories ─────────────────────────────────────────────
public enum UpdateStatus
{
AllCurrent, // Nothing needed downloading — everything up to date
UpdatedSuccessfully, // One or more mods downloaded without errors
CompletedWithErrors // Finished but some mods failed
}
// ── Result struct passed to the completion callback ─────────────────
public struct UpdateResult
{
public bool Success; // true when no failures occurred
public UpdateStatus Status; // granular outcome
public List<string> FailedMods; // names of mods that errored
public int UpdatedCount; // how many mods were downloaded
public static UpdateResult AllCurrent() => new UpdateResult
{
Success = true,
Status = UpdateStatus.AllCurrent,
FailedMods = new List<string>(),
UpdatedCount = 0
};
public static UpdateResult AllGood(int updatedCount) => new UpdateResult
{
Success = true,
Status = UpdateStatus.UpdatedSuccessfully,
FailedMods = new List<string>(),
UpdatedCount = updatedCount
};
public static UpdateResult WithErrors(List<string> failed, int updatedCount) => new UpdateResult
{
Success = false,
Status = UpdateStatus.CompletedWithErrors,
FailedMods = failed,
UpdatedCount = updatedCount
};
}
}