mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Use SharedInfo + Add ConfigGenerator version check
This commit is contained in:
@@ -49,6 +49,9 @@
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\ArchiSteamFarm\SharedInfo.cs">
|
||||
<Link>SharedInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ASFConfig.cs" />
|
||||
<Compile Include="BotConfig.cs" />
|
||||
<Compile Include="DialogBox.cs" />
|
||||
|
||||
@@ -29,6 +29,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using ArchiSteamFarm;
|
||||
|
||||
namespace ConfigGenerator {
|
||||
internal sealed partial class MainForm : Form {
|
||||
@@ -196,7 +197,7 @@ namespace ConfigGenerator {
|
||||
|
||||
args.Cancel = true;
|
||||
Tutorial.OnAction(Tutorial.EPhase.Help);
|
||||
Process.Start("https://github.com/JustArchi/ArchiSteamFarm/wiki/Configuration");
|
||||
Process.Start("https://github.com/" + SharedInfo.GithubRepo + "/wiki/Configuration");
|
||||
Tutorial.OnAction(Tutorial.EPhase.HelpFinished);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ArchiSteamFarm;
|
||||
|
||||
namespace ConfigGenerator {
|
||||
internal static class Program {
|
||||
@@ -35,8 +37,10 @@ namespace ConfigGenerator {
|
||||
internal const string GlobalConfigFile = ASF + ".json";
|
||||
|
||||
private const string ASFDirectory = "ArchiSteamFarm";
|
||||
private const string ASFExecutableFile = ASF + ".exe";
|
||||
|
||||
private static readonly string ExecutableDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
private static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
@@ -75,11 +79,30 @@ namespace ConfigGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
if (Directory.Exists(ConfigDirectory)) {
|
||||
if (!Directory.Exists(ConfigDirectory)) {
|
||||
Logging.LogGenericErrorWithoutStacktrace("Config directory could not be found!");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (!File.Exists(ASFExecutableFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericErrorWithoutStacktrace("Config directory could not be found!");
|
||||
FileVersionInfo asfVersionInfo = FileVersionInfo.GetVersionInfo(ASFExecutableFile);
|
||||
|
||||
Version asfVersion = new Version(asfVersionInfo.ProductVersion);
|
||||
if (Version == asfVersion) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericErrorWithoutStacktrace(
|
||||
"Version of ASF and ConfigGenerator doesn't match!" + Environment.NewLine +
|
||||
"ASF version: " + asfVersion + " | ConfigGenerator version: " + Version + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Please use ConfigGenerator from the same ASF release, I'll redirect you to appropriate ASF release..."
|
||||
);
|
||||
|
||||
Process.Start("https://github.com/" + SharedInfo.GithubRepo + "/releases/tag/" + asfVersion);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using ArchiSteamFarm;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
@@ -9,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConfigGenerator")]
|
||||
[assembly: AssemblyCopyright("Copyright © ArchiSteamFarm 2015-2016")]
|
||||
[assembly: AssemblyCopyright(SharedInfo.Copyright)]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion(SharedInfo.Version)]
|
||||
[assembly: AssemblyFileVersion(SharedInfo.Version)]
|
||||
|
||||
Reference in New Issue
Block a user