diff --git a/.vs/ThroughTheEyes/v15/sqlite3/storage.ide b/.vs/ThroughTheEyes/v15/sqlite3/storage.ide index b758a23..23b8a52 100644 Binary files a/.vs/ThroughTheEyes/v15/sqlite3/storage.ide and b/.vs/ThroughTheEyes/v15/sqlite3/storage.ide differ diff --git a/ChangeLog.txt b/ChangeLog.txt index 2bb361e..291a3c0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,10 @@ +ChangeLog + +2.0.3 + Added InstallChecker + Updated AssemblyVersion + Updated for KSP 1.8 + 2.0.2.5 Removed the useBlizzy option from the settings page as it wasn't being used diff --git a/GameData/ThroughTheEyes/ThroughTheEyes.version b/GameData/ThroughTheEyes/ThroughTheEyes.version index bb4885f..ff453c0 100644 --- a/GameData/ThroughTheEyes/ThroughTheEyes.version +++ b/GameData/ThroughTheEyes/ThroughTheEyes.version @@ -9,17 +9,12 @@ "VERSION": { "MAJOR": 2, "MINOR": 0, - "PATCH": 2, - "BUILD": 4 - }, - "KSP_VERSION": { - "MAJOR": 1, - "MINOR": 4, - "PATCH": 1 + "PATCH": 3, + "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 4, - "PATCH": 1 + "MINOR": 8, + "PATCH": 0 } } diff --git a/ThroughTheEyes.version b/ThroughTheEyes.version index 64ca773..ff453c0 100644 --- a/ThroughTheEyes.version +++ b/ThroughTheEyes.version @@ -9,17 +9,12 @@ "VERSION": { "MAJOR": 2, "MINOR": 0, - "PATCH": 2, - "BUILD": 5 - }, - "KSP_VERSION": { - "MAJOR": 1, - "MINOR": 4, - "PATCH": 1 + "PATCH": 3, + "BUILD": 0 }, "KSP_VERSION_MIN": { "MAJOR": 1, - "MINOR": 4, - "PATCH": 1 + "MINOR": 8, + "PATCH": 0 } } diff --git a/ThroughTheEyes.version.orig b/ThroughTheEyes.version.orig new file mode 100644 index 0000000..64ca773 --- /dev/null +++ b/ThroughTheEyes.version.orig @@ -0,0 +1,25 @@ +{ + "NAME": "ThroughTheEyes", + "URL": "http://ksp.spacetux.net/avc/ThroughTheEyes", + "DOWNLOAD": "https://spacedock.info/mod/1560/", + "GITHUB": { + "USERNAME": "linuxgurugamer", + "REPOSITORY": "Through-The-Eyes" + }, + "VERSION": { + "MAJOR": 2, + "MINOR": 0, + "PATCH": 2, + "BUILD": 5 + }, + "KSP_VERSION": { + "MAJOR": 1, + "MINOR": 4, + "PATCH": 1 + }, + "KSP_VERSION_MIN": { + "MAJOR": 1, + "MINOR": 4, + "PATCH": 1 + } +} diff --git a/ThroughTheEyes/AssemblyVersion.cs b/ThroughTheEyes/AssemblyVersion.cs index bef215c..8e06e31 100644 --- a/ThroughTheEyes/AssemblyVersion.cs +++ b/ThroughTheEyes/AssemblyVersion.cs @@ -10,4 +10,4 @@ using System.Reflection; - [assembly: AssemblyVersion("2.0.2.4")] \ No newline at end of file + [assembly: AssemblyVersion("2.0.3.0")] \ No newline at end of file diff --git a/ThroughTheEyes/AssemblyVersion.tt b/ThroughTheEyes/AssemblyVersion.tt index 794b8c1..7700a60 100644 --- a/ThroughTheEyes/AssemblyVersion.tt +++ b/ThroughTheEyes/AssemblyVersion.tt @@ -27,8 +27,14 @@ int i = 0; int i2 = 0; string s; + // 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 + "ThroughTheEyes.version"; - string versionfile = @"D:\Users\jbb\github\Through-The-Eyes\ThroughTheEyes.version"; if (!File.Exists(versionfile)) { Write("File: " + versionfile + " missing\n"); diff --git a/ThroughTheEyes/InstallChecker.cs b/ThroughTheEyes/InstallChecker.cs new file mode 100644 index 0000000..2e4195f --- /dev/null +++ b/ThroughTheEyes/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 ThroughTheEyes +{ + [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 = "Through-The-Eyes"; + private const string FOLDERNAME = "ThroughTheEyes"; + 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("[PlaneraryDiversity] 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("[PlaneraryDiversity] -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/ThroughTheEyes/ThroughTheEyes.csproj b/ThroughTheEyes/ThroughTheEyes.csproj index 4d85aaa..9363bf1 100644 --- a/ThroughTheEyes/ThroughTheEyes.csproj +++ b/ThroughTheEyes/ThroughTheEyes.csproj @@ -7,7 +7,7 @@ Library ThroughTheEyes ThroughTheEyes - v3.5 + v4.5 true @@ -17,6 +17,7 @@ DEBUG; prompt 4 + false false @@ -25,6 +26,7 @@ bin\Release prompt 4 + false false @@ -34,6 +36,7 @@ AssemblyVersion.tt + @@ -64,23 +67,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\Assembly-CSharp-firstpass.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 - diff --git a/ThroughTheEyes/ThroughTheEyes.csproj.173 b/ThroughTheEyes/ThroughTheEyes.csproj.173 new file mode 100644 index 0000000..9ebc146 --- /dev/null +++ b/ThroughTheEyes/ThroughTheEyes.csproj.173 @@ -0,0 +1,102 @@ + + + + Debug + AnyCPU + {7490BCE5-BAC8-44E3-BE55-6E6694583BC8} + Library + ThroughTheEyes + ThroughTheEyes + v3.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + 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\Assembly-CSharp-firstpass.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\Through-The-Eyes /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\Through-The-Eyes /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/ThroughTheEyes/ThroughTheEyes.csproj.orig b/ThroughTheEyes/ThroughTheEyes.csproj.orig new file mode 100644 index 0000000..9ebc146 --- /dev/null +++ b/ThroughTheEyes/ThroughTheEyes.csproj.orig @@ -0,0 +1,102 @@ + + + + Debug + AnyCPU + {7490BCE5-BAC8-44E3-BE55-6E6694583BC8} + Library + ThroughTheEyes + ThroughTheEyes + v3.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + 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\Assembly-CSharp-firstpass.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\Through-The-Eyes /WAIT deploy.bat $(TargetDir) $(TargetFileName) + +if $(ConfigurationName) == Release ( + start /D D:\Users\jbb\github\Through-The-Eyes /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 ec49231..62681cd 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=ThroughTheEyes set GAMEDATA="GameData\" set VERSIONFILE=%GAMEDIR%.version