diff --git a/.vs/NavBallDockingAlignmentIndicatorCE/v15/sqlite3/storage.ide b/.vs/NavBallDockingAlignmentIndicatorCE/v15/sqlite3/storage.ide index e9e0a1a..bdc42e4 100644 Binary files a/.vs/NavBallDockingAlignmentIndicatorCE/v15/sqlite3/storage.ide and b/.vs/NavBallDockingAlignmentIndicatorCE/v15/sqlite3/storage.ide differ diff --git a/Changelog.txt b/Changelog.txt index b67efa4..b32a4ff 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,4 @@ +ChangeLog 1.0.1.1 Initial release @@ -22,4 +23,8 @@ 1.0.5 Version bump for 1.7.2 - Updated AssemblyVersion.tt \ No newline at end of file + Updated AssemblyVersion.tt + +1.1.0 + Added Installchecker + Updated for KSP 1.8 \ No newline at end of file diff --git a/GameData/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.version b/GameData/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.version index 6354c08..db3a760 100644 --- a/GameData/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.version +++ b/GameData/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.version @@ -1,31 +1,20 @@ -{ +{ "NAME": "NavBallDockingAlignmentIndicatorCE", "URL": "http://ksp.spacetux.net/avc/NavBallDockingAlignmentIndicatorCE", - "DOWNLOAD" : "https://github.com/linuxgurugamer/NavBallDockingAlignmentIndicatorCE/releases", - "GITHUB" : - { - "USERNAME" : "linuxgurugamer", - "REPOSITORY" : "NavBallDockingAlignmentIndicatorCE" + "DOWNLOAD": "https://github.com/linuxgurugamer/NavBallDockingAlignmentIndicatorCE/releases", + "GITHUB": { + "USERNAME": "linuxgurugamer", + "REPOSITORY": "NavBallDockingAlignmentIndicatorCE" }, "VERSION": { "MAJOR": 1, - "MINOR": 0, - "PATCH": 4, - "BUILD": 3 - }, - "KSP_VERSION": { - "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "MINOR": 1, + "PATCH": 0, + "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 - }, - "KSP_VERSION_MAX": { - "MAJOR": 1, - "MINOR": 5, - "PATCH": 99 + "MINOR": 8, + "PATCH": 0 } } diff --git a/NavBallDockingAlignmentIndicatorCE.version b/NavBallDockingAlignmentIndicatorCE.version index b77a04d..db3a760 100644 --- a/NavBallDockingAlignmentIndicatorCE.version +++ b/NavBallDockingAlignmentIndicatorCE.version @@ -8,13 +8,13 @@ }, "VERSION": { "MAJOR": 1, - "MINOR": 0, - "PATCH": 5, + "MINOR": 1, + "PATCH": 0, "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 5, - "PATCH": 1 + "MINOR": 8, + "PATCH": 0 } } diff --git a/NavBallDockingAlignmentIndicatorCE.version.orig b/NavBallDockingAlignmentIndicatorCE.version.orig new file mode 100644 index 0000000..b77a04d --- /dev/null +++ b/NavBallDockingAlignmentIndicatorCE.version.orig @@ -0,0 +1,20 @@ +{ + "NAME": "NavBallDockingAlignmentIndicatorCE", + "URL": "http://ksp.spacetux.net/avc/NavBallDockingAlignmentIndicatorCE", + "DOWNLOAD": "https://github.com/linuxgurugamer/NavBallDockingAlignmentIndicatorCE/releases", + "GITHUB": { + "USERNAME": "linuxgurugamer", + "REPOSITORY": "NavBallDockingAlignmentIndicatorCE" + }, + "VERSION": { + "MAJOR": 1, + "MINOR": 0, + "PATCH": 5, + "BUILD": 0 + }, + "KSP_VERSION_MIN": { + "MAJOR": 1, + "MINOR": 5, + "PATCH": 1 + } +} diff --git a/NavBallDockingAlignmentIndicatorCE/AssemblyVersion.cs b/NavBallDockingAlignmentIndicatorCE/AssemblyVersion.cs index f23bf84..b94b26f 100644 --- a/NavBallDockingAlignmentIndicatorCE/AssemblyVersion.cs +++ b/NavBallDockingAlignmentIndicatorCE/AssemblyVersion.cs @@ -5,4 +5,4 @@ using System.Reflection; - [assembly: AssemblyVersion("1.0.4.4")] \ No newline at end of file + [assembly: AssemblyVersion("1.1.0.0")] \ No newline at end of file diff --git a/NavBallDockingAlignmentIndicatorCE/InstallChecker.cs b/NavBallDockingAlignmentIndicatorCE/InstallChecker.cs new file mode 100644 index 0000000..7ed2a16 --- /dev/null +++ b/NavBallDockingAlignmentIndicatorCE/InstallChecker.cs @@ -0,0 +1,99 @@ +/** + * 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; +using System.IO; +using System.Linq; +using System.Reflection; +using UnityEngine; + +namespace NavBallDockingAlignmentIndicatorCE +{ + [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 = "NavBall Docking Alignment Indicator CE"; + private const string FOLDERNAME = "NavBallDockingAlignmentIndicatorCE"; + 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/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj index d528863..48fb2f5 100644 --- a/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj +++ b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj @@ -9,7 +9,7 @@ Properties NavBallDockingAlignmentIndicatorCE NavBallDockingAlignmentIndicatorCE - 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.7.2_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll + + False - - - False - R:\KSP_1.7.2_dev\KSP_x64_Data\Managed\UnityEngine.dll - - - False - R:\KSP_1.7.2_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll + + False + diff --git a/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.173 b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.173 new file mode 100644 index 0000000..a496f4e --- /dev/null +++ b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.173 @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {F719FE8F-AF63-4D2E-A919-BBBE925EE8A5} + Library + Properties + NavBallDockingAlignmentIndicatorCE + NavBallDockingAlignmentIndicatorCE + 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 + + + + + +set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe" + + + +%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt" + + + +start /D D:\Users\jbb\github\NavBallDockingAlignmentIndicatorCE /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\NavBallDockingAlignmentIndicatorCE /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) +) + + + + \ No newline at end of file diff --git a/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.orig b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.orig new file mode 100644 index 0000000..a496f4e --- /dev/null +++ b/NavBallDockingAlignmentIndicatorCE/NavBallDockingAlignmentIndicatorCE.csproj.orig @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {F719FE8F-AF63-4D2E-A919-BBBE925EE8A5} + Library + Properties + NavBallDockingAlignmentIndicatorCE + NavBallDockingAlignmentIndicatorCE + 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 + + + + + +set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE \texttransform.exe" + + + +%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt" + + + +start /D D:\Users\jbb\github\NavBallDockingAlignmentIndicatorCE /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\NavBallDockingAlignmentIndicatorCE /WAIT buildRelease.bat $(TargetDir) $(TargetFileName) +) + + + + \ No newline at end of file diff --git a/deploy.bat b/deploy.bat index fd9ae7b..5fd5eb5 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.7.2_dev +set H=%KSPDIR% set GAMEDIR=NavBallDockingAlignmentIndicatorCE set GAMEDATA="GameData\" set VERSIONFILE=%GAMEDIR%.version