Revert "Update to 3.5.6 and for components"

This reverts commit 278f2ff0ea.
This commit is contained in:
MusicManiac
2023-05-26 21:37:34 +02:00
parent 278f2ff0ea
commit d664db95ff
9 changed files with 158 additions and 478 deletions

View File

@@ -7,12 +7,11 @@
<ProjectGuid>{967E5737-8917-4C2B-A0A4-B2B553498462}</ProjectGuid> <ProjectGuid>{967E5737-8917-4C2B-A0A4-B2B553498462}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>dvize.ASS</RootNamespace> <RootNamespace>armorMod.ASS</RootNamespace>
<AssemblyName>dvize.ASS</AssemblyName> <AssemblyName>armorMod.ASS</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -87,40 +86,13 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath> <HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ArmorRegenComponent.cs" />
<Compile Include="Plugin.cs" /> <Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="VersionChecker\TarkovVersion.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="VersionChecker\setbuild.ps1" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "F:\SPT-AKI\BepInEx\plugins\dvize.ASS.dll"</PostBuildEvent> <PostBuildEvent>copy "$(TargetPath)" "F:\SPT-AKI\BepInEx\plugins\dvize.ASS.dll"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
</Project> </Project>

View File

@@ -1,186 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BepInEx.Logging;
using Comfort.Common;
using EFT;
using EFT.InventoryLogic;
using HarmonyLib;
using UnityEngine;
namespace ASS
{
internal class ArmorRegenComponent : MonoBehaviour
{
private static float newRepairRate;
private static ArmorComponent armor;
private static float timeSinceLastHit = 0f;
private static Player player;
private static Slot slotContents;
private static bool isRegenerating = false;
private static InventoryControllerClass inventoryController;
private readonly Dictionary<EquipmentSlot, List<Item>> equipmentSlotDictionary =
new Dictionary<EquipmentSlot, List<Item>>
{
{ EquipmentSlot.ArmorVest, new List<Item>() },
{ EquipmentSlot.TacticalVest, new List<Item>() },
{ EquipmentSlot.Eyewear, new List<Item>() },
{ EquipmentSlot.FaceCover, new List<Item>() },
{ EquipmentSlot.Headwear, new List<Item>() },
};
protected static ManualLogSource Logger
{
get; private set;
}
private ArmorRegenComponent()
{
if (Logger == null)
{
Logger = BepInEx.Logging.Logger.CreateLogSource(nameof(ArmorRegenComponent));
}
}
internal static void Enable()
{
if (Singleton<GameWorld>.Instantiated)
{
var gameWorld = Singleton<GameWorld>.Instance;
gameWorld.GetOrAddComponent<ArmorRegenComponent>();
Logger.LogDebug("ASS: Attaching events");
}
}
private void Start()
{
player = Singleton<GameWorld>.Instance.MainPlayer;
player.OnPlayerDeadOrUnspawn += Player_OnPlayerDeadOrUnspawn;
player.BeingHitAction += Player_BeingHitAction;
}
private void Update()
{
if (ASS.Plugin.ArmorServiceMode.Value)
{
timeSinceLastHit += Time.unscaledDeltaTime;
if (timeSinceLastHit >= Plugin.TimeDelayRepairInSec.Value)
{
if (!isRegenerating)
{
isRegenerating = true;
StartCoroutine(RepairArmor());
}
}
}
}
private IEnumerator RepairArmor()
{
//if the time since we were last hit exceeds TimeDelayRepairInSec.Value then repair all armor
while (isRegenerating && Plugin.ArmorServiceMode.Value)
{
//Logger.LogInfo($"Repairing Armor Block Reached Because TimeSinceLastHitReached: " + timeSinceLastHit);
//repair the armor divided by the time.unfixed rate
newRepairRate = Plugin.ArmorRepairRateOverTime.Value * Time.deltaTime;
foreach (EquipmentSlot slot in equipmentSlotDictionary.Keys.ToArray())
{
//Logger.LogInfo("ASS: Checking EquipmentSlot: " + slot);
Slot tempSlot = getEquipSlot(slot);
if (tempSlot == null || tempSlot.ContainedItem == null)
{
continue;
}
foreach (var item in tempSlot.ContainedItem.GetAllItems())
{
//get the armorcomponent of each item in items and check to see if all item componenets (even helmet side ears) are max durability
armor = item.GetItemComponent<ArmorComponent>();
//check if it needs repair for the current item in loop of all items for the slot
if (
armor != null
&& (armor.Repairable.Durability < armor.Repairable.MaxDurability)
)
{
//increase armor durability by newRepairRate until maximum then set as maximum durability
if (
armor.Repairable.Durability + newRepairRate
>= armor.Repairable.MaxDurability
)
{
armor.Repairable.Durability = armor.Repairable.MaxDurability;
//Logger.LogInfo("ASS: Setting MaxDurability for " + item.LocalizedName());
}
else
{
armor.Repairable.Durability += newRepairRate;
Logger.LogInfo("ASS: Repairing " + item.LocalizedName() + " : " + armor.Repairable.Durability + "/" + armor.Repairable.MaxDurability);
}
}
}
}
// Wait for the next frame before continuing
yield return null;
}
}
private void Player_BeingHitAction(DamageInfo arg1, EBodyPart arg2, float arg3)
{
timeSinceLastHit = 0f;
isRegenerating = false;
StopCoroutine(RepairArmor());
}
private void Player_OnPlayerDeadOrUnspawn(Player player)
{
Disable();
}
private void Disable()
{
if (player != null)
{
player.OnPlayerDeadOrUnspawn -= Player_OnPlayerDeadOrUnspawn;
player.BeingHitAction -= Player_BeingHitAction;
}
}
private Slot getEquipSlot(EquipmentSlot slot)
{
var player = Singleton<GameWorld>.Instance.MainPlayer;
// Use AccessTools to get the protected field _inventoryController
inventoryController = (InventoryControllerClass)
AccessTools.Field(typeof(Player), "_inventoryController").GetValue(player);
if (inventoryController != null)
{
slotContents = inventoryController.Inventory.Equipment.GetSlot(slot);
if (slotContents.ContainedItem == null)
{
return null;
}
return slotContents;
}
return null;
}
}
}

201
Plugin.cs
View File

@@ -1,75 +1,172 @@
using System; using System;
using System.Diagnostics; using System.Collections.Generic;
using System.Reflection; using System.Linq;
using Aki.Reflection.Patching; using System.Runtime.Remoting.Messaging;
using System.Threading.Tasks;
using BepInEx; using BepInEx;
using BepInEx.Configuration; using BepInEx.Configuration;
using Comfort.Common;
using EFT; using EFT;
using VersionChecker; using EFT.InventoryLogic;
using HarmonyLib;
using UnityEngine;
namespace ASS namespace armorMod
{ {
[BepInPlugin("com.dvize.ASS", "dvize.ASS", "1.1.0")] [BepInPlugin("com.armorMod.ASS", "armorMod.ASS", "1.0.0")]
public class Plugin : BaseUnityPlugin
public class ASS : BaseUnityPlugin
{ {
internal static ConfigEntry<Boolean> ArmorServiceMode { get; set; } private ConfigEntry<Boolean> ArmorServiceMode
internal static ConfigEntry<float> TimeDelayRepairInSec { get; set; } {
internal static ConfigEntry<float> ArmorRepairRateOverTime { get; set; } get; set;
}
private static ConfigEntry<float> TimeDelayRepairInSec
{
get; set;
}
private static ConfigEntry<float> ArmorRepairRateOverTime
{
get; set;
}
private AbstractGame game;
private bool runOnceAlready = false;
private bool newGame = true;
private float newRepairRate;
private ArmorComponent armor;
private static float timeSinceLastHit = 0f;
private readonly Dictionary<EquipmentSlot, List<Item>> equipmentSlotDictionary = new Dictionary<EquipmentSlot, List<Item>>
{
{ EquipmentSlot.ArmorVest, new List<Item>() },
{ EquipmentSlot.TacticalVest, new List<Item>() },
{ EquipmentSlot.Eyewear, new List<Item>() },
{ EquipmentSlot.FaceCover, new List<Item>() },
{ EquipmentSlot.Headwear, new List<Item>() }
};
internal void Awake() internal void Awake()
{ {
CheckEftVersion(); ArmorServiceMode = Config.Bind("Armor Repair Settings", "Enable/Disable Mod", true, "Enables the Armor Repairing Options Below");
TimeDelayRepairInSec = Config.Bind("Armor Repair Settings", "Time Delay Repair in Sec", 60f, "How Long Before you were last hit that it repairs armor");
ArmorRepairRateOverTime = Config.Bind("Armor Repair Settings", "Armor Repair Rate", 0.5f, "How much durability per second is repaired");
}
private void Update()
{
try
{
game = Singleton<AbstractGame>.Instance;
ArmorServiceMode = Config.Bind( if (game.InRaid && Camera.main.transform.position != null && newGame && ArmorServiceMode.Value)
"Armor Repair Settings", {
"Enable/Disable Mod", var player = Singleton<GameWorld>.Instance.MainPlayer;
true, timeSinceLastHit += Time.deltaTime;
"Enables the Armor Repairing Options Below"
); if (!runOnceAlready && game.Status == GameStatus.Started)
TimeDelayRepairInSec = Config.Bind( {
"Armor Repair Settings", Logger.LogDebug("ASS: Attaching events");
"Time Delay Repair in Sec", player.BeingHitAction += Player_BeingHitAction;
60f, player.OnPlayerDeadOrUnspawn += Player_OnPlayerDeadOrUnspawn;
"How Long Before you were last hit that it repairs armor" runOnceAlready = true;
); }
ArmorRepairRateOverTime = Config.Bind(
"Armor Repair Settings", RepairArmor();
"Armor Repair Rate", }
0.5f, }
"How much durability per second is repaired" catch { }
);
} }
private void CheckEftVersion() private void RepairArmor()
{ {
// Make sure the version of EFT being run is the correct version //if the time since we were last hit exceeds TimeDelayRepairInSec.Value then repair all armor
int currentVersion = FileVersionInfo if (timeSinceLastHit >= TimeDelayRepairInSec.Value)
.GetVersionInfo(BepInEx.Paths.ExecutablePath)
.FilePrivatePart;
int buildVersion = TarkovVersion.BuildVersion;
if (currentVersion != buildVersion)
{ {
Logger.LogError( //Logger.LogInfo($"Repairing Armor Block Reached Because TimeSinceLastHitReached: " + timeSinceLastHit);
$"ERROR: This version of {Info.Metadata.Name} v{Info.Metadata.Version} was built for Tarkov {buildVersion}, but you are running {currentVersion}. Please download the correct plugin version." //repair the armor divided by the time.unfixed rate
); newRepairRate = ArmorRepairRateOverTime.Value * Time.deltaTime;
EFT.UI.ConsoleScreen.LogError(
$"ERROR: This version of {Info.Metadata.Name} v{Info.Metadata.Version} was built for Tarkov {buildVersion}, but you are running {currentVersion}. Please download the correct plugin version." foreach (EquipmentSlot slot in equipmentSlotDictionary.Keys.ToArray())
); {
throw new Exception($"Invalid EFT Version ({currentVersion} != {buildVersion})"); Logger.LogInfo("ASS: Checking EquipmentSlot: " + slot);
Slot tempSlot = getEquipSlot(slot);
if (tempSlot == null || tempSlot.ContainedItem == null)
{
continue;
}
foreach (var item in tempSlot.ContainedItem.GetAllItems())
{
//get the armorcomponent of each item in items and check to see if all item componenets (even helmet side ears) are max durability
armor = item.GetItemComponent<ArmorComponent>();
//check if it needs repair for the current item in loop of all items for the slot
if (armor != null && (armor.Repairable.Durability < armor.Repairable.MaxDurability))
{
//increase armor durability by newRepairRate until maximum then set as maximum durability
if (armor.Repairable.Durability + newRepairRate >= armor.Repairable.MaxDurability)
{
armor.Repairable.Durability = armor.Repairable.MaxDurability;
//Logger.LogInfo("ASS: Setting MaxDurability for " + item.LocalizedName());
}
else
{
armor.Repairable.Durability += newRepairRate;
//Logger.LogInfo("ASS: Repairing " + item.LocalizedName() + " : " + armor.Repairable.Durability + "/" + armor.Repairable.MaxDurability);
}
}
}
}
} }
} }
}
//re-initializes each new game private void Player_BeingHitAction(DamageInfo dmgInfo, EBodyPart bodyPart, float hitEffectId) => timeSinceLastHit = 0f;
internal class NewGamePatch : ModulePatch
{
protected override MethodBase GetTargetMethod() =>
typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
[PatchPrefix] private void Player_OnPlayerDeadOrUnspawn(Player player)
public static void PatchPrefix()
{ {
ASS.ArmorRegenComponent.Enable(); Logger.LogDebug("ASS: Undo all events");
player.BeingHitAction -= Player_BeingHitAction;
player.OnPlayerDeadOrUnspawn -= Player_OnPlayerDeadOrUnspawn;
runOnceAlready = false;
newGame = false;
Task.Delay(TimeSpan.FromSeconds(15)).ContinueWith(_ =>
{
// Set newGame = true after the timer is finished so it doesn't execute the events right away
newGame = true;
});
} }
private Slot slotContents;
private InventoryControllerClass inventoryController;
private Slot getEquipSlot(EquipmentSlot slot)
{
var player = Singleton<GameWorld>.Instance.MainPlayer;
// Use AccessTools to get the protected field _inventoryController
inventoryController = (InventoryControllerClass)AccessTools.Field(typeof(Player), "_inventoryController").GetValue(player);
if (inventoryController != null)
{
slotContents = inventoryController.Inventory.Equipment.GetSlot(slot);
if (slotContents.ContainedItem == null)
{
return null;
}
return slotContents;
}
return null;
}
} }
} }

View File

@@ -1,16 +1,15 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using VersionChecker;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("dvize.ASS")] [assembly: AssemblyTitle("armorMod.ASS")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("dvize.ASS")] [assembly: AssemblyProduct("armorMod.ASS")]
[assembly: AssemblyCopyright("Copyright <EFBFBD> 2023")] [assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -32,6 +31,5 @@ using VersionChecker;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TarkovVersion(23043)]

View File

@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace dvize.ASS.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -1,6 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

View File

@@ -1,146 +0,0 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx;
using static EFT.ScenesPreset;
using UnityEngine;
namespace VersionChecker
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class TarkovVersion : Attribute
{
private int version;
public TarkovVersion()
: this(0) { }
public TarkovVersion(int version)
{
this.version = version;
}
public static int BuildVersion
{
get
{
return Assembly
.GetExecutingAssembly()
.GetCustomAttributes(typeof(TarkovVersion), false)
?.Cast<TarkovVersion>()
?.FirstOrDefault()
?.version ?? 0;
}
}
// Make sure the version of EFT being run is the correct version, throw an exception and output log message if it isn't
/// <summary>
/// Check the currently running program's version against the plugin assembly TarkovVersion attribute, and
/// return false if they do not match.
/// Optionally add a fake setting to the F12 menu if Config is passed in
/// </summary>
/// <param name="Logger">The ManualLogSource to output an error to</param>
/// <param name="Info">The PluginInfo object for the plugin, used to get the plugin name and version</param>
/// <param name="Config">A BepinEx ConfigFile object, if provided, a custom message will be added to the F12 menu</param>
/// <returns></returns>
public static bool CheckEftVersion(
ManualLogSource Logger,
PluginInfo Info,
ConfigFile Config = null
)
{
int currentVersion = FileVersionInfo
.GetVersionInfo(BepInEx.Paths.ExecutablePath)
.FilePrivatePart;
int buildVersion = BuildVersion;
if (currentVersion != buildVersion)
{
string errorMessage =
$"ERROR: This version of {Info.Metadata.Name} v{Info.Metadata.Version} was built for Tarkov {buildVersion}, but you are running {currentVersion}. Please download the correct plugin version.";
Logger.LogError(errorMessage);
if (Config != null)
{
// This results in a bogus config entry in the BepInEx config file for the plugin, but it shouldn't hurt anything
// We leave the "section" parameter empty so there's no section header drawn
Config.Bind(
"",
"TarkovVersion",
"",
new ConfigDescription(
errorMessage,
null,
new ConfigurationManagerAttributes
{
CustomDrawer = ErrorLabelDrawer,
ReadOnly = true,
HideDefaultButton = true,
HideSettingName = true,
Category = null
}
)
);
}
return false;
}
return true;
}
static void ErrorLabelDrawer(ConfigEntryBase entry)
{
GUIStyle styleNormal = new GUIStyle(GUI.skin.label);
styleNormal.wordWrap = true;
styleNormal.stretchWidth = true;
GUIStyle styleError = new GUIStyle(GUI.skin.label);
styleError.stretchWidth = true;
styleError.alignment = TextAnchor.MiddleCenter;
styleError.normal.textColor = Color.red;
styleError.fontStyle = FontStyle.Bold;
// General notice that we're the wrong version
GUILayout.BeginVertical();
GUILayout.Label(
entry.Description.Description,
styleNormal,
new GUILayoutOption[] { GUILayout.ExpandWidth(true) }
);
// Centered red disabled text
GUILayout.Label(
"Plugin has been disabled!",
styleError,
new GUILayoutOption[] { GUILayout.ExpandWidth(true) }
);
GUILayout.EndVertical();
}
#pragma warning disable 0169, 0414, 0649
internal sealed class ConfigurationManagerAttributes
{
public bool? ShowRangeAsPercent;
public System.Action<BepInEx.Configuration.ConfigEntryBase> CustomDrawer;
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
public delegate void CustomHotkeyDrawerFunc(
BepInEx.Configuration.ConfigEntryBase setting,
ref bool isCurrentlyAcceptingInput
);
public bool? Browsable;
public string Category;
public object DefaultValue;
public bool? HideDefaultButton;
public bool? HideSettingName;
public string Description;
public string DispName;
public int? Order;
public bool? ReadOnly;
public bool? IsAdvanced;
public System.Func<object, string> ObjToStr;
public System.Func<string, object> StrToObj;
}
}
}

View File

@@ -1,20 +0,0 @@
# Fetch the version from EscapeFromTarkov.exe
$tarkovPath = 'F:\SPT-AKI\EscapeFromTarkov.exe'
$tarkovVersion = (Get-Item -Path $tarkovPath).VersionInfo.FileVersionRaw.Revision
Write-Host "Current version of EscapeFromTarkov.exe is: $tarkovVersion"
# Update AssemblyVersion
$assemblyPath = '{0}\..\Properties\AssemblyInfo.cs' -f $PSScriptRoot
$versionPattern = '^\[assembly: TarkovVersion\(.*\)\]'
(Get-Content $assemblyPath) | ForEach-Object {
if ($_ -match $versionPattern){
$versionType = $matches[1]
$newLine = '[assembly: TarkovVersion({0})]' -f $tarkovVersion
Write-Host "Changed the line from '$_' to '$newLine'"
$newLine
} else {
$_
}
} | Set-Content $assemblyPath
Write-Host "AssemblyInfo.cs updated successfully!"

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>