Skip to content

Commit

Permalink
Added InstallChecker
Browse files Browse the repository at this point in the history
 Updated AssemblyVersion.tt
 Updated for KSP 1.8
 Added INSTALL_LOC1  to .version file
Updated Firespitter
Updated RetractableLiftingSurface
  • Loading branch information
linuxgurugamer committed Nov 15, 2019
1 parent 1864fd2 commit 28d2ce7
Show file tree
Hide file tree
Showing 17 changed files with 354 additions and 42 deletions.
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,8 @@ ChangeLog
Fixing TweakScale patches to prevent triggering the Fatal Alert
from [#34](https://github.com/net-lisias-ksp/TweakScale/issues/34).

0.3.29
Added InstallChecker
Updated AssemblyVersion.tt
Updated for KSP 1.8
Added INSTALL_LOC1 to .version file
10 changes: 5 additions & 5 deletions GameData/Firespitter/Firespitter.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
"URL": "https://raw.githubusercontent.com/snjo/Firespitter/master/For%20release/Firespitter/Firespitter.version",
"VERSION": {
"MAJOR": 7,
"MINOR": 9,
"MINOR": 14,
"PATCH": 0
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":4,
"PATCH":1
"MINOR":8,
"PATCH":0
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":4,
"MINOR":8,
"PATCH":0
},
"KSP_VERSION_MAX":{
"MAJOR":1,
"MINOR":4,
"MINOR":8,
"PATCH":9
}
}
Binary file modified GameData/Firespitter/Plugins/Firespitter.dll
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{
{
"NAME": "RetractableLiftingSurface",
"URL": "http://ksp-avc.cybutek.net/version.php?id=332",
"URL": "http://ksp.spacetux.net/avc/RetractableLiftingSurface",
"DOWNLOAD": "https://github.com/linuxgurugamer/RetractableLiftingSurface",
"GITHUB" :
{
"USERNAME" : "linuxgurugamer",
"REPOSITORY" : "RetractableLiftingSurface"
"GITHUB": {
"USERNAME": "linuxgurugamer",
"REPOSITORY": "RetractableLiftingSurface"
},
"VERSION": {
"MAJOR": 0,
"MINOR": 1,
"PATCH": 5,
"BUILD": 1
"MINOR": 2,
"PATCH": 0,
"BUILD": 0
},
"KSP_VERSION": {
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 4,
"PATCH": 1
"MINOR": 8,
"PATCH": 0
}
}
Binary file removed GameData/SXT/MiniAVC.dll.pruned
Binary file not shown.
6 changes: 0 additions & 6 deletions GameData/SXT/MiniAVC.xml

This file was deleted.

2 changes: 1 addition & 1 deletion ModuleBounce/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

using System.Reflection;

[assembly: AssemblyVersion("0.3.26.0")]
[assembly: AssemblyVersion("0.3.29.0")]
8 changes: 6 additions & 2 deletions ModuleBounce/AssemblyVersion.tt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
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 complete path to the .version file
// Update the following with the name of the .version file which is in the root directory
//
string versionfile = @"D:\Users\jbb\github\SXTContinued\SXTContinued.version";
string versionfile = RootDirectory + "SXTContinued.version";

if (!File.Exists(versionfile))
{
Expand Down
94 changes: 94 additions & 0 deletions ModuleBounce/InstallChecker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* 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 ModuleBounce
{
[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 = "SXT";
private const string FOLDERNAME = "SXT";
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())
{
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
);

}

//// 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);

}
}
}
}
19 changes: 9 additions & 10 deletions ModuleBounce/ModuleBounce.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ModuleBounce</RootNamespace>
<AssemblyName>ModuleBounce</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand All @@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -28,28 +29,26 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyVersion.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AssemblyVersion.tt</DependentUpon>
</Compile>
<Compile Include="InstallChecker.cs" />
<Compile Include="ModuleBounce.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\Assembly*.dll">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="UnityEngine">
<HintPath>R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>R:\KSP_1.6.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\UnityEngine*.dll">
<Private>False</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Content Include="AssemblyVersion.tt">
Expand Down
86 changes: 86 additions & 0 deletions ModuleBounce/ModuleBounce.csproj.173
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{260333F5-A76F-4FD2-BB95-406209AF2F43}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ModuleBounce</RootNamespace>
<AssemblyName>ModuleBounce</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyVersion.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AssemblyVersion.tt</DependentUpon>
</Compile>
<Compile Include="ModuleBounce.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="UnityEngine">
<HintPath>R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>R:\KSP_1.7.3_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="AssemblyVersion.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>AssemblyVersion.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
start /D D:\Users\jbb\github\SXTContinued /WAIT deploy.bat $(TargetDir) $(TargetFileName)

if $(ConfigurationName) == Release (
start /D D:\Users\jbb\github\SXTContinued /WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
set textTemplatingPath="%25ProgramFiles(x86)%25\Microsoft Visual Studio\2017\Community\Common7\IDE\texttransform.exe"

%25textTemplatingPath%25 "$(ProjectDir)AssemblyVersion.tt"
</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading

0 comments on commit 28d2ce7

Please sign in to comment.