-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from GeneralLibrary/dev
Dev
- Loading branch information
Showing
16 changed files
with
121 additions
and
138 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
26 changes: 26 additions & 0 deletions
26
src/c#/GeneralUpdate.Common/Internal/Bootstrap/UpdateOption.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
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
32 changes: 32 additions & 0 deletions
32
src/c#/GeneralUpdate.Common/Internal/Pipeline/PipelineContext.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,32 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
|
||
namespace GeneralUpdate.Common.Internal.Pipeline; | ||
|
||
public class PipelineContext | ||
{ | ||
private ConcurrentDictionary<string, object?> _context = new(); | ||
|
||
public TValue? Get<TValue>(string key) | ||
{ | ||
if (_context.TryGetValue(key, out var value)) | ||
{ | ||
return value is TValue typedValue ? typedValue : default; | ||
} | ||
return default; | ||
} | ||
|
||
public void Add<TValue>(string key, TValue? value) | ||
{ | ||
if (string.IsNullOrWhiteSpace(key)) | ||
{ | ||
throw new ArgumentException("Key cannot be null or whitespace.", nameof(key)); | ||
} | ||
|
||
_context[key] = value; | ||
} | ||
|
||
public bool Remove(string key) => _context.TryRemove(key, out _); | ||
|
||
public bool ContainsKey(string key) => _context.ContainsKey(key); | ||
} |
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
Oops, something went wrong.