Skip to content

Commit 9a480db

Browse files
authored
Merge pull request #36 from exomia/development
workflow & readme changed
2 parents abf26f4 + 2647d8c commit 9a480db

File tree

17 files changed

+355
-173
lines changed

17 files changed

+355
-173
lines changed

.github/workflows/build_and_test.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,44 @@ on:
77
branches:
88
- master
99
- development
10+
env:
11+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
12+
DOTNET_NOLOGO: 1
13+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
1014
jobs:
11-
build:
12-
name: build release and debug
15+
build-windows:
16+
name: build release and debug for windows
1317
runs-on: windows-latest
1418
steps:
1519
- uses: actions/checkout@v2
1620
- uses: actions/setup-dotnet@v1
1721
with:
1822
dotnet-version: 3.1.300
1923
- name: build debug
20-
env:
21-
DOTNET_NOLOGO: 1
22-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2324
run: |
2425
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=AnyCPU
2526
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x86
2627
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x64
2728
- name: build release
28-
env:
29-
DOTNET_NOLOGO: 1
30-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
3129
run: |
3230
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=AnyCPU
3331
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x86
3432
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x64
35-
test:
36-
name: test release and debug
37-
needs: [build]
33+
test-windows:
34+
name: test release and debug for windows
35+
needs: [build-windows]
3836
runs-on: windows-latest
3937
steps:
4038
- uses: actions/checkout@v2
4139
- uses: actions/setup-dotnet@v1
4240
with:
4341
dotnet-version: 3.1.300
4442
- name: test debug
45-
env:
46-
DOTNET_NOLOGO: 1
47-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
4843
run: |
4944
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=AnyCPU
5045
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x86
5146
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x64
5247
- name: test release
53-
env:
54-
DOTNET_NOLOGO: 1
55-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5648
run: |
5749
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=AnyCPU
5850
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x86

.github/workflows/build_test_and_publish.yml

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,91 @@ name: build, test & publish
22
on:
33
release:
44
types: [published]
5+
env:
6+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
7+
DOTNET_NOLOGO: 1
8+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
59
jobs:
6-
build:
7-
name: build release and debug
10+
build-windows:
11+
name: build release and debug for windows
812
runs-on: windows-latest
913
steps:
1014
- uses: actions/checkout@v2
1115
- uses: actions/setup-dotnet@v1
1216
with:
1317
dotnet-version: 3.1.300
1418
- name: build debug
15-
env:
16-
DOTNET_NOLOGO: 1
17-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
1819
run: |
1920
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=AnyCPU
2021
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x86
2122
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x64
2223
- name: build release
23-
env:
24-
DOTNET_NOLOGO: 1
25-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2624
run: |
2725
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=AnyCPU
2826
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x86
2927
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x64
30-
test:
31-
name: test release and debug
32-
needs: [build]
28+
test-windows:
29+
name: test release and debug for windows
30+
needs: [build-windows]
3331
runs-on: windows-latest
3432
steps:
3533
- uses: actions/checkout@v2
3634
- uses: actions/setup-dotnet@v1
3735
with:
3836
dotnet-version: 3.1.300
3937
- name: test debug
40-
env:
41-
DOTNET_NOLOGO: 1
42-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
4338
run: |
4439
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=AnyCPU
4540
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x86
4641
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x64
4742
- name: test release
48-
env:
49-
DOTNET_NOLOGO: 1
50-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5143
run: |
5244
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=AnyCPU
5345
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x86
5446
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x64
55-
publish:
56-
name: publish release or debug
57-
needs: [test]
47+
publish-github-windows:
48+
name: publish debug for windows on github
49+
needs: [test-windows]
5850
if: ${{ github.event_name == 'release' }}
5951
runs-on: windows-latest
6052
steps:
6153
- uses: actions/checkout@v2
62-
- name: extract tag version & release or debug
54+
- name: extract tag version
55+
run: echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
56+
shell: bash
57+
- uses: actions/setup-dotnet@v1
58+
with:
59+
dotnet-version: 3.1.301
60+
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }}]
6361
run: |
64-
echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
65-
grep -q '-' <<< ${GITHUB_REF#refs/tags/v*} && echo ::set-env name=TAG_CONFIGURATION::Debug || echo ::set-env name=TAG_CONFIGURATION::Release
62+
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
63+
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
64+
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
65+
for f in ./*.nupkg
66+
do
67+
STATUSCODE=$(curl -sSX PUT --retry 3 -o /dev/null -w "%{http_code}" -u "${{ github.repository_owner }}:${{ github.token }}" -F package=@$f https://nuget.pkg.github.com/${{ github.repository_owner }}/)
68+
echo "[$STATUSCODE:https://nuget.pkg.github.com/${{ github.repository_owner }}/] $f"
69+
if [ "${STATUSCODE}" != 200 ] && [ "${STATUSCODE}" != 409 ]; then exit 1; fi
70+
done
71+
shell: bash
72+
working-directory: src/Exomia.Framework
73+
publish-nuget-windows:
74+
name: publish release for windows on nuget
75+
needs: [test-windows, publish-github-windows]
76+
if: ${{ github.event_name == 'release' }}
77+
runs-on: windows-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
- name: extract tag version
81+
run: echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
6682
shell: bash
6783
- uses: actions/setup-dotnet@v1
6884
with:
69-
dotnet-version: 3.1.300
70-
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }} | ${{ env.TAG_CONFIGURATION }}]
71-
env:
72-
DOTNET_NOLOGO: 1
73-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
85+
dotnet-version: 3.1.301
86+
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }}]
7487
run: |
75-
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
76-
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
77-
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
78-
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.EXOMIA_NUGET_API_KEY_PUSH }}
88+
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
89+
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
90+
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
91+
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.EXOMIA_NUGET_API_KEY_PUSH }} --skip-duplicate
7992
shell: bash

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ The exomia/framework is used for building 2D and 3D games and more inspired by t
1717
[Package Manager]
1818
PM> Install-Package Exomia.Framework
1919
```
20+
21+
## Templates
22+
23+
You are bored of typing boiler plate code to get things up and running?
24+
Take a look at our [exomia/templates](https://github.com/exomia/templates) repository!
25+
26+
---
27+
## Social
28+
29+
[![Discord](https://img.shields.io/discord/427640639732187136.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.com/invite/ZFJXe6f)
30+
[![Twitch](https://img.shields.io/twitch/status/exomia.svg?label=&logo=twitch&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://www.twitch.tv/exomia/about)

framework.wiki

src/Exomia.Framework/Collections/Heap.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,14 @@ public sealed class Heap<T>
3333
private int _size;
3434

3535
/// <summary>
36-
/// Gets the number of items in the heap.
36+
/// Gets the number of items in the heap.
3737
/// </summary>
3838
/// <value>
3939
/// The count.
4040
/// </value>
4141
public int Count
4242
{
43-
get
44-
{
45-
return _size;
46-
}
43+
get { return _size; }
4744
}
4845

4946
/// <summary>

src/Exomia.Framework/Content/ContentManager.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public object Load(Type assetType, string assetName, bool fromEmbeddedResource =
235235
}
236236

237237
AssetKey assetKey = new AssetKey(assetType, assetName);
238-
lock (GetAssetLocker(assetKey, true))
238+
lock (GetAssetLocker(assetKey, true)!)
239239
{
240240
if (_loadedAssets.TryGetValue(assetKey, out object result))
241241
{
@@ -257,12 +257,24 @@ public object Load(Type assetType, string assetName, bool fromEmbeddedResource =
257257
}
258258
}
259259

260+
/// <inheritdoc />
261+
public object Load(Type assetType, FileInfo assetFileInfo)
262+
{
263+
return Load(assetType, assetFileInfo.FullName);
264+
}
265+
260266
/// <inheritdoc />
261267
public T Load<T>(string assetName, bool fromEmbeddedResource = false)
262268
{
263269
return (T)Load(typeof(T), assetName, fromEmbeddedResource);
264270
}
265271

272+
/// <inheritdoc />
273+
public T Load<T>(FileInfo assetFileInfo)
274+
{
275+
return (T)Load(typeof(T), assetFileInfo.FullName);
276+
}
277+
266278
/// <inheritdoc />
267279
public void Unload()
268280
{
@@ -299,7 +311,7 @@ public bool Unload(Type assetType, string assetName)
299311

300312
AssetKey assetKey = new AssetKey(assetType, assetName);
301313

302-
object assetLockerRead = GetAssetLocker(assetKey, false);
314+
object? assetLockerRead = GetAssetLocker(assetKey, false);
303315
if (assetLockerRead == null) { return false; }
304316

305317
object asset;
@@ -332,6 +344,12 @@ public bool Unload<T>(string assetName)
332344
return Unload(typeof(T), assetName);
333345
}
334346

347+
/// <inheritdoc />
348+
public bool Unload<T>(FileInfo assetFileInfo)
349+
{
350+
return Unload(typeof(T), assetFileInfo.FullName);
351+
}
352+
335353
/// <summary>
336354
/// Resolve stream.
337355
/// </summary>
@@ -427,7 +445,7 @@ private Stream ResolveEmbeddedResourceStream(Type assetType, string assetName)
427445
/// <returns>
428446
/// The asset locker.
429447
/// </returns>
430-
private object GetAssetLocker(AssetKey assetKey, bool create)
448+
private object? GetAssetLocker(AssetKey assetKey, bool create)
431449
{
432450
lock (_assetLockers)
433451
{

src/Exomia.Framework/Content/IContentManager.cs

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#endregion
1010

1111
using System;
12+
using System.IO;
1213
using Exomia.Framework.Content.Resolver;
1314
using Exomia.Framework.Content.Resolver.EmbeddedResource;
1415

@@ -83,18 +84,18 @@ public interface IContentManager : IDisposable
8384
bool Exists(string assetName);
8485

8586
/// <summary>
86-
/// Loads an asset that has been processed by the Content Pipeline.
87+
/// Loads an asset that has been processed by the content pipeline.
8788
/// </summary>
88-
/// <typeparam name="T"> . </typeparam>
89-
/// <param name="assetName"> Full asset name (with its extension) </param>
89+
/// <typeparam name="T"> Generic type parameter. </typeparam>
90+
/// <param name="assetName"> Asset path and name (with its extension) </param>
9091
/// <param name="fromEmbeddedResource">
9192
/// (Optional)
9293
/// <c>true</c> if the asset should be loaded from an
9394
/// embedded resource; <c>false</c>
9495
/// otherwise.
9596
/// </param>
9697
/// <returns>
97-
/// ``0.
98+
/// A asset of type <typeparamref name="T" />.
9899
/// </returns>
99100
/// <exception cref="Exceptions.AssetNotFoundException">
100101
/// If the asset was not found from all
@@ -106,6 +107,24 @@ public interface IContentManager : IDisposable
106107
/// </exception>
107108
T Load<T>(string assetName, bool fromEmbeddedResource = false);
108109

110+
/// <summary>
111+
/// Loads an asset that has been processed by the content pipeline.
112+
/// </summary>
113+
/// <typeparam name="T"> Generic type parameter. </typeparam>
114+
/// <param name="assetFileInfo"> Information describing the asset file. </param>
115+
/// <returns>
116+
/// A asset of type <typeparamref name="T" />.
117+
/// </returns>
118+
/// <exception cref="Exceptions.AssetNotFoundException">
119+
/// If the asset was not found from all
120+
/// <see cref="IContentResolver" />.
121+
/// </exception>
122+
/// <exception cref="NotSupportedException">
123+
/// If no content reader was suitable to
124+
/// decode the asset.
125+
/// </exception>
126+
T Load<T>(FileInfo assetFileInfo);
127+
109128
/// <summary>
110129
/// Loads an asset that has been processed by the Content Pipeline.
111130
/// </summary>
@@ -118,7 +137,7 @@ public interface IContentManager : IDisposable
118137
/// otherwise.
119138
/// </param>
120139
/// <returns>
121-
/// Asset.
140+
/// An asset of type <paramref name="assetType" />.
122141
/// </returns>
123142
/// <exception cref="Exceptions.AssetNotFoundException">
124143
/// If the asset was not found from all
@@ -130,11 +149,21 @@ public interface IContentManager : IDisposable
130149
/// </exception>
131150
object Load(Type assetType, string assetName, bool fromEmbeddedResource = false);
132151

152+
/// <summary>
153+
/// Loads an asset that has been processed by the Content Pipeline.
154+
/// </summary>
155+
/// <param name="assetType"> Asset Type. </param>
156+
/// <param name="assetFileInfo"> Information describing the asset file. </param>
157+
/// <returns>
158+
/// An asset of type <paramref name="assetType" />.
159+
/// </returns>
160+
object Load(Type assetType, FileInfo assetFileInfo);
161+
133162
/// <summary>
134163
/// Unloads all data that was loaded by this ContentManager. All data will be disposed.
135164
/// </summary>
136165
/// <remarks>
137-
/// Unlike <see cref="ContentManager.Load{T}" /> method, this method is not thread safe and
166+
/// Unlike <see cref="IContentManager.Load(Type, string, bool)" /> method, this method is not thread safe and
138167
/// must be called by a single caller at a single time.
139168
/// </remarks>
140169
void Unload();
@@ -149,6 +178,16 @@ public interface IContentManager : IDisposable
149178
/// </returns>
150179
bool Unload<T>(string assetName);
151180

181+
/// <summary>
182+
/// Unloads and disposes an asset.
183+
/// </summary>
184+
/// <typeparam name="T"> Generic type parameter. </typeparam>
185+
/// <param name="assetFileInfo"> Information describing the asset file. </param>
186+
/// <returns>
187+
/// <c>true</c> if the asset exists and was unloaded, <c>false</c> otherwise.
188+
/// </returns>
189+
bool Unload<T>(FileInfo assetFileInfo);
190+
152191
/// <summary>
153192
/// Unloads and disposes an asset.
154193
/// </summary>

0 commit comments

Comments
 (0)