diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 67a5b7c9d..918d9c51b 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -114,6 +114,7 @@ + diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index cae1fda29..219d3280c 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -881,7 +881,7 @@ namespace ArchiSteamFarm { return null; } - return "https://github.com/" + Program.GithubRepo + "/wiki/Commands"; + return "https://github.com/" + SharedInfo.GithubRepo + "/wiki/Commands"; } private async Task ResponseRedeem(ulong steamID, string message, bool validate) { diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index d6d56800f..f6564a5ae 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -61,10 +61,9 @@ namespace ArchiSteamFarm { internal const string ConfigDirectory = "config"; internal const string DebugDirectory = "debug"; internal const string LogFile = "log.txt"; - internal const string GithubRepo = "JustArchi/ArchiSteamFarm"; private const string ASF = "ASF"; - private const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only + private const string GithubReleaseURL = "https://api.github.com/repos/" + SharedInfo.GithubRepo + "/releases"; // GitHub API is HTTPS only private const string GlobalConfigFile = ASF + ".json"; private const string GlobalDatabaseFile = ASF + ".db"; diff --git a/ArchiSteamFarm/Properties/AssemblyInfo.cs b/ArchiSteamFarm/Properties/AssemblyInfo.cs index 62ef638d3..47077a833 100644 --- a/ArchiSteamFarm/Properties/AssemblyInfo.cs +++ b/ArchiSteamFarm/Properties/AssemblyInfo.cs @@ -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("ArchiSteamFarm")] -[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("2.1.1.2")] -[assembly: AssemblyFileVersion("2.1.1.2")] +[assembly: AssemblyVersion(SharedInfo.Version)] +[assembly: AssemblyFileVersion(SharedInfo.Version)] diff --git a/ArchiSteamFarm/SharedInfo.cs b/ArchiSteamFarm/SharedInfo.cs new file mode 100644 index 000000000..6f1bccd3b --- /dev/null +++ b/ArchiSteamFarm/SharedInfo.cs @@ -0,0 +1,32 @@ +/* + _ _ _ ____ _ _____ + / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ + / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ + / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | +/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| + + Copyright 2015-2016 Łukasz "JustArchi" Domeradzki + Contact: JustArchi@JustArchi.net + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +namespace ArchiSteamFarm { + internal static class SharedInfo { + internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016"; + internal const string Version = "2.1.1.2"; + + internal const string GithubRepo = "JustArchi/ArchiSteamFarm"; + } +} diff --git a/ConfigGenerator/ConfigGenerator.csproj b/ConfigGenerator/ConfigGenerator.csproj index 3ca46925b..d677cb589 100644 --- a/ConfigGenerator/ConfigGenerator.csproj +++ b/ConfigGenerator/ConfigGenerator.csproj @@ -49,6 +49,9 @@ + + SharedInfo.cs + diff --git a/ConfigGenerator/MainForm.cs b/ConfigGenerator/MainForm.cs index c263abf8c..9b7331651 100644 --- a/ConfigGenerator/MainForm.cs +++ b/ConfigGenerator/MainForm.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); } } diff --git a/ConfigGenerator/Program.cs b/ConfigGenerator/Program.cs index bcbb63a40..2d9a1c524 100644 --- a/ConfigGenerator/Program.cs +++ b/ConfigGenerator/Program.cs @@ -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; /// /// 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); } diff --git a/ConfigGenerator/Properties/AssemblyInfo.cs b/ConfigGenerator/Properties/AssemblyInfo.cs index b59143d9f..625f83e9e 100644 --- a/ConfigGenerator/Properties/AssemblyInfo.cs +++ b/ConfigGenerator/Properties/AssemblyInfo.cs @@ -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)]