-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e98a68
commit 4b3bb3f
Showing
47 changed files
with
1,734 additions
and
844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Mosaic.Infrastructure/Collections/ConcurrentLoopingQueue{T}.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ------------------------------------------------------------------------------ | ||
// <copyright file="ConcurrentLoopingQueue{T}.cs" company="Rory Claasen"> | ||
// Copyright (c) Rory Claasen. All rights reserved. | ||
// </copyright> | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Mosaic.Infrastructure.Collections | ||
{ | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
public class ConcurrentLoopingQueue<T> : IConcurrentLoopingQueue<T> | ||
{ | ||
private readonly ConcurrentQueue<T> entries = new(); | ||
|
||
public int Count => this.entries.Count; | ||
|
||
public void Enqueue(T item) => this.entries.Enqueue(item); | ||
|
||
public void EnqueueRange(IEnumerable<T> items) | ||
{ | ||
foreach (var item in items) | ||
{ | ||
this.Enqueue(item); | ||
} | ||
} | ||
|
||
public bool TryDequeue([MaybeNullWhen(false)] out T result) | ||
{ | ||
if (this.entries.TryDequeue(out result)) | ||
{ | ||
this.entries.Enqueue(result); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public bool TryPeak([MaybeNullWhen(false)] out T result) | ||
=> this.entries.TryPeek(out result); | ||
|
||
public void Clear() | ||
=> this.entries.Clear(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Mosaic.Infrastructure/Collections/IConcurrentLoopingQueue{T}.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ------------------------------------------------------------------------------ | ||
// <copyright file="IConcurrentLoopingQueue{T}.cs" company="Rory Claasen"> | ||
// Copyright (c) Rory Claasen. All rights reserved. | ||
// </copyright> | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Mosaic.Infrastructure.Collections | ||
{ | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
public interface IConcurrentLoopingQueue<T> | ||
{ | ||
int Count { get; } | ||
|
||
void Enqueue(T item); | ||
|
||
void EnqueueRange(IEnumerable<T> items); | ||
|
||
bool TryDequeue([MaybeNullWhen(false)] out T result); | ||
|
||
bool TryPeak([MaybeNullWhen(false)] out T result); | ||
|
||
void Clear(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// ------------------------------------------------------------------------------ | ||
// <copyright file="MediaEntry.cs" company="Rory Claasen"> | ||
// Copyright (c) Rory Claasen. All rights reserved. | ||
// </copyright> | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Mosaic.Infrastructure.Config | ||
{ | ||
using System; | ||
using CsvHelper.Configuration.Attributes; | ||
|
||
public record MediaEntry( | ||
[property: Index(0)] | ||
Uri Mrl, | ||
|
||
[property: Index(1)] | ||
string? DisplayLabel = null); | ||
} |
Oops, something went wrong.