diff --git a/Changelog.txt b/Changelog.txt index 4fc7888..d5f0fa9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,5 @@ +ChangeLog + 1.1.3 Fixed issue with emitters, thanks @sarbian 1.1.4 @@ -20,4 +22,9 @@ Removed log spam during flight (once eveyr 5 secs) 1.1.9.1 - Version bump for 1.5 rebuild \ No newline at end of file + Version bump for 1.5 rebuild + +0.1.10 + Updated AssemblyVersion + Added InstallChecker + Updated for KSP 1.8 \ No newline at end of file diff --git a/GameData/VaporVent/VaporVent.version b/GameData/VaporVent/VaporVent.version index 7da1efa..8b4e0b2 100644 --- a/GameData/VaporVent/VaporVent.version +++ b/GameData/VaporVent/VaporVent.version @@ -1,4 +1,4 @@ -{ +{ "NAME": "VaporVent", "URL": "http://ksp.spacetux.net/avc/VaporVent", "DOWNLOAD": "http://spacedock.info/mod/931", @@ -9,22 +9,18 @@ "VERSION": { "MAJOR": 1, "MINOR": 1, - "PATCH": 9, - "BUILD": 1 - }, - "KSP_VERSION": { - "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "PATCH": 10, + "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "MINOR": 8, + "PATCH": 0 }, - "KSP_VERSION_MAX": { - "MAJOR": 1, - "MINOR": 5, - "PATCH": 99 + "INSTALL_LOC_1": { + "NAME": "VaporVent", + "PATH": "", + "DIRECTORY": "VaporVent", + "FILE": "VaporVent.version" } -} \ No newline at end of file +} diff --git a/VaporVent.version b/VaporVent.version index fdada8e..8b4e0b2 100644 --- a/VaporVent.version +++ b/VaporVent.version @@ -9,17 +9,18 @@ "VERSION": { "MAJOR": 1, "MINOR": 1, - "PATCH": 9, - "BUILD": 2 - }, - "KSP_VERSION": { - "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "PATCH": 10, + "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "MINOR": 8, + "PATCH": 0 + }, + "INSTALL_LOC_1": { + "NAME": "VaporVent", + "PATH": "", + "DIRECTORY": "VaporVent", + "FILE": "VaporVent.version" } } diff --git a/VaporVent.version.orig b/VaporVent.version.orig new file mode 100644 index 0000000..65684be --- /dev/null +++ b/VaporVent.version.orig @@ -0,0 +1,32 @@ +{ + "NAME": "VaporVent", + "URL": "http://ksp.spacetux.net/avc/VaporVent", + "DOWNLOAD": "http://spacedock.info/mod/931", + "GITHUB": { + "USERNAME": "linuxgurugamer", + "REPOSITORY": "VaporVent" + }, + "VERSION": { + "MAJOR": 1, + "MINOR": 1, + "PATCH": 9, + "BUILD": 2 + }, + "KSP_VERSION": { + "MAJOR": 1, + "MINOR": 5, + "PATCH": 1 + }, + "KSP_VERSION_MIN": { + "MAJOR": 1, + "MINOR": 5, + "PATCH": 1 + }, + "INSTALL_LOC_1": + { + "NAME": "VaporVent", + "PATH": "", + "DIRECTORY": "VaporVent", + "FILE": "VaporVent.version" + } +} diff --git a/VaporVent.version.old b/VaporVent.version.orig1 similarity index 96% rename from VaporVent.version.old rename to VaporVent.version.orig1 index 39b24b2..fdada8e 100644 --- a/VaporVent.version.old +++ b/VaporVent.version.orig1 @@ -10,7 +10,7 @@ "MAJOR": 1, "MINOR": 1, "PATCH": 9, - "BUILD": 1 + "BUILD": 2 }, "KSP_VERSION": { "MAJOR": 1, diff --git a/VaporVent/AssemblyVersion.cs b/VaporVent/AssemblyVersion.cs index ad62ef1..eb2c9bb 100644 --- a/VaporVent/AssemblyVersion.cs +++ b/VaporVent/AssemblyVersion.cs @@ -5,4 +5,4 @@ using System.Reflection; - [assembly: AssemblyVersion("1.1.9.1")] + [assembly: AssemblyVersion("1.1.10.0")] diff --git a/VaporVent/AssemblyVersion.tt b/VaporVent/AssemblyVersion.tt index b9b195e..0f5f44f 100644 --- a/VaporVent/AssemblyVersion.tt +++ b/VaporVent/AssemblyVersion.tt @@ -27,7 +27,14 @@ int i2 = 0; string s; - string versionfile = @"D:\Users\jbb\github\VaporVent\VaporVent.version"; + // For Visual Studio / MSBuild Build-Time Template Resolution + string RootDirectory = System.IO.Path.GetDirectoryName(Host.TemplateFile) + @"\..\"; + + // + // Update the following with the name of the .version file which is in the root directory + // + string versionfile = RootDirectory +"VaporVent.version"; + if (!File.Exists(versionfile)) { Write("File: " + versionfile + " missing\n"); diff --git a/VaporVent/InstallChecker.cs b/VaporVent/InstallChecker.cs new file mode 100644 index 0000000..e5ae281 --- /dev/null +++ b/VaporVent/InstallChecker.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +/** + * Based on the InstallChecker from the Kethane mod for Kerbal Space Program. + * https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs + * + * Original is (C) Copyright Majiir. + * CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/) + * http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895 + * + * This file has been modified extensively and is released under the same license. + */ +using System.IO; +using System.Reflection; +using UnityEngine; + +namespace vaporvent +{ + + + [KSPAddon(KSPAddon.Startup.Instantly, true)] + internal class Startup : MonoBehaviour + { + private void Start() + { + string v = "n/a"; + AssemblyTitleAttribute attributes = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false); + string title = attributes?.Title; + if (title == null) + { + title = "TitleNotAvailable"; + } + v = Assembly.GetExecutingAssembly().FullName; + if (v == null) + { + v = "VersionNotAvailable"; + } + Debug.Log("[" + title + "] Version " + v); + } + } + + [KSPAddon(KSPAddon.Startup.MainMenu, true)] + internal class InstallChecker : MonoBehaviour + { + private const string MODNAME = "Vapor Vent"; + private const string FOLDERNAME = "VaporVent"; + private const string EXPECTEDPATH = FOLDERNAME + "/Plugins"; + + protected void Start() + { + // Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place. + var assemblies = AssemblyLoader.loadedAssemblies.Where(a => a.assembly.GetName().Name == Assembly.GetExecutingAssembly().GetName().Name).Where(a => a.url != EXPECTEDPATH); + if (assemblies.Any()) + { + var badPaths = assemblies.Select(a => a.path).Select(p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar))); + PopupDialog.SpawnPopupDialog + ( + new Vector2(0.5f, 0.5f), + new Vector2(0.5f, 0.5f), + "test", + "Incorrect " + MODNAME + " Installation", + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + FOLDERNAME + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()), + "OK", + false, + HighLogic.UISkin + ); + Debug.Log("Incorrect " + MODNAME + " Installation: " + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + EXPECTEDPATH + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()) + + ); + + } + + //// Check for Module Manager + //if (!AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name.StartsWith("ModuleManager") && a.url == "")) + //{ + // PopupDialog.SpawnPopupDialog("Missing Module Manager", + // modName + " requires the Module Manager mod in order to function properly.\n\nPlease download from http://forum.kerbalspaceprogram.com/threads/55219 and copy to the KSP/GameData/ directory.", + // "OK", false, HighLogic.Skin); + //} + + CleanupOldVersions(); + } + + /* + * Tries to fix the install if it was installed over the top of a previous version + */ + void CleanupOldVersions() + { + try + { + } + catch (Exception ex) + { + Debug.LogError("-ERROR- " + this.GetType().FullName + "[" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.00") + "]: " + + "Exception caught while cleaning up old files.\n" + ex.Message + "\n" + ex.StackTrace); + + } + } + } +} + diff --git a/VaporVent/InstallChecker.cs.orig b/VaporVent/InstallChecker.cs.orig new file mode 100644 index 0000000..4257205 --- /dev/null +++ b/VaporVent/InstallChecker.cs.orig @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +/** + * Based on the InstallChecker from the Kethane mod for Kerbal Space Program. + * https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs + * + * Original is (C) Copyright Majiir. + * CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/) + * http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895 + * + * This file has been modified extensively and is released under the same license. + */ +using System.IO; +using System.Reflection; +using UnityEngine; + +namespace vaporvent +{ + [KSPAddon(KSPAddon.Startup.Instantly, true)] + internal class Startup : MonoBehaviour + { + private void Start() + { + string v = "n/a"; + AssemblyTitleAttribute attributes = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false); + string title = attributes?.Title; + if (title == null) + { + title = "TitleNotAvailable"; + } + v = Assembly.GetExecutingAssembly().FullName; + if (v == null) + { + v = "VersionNotAvailable"; + } + Debug.Log("[" + title + "] Version " + v); + } + } + + [KSPAddon(KSPAddon.Startup.MainMenu, true)] + internal class InstallChecker : MonoBehaviour + { + private const string MODNAME = "Vapor Vent"; + private const string FOLDERNAME = "VaporVent"; + private const string EXPECTEDPATH = FOLDERNAME + "/Plugins"; + + protected void Start() + { + // Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place. + var assemblies = AssemblyLoader.loadedAssemblies.Where(a => a.assembly.GetName().Name == Assembly.GetExecutingAssembly().GetName().Name).Where(a => a.url != EXPECTEDPATH); + if (assemblies.Any()) + { + var badPaths = assemblies.Select(a => a.path).Select(p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar))); + PopupDialog.SpawnPopupDialog + ( + new Vector2(0.5f, 0.5f), + new Vector2(0.5f, 0.5f), + "test", + "Incorrect " + MODNAME + " Installation", + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + FOLDERNAME + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()), + "OK", + false, + HighLogic.UISkin + ); + Debug.Log("Incorrect " + MODNAME + " Installation: " + MODNAME + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + EXPECTEDPATH + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()) + + ); + + } + + //// Check for Module Manager + //if (!AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name.StartsWith("ModuleManager") && a.url == "")) + //{ + // PopupDialog.SpawnPopupDialog("Missing Module Manager", + // modName + " requires the Module Manager mod in order to function properly.\n\nPlease download from http://forum.kerbalspaceprogram.com/threads/55219 and copy to the KSP/GameData/ directory.", + // "OK", false, HighLogic.Skin); + //} + + CleanupOldVersions(); + } + + /* + * Tries to fix the install if it was installed over the top of a previous version + */ + void CleanupOldVersions() + { + try + { + } + catch (Exception ex) + { + Debug.LogError("-ERROR- " + this.GetType().FullName + "[" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.00") + "]: " + + "Exception caught while cleaning up old files.\n" + ex.Message + "\n" + ex.StackTrace); + + } + } + } +} + diff --git a/VaporVent/VaporVent.csproj b/VaporVent/VaporVent.csproj index 677f664..ba2fc12 100644 --- a/VaporVent/VaporVent.csproj +++ b/VaporVent/VaporVent.csproj @@ -9,7 +9,7 @@ Properties VaporVent VaporVent - v3.5 + v4.5 512 @@ -20,6 +20,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -28,6 +29,7 @@ TRACE prompt 4 + false @@ -35,6 +37,7 @@ True AssemblyVersion.tt + @@ -48,19 +51,13 @@ - - False - R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll + + False - - - False - R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\UnityEngine.dll - - - False - R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll + + False + @@ -87,4 +84,4 @@ set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Com --> - \ No newline at end of file + diff --git a/VaporVent/VaporVent.csproj.173 b/VaporVent/VaporVent.csproj.173 new file mode 100644 index 0000000..f9ba35d --- /dev/null +++ b/VaporVent/VaporVent.csproj.173 @@ -0,0 +1,91 @@ + + + + + Debug + AnyCPU + {E3B49F92-3626-4CB1-A926-F9DEE8E5C35E} + Library + Properties + VaporVent + VaporVent + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + True + AssemblyVersion.tt + + + + + + + + TextTemplatingFileGenerator + AssemblyVersion.cs + + + + + + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll + + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.dll + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll + + + + + +start /D D:\Users\jbb\github\VaporVent /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\VaporVent /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) +) + + + + +set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe" + + + +%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt" + + + \ No newline at end of file diff --git a/VaporVent/VaporVent.csproj.orig b/VaporVent/VaporVent.csproj.orig new file mode 100644 index 0000000..f9ba35d --- /dev/null +++ b/VaporVent/VaporVent.csproj.orig @@ -0,0 +1,91 @@ + + + + + Debug + AnyCPU + {E3B49F92-3626-4CB1-A926-F9DEE8E5C35E} + Library + Properties + VaporVent + VaporVent + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + True + AssemblyVersion.tt + + + + + + + + TextTemplatingFileGenerator + AssemblyVersion.cs + + + + + + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll + + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.dll + + + False + R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll + + + + + +start /D D:\Users\jbb\github\VaporVent /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\VaporVent /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) +) + + + + +set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe" + + + +%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt" + + + \ No newline at end of file diff --git a/deploy.bat b/deploy.bat index 41ae1bc..20beb26 100644 --- a/deploy.bat +++ b/deploy.bat @@ -7,7 +7,7 @@ rem GAMEDATA is the name of the local GameData rem VERSIONFILE is the name of the version file, usually the same as GAMEDATA, rem but not always -set H=R:\KSP_1.6.1_dev +set H=%KSPDIR% set GAMEDIR=VaporVent set GAMEDATA="GameData\" set VERSIONFILE=%GAMEDIR%.version