@@ -23,10 +23,12 @@ limitations under the License.
2323*/
2424
2525using System ;
26+ using System . Diagnostics ;
2627using System . IO ;
2728using System . Reflection ;
2829using System . Threading . Tasks ;
2930using System . Windows . Forms ;
31+ using ArchiSteamFarm ;
3032
3133namespace ConfigGenerator {
3234 internal static class Program {
@@ -35,8 +37,10 @@ internal static class Program {
3537 internal const string GlobalConfigFile = ASF + ".json" ;
3638
3739 private const string ASFDirectory = "ArchiSteamFarm" ;
40+ private const string ASFExecutableFile = ASF + ".exe" ;
3841
3942 private static readonly string ExecutableDirectory = Path . GetDirectoryName ( Assembly . GetEntryAssembly ( ) . Location ) ;
43+ private static readonly Version Version = Assembly . GetEntryAssembly ( ) . GetName ( ) . Version ;
4044
4145 /// <summary>
4246 /// The main entry point for the application.
@@ -75,11 +79,30 @@ private static void Init() {
7579 }
7680 }
7781
78- if ( Directory . Exists ( ConfigDirectory ) ) {
82+ if ( ! Directory . Exists ( ConfigDirectory ) ) {
83+ Logging . LogGenericErrorWithoutStacktrace ( "Config directory could not be found!" ) ;
84+ Environment . Exit ( 1 ) ;
85+ }
86+
87+ if ( ! File . Exists ( ASFExecutableFile ) ) {
7988 return ;
8089 }
8190
82- Logging . LogGenericErrorWithoutStacktrace ( "Config directory could not be found!" ) ;
91+ FileVersionInfo asfVersionInfo = FileVersionInfo . GetVersionInfo ( ASFExecutableFile ) ;
92+
93+ Version asfVersion = new Version ( asfVersionInfo . ProductVersion ) ;
94+ if ( Version == asfVersion ) {
95+ return ;
96+ }
97+
98+ Logging . LogGenericErrorWithoutStacktrace (
99+ "Version of ASF and ConfigGenerator doesn't match!" + Environment . NewLine +
100+ "ASF version: " + asfVersion + " | ConfigGenerator version: " + Version + Environment . NewLine +
101+ Environment . NewLine +
102+ "Please use ConfigGenerator from the same ASF release, I'll redirect you to appropriate ASF release..."
103+ ) ;
104+
105+ Process . Start ( "https://github.com/" + SharedInfo . GithubRepo + "/releases/tag/" + asfVersion ) ;
83106 Environment . Exit ( 1 ) ;
84107 }
85108
0 commit comments