From ef540f480f4d22e9585936320e40c71dc368aaae Mon Sep 17 00:00:00 2001 From: "Nuno \"Omega Leo\" Diogo" Date: Sat, 4 May 2024 18:27:22 +0100 Subject: [PATCH 1/3] Create dotnet.yml --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..217f7cb --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal -- 2.52.0 From eabfbae92d460cf034af6847208b7aef3a9d1a49 Mon Sep 17 00:00:00 2001 From: "Nuno \"Omega Leo\" Diogo" Date: Wed, 3 Jul 2024 17:24:23 +0100 Subject: [PATCH 2/3] Fixed dependency --- OmegaLeo.HelperLib/Extensions/ArrayExtensions.cs | 2 +- OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OmegaLeo.HelperLib/Extensions/ArrayExtensions.cs b/OmegaLeo.HelperLib/Extensions/ArrayExtensions.cs index 00ad8a4..fc4a942 100644 --- a/OmegaLeo.HelperLib/Extensions/ArrayExtensions.cs +++ b/OmegaLeo.HelperLib/Extensions/ArrayExtensions.cs @@ -1,4 +1,4 @@ -using UnityFlow.DocumentationHelper.Library.Attributes; +using NetFlow.DocumentationHelper.Library.Attributes; namespace GameDevLibrary.Extensions { diff --git a/OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj b/OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj index 1e91962..cd876f5 100644 --- a/OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj +++ b/OmegaLeo.HelperLib/OmegaLeo.HelperLib.csproj @@ -7,10 +7,12 @@ 0.0.2 Omega Leo's Helper Library Nuno "Omega Leo" Diogo + https://github.com/omegaleo/HelperLib + https://github.com/omegaleo/HelperLib - + -- 2.52.0 From e6b57bb346f6a0aa1f186f761d250e60191d95ff Mon Sep 17 00:00:00 2001 From: "Nuno \"Omega Leo\" Diogo" Date: Wed, 3 Jul 2024 21:56:33 +0100 Subject: [PATCH 3/3] Updates to NeoDictionary --- OmegaLeo.HelperLib/Models/NeoDictionary.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/OmegaLeo.HelperLib/Models/NeoDictionary.cs b/OmegaLeo.HelperLib/Models/NeoDictionary.cs index af3ba14..12861fb 100644 --- a/OmegaLeo.HelperLib/Models/NeoDictionary.cs +++ b/OmegaLeo.HelperLib/Models/NeoDictionary.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using NetFlow.DocumentationHelper.Library.Attributes; namespace GameDevLibrary.Models { // Inspiration: https://www.youtube.com/watch?v=x-ejym1WdjE [Serializable] + [Documentation("NeoDictionary", "Dictionary like class created to make it easier to display dictionaries in game engines like Unity")] public class NeoDictionary { public List> Items = new List>(); @@ -66,6 +68,28 @@ namespace GameDevLibrary.Models public bool Any() => Items.Any(); public bool Any(Func, bool> predicate) => Items.Any(predicate); + + public IEnumerable> Where(Func, bool> predicate) => + Items.Where(predicate); + + public NeoDictionaryItem? FirstOrDefault() => Items.FirstOrDefault(); + + public NeoDictionaryItem? FirstOrDefault(Func, bool> predicate) => + Items.FirstOrDefault(predicate); + + public NeoDictionaryItem? LastOrDefault() => Items.LastOrDefault(); + + public NeoDictionaryItem? LastOrDefault(Func, bool> predicate) => + Items.LastOrDefault(predicate); + + public void Remove(TKey key) + { + var index = Items.FindIndex(x => x.Key.Equals(key)); + + Items.RemoveAt(index); + } + + public void RemoveAt(int index) => Items.RemoveAt(index); } [Serializable] -- 2.52.0