@@ -9,23 +9,28 @@ Class WikiHandler
99 Shared InputFromGitHub As IEnumerable( Of XElement)
1010 Friend Shared allResults As New List( Of Result)
1111 Shared workingname As String = "testdir"
12- Shared DBZipFileLoc As String = AppDomain.CurrentDomain.BaseDirectory & "\ CompactGUI.zxm"
12+ Shared DBZipFileLoc As String = Path.GetTempPath & "CompactGUI.zxm"
1313
1414 Private Shared Sub WikiParser()
1515 Console.WriteLine( "Working Name: " & workingname)
16-
16+ Console.WriteLine(DBZipFileLoc)
1717 allResults.Clear()
1818
19- Console.WriteLine( New FileInfo(DBZipFileLoc).LastWriteTime )
20- If InputFromGitHub Is Nothing AndAlso File.Exists(DBZipFileLoc) AndAlso Date .Now < ( New FileInfo(DBZipFileLoc).LastWriteTime. AddHours(24 ) ) Then
19+ Console.WriteLine(My.Settings.ResultsDB_Date )
20+ If InputFromGitHub Is Nothing AndAlso My.Settings.ResultsDB IsNot Nothing AndAlso Date .Now < My.Settings.ResultsDB_Date. AddHours(12 ) Then
2121 Console.WriteLine( "Using existing DB" )
2222 InitialiseInputFromGithub()
2323
2424 ElseIf InputFromGitHub Is Nothing Then
2525 Console.WriteLine( "Fetching New DB" )
26+
2627 Dim wc = New WebClient With {.Encoding = Encoding.UTF8}
2728 Try
2829 wc.DownloadFile( "https://raw.githubusercontent.com/ImminentFate/CompactGUI/master/Wiki/Database.zip" , DBZipFileLoc)
30+ Dim x As Compression.ZipArchive = Compression.ZipFile.OpenRead(DBZipFileLoc)
31+ Dim stre As StreamReader = New StreamReader(x.Entries( 0 ).Open())
32+ My.Settings.ResultsDB = stre.ReadToEnd
33+ My.Settings.ResultsDB_Date = Date .Now
2934 InitialiseInputFromGithub()
3035
3136 Catch ex As WebException
@@ -47,9 +52,7 @@ Class WikiHandler
4752
4853 Private Shared Sub InitialiseInputFromGithub()
4954 Dim SRC As XElement
50- Dim x As Compression.ZipArchive = Compression.ZipFile.OpenRead(DBZipFileLoc)
51- Dim stre As StreamReader = New StreamReader(x.Entries( 0 ).Open())
52- SRC = XElement.Parse(stre.ReadToEnd)
55+ SRC = XElement.Parse(My.Settings.ResultsDB)
5356 InputFromGitHub = SRC.Elements()
5457 ParseData()
5558 End Sub
0 commit comments