Skip to content

Commit

Permalink
Added project files
Browse files Browse the repository at this point in the history
  • Loading branch information
Auros committed Oct 26, 2021
1 parent 3b7b756 commit 43efeef
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 0 deletions.
25 changes: 25 additions & 0 deletions SiraUtil Examples.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31815.197
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FailOnSaberClash", "[1] FailOnSaberClash\[1] FailOnSaberClash.csproj", "{25F997F4-845A-4716-9E53-584F630BD1D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25F997F4-845A-4716-9E53-584F630BD1D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25F997F4-845A-4716-9E53-584F630BD1D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25F997F4-845A-4716-9E53-584F630BD1D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25F997F4-845A-4716-9E53-584F630BD1D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B60B8918-8D73-4B77-AE5A-FF5A041456A9}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions [1] FailOnSaberClash/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file contains project properties used by the build. -->
<Project>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<DisableCopyToPlugins>true</DisableCopyToPlugins>
<DisableZipRelease>true</DisableZipRelease>
</PropertyGroup>
<PropertyGroup Condition="'$(NCrunch)' == '1'">
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
<DisableCopyToPlugins>true</DisableCopyToPlugins>
<DisableZipRelease>true</DisableZipRelease>
</PropertyGroup>
</Project>
102 changes: 102 additions & 0 deletions [1] FailOnSaberClash/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file contains the build tasks and targets for verifying the manifest, zipping Release builds,
and copying the plugin to to your Beat Saber folder. Only edit this if you know what you are doing. -->
<Project>
<PropertyGroup>
<BuildTargetsVersion>2.0</BuildTargetsVersion>
<!--Set this to true if you edit this file to prevent automatic updates-->
<BuildTargetsModified>false</BuildTargetsModified>
<!--Output assembly path without extension-->
<OutputAssemblyName>$(OutputPath)$(AssemblyName)</OutputAssemblyName>
<!--Path to folder to be zipped. Needs to be relative to the project directory to work without changes to the 'BuildForCI' target.-->
<ArtifactDestination>$(OutputPath)Final</ArtifactDestination>
<ErrorOnMismatchedVersions Condition="'$(Configuration)' == 'Release'">True</ErrorOnMismatchedVersions>
</PropertyGroup>
<!--Build Targets-->
<!--Displays a warning if BeatSaberModdingTools.Tasks is not installed.-->
<Target Name="CheckBSMTInstalled" AfterTargets="BeforeBuild" Condition="'$(BSMTTaskAssembly)' == ''">
<Warning Text="The BeatSaberModdingTools.Tasks nuget package doesn't seem to be installed, advanced build targets will not work." />
</Target>
<!--Runs a build task to get info about the project used by later targets.-->
<Target Name="GetProjectInfo" AfterTargets="CheckBSMTInstalled" DependsOnTargets="CheckBSMTInstalled" Condition="'$(BSMTTaskAssembly)' != ''">
<Message Text="Using AssemblyVersion defined in project instead of 'Properties\AssemblyInfo.cs'" Importance="high" Condition="'$(AssemblyVersion)' != ''" />
<GetManifestInfo FailOnError="$(ErrorOnMismatchedVersions)">
<Output TaskParameter="PluginVersion" PropertyName="PluginVersion" />
<Output TaskParameter="BasePluginVersion" PropertyName="BasePluginVersion" />
<Output TaskParameter="GameVersion" PropertyName="GameVersion" />
</GetManifestInfo>
<PropertyGroup>
<AssemblyVersion>$(BasePluginVersion)</AssemblyVersion>
<FileVersion>$(BasePluginVersion)</FileVersion>
<InformationalVersion>$(BasePluginVersion)</InformationalVersion>
</PropertyGroup>
<GetCommitInfo ProjectDir="$(ProjectDir)">
<Output TaskParameter="CommitHash" PropertyName="CommitHash" />
<Output TaskParameter="Branch" PropertyName="Branch" />
<Output TaskParameter="Modified" PropertyName="GitModified" />
</GetCommitInfo>
<PropertyGroup>
<!--Build name for artifact/zip file-->
<ArtifactName>$(AssemblyName)_[</ArtifactName>
<ArtifactName Condition="'$(PluginVersion)' != ''">$(ArtifactName)v$(PluginVersion)</ArtifactName>
<ArtifactName Condition="'$(GameVersion)' != ''">$(ArtifactName)-g$(GameVersion)</ArtifactName>
<ArtifactName Condition="'$(CommitHash)' != '' AND '$(CommitHash)' != 'local'">$(ArtifactName)-$(CommitHash)</ArtifactName>
<ArtifactName>$(ArtifactName)]</ArtifactName>
</PropertyGroup>
</Target>
<!--Build target for Continuous Integration builds. Set up for GitHub Actions.-->
<Target Name="BuildForCI" AfterTargets="Build" DependsOnTargets="GetProjectInfo" Condition="'$(ContinuousIntegrationBuild)' == 'True' AND '$(BSMTTaskAssembly)' != ''">
<PropertyGroup>
<!--Set 'ArtifactName' if it failed before.-->
<ArtifactName Condition="'$(ArtifactName)' == ''">$(AssemblyName)</ArtifactName>
</PropertyGroup>
<Message Text="Building for CI" Importance="high" />
<Message Text="PluginVersion: $(PluginVersion), AssemblyVersion: $(AssemblyVersion), GameVersion: $(GameVersion)" Importance="high" />
<Message Text="::set-output name=filename::$(ArtifactName)" Importance="high" />
<Message Text="::set-output name=assemblyname::$(AssemblyName)" Importance="high" />
<Message Text="::set-output name=artifactpath::$(ProjectDir)$(ArtifactDestination)" Importance="high" />
<Message Text="Copying '$(OutputAssemblyName).dll' to '$(ProjectDir)$(ArtifactDestination)\Plugins\$(AssemblyName).dll'" Importance="high" />
<Copy SourceFiles="$(OutputAssemblyName).dll" DestinationFiles="$(ProjectDir)$(ArtifactDestination)\Plugins\$(AssemblyName).dll" />
</Target>
<!--Creates a BeatMods compliant zip file with the release.-->
<Target Name="ZipRelease" AfterTargets="Build" Condition="'$(DisableZipRelease)' != 'True' AND '$(Configuration)' == 'Release' AND '$(BSMTTaskAssembly)' != ''">
<PropertyGroup>
<!--Set 'ArtifactName' if it failed before.-->
<ArtifactName Condition="'$(ArtifactName)' == ''">$(AssemblyName)</ArtifactName>
<DestinationDirectory>$(OutDir)zip\</DestinationDirectory>
</PropertyGroup>
<ItemGroup>
<OldZips Include="$(DestinationDirectory)$(AssemblyName)*.zip"/>
</ItemGroup>
<Copy SourceFiles="$(OutputAssemblyName).dll" DestinationFiles="$(ArtifactDestination)\Plugins\$(AssemblyName).dll" />
<Message Text="PluginVersion: $(PluginVersion), GameVersion: $(GameVersion)" Importance="high" />
<Delete Files="@(OldZips)" TreatErrorsAsWarnings="true" ContinueOnError="true" />
<ZipDir SourceDirectory="$(ArtifactDestination)" DestinationFile="$(DestinationDirectory)$(ArtifactName).zip" />
</Target>
<!--Copies the assembly and pdb to the Beat Saber folder.-->
<Target Name="CopyToPlugins" AfterTargets="Build" Condition="'$(DisableCopyToPlugins)' != 'True' AND '$(ContinuousIntegrationBuild)' != 'True'">
<PropertyGroup>
<PluginDir>$(BeatSaberDir)\Plugins</PluginDir>
<CanCopyToPlugins>True</CanCopyToPlugins>
<CopyToPluginsError Condition="!Exists('$(PluginDir)')">Unable to copy assembly to game folder, did you set 'BeatSaberDir' correctly in your 'csproj.user' file? Plugins folder doesn't exist: '$(PluginDir)'.</CopyToPluginsError>
<!--Error if 'BeatSaberDir' does not have 'Beat Saber.exe'-->
<CopyToPluginsError Condition="!Exists('$(BeatSaberDir)\Beat Saber.exe')">Unable to copy to Plugins folder, '$(BeatSaberDir)' does not appear to be a Beat Saber game install.</CopyToPluginsError>
<!--Error if 'BeatSaberDir' is the same as 'LocalRefsDir'-->
<CopyToPluginsError Condition="'$(BeatSaberDir)' == '$(LocalRefsDir)' OR '$(BeatSaberDir)' == ''">Unable to copy to Plugins folder, 'BeatSaberDir' has not been set in your 'csproj.user' file.</CopyToPluginsError>
<CanCopyToPlugins Condition="'$(CopyToPluginsError)' != ''">False</CanCopyToPlugins>
</PropertyGroup>
<!--Check if Beat Saber is running-->
<IsProcessRunning ProcessName="Beat Saber" Condition="'$(BSMTTaskAssembly)' != ''">
<Output TaskParameter="IsRunning" PropertyName="IsRunning" />
</IsProcessRunning>
<PropertyGroup>
<!--If Beat Saber is running, output to the Pending folder-->
<PluginDir Condition="'$(IsRunning)' == 'True'">$(BeatSaberDir)\IPA\Pending\Plugins</PluginDir>
</PropertyGroup>
<Warning Text="$(CopyToPluginsError)" Condition="'$(CopyToPluginsError)' != ''" />
<Message Text="Copying '$(OutputAssemblyName).dll' to '$(PluginDir)'." Importance="high" Condition="$(CanCopyToPlugins)" />
<Copy SourceFiles="$(OutputAssemblyName).dll" DestinationFiles="$(PluginDir)\$(AssemblyName).dll" Condition="$(CanCopyToPlugins)" />
<Copy SourceFiles="$(OutputAssemblyName).pdb" DestinationFiles="$(PluginDir)\$(AssemblyName).pdb" Condition="'$(CanCopyToPlugins)' == 'True' AND Exists('$(OutputAssemblyName).pdb')" />
<Warning Text="Beat Saber is running, restart the game to use the latest build." Condition="'$(IsRunning)' == 'True'" />
</Target>
</Project>
12 changes: 12 additions & 0 deletions [1] FailOnSaberClash/Installers/FailOnSaberClashCoreInstaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Zenject;

namespace FailOnSaberClash.Installers
{
internal class FailOnSaberClashCoreInstaller : Installer
{
public override void InstallBindings()
{

}
}
}
18 changes: 18 additions & 0 deletions [1] FailOnSaberClash/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using FailOnSaberClash.Installers;
using IPA;
using SiraUtil.Zenject;
using IPALogger = IPA.Logging.Logger;

namespace FailOnSaberClash
{
[Plugin(RuntimeOptions.DynamicInit)]
public class Plugin
{
[Init]
public Plugin(IPALogger logger, Zenjector zenjector)
{
zenjector.UseLogger(logger);
zenjector.Install<FailOnSaberClashCoreInstaller>(Location.App);
}
}
}
155 changes: 155 additions & 0 deletions [1] FailOnSaberClash/[1] FailOnSaberClash.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<LangVersion>8</LangVersion>
<Nullable>disable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LocalRefsDir Condition="Exists('..\Refs')">..\Refs</LocalRefsDir>
<BeatSaberDir>$(LocalRefsDir)</BeatSaberDir>
<AppOutputBase>$(MSBuildProjectDirectory)\</AppOutputBase>
<Copyright>Copyright © SIRA 2021</Copyright>
<AssemblyName>FailOnSaberClash</AssemblyName>
<RootNamespace>FailOnSaberClash</RootNamespace>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DebugType>full</DebugType>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DebugType>pdbonly</DebugType>
</PropertyGroup>

<PropertyGroup Condition="$(DefineConstants.Contains('CIBuild')) OR '$(NCrunch)' == '1'">
<DisableCopyToPlugins>True</DisableCopyToPlugins>
</PropertyGroup>

<PropertyGroup Condition="'$(NCrunch)' == '1'">
<DisableCopyToPlugins>True</DisableCopyToPlugins>
<DisableZipRelease>True</DisableZipRelease>
</PropertyGroup>

<ItemGroup>
<Reference Include="Core">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GameplayCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\GameplayCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="HMRendering">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMRendering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MediaLoader">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\MediaLoader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Rendering">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Rendering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Hive.Versioning">
<HintPath>$(BeatSaberDir)\Libs\Hive.Versioning.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(BeatSaberDir)\Libs\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="SiraUtil">
<HintPath>$(BeatSaberDir)\Plugins\SiraUtil.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.VRModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.VRModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Main">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="HMLib">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="HMUI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="IPA.Loader">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VRUI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\VRUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Zenject">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Zenject.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Zenject-usage">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Zenject-usage.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="manifest.json" />
</ItemGroup>

<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
</ItemGroup>

<ItemGroup>
<None Include="FailOnSaberClash.csproj.user" Condition="Exists('FailOnSaberClash.csproj.user')" Visible="false" />
<None Include="Directory.Build.props" Condition="Exists('Directory.Build.props')" Visible="false" />
<None Include="Directory.Build.targets" Condition="Exists('Directory.Build.targets')" Visible="false" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BeatSaberModdingTools.Tasks" Version="1.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions [1] FailOnSaberClash/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/bsmg/BSIPA-MetadataFileSchema/master/Schema.json",
"id": "FailOnSaberClash",
"name": "FailOnSaberClash",
"author": "auros",
"version": "3.0.0",
"description": "",
"gameVersion": "1.18.1",
"dependsOn": {
"BSIPA": "^4.2.0"
}
}

0 comments on commit 43efeef

Please sign in to comment.