3
3
using System . IO ;
4
4
using System . Diagnostics ;
5
5
using System . Linq ;
6
- using System . Text ;
7
6
using System . Threading . Tasks ;
8
- using LogUploader . Properties ;
9
7
using System . IO . Compression ;
10
8
using System . Reflection ;
11
- using System . Net ;
12
9
using LogUploader . Data . Settings ;
13
10
using Extensiones . HTTPClient ;
14
11
using System . Threading ;
@@ -27,12 +24,14 @@ internal static class EliteInsights
27
24
private const string GitHubApiLink = @"https://api.github.com/repos/baaron4/GW2-Elite-Insights-Parser/releases/latest" ;
28
25
private const string USER_AGENT = "LogUploader" ;
29
26
private const string ZIP_NAME = "NewEI.zip" ;
27
+ private const string EI_EXECUTABLE = "GuildWars2EliteInsights-CLI.exe" ;
30
28
31
29
public static string LogsPath { get => BASE_PATH + LOGS ; }
32
30
private static string TempPath { get => BASE_PATH + TEMP_FOLDER ; }
33
31
private static string TempOldPath { get => BASE_PATH + TEMP_OLD_FOLDER ; }
34
32
private static string BinPath { get => BASE_PATH + BIN ; }
35
33
private static string ZipFilePath { get => BASE_PATH + ZIP_NAME ; }
34
+ private static string EiPath { get => BASE_PATH + BIN + EI_EXECUTABLE ; }
36
35
37
36
private static string DownloadURLCache { get ; set ; } = null ;
38
37
@@ -49,9 +48,9 @@ public static void Init(IEliteInsightsSettings settings)
49
48
50
49
public static Version UpdateLocalVersion ( )
51
50
{
52
- if ( File . Exists ( BASE_PATH + BIN + "GuildWars2EliteInsights.exe" ) )
51
+ if ( File . Exists ( EiPath ) )
53
52
{
54
- var fi = FileVersionInfo . GetVersionInfo ( BASE_PATH + BIN + "GuildWars2EliteInsights.exe" ) ;
53
+ var fi = FileVersionInfo . GetVersionInfo ( EiPath ) ;
55
54
LocalVersion = new Version ( fi . ProductMajorPart , fi . ProductMinorPart , fi . ProductBuildPart , fi . ProductPrivatePart ) ;
56
55
}
57
56
else
@@ -104,7 +103,7 @@ public static bool UpdateAvailable()
104
103
105
104
public static bool IsInstalled ( )
106
105
{
107
- return File . Exists ( BASE_PATH + BIN + "GuildWars2EliteInsights.exe" ) ;
106
+ return File . Exists ( EiPath ) ;
108
107
}
109
108
110
109
/// <summary>
@@ -190,7 +189,7 @@ public static async Task<Version> Update(IProxySettings settings, IProgress<doub
190
189
}
191
190
catch ( Exception e )
192
191
{
193
- Logger . Error ( "Unkown EI Update error" ) ;
192
+ Logger . Error ( "Unknown EI Update error" ) ;
194
193
Logger . LogException ( e ) ;
195
194
FolderCleanup ( ) ;
196
195
return LocalVersion ;
@@ -220,7 +219,7 @@ public static async Task<Version> Update(IProxySettings settings, IProgress<doub
220
219
private static string GetDownloadURL ( Newtonsoft . Json . Linq . JObject jsonData )
221
220
{
222
221
return jsonData [ "assets" ]
223
- . Where ( json => ( string ) json [ "name" ] == "GW2EI .zip" )
222
+ . Where ( json => ( string ) json [ "name" ] == "GW2EICLI .zip" )
224
223
. Select ( json => ( string ) json [ "browser_download_url" ] )
225
224
. First ( ) ;
226
225
}
@@ -252,14 +251,13 @@ public static List<string> Parse(string log)
252
251
throw new NotSupportedException ( $ "EliteInsights version too low.\n Installed { LocalVersion } \n Min required { new Version ( 2 , 24 ) } \n Please update EI via the settings.") ;
253
252
}
254
253
255
- string destConf = PrepearConfig ( ) ;
256
- //-p requiered for silent execution!!
257
- var args = $ "-p -c \" { destConf } \" \" { log } \" ";
254
+ string destConf = PrepareConfig ( ) ;
255
+ var args = $ "-c \" { destConf } \" \" { log } \" ";
258
256
var psi = new ProcessStartInfo
259
257
{
260
- FileName = BASE_PATH + BIN + "GuildWars2EliteInsights.exe" ,
258
+ FileName = EiPath ,
261
259
WorkingDirectory = BinPath ,
262
- CreateNoWindow = false ,
260
+ CreateNoWindow = true ,
263
261
UseShellExecute = false ,
264
262
RedirectStandardOutput = true ,
265
263
RedirectStandardError = true ,
@@ -304,7 +302,7 @@ private static List<string> ReadLinesFromStream(StreamReader stream)
304
302
return lines ;
305
303
}
306
304
307
- private static string PrepearConfig ( )
305
+ private static string PrepareConfig ( )
308
306
{
309
307
var defaultConf = $ "{ Path . GetDirectoryName ( Assembly . GetEntryAssembly ( ) . Location ) + @"\Data\EIconf.conf" } ";
310
308
var destConf = BASE_PATH + "EIconf.conf" ;
0 commit comments