update structure
This commit is contained in:
30
ModpackUpdater.Model/ModpackInfo.vb
Normal file
30
ModpackUpdater.Model/ModpackInfo.vb
Normal file
@@ -0,0 +1,30 @@
|
||||
Imports System.IO
|
||||
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Converters
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Public Class ModpackInfo
|
||||
|
||||
Private Const FILENAME_MODPACKINFO = "modpack-info.json"
|
||||
|
||||
<JsonConverter(GetType(VersionConverter))>
|
||||
Public Property Version As Version
|
||||
|
||||
Public Sub Save(mcRoot As String)
|
||||
File.WriteAllText(GetFilePath(mcRoot), JObject.FromObject(Me).ToString)
|
||||
End Sub
|
||||
|
||||
Public Shared Function Load(mcRoot As String) As ModpackInfo
|
||||
Return JObject.Parse(File.ReadAllText(GetFilePath(mcRoot))).ToObject(Of ModpackInfo)
|
||||
End Function
|
||||
|
||||
Public Shared Function HasModpackInfo(mcRoot As String) As Boolean
|
||||
Return File.Exists(GetFilePath(mcRoot))
|
||||
End Function
|
||||
|
||||
Private Shared Function GetFilePath(mcRoot As String)
|
||||
Return Path.Combine(mcRoot, FILENAME_MODPACKINFO)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user