diff --git a/.cr/team/Editor/Code Templates/Templates.CSharp.xml b/.cr/team/Editor/Code Templates/Templates.CSharp.xml index ad4ab5d8..d3e026a5 100644 --- a/.cr/team/Editor/Code Templates/Templates.CSharp.xml +++ b/.cr/team/Editor/Code Templates/Templates.CSharp.xml @@ -8,33 +8,12 @@ - //----------------------------------------------------------------------- -// ----------------------------------------------------------------------- + // ----------------------------------------------------------------------------- // file="«?FileBase»" // Project: StgSharp -// AuthorGroup: «?GetUserInfo(Company)» -// Copyright (c) «?GetUserInfo(Company)». All rights reserved. -// -//Permission is hereby granted, free of charge, to any person obtaining a copy -//of this software and associated documentation files (the "Software"), to deal -//in the Software without restriction, including without limitation the rights -//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -//copies of the Software, and to permit persons to whom the Software is -//furnished to do so, subject to the following conditions: -// -//The above copyright notice and this permission notice shall be included in all -//copies or substantial portions of the Software. -// -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -//SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) «?GetUserInfo(Company)». +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- diff --git a/StgSharp.Benchmark/HlsfAllocatorBench.cs b/StgSharp.Benchmark/HlsfAllocatorBench.cs index 066cdb6b..fbc14e74 100644 --- a/StgSharp.Benchmark/HlsfAllocatorBench.cs +++ b/StgSharp.Benchmark/HlsfAllocatorBench.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="TlsfAllocatorBench" +// ----------------------------------------------------------------------------- +// file="HlsfAllocatorBench" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using BenchmarkDotNet.Attributes; using StgSharp.HighPerformance.Memory; using System; @@ -72,14 +52,6 @@ namespace StgSharp.Benchmark _libcLocalList.TrimExcess(); } - [Benchmark(OperationsPerInvoke = TotalOperationsPerInvoke)] - public void Tlsf() - { - for (int batch = 0; batch < BatchCount; batch++) { - RunTlsf(batch, _tlsfAllocator, 4); - } - } - [IterationCleanup] public void IterationCleanup() { @@ -108,6 +80,14 @@ namespace StgSharp.Benchmark } } + [Benchmark(OperationsPerInvoke = TotalOperationsPerInvoke)] + public void Tlsf() + { + for (int batch = 0; batch < BatchCount; batch++) { + RunTlsf(batch, _tlsfAllocator, 4); + } + } + private static uint AlignSize( uint size ) @@ -150,27 +130,6 @@ namespace StgSharp.Benchmark return (nuint)mb * 1024u * 1024u; } - private void RunTlsf( - int batch, - TwoLayerSegregatedFitAllocator allocator, - int scanWindow = 4 - ) - { - int batchOffset = batch * AllocationCount; - _tlsfLocalList.Clear(); - - for (int i = 0; i < AllocationCount; i++) - { - uint size = _requestSizesByBatch[batchOffset + i]; - Tlsf.Handle allocate = allocator.Alloc(size); - _tlsfLocalList.Add(allocate); - } - - for (int i = 0; i < _tlsfLocalList.Count; i++) { - allocator.Free(_tlsfLocalList[_freeOrderByBatch[batchOffset + i]], scanWindow); - } - } - private unsafe void RunLibc( int batch ) @@ -193,6 +152,27 @@ namespace StgSharp.Benchmark } } + private void RunTlsf( + int batch, + TwoLayerSegregatedFitAllocator allocator, + int scanWindow = 4 + ) + { + int batchOffset = batch * AllocationCount; + _tlsfLocalList.Clear(); + + for (int i = 0; i < AllocationCount; i++) + { + uint size = _requestSizesByBatch[batchOffset + i]; + Tlsf.Handle allocate = allocator.Alloc(size); + _tlsfLocalList.Add(allocate); + } + + for (int i = 0; i < _tlsfLocalList.Count; i++) { + allocator.Free(_tlsfLocalList[_freeOrderByBatch[batchOffset + i]], scanWindow); + } + } + private void ShuffleFreeOrder( int offset, int count diff --git a/StgSharp.Benchmark/Program.cs b/StgSharp.Benchmark/Program.cs index 1c09e4bd..6765f83a 100644 --- a/StgSharp.Benchmark/Program.cs +++ b/StgSharp.Benchmark/Program.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Program" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using BenchmarkDotNet.Configs; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; @@ -35,10 +15,10 @@ using StgSharp.Benchmark; IConfig config = ManualConfig.Create(DefaultConfig.Instance) .AddLogger(ConsoleLogger.Default) .AddJob(Job.Default - .WithToolchain(InProcessEmitToolchain.Instance) - .WithLaunchCount(1) - .WithWarmupCount(6) - .WithIterationCount(15) - .WithInvocationCount(3) - .WithUnrollFactor(1)); + .WithToolchain(InProcessEmitToolchain.Instance) + .WithLaunchCount(1) + .WithWarmupCount(6) + .WithIterationCount(15) + .WithInvocationCount(3) + .WithUnrollFactor(1)); _ = BenchmarkRunner.Run(config); diff --git a/StgSharp.Benchmark/SwissBenchmark.cs b/StgSharp.Benchmark/SwissBenchmark.cs index 47feca5e..8d9a8b39 100644 --- a/StgSharp.Benchmark/SwissBenchmark.cs +++ b/StgSharp.Benchmark/SwissBenchmark.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SwissBenchmark" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using BenchmarkDotNet.Attributes; using StgSharp.Collections; using System; @@ -35,11 +15,11 @@ namespace StgSharp.Benchmark { /// /// Benchmark comparing SwissTable against under - /// realistic L4 software cache address-mapping workloads. /// L4 scenario + /// realistic L4 software cache address-mapping workloads. /// L4 scenario /// characteristics: /// - Keys are HLSF/malloc pointer addresses (large, 1024-byte aligned) /// /// - Access pattern is Zipfian-skewed (20% hot cache lines receive 80% of lookups) /// - /// - Steady state: high hit-rate lookups dominate, with rare evict+refill on miss /// - - /// Working set: 512–4096 active cache line mappings /// + /// - Steady state: high hit-rate lookups dominate, with rare evict+refill on miss /// - + /// Working set: 512–4096 active cache line mappings /// /// [MemoryDiagnoser] public class SwissTableBench diff --git a/StgSharp.Common/Collections/BidirectionalDictionary.cs b/StgSharp.Common/Collections/BidirectionalDictionary.cs index 7969ef15..356d2e40 100644 --- a/StgSharp.Common/Collections/BidirectionalDictionary.cs +++ b/StgSharp.Common/Collections/BidirectionalDictionary.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="BidirectionalDictionary" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -34,8 +14,8 @@ using System.Linq; namespace StgSharp.Collections { public sealed class BidirectionalDictionary : IBidirectionalDictionary - where TFirst: notnull - where TSecond: notnull + where TFirst : notnull + where TSecond : notnull { private readonly Dictionary _forward; @@ -47,7 +27,9 @@ namespace StgSharp.Collections _reverse = []; } - public TFirst this[TSecond key] + public TFirst this[ + TSecond key + ] { get => _reverse.TryGetValue(key, out TFirst value) ? value : @@ -66,7 +48,9 @@ namespace StgSharp.Collections } } - public TSecond this[TFirst key] + public TSecond this[ + TFirst key + ] { get => _forward.TryGetValue(key, out TSecond value) ? value : @@ -99,7 +83,9 @@ namespace StgSharp.Collections public IReadOnlyDictionary Reverse => new ReadOnlyDictionary( _reverse); - public void Add(KeyValuePair item) + public void Add( + KeyValuePair item + ) { if (_forward.ContainsKey(item.Key) || _reverse.ContainsKey(item.Value)) { throw new ArgumentException("Duplicate key or value."); @@ -108,7 +94,10 @@ namespace StgSharp.Collections _reverse.Add(item.Value, item.Key); } - public void Add(TFirst key, TSecond value) + public void Add( + TFirst key, + TSecond value + ) { if (_forward.ContainsKey(key) || _reverse.ContainsKey(value)) { throw new ArgumentException("Duplicate key or value."); @@ -123,22 +112,33 @@ namespace StgSharp.Collections _reverse.Clear(); } - public bool Contains(KeyValuePair item) + public bool Contains( + KeyValuePair item + ) { - return _forward.Contains(item) && _reverse.TryGetValue(item.Value, out TFirst var) && var!.Equals(item.Key); + return _forward.Contains(item) && + _reverse.TryGetValue(item.Value, out TFirst var) && + var!.Equals(item.Key); } - public bool Contains(TSecond key) + public bool Contains( + TSecond key + ) { return _reverse.ContainsKey(key); } - public bool Contains(TFirst key) + public bool Contains( + TFirst key + ) { return _forward.ContainsKey(key); } - public void CopyTo(KeyValuePair[] array, int arrayIndex) + public void CopyTo( + KeyValuePair[] array, + int arrayIndex + ) { if (array == null) { throw new ArgumentNullException(nameof(array)); @@ -162,12 +162,16 @@ namespace StgSharp.Collections } } - public bool Remove(TFirst key) + public bool Remove( + TFirst key + ) { throw new NotImplementedException(); } - public bool Remove(KeyValuePair item) + public bool Remove( + KeyValuePair item + ) { if (_forward.Remove(item.Key)) { return _reverse.Remove(item.Value); @@ -175,12 +179,18 @@ namespace StgSharp.Collections return false; } - public bool TryGetValue(TFirst key, out TSecond value) + public bool TryGetValue( + TFirst key, + out TSecond value + ) { return _forward.TryGetValue(key, out value); } - public bool TryGetValue(TSecond key, out TFirst value) + public bool TryGetValue( + TSecond key, + out TFirst value + ) { return _reverse.TryGetValue(key, out value); } diff --git a/StgSharp.Common/Collections/CapacityFixedBag.cs b/StgSharp.Common/Collections/CapacityFixedBag.cs index bb1fbd5a..43ac6afc 100644 --- a/StgSharp.Common/Collections/CapacityFixedBag.cs +++ b/StgSharp.Common/Collections/CapacityFixedBag.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CapacityFixedBag" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -37,7 +17,9 @@ namespace StgSharp.Collections private readonly T[] _buffer; - public CapacityFixedBag(int capacity) + public CapacityFixedBag( + int capacity + ) { _buffer = new T[capacity]; } @@ -46,7 +28,9 @@ namespace StgSharp.Collections public int Capacity => _buffer.Length; - public void Add(T item) + public void Add( + T item + ) { if (Count >= _buffer.Length) { throw new InvalidOperationException("Bag capacity exceeded."); @@ -62,7 +46,9 @@ namespace StgSharp.Collections } } - public void Remove(T item) + public void Remove( + T item + ) { int index = Array.IndexOf(_buffer, item, 0, Count); if (index >= 0) @@ -73,7 +59,9 @@ namespace StgSharp.Collections } } - public void RemoveAt(int index) + public void RemoveAt( + int index + ) { if (index >= 0) { diff --git a/StgSharp.Common/Collections/CapacityFixedList.cs b/StgSharp.Common/Collections/CapacityFixedList.cs index b62d7ed9..6a940fbe 100644 --- a/StgSharp.Common/Collections/CapacityFixedList.cs +++ b/StgSharp.Common/Collections/CapacityFixedList.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CapacityFixedList" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; diff --git a/StgSharp.Common/Collections/CapacityFixedStack.cs b/StgSharp.Common/Collections/CapacityFixedStack.cs index c3c7e7e9..d98d0d7a 100644 --- a/StgSharp.Common/Collections/CapacityFixedStack.cs +++ b/StgSharp.Common/Collections/CapacityFixedStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CapacityFixedStack" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +22,9 @@ namespace StgSharp.Collections // _index points to the next free slot (top empty position). Therefore Count == _index. private int _index; - public CapacityFixedStack(int size) + public CapacityFixedStack( + int size + ) { ArgumentOutOfRangeException.ThrowIfNegative(size); _values = new T[size]; @@ -99,7 +81,9 @@ namespace StgSharp.Collections } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public T[] PopRange(int count) + public T[] PopRange( + int count + ) { if (count <= 0 || _index == 0) { return Array.Empty(); @@ -113,7 +97,9 @@ namespace StgSharp.Collections return ret; } - public void Push(T item) + public void Push( + T item + ) { if (_index >= _values.Length) { throw new InvalidOperationException("Stack is full."); @@ -122,7 +108,9 @@ namespace StgSharp.Collections _index++; } - public void PushRange(ReadOnlySpan span) + public void PushRange( + ReadOnlySpan span + ) { if (span.Length == 0) { return; @@ -134,7 +122,9 @@ namespace StgSharp.Collections _index += span.Length; } - public bool TryPop(out T value) + public bool TryPop( + out T value + ) { if (_index == 0) { @@ -163,7 +153,9 @@ namespace StgSharp.Collections public static class CapacityFixedStackBuilder { - public static CapacityFixedStack Create(ReadOnlySpan values) + public static CapacityFixedStack Create( + ReadOnlySpan values + ) { CapacityFixedStack stack = new(values.Length); stack.PushRange(values); // Push in order diff --git a/StgSharp.Common/Collections/ConcurrentCapacityFixedStack.cs b/StgSharp.Common/Collections/ConcurrentCapacityFixedStack.cs index 9c62a4ba..ee25e051 100644 --- a/StgSharp.Common/Collections/ConcurrentCapacityFixedStack.cs +++ b/StgSharp.Common/Collections/ConcurrentCapacityFixedStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ConcurrentCapacityFixedStack" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -51,7 +31,9 @@ namespace StgSharp.Collections // Next push position (0.._capacity). Only modified via CAS. private int _top; - public ConcurrentCapacityFixedStack(int capacity) + public ConcurrentCapacityFixedStack( + int capacity + ) { if (capacity <= 0) { throw new ArgumentOutOfRangeException(nameof(capacity)); @@ -102,7 +84,9 @@ namespace StgSharp.Collections throw new InvalidOperationException("Stack is empty."); } - public T[] PopRange(int count) + public T[] PopRange( + int count + ) { if (count <= 0) { return []; @@ -130,7 +114,9 @@ namespace StgSharp.Collections return trimmed; } - public void Push(T item) + public void Push( + T item + ) { SpinWait sw = default; while (true) @@ -154,7 +140,9 @@ namespace StgSharp.Collections } } - public void PushRange(ReadOnlySpan span) + public void PushRange( + ReadOnlySpan span + ) { for (int i = 0; i < span.Length; i++) { Push(span[i]); @@ -192,7 +180,9 @@ namespace StgSharp.Collections return trimmed; } - public bool TryPeek(out T value) + public bool TryPeek( + out T value + ) { value = default!; SpinWait sw = default; @@ -227,7 +217,9 @@ namespace StgSharp.Collections } } - public bool TryPop(out T value) + public bool TryPop( + out T value + ) { value = default!; SpinWait sw = default; @@ -264,7 +256,9 @@ namespace StgSharp.Collections } } - public int TryPopRange(Span destination) + public int TryPopRange( + Span destination + ) { if (destination.IsEmpty) { return 0; @@ -281,7 +275,10 @@ namespace StgSharp.Collections return i; } - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } } diff --git a/StgSharp.Common/Collections/ConcurrentFlexibaleArray.cs b/StgSharp.Common/Collections/ConcurrentFlexibleArray.cs similarity index 65% rename from StgSharp.Common/Collections/ConcurrentFlexibaleArray.cs rename to StgSharp.Common/Collections/ConcurrentFlexibleArray.cs index d256bbf6..8ebe3179 100644 --- a/StgSharp.Common/Collections/ConcurrentFlexibaleArray.cs +++ b/StgSharp.Common/Collections/ConcurrentFlexibleArray.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="ConcurrentFlexibaleArray" +// ----------------------------------------------------------------------------- +// file="ConcurrentFlexibleArray" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/Collections/IBidirectionalDictionary.cs b/StgSharp.Common/Collections/IBidirectionalDictionary.cs index 20bbcc84..fa6d2a4f 100644 --- a/StgSharp.Common/Collections/IBidirectionalDictionary.cs +++ b/StgSharp.Common/Collections/IBidirectionalDictionary.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IBidirectionalDictionary" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Collections.Generic; namespace StgSharp.Collections @@ -32,7 +12,9 @@ namespace StgSharp.Collections public interface IBidirectionalDictionary : IDictionary { - TFirst this[TSecond key] { get; set; } + TFirst this[ + TSecond key + ] { get; set; } ICollection FirstIndex { get; } @@ -53,7 +35,9 @@ namespace StgSharp.Collections /// true if the contains an element with /// the specified key; otherwise, false. /// - bool Contains(TSecond key); + bool Contains( + TSecond key + ); /// /// Determines whether the contains the @@ -66,16 +50,23 @@ namespace StgSharp.Collections /// true if the contains an element with /// the specified key; otherwise, false. /// - bool Contains(TFirst key); + bool Contains( + TFirst key + ); - bool TryGetValue(TSecond key, out TFirst value); + bool TryGetValue( + TSecond key, + out TFirst value + ); #pragma warning disable CA1033 ICollection IDictionary.Keys => FirstIndex; ICollection IDictionary.Values => SecondIndex; - bool IDictionary.ContainsKey(TFirst key) + bool IDictionary.ContainsKey( + TFirst key + ) { return Contains(key); } diff --git a/StgSharp.Common/Collections/LinearBag.cs b/StgSharp.Common/Collections/LinearBag.cs index 6355b24d..83e9cdbf 100644 --- a/StgSharp.Common/Collections/LinearBag.cs +++ b/StgSharp.Common/Collections/LinearBag.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="LinearBag" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Runtime.CompilerServices; diff --git a/StgSharp.Common/Collections/ListSegment.cs b/StgSharp.Common/Collections/ListSegment.cs index c29488d0..b3758985 100644 --- a/StgSharp.Common/Collections/ListSegment.cs +++ b/StgSharp.Common/Collections/ListSegment.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ListSegment" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; diff --git a/StgSharp.Common/Collections/RandomAccessibleStack.cs b/StgSharp.Common/Collections/RandomAccessibleStack.cs index fabe52ab..2e338620 100644 --- a/StgSharp.Common/Collections/RandomAccessibleStack.cs +++ b/StgSharp.Common/Collections/RandomAccessibleStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RandomAccessibleStack" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -53,7 +33,9 @@ namespace StgSharp.Collections /// Initializes a new instance of the RandomAccessStack class that is empty and has the /// specified initial capacity. /// - public RandomAccessibleStack(int capacity) + public RandomAccessibleStack( + int capacity + ) { if (capacity < 0) { throw new ArgumentOutOfRangeException( @@ -67,7 +49,9 @@ namespace StgSharp.Collections /// Gets or sets the element at the specified index in the stack (0 = bottom, Count-1 = /// top). /// - public T this[int index] + public T this[ + int index + ] { get { @@ -152,7 +136,9 @@ namespace StgSharp.Collections /// /// Adds an item to the top of the stack. /// - public void Push(T item) + public void Push( + T item + ) { if (_size == _array.Length) { EnsureCapacity(_size + 1); @@ -162,7 +148,9 @@ namespace StgSharp.Collections _version++; } - private void EnsureCapacity(int min) + private void EnsureCapacity( + int min + ) { int newCapacity = _array.Length == 0 ? DefaultCapacity : _array.Length * 2; if (newCapacity < min) { diff --git a/StgSharp.Common/Collections/SwissTable.X86.cs b/StgSharp.Common/Collections/SwissTable.X86.cs index d6b8d1e0..4fc67a22 100644 --- a/StgSharp.Common/Collections/SwissTable.X86.cs +++ b/StgSharp.Common/Collections/SwissTable.X86.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SwissTable.X86" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Numerics; using System.Runtime.Intrinsics; diff --git a/StgSharp.Common/Collections/SwissTable.cs b/StgSharp.Common/Collections/SwissTable.cs index 19dec5d1..5abedea8 100644 --- a/StgSharp.Common/Collections/SwissTable.cs +++ b/StgSharp.Common/Collections/SwissTable.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="SwissTable.cs" +// ----------------------------------------------------------------------------- +// file="SwissTable" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Numerics; using System.Runtime.CompilerServices; @@ -55,7 +32,10 @@ namespace StgSharp.Collections private readonly Action _freeHandle; private bool _disposed; - private SwissTable(Entry* buffer, Action freeHandle) + private SwissTable( + Entry* buffer, + Action freeHandle + ) { _entries = buffer; _freeHandle = freeHandle; @@ -72,7 +52,10 @@ namespace StgSharp.Collections return new SwissTable(buffer, handle => NativeMemory.AlignedFree((void*)handle)); } - public static SwissTable Create(Func allocator, Action freeHandle) + public static SwissTable Create( + Func allocator, + Action freeHandle + ) { Entry* buffer = (Entry*)allocator(RequestedNativeMemorySize); for (int i = 0; i < BucketCount; i++) @@ -93,7 +76,11 @@ namespace StgSharp.Collections GC.SuppressFinalize(this); } - public bool TryAddOrSet(nuint key, nuint value, out bool isNewKey) + public bool TryAddOrSet( + nuint key, + nuint value, + out bool isNewKey + ) { uint hash = BitOperations.Crc32C(CrcMagic, (ulong)key); ushort entry = (ushort)(hash & (BucketCount - 1)); @@ -101,7 +88,10 @@ namespace StgSharp.Collections return IBucketScanner.Current.TrySet(key, hash, bucket, value, out isNewKey); } - public bool TryGet(nuint key, out nuint value) + public bool TryGet( + nuint key, + out nuint value + ) { uint hash = BitOperations.Crc32C(CrcMagic, key); ushort entry = (ushort)(hash & (BucketCount - 1)); @@ -116,7 +106,10 @@ namespace StgSharp.Collections */ } - public bool TryRemove(nuint key, out nuint value) + public bool TryRemove( + nuint key, + out nuint value + ) { uint hash = BitOperations.Crc32C(CrcMagic, key); ushort entry = (ushort)(hash & (BucketCount - 1)); @@ -124,7 +117,10 @@ namespace StgSharp.Collections return IBucketScanner.Current.TryRemove(key, hash, bucket, out value); } - internal static SwissTable Create(nuint bufferPtr, Action FreeHandle) + internal static SwissTable Create( + nuint bufferPtr, + Action FreeHandle + ) { Entry* buffer = (Entry*)bufferPtr; for (int i = 0; i < BucketCount; i++) @@ -162,11 +158,27 @@ namespace StgSharp.Collections static IBucketScanner Current { get; } = Create(); - bool TryFind(nuint key, uint Hash, Bucket* bucket, out nuint value); + bool TryFind( + nuint key, + uint Hash, + Bucket* bucket, + out nuint value + ); - unsafe bool TryRemove(nuint key, uint hash, Bucket* bucket, out nuint value); + unsafe bool TryRemove( + nuint key, + uint hash, + Bucket* bucket, + out nuint value + ); - bool TrySet(nuint key, uint hash, Bucket* bucket, nuint value, out bool isNewKey); + bool TrySet( + nuint key, + uint hash, + Bucket* bucket, + nuint value, + out bool isNewKey + ); private static IBucketScanner Create() { diff --git a/StgSharp.Common/Collections/UnmanagedArray.cs b/StgSharp.Common/Collections/UnmanagedArray.cs index 52859a13..b96b4313 100644 --- a/StgSharp.Common/Collections/UnmanagedArray.cs +++ b/StgSharp.Common/Collections/UnmanagedArray.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="UnmanagedArray" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/StgSharp.Common/Collections/UnmanagedStack.cs b/StgSharp.Common/Collections/UnmanagedStack.cs index 819f1c21..eb94681d 100644 --- a/StgSharp.Common/Collections/UnmanagedStack.cs +++ b/StgSharp.Common/Collections/UnmanagedStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="UnmanagedStack" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -33,8 +13,11 @@ using System.Threading.Tasks; namespace StgSharp.Collections { - public unsafe class UnmanagedStack(T* address, int capacity, Action freeHandle) : IDisposable - where T: unmanaged + public unsafe class UnmanagedStack( + T* address, + int capacity, + Action freeHandle + ) : IDisposable where T : unmanaged { private T* _array = address; @@ -65,13 +48,17 @@ namespace StgSharp.Collections return _array[--_index]; } - public void Push(T value) + public void Push( + T value + ) { _array[_index] = value; _index++; } - public bool TryPop(out T value) + public bool TryPop( + out T value + ) { if (_index == 0) { @@ -82,7 +69,9 @@ namespace StgSharp.Collections return true; } - public bool TryPush(T value) + public bool TryPush( + T value + ) { if (_index >= _capacity) { return false; diff --git a/StgSharp.Common/Environment/Dialogue.cs b/StgSharp.Common/Environment/Dialogue.cs index 3127bb1d..9fe04505 100644 --- a/StgSharp.Common/Environment/Dialogue.cs +++ b/StgSharp.Common/Environment/Dialogue.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Dialogue" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/StgSharp.Common/Environment/ErrorDefine.cs b/StgSharp.Common/Environment/ErrorDefine.cs index 3a668dab..4944ea50 100644 --- a/StgSharp.Common/Environment/ErrorDefine.cs +++ b/StgSharp.Common/Environment/ErrorDefine.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ErrorDefine" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +16,10 @@ namespace StgSharp public class UniformEmptyReferenceException : Exception { - public UniformEmptyReferenceException(string program, string name) + public UniformEmptyReferenceException( + string program, + string name + ) : base( $"Location -1 returned when trying to find uniform {name} in shader program {program}") { } diff --git a/StgSharp.Common/Environment/GlobalSetting.cs b/StgSharp.Common/Environment/GlobalSetting.cs index 18b6c199..a663f45a 100644 --- a/StgSharp.Common/Environment/GlobalSetting.cs +++ b/StgSharp.Common/Environment/GlobalSetting.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="GlobalSetting.cs" +// ----------------------------------------------------------------------------- +// file="GlobalSetting" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -85,11 +62,9 @@ namespace StgSharp public static bool VSyncActivated { get => vsyncActivated; - set - { - // GraphicFramework.glfwSwapInterval(value ? 1 : 0); - vsyncActivated = value; - } + set => + // GraphicFramework.glfwSwapInterval(value ? 1 : 0); + vsyncActivated = value; } } diff --git a/StgSharp.Common/Environment/IStaticModule.cs b/StgSharp.Common/Environment/IStaticModule.cs index a8d6c902..0cd31d14 100644 --- a/StgSharp.Common/Environment/IStaticModule.cs +++ b/StgSharp.Common/Environment/IStaticModule.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IStaticModule" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -50,7 +30,9 @@ namespace StgSharp /// The configuration profile supplied at registration time. Use if no configuration is required. /// - void InitializeModule(IModuleInitializeProfile profile); + void InitializeModule( + IModuleInitializeProfile profile + ); /// /// Releases all resources acquired during . Implementations should @@ -98,12 +80,18 @@ namespace StgSharp /// Initializes a new using as the profile. /// - public ModuleDescriptor(IStaticModule module) : this(module, IModuleInitializeProfile.Empty) { } + public ModuleDescriptor( + IStaticModule module + ) + : this(module, IModuleInitializeProfile.Empty) { } /// /// Initializes a new with an explicit profile. /// - public ModuleDescriptor(IStaticModule module, IModuleInitializeProfile profile) + public ModuleDescriptor( + IStaticModule module, + IModuleInitializeProfile profile + ) { Module = module; Profile = profile; @@ -139,15 +127,17 @@ namespace StgSharp /// /// An ordered collection of modules to be initialized during application startup and - /// uninitialized on shutdown. Supports three registration strategies so that the new() - /// generic constraint is never a hard requirement. + /// uninitialized on shutdown. Supports three registration strategies so that the new() + /// generic constraint is never a hard requirement. /// public sealed class ModuleToInitializeCollection : IEnumerable, IStaticModule { private readonly List _descriptors = []; - internal ModuleToInitializeCollection(World.Initializer i) + internal ModuleToInitializeCollection( + World.Initializer i + ) { _descriptors.Add(new ModuleDescriptor(i)); } @@ -202,8 +192,9 @@ namespace StgSharp /// Optional initialization profile. Defaults to when . /// - public ModuleToInitializeCollection UseModule(IModuleInitializeProfile? profile = null) - where T: IStaticModule, new() + public ModuleToInitializeCollection UseModule( + IModuleInitializeProfile? profile = null + ) where T : IStaticModule, new() { return UseModule(static() => new T(), profile); } @@ -225,7 +216,8 @@ namespace StgSharp /// public ModuleToInitializeCollection UseModule( Func factory, - IModuleInitializeProfile? profile = null) + IModuleInitializeProfile? profile = null + ) { if (factory is null) { return this; @@ -251,7 +243,10 @@ namespace StgSharp /// Optional initialization profile. Defaults to when . /// - public ModuleToInitializeCollection UseModule(IStaticModule module, IModuleInitializeProfile? profile = null) + public ModuleToInitializeCollection UseModule( + IStaticModule module, + IModuleInitializeProfile? profile = null + ) { _descriptors.Add(new ModuleDescriptor( module, @@ -272,7 +267,9 @@ namespace StgSharp /// cref="InitializeModule()" />, ignoring the supplied profile because each contained module uses /// its own registered profile. /// - void IStaticModule.InitializeModule(IModuleInitializeProfile profile) + void IStaticModule.InitializeModule( + IModuleInitializeProfile profile + ) { InitializeModule(); } diff --git a/StgSharp.Common/Environment/Platform.cs b/StgSharp.Common/Environment/Platform.cs index 449c672f..e55225ea 100644 --- a/StgSharp.Common/Environment/Platform.cs +++ b/StgSharp.Common/Environment/Platform.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Platform" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance; using StgSharp.HighPerformance.ProcessorAbstraction; using System; diff --git a/StgSharp.Common/Global.cs b/StgSharp.Common/Global.cs index 17b95f61..5f75e5cf 100644 --- a/StgSharp.Common/Global.cs +++ b/StgSharp.Common/Global.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Global" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + global using StgSharp.Internal; global using System; diff --git a/StgSharp.Common/HighPerformance/IdMultiplexer.cs b/StgSharp.Common/HighPerformance/IdMultiplexer.cs index 08f1f70e..3e13b671 100644 --- a/StgSharp.Common/HighPerformance/IdMultiplexer.cs +++ b/StgSharp.Common/HighPerformance/IdMultiplexer.cs @@ -1,4 +1,11 @@ -using System; +// ----------------------------------------------------------------------------- +// file="IdMultiplexer" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,8 +13,5 @@ using System.Threading.Tasks; namespace StgSharp.HighPerformance { - public class IdMultiplexer - { - - } + public class IdMultiplexer { } } diff --git a/StgSharp.Common/HighPerformance/Memory/BufferStack.cs b/StgSharp.Common/HighPerformance/Memory/BufferStack.cs index 53f12c7c..a686d04b 100644 --- a/StgSharp.Common/HighPerformance/Memory/BufferStack.cs +++ b/StgSharp.Common/HighPerformance/Memory/BufferStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="BufferStack" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -32,24 +12,22 @@ using System.Runtime.InteropServices; namespace StgSharp.HighPerformance.Memory { [CollectionBuilder(typeof(BufferStackBuilder), nameof(BufferStackBuilder.Create))] - public unsafe class BufferStack : IDisposable where T: unmanaged + public unsafe class BufferStack : IDisposable where T : unmanaged { private byte* _buffer; private ulong _count; - public BufferStack(int capacity) + public BufferStack( + int capacity + ) { ArgumentOutOfRangeException.ThrowIfNegativeOrZero(capacity); AllocateBuffer(capacity); } - public int Count - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (int)_count; - } + public int Count => (int)_count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Clear() @@ -79,7 +57,9 @@ namespace StgSharp.HighPerformance.Memory } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Push(T item) + public void Push( + T item + ) { Header* header = (Header*)_buffer; if (header->Top >= header->Capacity) @@ -95,7 +75,9 @@ namespace StgSharp.HighPerformance.Memory } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryPop(out T value) + public bool TryPop( + out T value + ) { Header* header = (Header*)_buffer; if (header->Top == 0) @@ -112,7 +94,9 @@ namespace StgSharp.HighPerformance.Memory // Internal method for efficient bulk initialization [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal unsafe void InitializeFromSpan(ReadOnlySpan span) + internal unsafe void InitializeFromSpan( + ReadOnlySpan span + ) { if (span.IsEmpty) { return; @@ -131,7 +115,9 @@ namespace StgSharp.HighPerformance.Memory } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void AllocateBuffer(int capacity) + private void AllocateBuffer( + int capacity + ) { nuint size = (nuint)sizeof(Header) + ((nuint)capacity * (nuint)sizeof(T)); _buffer = (byte*)NativeMemory.Alloc(size); diff --git a/StgSharp.Common/HighPerformance/Memory/ConcurrentBufferStack.cs b/StgSharp.Common/HighPerformance/Memory/ConcurrentBufferStack.cs index 600ddb55..411003c1 100644 --- a/StgSharp.Common/HighPerformance/Memory/ConcurrentBufferStack.cs +++ b/StgSharp.Common/HighPerformance/Memory/ConcurrentBufferStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ConcurrentBufferStack" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Threading; using System; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.CacheLine.cs b/StgSharp.Common/HighPerformance/Memory/L4.CacheLine.cs index 210987f0..c1591ad7 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.CacheLine.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.CacheLine.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.CacheLine" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using System.Runtime.InteropServices; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Debug.cs b/StgSharp.Common/HighPerformance/Memory/L4.Debug.cs index 0dabf68a..e3dd9817 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Debug.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Debug.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Debug" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Evict.cs b/StgSharp.Common/HighPerformance/Memory/L4.Evict.cs index 7bbbd8b3..decbe839 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Evict.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Evict.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Evict" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + namespace StgSharp.HighPerformance.Memory { public partial class L4 diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Exceptions.cs b/StgSharp.Common/HighPerformance/Memory/L4.Exceptions.cs index 11a2430a..cff71175 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Exceptions.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Exceptions.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Exceptions" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + namespace StgSharp.HighPerformance.Memory { #pragma warning disable CA1032 // Implement standard exception constructors diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Predict.cs b/StgSharp.Common/HighPerformance/Memory/L4.Predict.cs index 944d0edf..7aecfb7b 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Predict.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Predict.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Predict" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using System; @@ -41,7 +21,9 @@ namespace StgSharp.HighPerformance.Memory private IL4Predict CurrentPredict { get; set; } - public void ResetPredict(IL4Predict predict) + public void ResetPredict( + IL4Predict predict + ) { if (CurrentPredict is null) { diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Predictor.cs b/StgSharp.Common/HighPerformance/Memory/L4.Predictor.cs index fdad7c50..df0ec9d0 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Predictor.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Predictor.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Predictor" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Prefetch.cs b/StgSharp.Common/HighPerformance/Memory/L4.Prefetch.cs index 81bfaee2..6b20ce78 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Prefetch.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Prefetch.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Prefetch" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.ComponentModel; using System.Numerics; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.Tlsf.cs b/StgSharp.Common/HighPerformance/Memory/L4.Tlsf.cs index d9400308..240fda88 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.Tlsf.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.Tlsf.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4.Tlsf" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/HighPerformance/Memory/L4.cs b/StgSharp.Common/HighPerformance/Memory/L4.cs index 93b56624..55eddf84 100644 --- a/StgSharp.Common/HighPerformance/Memory/L4.cs +++ b/StgSharp.Common/HighPerformance/Memory/L4.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="L4" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using StgSharp.HighPerformance.ProcessorAbstraction; diff --git a/StgSharp.Common/HighPerformance/Memory/Ptr64.cs b/StgSharp.Common/HighPerformance/Memory/Ptr64.cs index 05cb2b54..8a1e0426 100644 --- a/StgSharp.Common/HighPerformance/Memory/Ptr64.cs +++ b/StgSharp.Common/HighPerformance/Memory/Ptr64.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Ptr64" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocationHandle.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocationHandle.cs index eb60e538..6692085c 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocationHandle.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocationHandle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocationHandle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Chunked.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Chunked.cs index 4d3d5ec0..1017ca8d 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Chunked.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Chunked.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocator.Chunked" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Threading; using System; diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.ChunkedConcurrent.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.ChunkedConcurrent.cs index e43cd210..8762698a 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.ChunkedConcurrent.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.ChunkedConcurrent.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocator.ChunkedConcurrent" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Threading; using System; @@ -38,7 +18,8 @@ using System.Threading.Tasks; namespace StgSharp.HighPerformance.Memory { - internal sealed unsafe class ConcurrentChunkedSlabAllocator : SlabAllocator where T: unmanaged + internal sealed unsafe class ConcurrentChunkedSlabAllocator : SlabAllocator + where T : unmanaged { private bool _disposed; @@ -51,7 +32,9 @@ namespace StgSharp.HighPerformance.Memory private nuint _currentBuffer; private nuint _currentCapacity, _currentIndex; - public ConcurrentChunkedSlabAllocator(nuint count) + public ConcurrentChunkedSlabAllocator( + nuint count + ) { _currentBuffer = (nuint)NativeMemory.Alloc(count * (nuint)_elementSize); _currentCapacity = count; @@ -137,7 +120,9 @@ namespace StgSharp.HighPerformance.Memory public override void ExitBufferReading() { } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override void Free(nuint index) + public override void Free( + nuint index + ) { _recycle.Push(index); } diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Fixed.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Fixed.cs index 58e7b05a..032e744a 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Fixed.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.Fixed.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocator.Fixed" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using StgSharp.Threading; diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.SequencialConcurrent.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.SequencialConcurrent.cs index d9421978..21213dc0 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.SequencialConcurrent.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.SequencialConcurrent.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocator.SequencialConcurrent" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Threading; using System; diff --git a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.cs b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.cs index bbedb8aa..12f8fc77 100644 --- a/StgSharp.Common/HighPerformance/Memory/SlabAllocator.cs +++ b/StgSharp.Common/HighPerformance/Memory/SlabAllocator.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabAllocator" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; @@ -55,26 +35,26 @@ namespace StgSharp.HighPerformance.Memory /// Thrown when requesting unsupported configurations. /// /// - /// Important Threading Considerations: While SLAB + /// Important Threading Considerations: While SLAB /// allocators themselves may be designed for single-threaded use, allocated objects are /// frequently shared across multiple threads in real-world applications. Due to the /// special implementation of expandable concurrent sequential SLAB allocators, they rely /// on internal expansion locks to ensure that memory buffer expansions (which involve /// copying the entire buffer to a new location) do not occur while other threads are - /// reading from allocated regions. Sequential Layout - /// Limitations:
Sequential layout SLAB allocators cannot provide a single- - /// threaded version because:They use contiguous - /// memory layout that requires buffer expansion when capacity is - /// exceededBuffer expansion involves copying all - /// existing data to a new memory location Without + /// reading from allocated regions.
Sequential Layout Limitations: + ///
Sequential layout SLAB allocators cannot provide a single- threaded + /// version because: They use contiguous memory + /// layout that requires buffer expansion when capacity is exceeded + /// Buffer expansion involves copying all + /// existing data to a new memory location Without /// proper synchronization, concurrent access to allocated objects during synchronization, - /// concurrent access to allocated objects during expansion would cause memory corruption - /// The expansion lock mechanism is essential - /// even if allocation itself is single- threaded
- /// Chunked Layout:
Chunked layout allocators can - /// optionally provide single-threaded versions since they don't require buffer expansion - /// and copying. Each chunk is allocated independently, avoiding the memory relocation - /// issues present in sequential layouts.
+ /// concurrent access to allocated objects during expansion would cause memory + /// corruptionThe expansion lock mechanism is + /// essential even if allocation itself is single- threaded + ///
Chunked Layout:
+ /// Chunked layout allocators can optionally provide single-threaded versions since they + /// don't require buffer expansion and copying. Each chunk is allocated independently, + /// avoiding the memory relocation issues present in sequential layouts.
///
public static SlabAllocator Create( nuint count, diff --git a/StgSharp.Common/HighPerformance/Memory/TwoLayerSegregatedFitAllocator.cs b/StgSharp.Common/HighPerformance/Memory/TwoLayerSegregatedFitAllocator.cs index 45778611..459061ae 100644 --- a/StgSharp.Common/HighPerformance/Memory/TwoLayerSegregatedFitAllocator.cs +++ b/StgSharp.Common/HighPerformance/Memory/TwoLayerSegregatedFitAllocator.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TwoLayerSegregatedFitAllocator" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.HighPerformance.ProcessorAbstraction; using System; diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/IRegisterType.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/IRegisterType.cs index 639dc2fa..f5afe124 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/IRegisterType.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/IRegisterType.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IRegisterType" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -59,7 +39,7 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction /// cref="Member{T}(int)" /> with index 0. Caller must choose a type layout compatible with the /// actual register representation. /// - ref T AsRef() where T: unmanaged, INumber; + ref T AsRef() where T : unmanaged, INumber; /// /// Fills all elements (lanes) of the register with the provided scalar . @@ -74,7 +54,9 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction /// Should map to a single broadcast/shuffle instruction where possible. After completion all /// lanes read back the same value. /// - void BroadCastFrom(T value) where T: unmanaged, INumber; + void BroadCastFrom( + T value + ) where T : unmanaged, INumber; /// /// Gets a writable reference to the element at the specified . @@ -92,7 +74,9 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction /// Enables scalar lane edits without unpacking the entire register. Implementations may omit /// bounds checks for performance. Caller is responsible for passing a valid index. /// - ref T Member(int index) where T: unmanaged, INumber; + ref T Member( + int index + ) where T : unmanaged, INumber; } } diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/LogicalCore.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/LogicalCore.cs index fb4d8008..3c079026 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/LogicalCore.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/LogicalCore.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="LogicalCore" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M128.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M128.cs index 785d6fc9..1119ceab 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M128.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M128.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="M128" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -45,20 +25,24 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction [FieldOffset(0)] internal fixed byte Buffer[16]; [FieldOffset(0)] internal Vector128 Vec; - internal M128(Vector4 v) + internal M128( + Vector4 v + ) { Unsafe.SkipInit(out this); Unsafe.SkipInit(out Vec); Vec = v.AsVector128(); } - internal M128(Vector128 v) + internal M128( + Vector128 v + ) { Unsafe.SkipInit(out this); Vec = v; } - public ref T AsRef() where T: unmanaged, INumber + public ref T AsRef() where T : unmanaged, INumber { return ref Unsafe.As(ref Buffer[0]); } @@ -69,12 +53,16 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction return Vec.AsVector4(); } - public void BroadCastFrom(T value) where T: unmanaged, INumber + public void BroadCastFrom( + T value + ) where T : unmanaged, INumber { Vec = Vector128.Create(value).AsSingle(); } - public override readonly bool Equals([NotNullWhen(true)] object obj) + public override readonly bool Equals( + [NotNullWhen(true)] object obj + ) { return obj is M128 other && this == other; } @@ -85,7 +73,9 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref T Member(int index) where T: unmanaged, INumber + public ref T Member( + int index + ) where T : unmanaged, INumber { return ref Unsafe.Add(ref AsRef(), index); } @@ -95,7 +85,9 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction return string.Empty; } - public string ToString(int sample) + public string ToString( + int sample + ) { string str = string.Empty; for (int i = 15; i >= 0; i--) { @@ -105,13 +97,19 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(M128 left, M128 right) + public static bool operator !=( + M128 left, + M128 right + ) { return left.Vec != right.Vec; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(M128 left, M128 right) + public static bool operator ==( + M128 left, + M128 right + ) { return left.Vec == right.Vec; } diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M256.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M256.cs index b605b604..cf75bdb4 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M256.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M256.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="M256" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -45,18 +25,22 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction [FieldOffset(0)] internal Vector256 Vec; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref T AsRef() where T: unmanaged, INumber + public ref T AsRef() where T : unmanaged, INumber { return ref Unsafe.As(ref Buffer[0]); } - public void BroadCastFrom(T value) where T: unmanaged, INumber + public void BroadCastFrom( + T value + ) where T : unmanaged, INumber { Vec = Vector256.Create(value).AsSingle(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref T Member(int index) where T: unmanaged, INumber + public ref T Member( + int index + ) where T : unmanaged, INumber { return ref Unsafe.Add(ref AsRef(), index); } diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M512.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M512.cs index a29b9f77..cfc4018d 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M512.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M512.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="M512" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M64.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M64.cs index edfb7721..74f848a8 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/M64.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/M64.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="M64" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/Numa.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/Numa.cs index 386433b4..20258831 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/Numa.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/Numa.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Numa" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/HighPerformance/ProcessorAbstraction/NumaNode.cs b/StgSharp.Common/HighPerformance/ProcessorAbstraction/NumaNode.cs index ced69942..0da0f35d 100644 --- a/StgSharp.Common/HighPerformance/ProcessorAbstraction/NumaNode.cs +++ b/StgSharp.Common/HighPerformance/ProcessorAbstraction/NumaNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="NumaNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/Internal/DefaultLog.cs b/StgSharp.Common/Internal/DefaultLog.cs index 4241c8c1..6431bb09 100644 --- a/StgSharp.Common/Internal/DefaultLog.cs +++ b/StgSharp.Common/Internal/DefaultLog.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="DefaultLog" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.IO; using System.Runtime.InteropServices; diff --git a/StgSharp.Common/Internal/Native.cs b/StgSharp.Common/Internal/Native.cs index 2e1cb09d..9a0fd956 100644 --- a/StgSharp.Common/Internal/Native.cs +++ b/StgSharp.Common/Internal/Native.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Native" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/Internal/public.cs b/StgSharp.Common/Internal/public.cs index cc575130..9258ac6d 100644 --- a/StgSharp.Common/Internal/public.cs +++ b/StgSharp.Common/Internal/public.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="public" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/PipeLine/CrossFramePipelineNode.cs b/StgSharp.Common/PipeLine/CrossFramePipelineNode.cs index 5863abb0..3728630f 100644 --- a/StgSharp.Common/PipeLine/CrossFramePipelineNode.cs +++ b/StgSharp.Common/PipeLine/CrossFramePipelineNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CrossFramePipelineNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.PipeLine; using System; @@ -38,13 +18,16 @@ namespace StgSharp.PipeLine public class CrossFrameOperation : IConvertableToPipelineNode { - private static string[] _inputName = [ "TaskIn" ]; - private static string[] _outputName = [ "TaskOut" ]; + private static string[] _inputName = ["TaskIn"]; + private static string[] _outputName = ["TaskOut"]; private Action _mainExecution; private int currentCount; private readonly int cycleCount; - public CrossFrameOperation(Action startup, int cycleCount) + public CrossFrameOperation( + Action startup, + int cycleCount + ) { MainExecution = startup; this.cycleCount = (cycleCount > 1) ? @@ -65,14 +48,12 @@ namespace StgSharp.PipeLine public IEnumerable OutputPortName => _outputName; - public PipelineNodeOperation Operation - { - get => NodeMain; - } + public PipelineNodeOperation Operation => NodeMain; public void NodeMain( in Dictionary input, - in Dictionary output) + in Dictionary output + ) { if (currentCount < cycleCount) { diff --git a/StgSharp.Common/PipeLine/IConvertableToPipelineNode.cs b/StgSharp.Common/PipeLine/IConvertableToPipelineNode.cs index c220b7c5..402fd3fb 100644 --- a/StgSharp.Common/PipeLine/IConvertableToPipelineNode.cs +++ b/StgSharp.Common/PipeLine/IConvertableToPipelineNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IConvertableToPipelineNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Runtime.CompilerServices; @@ -34,7 +14,8 @@ namespace StgSharp.PipeLine { public delegate void PipelineNodeOperation( in Dictionary input, - in Dictionary output); + in Dictionary output + ); public interface IConvertableToPipelineNode { @@ -47,7 +28,8 @@ namespace StgSharp.PipeLine void NodeMain( in Dictionary input, - in Dictionary output); + in Dictionary output + ); } @@ -58,7 +40,11 @@ namespace StgSharp.PipeLine private string[] _output; private PipelineNodeOperation _execution; - public DefaultConvertableToBlueprintNode(PipelineNodeOperation execution, string[] input, string[] output) + public DefaultConvertableToBlueprintNode( + PipelineNodeOperation execution, + string[] input, + string[] output + ) { _input = input; _output = output; @@ -73,7 +59,8 @@ namespace StgSharp.PipeLine public void NodeMain( in Dictionary input, - in Dictionary output) + in Dictionary output + ) { _execution.Invoke(input, output); } diff --git a/StgSharp.Common/PipeLine/PipeLineRunner.cs b/StgSharp.Common/PipeLine/PipeLineRunner.cs index 5dfb7ae1..e56c66a4 100644 --- a/StgSharp.Common/PipeLine/PipeLineRunner.cs +++ b/StgSharp.Common/PipeLine/PipeLineRunner.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipeLineRunner" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Threading; using System; @@ -50,7 +30,9 @@ namespace StgSharp.PipeLine private static int _callingThread; private static SemaphoreSlim pipelineLock = new SemaphoreSlim(0, 1); - public static void Run(PipelineScheduler pipeline) + public static void Run( + PipelineScheduler pipeline + ) { // Console.WriteLine(); if (pipeline == null) @@ -71,7 +53,9 @@ namespace StgSharp.PipeLine Interlocked.Exchange(ref _callingThread, -1); } - public static void SetMaxTaskCount(int size) + public static void SetMaxTaskCount( + int size + ) { if (size < 1) { size = 1; @@ -104,7 +88,9 @@ namespace StgSharp.PipeLine pipelineInWaiting.Clear(); } - internal static bool InterruptAndRunNewPipeline(PipelineScheduler newPipeline) + internal static bool InterruptAndRunNewPipeline( + PipelineScheduler newPipeline + ) { ArgumentNullException.ThrowIfNull(newPipeline); if ((newPipeline != NodeRunner.CurrentPipeline) && (NodeRunner.CurrentPipeline != null)) @@ -134,7 +120,8 @@ namespace StgSharp.PipeLine } /**/ PipelineNode node; - while (!cts.Token.IsCancellationRequested && NodeRunner.CurrentPipeline.RequestNextMainThreadNode(out node)) + while (!cts.Token.IsCancellationRequested && + NodeRunner.CurrentPipeline.RequestNextMainThreadNode(out node)) { node.Run(); if (!NodeRunner.CurrentPipeline.IsRunning) @@ -161,9 +148,9 @@ namespace StgSharp.PipeLine } /// - /// Only the following occasions of calling are valid: 1. no bp is - /// running or the only bp is quitting. 2. calling from the main thread or a - /// thread the current bp is running on. + /// Only the following occasions of calling are valid: 1. no bp is + /// running or the only bp is quitting.2. calling from the main thread or a + /// thread the current bp is running on. /// internal static bool IsValidCalling() { @@ -226,7 +213,9 @@ namespace StgSharp.PipeLine return ret; } - private static void InternalRun(CancellationToken token) + private static void InternalRun( + CancellationToken token + ) { PipelineNode item; Console.WriteLine($"Global thread {Environment.CurrentManagedThreadId} starts."); diff --git a/StgSharp.Common/PipeLine/PipelineMarshal.cs b/StgSharp.Common/PipeLine/PipelineMarshal.cs index a47cff83..90c056e7 100644 --- a/StgSharp.Common/PipeLine/PipelineMarshal.cs +++ b/StgSharp.Common/PipeLine/PipelineMarshal.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipelineMarshal" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections; using System.Collections.Generic; @@ -38,7 +18,9 @@ namespace StgSharp.PipeLine public static class PipelineMarshal { - public static IEnumerable GetNodeSortedEnumeration(PipelineScheduler scheduler) + public static IEnumerable GetNodeSortedEnumeration( + PipelineScheduler scheduler + ) { ArgumentNullException.ThrowIfNull(scheduler); return new PipelineNodeEnumerator(scheduler) @@ -54,7 +36,9 @@ namespace StgSharp.PipeLine public int _count; - public PipelineNodeEnumerator(PipelineScheduler scheduler) + public PipelineNodeEnumerator( + PipelineScheduler scheduler + ) { if (!scheduler.TryGetAllNode(out _mt, out _c)) { throw new InvalidOperationException("Binded scheduler is not sorted."); @@ -78,7 +62,9 @@ namespace StgSharp.PipeLine } } - void ICollection.Add(PipelineNode item) + void ICollection.Add( + PipelineNode item + ) { throw new NotSupportedException(); } @@ -88,17 +74,24 @@ namespace StgSharp.PipeLine throw new NotSupportedException(); } - bool ICollection.Contains(PipelineNode item) + bool ICollection.Contains( + PipelineNode item + ) { throw new NotSupportedException(); } - void ICollection.CopyTo(PipelineNode[] array, int arrayIndex) + void ICollection.CopyTo( + PipelineNode[] array, + int arrayIndex + ) { throw new NotSupportedException(); } - bool ICollection.Remove(PipelineNode item) + bool ICollection.Remove( + PipelineNode item + ) { throw new NotSupportedException(); } diff --git a/StgSharp.Common/PipeLine/PipelineNode.cs b/StgSharp.Common/PipeLine/PipelineNode.cs index 30707116..ca36c5bc 100644 --- a/StgSharp.Common/PipeLine/PipelineNode.cs +++ b/StgSharp.Common/PipeLine/PipelineNode.cs @@ -1,30 +1,9 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipelineNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- using System; using System.Collections.Generic; @@ -61,7 +40,11 @@ namespace StgSharp.PipeLine private protected Dictionary _output; private protected int _level, _count; - internal PipelineNode(PipelineNodeLabel label, IConvertableToPipelineNode node, bool isNative) + internal PipelineNode( + PipelineNodeLabel label, + IConvertableToPipelineNode node, + bool isNative + ) { _label = label; _nativeRequested = isNative; @@ -82,7 +65,8 @@ namespace StgSharp.PipeLine PipelineNodeLabel name, bool isNative, string[] inputNames, - string[] outputNames) + string[] outputNames + ) #pragma warning restore CS8618 { if ((inputNames == null) || (inputNames.Length == 0)) { @@ -148,7 +132,12 @@ namespace StgSharp.PipeLine internal int RemainingIncreaseCount => Previous.Count - _count; - public static void Connect(PipelineNode front, string frontNodePort, string backNodePort, PipelineNode back) + public static void Connect( + PipelineNode front, + string frontNodePort, + string backNodePort, + PipelineNode back + ) { ArgumentNullException.ThrowIfNull(front); ArgumentNullException.ThrowIfNull(back); @@ -191,7 +180,9 @@ namespace StgSharp.PipeLine } } - internal bool TryIncreaseLevelTo(int level) + internal bool TryIncreaseLevelTo( + int level + ) { _count++; if (_count > Previous.Count) { @@ -203,14 +194,17 @@ namespace StgSharp.PipeLine protected static void DefaultOperation( in Dictionary input, - in Dictionary output) + in Dictionary output + ) { PipelineNodeOutPort.SkipAll(output); } #region port operation - public PipelineNodeInPort GetInputPort(string lable) + public PipelineNodeInPort GetInputPort( + string lable + ) { if (!InputPorts.TryGetValue(lable, out PipelineNodeInPort? ret)) { throw new ArgumentOutOfRangeException( @@ -219,7 +213,9 @@ namespace StgSharp.PipeLine return ret; } - public PipelineNodeOutPort GetOutputPort(string lable) + public PipelineNodeOutPort GetOutputPort( + string lable + ) { if (!OutputPorts.TryGetValue(lable, out PipelineNodeOutPort? ret)) { throw new ArgumentOutOfRangeException( @@ -228,7 +224,9 @@ namespace StgSharp.PipeLine return ret; } - public PipelineNodeInPort? DefineCertainInputPort(string label) + public PipelineNodeInPort? DefineCertainInputPort( + string label + ) { if (InputPorts.ContainsKey(label)) { return null; @@ -238,7 +236,9 @@ namespace StgSharp.PipeLine return port; } - public PipelineNodeOutPort? DefineCertainOutputPort(string label) + public PipelineNodeOutPort? DefineCertainOutputPort( + string label + ) { if (OutputPorts.ContainsKey(label)) { return null; @@ -256,11 +256,21 @@ namespace StgSharp.PipeLine public PipelineNodeRunException() { } - public PipelineNodeRunException(Exception ex) : base(string.Empty, ex) { } + public PipelineNodeRunException( + Exception ex + ) + : base(string.Empty, ex) { } - public PipelineNodeRunException(string message) : base(message) { } + public PipelineNodeRunException( + string message + ) + : base(message) { } - public PipelineNodeRunException(string message, Exception innerException) : base(message, innerException) { } + public PipelineNodeRunException( + string message, + Exception innerException + ) + : base(message, innerException) { } } } diff --git a/StgSharp.Common/PipeLine/PipelineNodeLabel.cs b/StgSharp.Common/PipeLine/PipelineNodeLabel.cs index 4e64a4dc..0de06888 100644 --- a/StgSharp.Common/PipeLine/PipelineNodeLabel.cs +++ b/StgSharp.Common/PipeLine/PipelineNodeLabel.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipelineNodeLabel" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -52,7 +32,9 @@ namespace StgSharp.PipeLine public record class PipelineNodeStringLabel : PipelineNodeLabel { - public PipelineNodeStringLabel(string name) + public PipelineNodeStringLabel( + string name + ) { Name = name; } diff --git a/StgSharp.Common/PipeLine/PipelineNodePort.cs b/StgSharp.Common/PipeLine/PipelineNodePort.cs index f130c012..1d4f934d 100644 --- a/StgSharp.Common/PipeLine/PipelineNodePort.cs +++ b/StgSharp.Common/PipeLine/PipelineNodePort.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipelineNodePort" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -40,7 +20,10 @@ namespace StgSharp.PipeLine private HashSet _linkerSet = new HashSet(); - public PipelineNodeInPort(PipelineNode container, string label) + public PipelineNodeInPort( + PipelineNode container, + string label + ) { Container = container; Label = label; @@ -56,7 +39,9 @@ namespace StgSharp.PipeLine internal HashSet Linkers => _linkerSet; - public void Connect(PipelineNodeOutPort port) + public void Connect( + PipelineNodeOutPort port + ) { ArgumentNullException.ThrowIfNull(port); if (_linkerSet.Add(port)) @@ -79,7 +64,9 @@ namespace StgSharp.PipeLine PipelineNodeOutPort.WaitAll(_linkerSet); } - public static void WaitAll(IDictionary ports) + public static void WaitAll( + IDictionary ports + ) { if (ports is null) { return; @@ -89,7 +76,9 @@ namespace StgSharp.PipeLine } } - public static void WaitAll(IEnumerable ports) + public static void WaitAll( + IEnumerable ports + ) { if (ports is null) { return; @@ -108,7 +97,10 @@ namespace StgSharp.PipeLine private volatile int _passCount; private SemaphoreSlim formerCompleteSemaphore; - public PipelineNodeOutPort(PipelineNode container, string label) + public PipelineNodeOutPort( + PipelineNode container, + string label + ) { Container = container; Label = label; @@ -123,7 +115,9 @@ namespace StgSharp.PipeLine private SemaphoreSlim Waiter => formerCompleteSemaphore; - public void Connect(PipelineNodeInPort port) + public void Connect( + PipelineNodeInPort port + ) { ArgumentNullException.ThrowIfNull(port); if (_linkerSet.Add(port)) @@ -145,7 +139,9 @@ namespace StgSharp.PipeLine } } - public static void SkipAll(Dictionary ports) + public static void SkipAll( + Dictionary ports + ) { if (ports is null) { return; @@ -155,12 +151,16 @@ namespace StgSharp.PipeLine } } - public void TransmitValue(IPipeLineConnectionPayload value) + public void TransmitValue( + IPipeLineConnectionPayload value + ) { foreach (PipelineNodeInPort item in _linkerSet) { } } - public static void WaitAll(IEnumerable ports) + public static void WaitAll( + IEnumerable ports + ) { if (ports is null) { return; diff --git a/StgSharp.Common/PipeLine/PipelineScheduler.cs b/StgSharp.Common/PipeLine/PipelineScheduler.cs index c6dc81b1..dd4e0598 100644 --- a/StgSharp.Common/PipeLine/PipelineScheduler.cs +++ b/StgSharp.Common/PipeLine/PipelineScheduler.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PipelineScheduler" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -61,43 +41,30 @@ namespace StgSharp.PipeLine } /**/ - public PipelineNode this[PipelineNodeLabel label] - { - get { return _allNode[label]; } - } + public PipelineNode this[ + PipelineNodeLabel label + ] => _allNode[label]; - public bool IsRunning - { - get => runningStat.CurrentCount == 0; - } + public bool IsRunning => runningStat.CurrentCount == 0; - public IEnumerable InputPortName - { - get => _beginning.InputPorts.Keys; - } + public IEnumerable InputPortName => _beginning.InputPorts.Keys; - public IEnumerable OutputPortName - { - get => _beginning.OutputPorts.Keys; - } + public IEnumerable OutputPortName => _beginning.OutputPorts.Keys; public PipelineNode BeginLayer => _beginning; public PipelineNode EndLayer => _ending; - public PipelineNodeOperation Operation - { - get => (this as IConvertableToPipelineNode).NodeMain; - } + public PipelineNodeOperation Operation => (this as IConvertableToPipelineNode).NodeMain; /**/ - internal SemaphoreSlim RunningStat - { - get => runningStat; - } + internal SemaphoreSlim RunningStat => runningStat; - public void AddNode(PipelineNode node, bool isNative) + public void AddNode( + PipelineNode node, + bool isNative + ) { ArgumentNullException.ThrowIfNull(node); node.IsNative = isNative; @@ -161,7 +128,10 @@ namespace StgSharp.PipeLine _isAvailable = true; } - public PipelineNode Create(PipelineNodeLabel label, [NotNull] IConvertableToPipelineNode body) + public PipelineNode Create( + PipelineNodeLabel label, + [NotNull] IConvertableToPipelineNode body + ) { if (_allNode.TryGetValue(label, out PipelineNode? node)) { throw new InvalidOperationException("Label has exist in scheduler."); @@ -171,7 +141,9 @@ namespace StgSharp.PipeLine return node; } - public PipelineNode GetNode(PipelineNodeLabel label) + public PipelineNode GetNode( + PipelineNodeLabel label + ) { if (_allNode.TryGetValue(label, out PipelineNode? node)) { @@ -182,14 +154,19 @@ namespace StgSharp.PipeLine } } - public void LinkToInput(PipelineNodeInPort port) + public void LinkToInput( + PipelineNodeInPort port + ) { ArgumentNullException.ThrowIfNull(port); PipelineNodeOutPort p = _beginning.DefaultOut; p.Connect(port); } - public void LinkToInput(PipelineNodeInPort port, string inputPortName) + public void LinkToInput( + PipelineNodeInPort port, + string inputPortName + ) { ArgumentNullException.ThrowIfNull(port); PipelineNodeOutPort p = _beginning.DefineCertainOutputPort(inputPortName); @@ -197,7 +174,9 @@ namespace StgSharp.PipeLine } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetInput(params (string label, IPipeLineConnectionPayload arg)[] parameters) + public void SetInput( + params (string label, IPipeLineConnectionPayload arg)[] parameters + ) { _beginning.SetInputData(parameters); } @@ -211,7 +190,8 @@ namespace StgSharp.PipeLine public bool TryGetAllNode( out List> mainThreadNodes, - out List> concurrentNodes) + out List> concurrentNodes + ) { if (_isAvailable) { @@ -224,7 +204,9 @@ namespace StgSharp.PipeLine return false; } - internal bool RequestNexConcurrentNode(out PipelineNode node) + internal bool RequestNexConcurrentNode( + out PipelineNode node + ) { int index, level; if (cLevel >= _concurrentNodes.Count) @@ -251,7 +233,9 @@ namespace StgSharp.PipeLine return true; } - internal bool RequestNextMainThreadNode(out PipelineNode node) + internal bool RequestNextMainThreadNode( + out PipelineNode node + ) { if (mtLevel >= _mainThreadNodes.Count) { @@ -280,7 +264,8 @@ namespace StgSharp.PipeLine void IConvertableToPipelineNode.NodeMain( in Dictionary input, - in Dictionary output) + in Dictionary output + ) { PipeLineRunner.Run(this); PipelineNodeOutPort.SkipAll(output); diff --git a/StgSharp.Common/PipeLine/PortArgs.cs b/StgSharp.Common/PipeLine/PortArgs.cs index 0a799c7f..53903de2 100644 --- a/StgSharp.Common/PipeLine/PortArgs.cs +++ b/StgSharp.Common/PipeLine/PortArgs.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PortArgs" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -45,7 +25,10 @@ namespace StgSharp.PipeLine private protected PipelineNodeOutPort input; private protected SemaphoreSlim formerCompleteSemaphore; - public PipelineConnector(PipelineNodeOutPort former, PipelineNodeInPort after) + public PipelineConnector( + PipelineNodeOutPort former, + PipelineNodeInPort after + ) { this.input = former; this.output = after; @@ -62,7 +45,9 @@ namespace StgSharp.PipeLine public PipelineNodeOutPort Input => input; - public static void SkipAll(Dictionary ports) + public static void SkipAll( + Dictionary ports + ) { if (ports == null) { return; @@ -75,7 +60,9 @@ namespace StgSharp.PipeLine } } - public static void WaitAll(Dictionary ports) + public static void WaitAll( + Dictionary ports + ) { if (ports == null) { return; @@ -110,7 +97,9 @@ namespace StgSharp.PipeLine } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void CompleteAndWriteData(IPipeLineConnectionPayload args) + public void CompleteAndWriteData( + IPipeLineConnectionPayload args + ) { this.args = args; CompleteAndSkip(); diff --git a/StgSharp.Common/PipeLine/SideNode.cs b/StgSharp.Common/PipeLine/SideNode.cs index bac1eec2..ea4d689a 100644 --- a/StgSharp.Common/PipeLine/SideNode.cs +++ b/StgSharp.Common/PipeLine/SideNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SideNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Globalization; @@ -43,9 +23,11 @@ namespace StgSharp.PipeLine private PipelineScheduler _bp; - public BeginningNode(PipelineScheduler bp) - : base( - DefaultOperation, new PipelineNodeStringLabel("BeginningNode"), true, [ "default" ],[ OutName ]) + public BeginningNode( + PipelineScheduler bp + ) + : base(DefaultOperation, new PipelineNodeStringLabel("BeginningNode"), true, + ["default"], [OutName]) { _bp = bp; } @@ -58,7 +40,9 @@ namespace StgSharp.PipeLine PipelineNodeOutPort.SkipAll(_output); } - internal void SetInputData(IEnumerable<(string, IPipeLineConnectionPayload)> data) + internal void SetInputData( + IEnumerable<(string, IPipeLineConnectionPayload)> data + ) { if (data is null) { return; @@ -75,9 +59,11 @@ namespace StgSharp.PipeLine private PipelineScheduler _bp; - public EndingNode(PipelineScheduler bp) - : base( - DefaultOperation, name:new PipelineNodeStringLabel("EndingNode"), true, [ "default" ],[ "default" ]) + public EndingNode( + PipelineScheduler bp + ) + : base(DefaultOperation, name:new PipelineNodeStringLabel("EndingNode"), true, + ["default"], ["default"]) { _bp = bp; } diff --git a/StgSharp.Common/State/ISimpleStateMachine.cs b/StgSharp.Common/State/ISimpleStateMachine.cs index a6b557fe..19936791 100644 --- a/StgSharp.Common/State/ISimpleStateMachine.cs +++ b/StgSharp.Common/State/ISimpleStateMachine.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ISimpleStateMachine" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/State/SimpleStateMachineNode.cs b/StgSharp.Common/State/SimpleStateMachineNode.cs index 1def67db..df4f38c3 100644 --- a/StgSharp.Common/State/SimpleStateMachineNode.cs +++ b/StgSharp.Common/State/SimpleStateMachineNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SimpleStateMachineNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/State/StateContext.cs b/StgSharp.Common/State/StateContext.cs index 38d1d62f..7b39d320 100644 --- a/StgSharp.Common/State/StateContext.cs +++ b/StgSharp.Common/State/StateContext.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="StateContext.cs" +// ----------------------------------------------------------------------------- +// file="StateContext" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Common/Threading/AdaptiveBackoffStrategy.cs b/StgSharp.Common/Threading/AdaptiveBackoffStrategy.cs index 7ae08707..80c62853 100644 --- a/StgSharp.Common/Threading/AdaptiveBackoffStrategy.cs +++ b/StgSharp.Common/Threading/AdaptiveBackoffStrategy.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="AdaptiveBackoffStrategy" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Diagnostics; using System.Runtime.CompilerServices; @@ -109,14 +89,17 @@ public struct AdaptiveBackoffStrategy _currentMethod = s_globalBestMethod, _consecutiveFailures = 0, _localAttempts = 0, - _fastRng = (uint)(Environment.TickCount64 ^ Thread.CurrentThread.ManagedThreadId * 0x9E3779B9U) + _fastRng = + (uint)(Environment.TickCount64 ^ Thread.CurrentThread.ManagedThreadId * 0x9E3779B9U) }; } /// /// Gets global statistics for the specified strategy (for monitoring) /// - public static (long attempts, long successes, double successRate) GetGlobalStats(BackoffMethod method) + public static (long attempts, long successes, double successRate) GetGlobalStats( + BackoffMethod method + ) { PerformanceStats stats = s_globalStats[(int)method]; return (stats.Attempts, stats.Successes, stats.SuccessRate); @@ -338,14 +321,12 @@ public struct AdaptiveBackoffStrategy public long LastResetTicks; public long Successes; - public readonly double SuccessRate - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => Attempts == 0 ? 0.0 : (double)Successes / Attempts; - } + public readonly double SuccessRate => Attempts == 0 ? 0.0 : (double)Successes / Attempts; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void RecordAttempt(bool success) + public void RecordAttempt( + bool success + ) { _ = Interlocked.Increment(ref Attempts); if (success) { diff --git a/StgSharp.Common/Threading/BufferExpansionLock.cs b/StgSharp.Common/Threading/BufferExpansionLock.cs index df5fbedb..b6589fe6 100644 --- a/StgSharp.Common/Threading/BufferExpansionLock.cs +++ b/StgSharp.Common/Threading/BufferExpansionLock.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="BufferExpansionLock" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -53,11 +33,7 @@ namespace StgSharp.Threading _copyLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion); } - public bool IsThreadReadingMetaData - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _expansionLock.IsReadLockHeld; - } + public bool IsThreadReadingMetaData => _expansionLock.IsReadLockHeld; public void Dispose() { diff --git a/StgSharp.Common/Threading/CancellableTask.cs b/StgSharp.Common/Threading/CancellableTask.cs index 18a133f5..8e0377a0 100644 --- a/StgSharp.Common/Threading/CancellableTask.cs +++ b/StgSharp.Common/Threading/CancellableTask.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CancellableTask" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -48,26 +28,19 @@ namespace StgSharp.Threading cts = new CancellationTokenSource(); } - private protected CancellableTask(Action action) + private protected CancellableTask( + Action action + ) { _internalTask = new Task(InternalAction); cts = new CancellationTokenSource(); } - public bool IsCompleted - { - get => _internalTask.IsCompleted; - } + public bool IsCompleted => _internalTask.IsCompleted; - public CancellationTokenSource Cts - { - get => cts; - } + public CancellationTokenSource Cts => cts; - public int Id - { - get => _internalTask.Id; - } + public int Id => _internalTask.Id; public void Cancel() { @@ -91,7 +64,9 @@ namespace StgSharp.Threading GC.SuppressFinalize(this); } - public static CancellableTask Run(Action startup) + public static CancellableTask Run( + Action startup + ) { CancellableTask ret = new CancellableTask { @@ -106,7 +81,9 @@ namespace StgSharp.Threading _internalTask.Wait(); } - public static void WaitAll(IEnumerable tasks) + public static void WaitAll( + IEnumerable tasks + ) { IEnumerable convertedTasks = tasks.Select( ct => ct._internalTask); @@ -119,7 +96,9 @@ namespace StgSharp.Threading _startup(Cts.Token); } - protected virtual void Dispose(bool disposing) + protected virtual void Dispose( + bool disposing + ) { if (!disposedValue) { @@ -140,7 +119,9 @@ namespace StgSharp.Threading } } - public static implicit operator Task(CancellableTask task) + public static implicit operator Task( + CancellableTask task + ) { return task._internalTask; } diff --git a/StgSharp.Common/Threading/SingleConsumerBell.cs b/StgSharp.Common/Threading/SingleConsumerBell.cs index 379b2a79..6ef5cdf2 100644 --- a/StgSharp.Common/Threading/SingleConsumerBell.cs +++ b/StgSharp.Common/Threading/SingleConsumerBell.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SingleConsumerBell" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; @@ -34,15 +14,15 @@ namespace StgSharp.Threading /// A single-consumer bell/signal primitive. /// /// - /// Producers can call multiple times to publish signals. The bell + /// Producers can call multiple times to publish signals. The bell /// keeps a pending count of not-yet-consumed signals. The consumer uses or to consume - /// signals. When a producer increments the pending count from 0 to 1, the + /// signals. When a producer increments the pending count from 0 to 1, the /// internal event is set to wake the consumer. Consuming via /// or clears the entire pending count /// (aggregate consumption). If new signals arrive while resetting, the event is set again to - /// avoid missed signals. Ownership: only the specified owner can call - /// the consumer APIs. + /// avoid missed signals. Ownership: only the specified owner can call + /// the consumer APIs. /// public sealed class SingleConsumerBell : IDisposable { @@ -65,7 +45,10 @@ namespace StgSharp.Threading /// /// Thrown if is null. /// - public SingleConsumerBell(object owner, int spinCount = 100) + public SingleConsumerBell( + object owner, + int spinCount = 100 + ) { _owner = owner ?? throw new ArgumentNullException(nameof(owner)); _evt = new ManualResetEventSlim(false, spinCount); @@ -113,13 +96,15 @@ namespace StgSharp.Threading /// The consumer object; must be the same reference provided at construction. /// /// - /// true if a signal was available (pending or event set); otherwise false - /// . + /// true if a signal was available (pending or event set); otherwise + /// false. /// /// /// Thrown if is not the owner. /// - public bool TryWait(object consumer) + public bool TryWait( + object consumer + ) { if (!ReferenceEquals(_owner, consumer)) { throw new InvalidOperationException("This bell is owned by another consumer."); @@ -153,7 +138,10 @@ namespace StgSharp.Threading /// /// Thrown if is not the owner. /// - public void Wait(object consumer, CancellationToken cancellationToken = default) + public void Wait( + object consumer, + CancellationToken cancellationToken = default + ) { if (!ReferenceEquals(_owner, consumer)) { throw new InvalidOperationException("This bell is owned by another consumer."); diff --git a/StgSharp.Common/Threading/ThreadHelper.cs b/StgSharp.Common/Threading/ThreadHelper.cs index d0789f54..c1c1e5ea 100644 --- a/StgSharp.Common/Threading/ThreadHelper.cs +++ b/StgSharp.Common/Threading/ThreadHelper.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ThreadHelper" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using System; using System.Diagnostics; diff --git a/StgSharp.Common/Threading/VariableCapacitySemaphore.cs b/StgSharp.Common/Threading/VariableCapacitySemaphore.cs index 41f521ba..1000dd9a 100644 --- a/StgSharp.Common/Threading/VariableCapacitySemaphore.cs +++ b/StgSharp.Common/Threading/VariableCapacitySemaphore.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="VariableCapacitySemaphore" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; using System.Threading; diff --git a/StgSharp.Common/Timing/StgSharpTime.cs b/StgSharp.Common/Timing/StgSharpTime.cs index 440da94a..76c38e7a 100644 --- a/StgSharp.Common/Timing/StgSharpTime.cs +++ b/StgSharp.Common/Timing/StgSharpTime.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="StgSharpTime" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.Timing; using System; diff --git a/StgSharp.Common/Timing/TimeSequence.cs b/StgSharp.Common/Timing/TimeSequence.cs index 4eee41a4..d46aafa0 100644 --- a/StgSharp.Common/Timing/TimeSequence.cs +++ b/StgSharp.Common/Timing/TimeSequence.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TimeSequence" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Timing; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Common/Timing/TimeSourceProvider.cs b/StgSharp.Common/Timing/TimeSourceProvider.cs index d07c2fdc..ca881787 100644 --- a/StgSharp.Common/Timing/TimeSourceProvider.cs +++ b/StgSharp.Common/Timing/TimeSourceProvider.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TimeSourceProvider" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp; using System; @@ -40,7 +20,9 @@ namespace StgSharp.Timing protected object SubscribeLock { get; } = new(); - public void AddSubscriber(TimeSpanProvider subscriber) + public void AddSubscriber( + TimeSpanProvider subscriber + ) { lock (SubscribeLock) { AddSubscriberUnsynced(subscriber); @@ -49,7 +31,9 @@ namespace StgSharp.Timing public abstract long GetCurrentTimeSpanTick(); - public void RemoveSubscriber(TimeSpanProvider subscriber) + public void RemoveSubscriber( + TimeSpanProvider subscriber + ) { lock (SubscribeLock) { RemoveSubscriberUnsynced(subscriber); @@ -60,9 +44,13 @@ namespace StgSharp.Timing public abstract void StopProvidingTime(); - protected abstract void AddSubscriberUnsynced(TimeSpanProvider subscriber); + protected abstract void AddSubscriberUnsynced( + TimeSpanProvider subscriber + ); - protected abstract void RemoveSubscriberUnsynced(TimeSpanProvider subscriber); + protected abstract void RemoveSubscriberUnsynced( + TimeSpanProvider subscriber + ); } } diff --git a/StgSharp.Common/Timing/TimeSpanProvider.Awaiting.cs b/StgSharp.Common/Timing/TimeSpanProvider.Awaiting.cs index 5a3a74d8..947cb4c2 100644 --- a/StgSharp.Common/Timing/TimeSpanProvider.Awaiting.cs +++ b/StgSharp.Common/Timing/TimeSpanProvider.Awaiting.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TimeSpanProvider.Awaiting" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; @@ -77,11 +57,7 @@ namespace StgSharp.Timing /// public long PendingSpanCount => Volatile.Read(ref _pendingSpans); - internal ManualResetEventSlim AwaitingEvent - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _event; - } + internal ManualResetEventSlim AwaitingEvent => _event; public void Dispose() { @@ -92,7 +68,10 @@ namespace StgSharp.Timing GC.SuppressFinalize(this); } - public override int GetHashCode() => _id; + public override int GetHashCode() + { + return _id; + } public void Participant() { @@ -154,7 +133,9 @@ namespace StgSharp.Timing /// OperationCanceledException when token is cancelled. If the provider is disposed during /// wait an OperationCanceledException is thrown to indicate end. /// - public Task WaitNextSpanAsync(CancellationToken ct) + public Task WaitNextSpanAsync( + CancellationToken ct + ) { // Block the current thread until the event is signaled or cancellation requested. _event.Wait(ct); @@ -181,7 +162,10 @@ namespace StgSharp.Timing return Task.CompletedTask; } - internal void MissRefresh() => _missHandler?.Invoke(this, EventArgs.Empty); // Legacy compatibility. + internal void MissRefresh() + { + _missHandler?.Invoke(this, EventArgs.Empty); + } // Legacy compatibility. /// /// @@ -193,7 +177,9 @@ namespace StgSharp.Timing /// True if the span provider is working. False if time is over (the sequence ended). /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal bool OnSpanTick(long currentTick) + internal bool OnSpanTick( + long currentTick + ) { if (_sequence.EndsAt(currentTick)) { @@ -228,7 +214,10 @@ namespace StgSharp.Timing return true; } - ~TimeSpanProvider() => Dispose(); + ~TimeSpanProvider() + { + Dispose(); + } } } diff --git a/StgSharp.Common/Timing/TimeSpanProvider.cs b/StgSharp.Common/Timing/TimeSpanProvider.cs index 122db5dc..0b9be884 100644 --- a/StgSharp.Common/Timing/TimeSpanProvider.cs +++ b/StgSharp.Common/Timing/TimeSpanProvider.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TimeSpanProvider" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Timing; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/CPUanimation/IImageProvider.cs b/StgSharp.Graphics/CPUanimation/IImageProvider.cs index 63095bd9..37c50539 100644 --- a/StgSharp.Graphics/CPUanimation/IImageProvider.cs +++ b/StgSharp.Graphics/CPUanimation/IImageProvider.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IImageProvider" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Text; diff --git a/StgSharp.Graphics/CPUanimation/ImageHelper.cs b/StgSharp.Graphics/CPUanimation/ImageHelper.cs index 559e4f06..973d4fa9 100644 --- a/StgSharp.Graphics/CPUanimation/ImageHelper.cs +++ b/StgSharp.Graphics/CPUanimation/ImageHelper.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ImageHelper" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.ComponentModel; @@ -35,7 +15,12 @@ namespace StgSharp.Graphics public static class ImageHelper { - public static void Resize(Image i, int width, int height, ImageMovement move) + public static void Resize( + Image i, + int width, + int height, + ImageMovement move + ) { if (i == null) { throw new ArgumentNullException(nameof(i)); diff --git a/StgSharp.Graphics/Camera.cs b/StgSharp.Graphics/Camera.cs index bf4b5bd1..a8dd0718 100644 --- a/StgSharp.Graphics/Camera.cs +++ b/StgSharp.Graphics/Camera.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Camera" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.ShaderEdit; diff --git a/StgSharp.Graphics/Define/BufferObjectBase.cs b/StgSharp.Graphics/Define/BufferObjectBase.cs index 7047e002..16271776 100644 --- a/StgSharp.Graphics/Define/BufferObjectBase.cs +++ b/StgSharp.Graphics/Define/BufferObjectBase.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="BufferObjectBase" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using System; @@ -53,7 +33,9 @@ namespace StgSharp.Graphics /// /// /// - public GlHandle this[int index] => _bufferHandle[index]; + public GlHandle this[ + int index + ] => _bufferHandle[index]; /// /// Bind a BufferHandle instance to OpenGL @@ -61,7 +43,9 @@ namespace StgSharp.Graphics /// /// Index of handle of the object in this instance to be bind /// - public abstract void Bind(int index); + public abstract void Bind( + int index + ); public void Dispose() { @@ -75,7 +59,9 @@ namespace StgSharp.Graphics return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}."; } - protected abstract void Dispose(bool disposing); + protected abstract void Dispose( + bool disposing + ); ~BufferObjectBase() { diff --git a/StgSharp.Graphics/Environment/Monitor.cs b/StgSharp.Graphics/Environment/Monitor.cs index 2f81a6bd..e4c1b361 100644 --- a/StgSharp.Graphics/Environment/Monitor.cs +++ b/StgSharp.Graphics/Environment/Monitor.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Monitor" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Graphics/FrameworkConstant.cs b/StgSharp.Graphics/FrameworkConstant.cs index 2cc3d08a..b453ed3f 100644 --- a/StgSharp.Graphics/FrameworkConstant.cs +++ b/StgSharp.Graphics/FrameworkConstant.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="FrameworkConstant" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Graphics/Global.cs b/StgSharp.Graphics/Global.cs index 8210befb..3224363c 100644 --- a/StgSharp.Graphics/Global.cs +++ b/StgSharp.Graphics/Global.cs @@ -1,29 +1,9 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Global" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + global using StgSharp.Internal; global using System; \ No newline at end of file diff --git a/StgSharp.Graphics/GraphicInitializer.cs b/StgSharp.Graphics/GraphicInitializer.cs index a47753b5..de3f26e8 100644 --- a/StgSharp.Graphics/GraphicInitializer.cs +++ b/StgSharp.Graphics/GraphicInitializer.cs @@ -1,30 +1,9 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GraphicInitializer" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- using StgSharp; using System; @@ -41,7 +20,9 @@ namespace StgSharp.Graphics public string ModuleName => "Graphics"; - public void InitializeModule(IModuleInitializeProfile profile) + public void InitializeModule( + IModuleInitializeProfile profile + ) { GraphicFramework.LoadGlfw(); if (GraphicFramework.glfwInit() == 0) { diff --git a/StgSharp.Graphics/Image.cs b/StgSharp.Graphics/Image.cs index 6d40e265..61ef26bd 100644 --- a/StgSharp.Graphics/Image.cs +++ b/StgSharp.Graphics/Image.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="Image.cs" +// ----------------------------------------------------------------------------- +// file="Image" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; @@ -47,7 +24,9 @@ namespace StgSharp.Graphics _rawInfo = new ImageInfo(); } - internal Image(ImageInfo information) + internal Image( + ImageInfo information + ) { _rawInfo = information; _data = []; @@ -55,11 +34,7 @@ namespace StgSharp.Graphics // int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel; } - public (int width, int height) Size - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (_rawInfo.Width, _rawInfo.Height); - } + public (int width, int height) Size => (_rawInfo.Width, _rawInfo.Height); public byte[] PixelBuffer { @@ -109,9 +84,14 @@ namespace StgSharp.Graphics internal ref byte[] Data => ref _data; - public void FromBytes(byte[] stream) { } + public void FromBytes( + byte[] stream + ) { } - public static unsafe Image FromFile(string route, ImageLoader loader) + public static unsafe Image FromFile( + string route, + ImageLoader loader + ) { Image ret = new Image(); fixed (ImageInfo* iptr = &ret._rawInfo) { @@ -120,7 +100,11 @@ namespace StgSharp.Graphics return ret; } - public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream) + public static Image FromMemory( + (int width, int height) size, + ImageChannel channel, + byte[] stream + ) { ImageInfo _info = new ImageInfo { @@ -139,7 +123,8 @@ namespace StgSharp.Graphics (int width, int height) size, ImageChannel channel, PixelChannelLayout layout, - byte[] stream) + byte[] stream + ) { ImageInfo _info = new ImageInfo { @@ -173,7 +158,11 @@ namespace StgSharp.Graphics return this; } - internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount) + internal static Image FromMemory( + ImageInfo info, + byte[] data, + int operationCount + ) { return new Image { diff --git a/StgSharp.Graphics/ImageInfo.cs b/StgSharp.Graphics/ImageInfo.cs index 9bd73916..48651146 100644 --- a/StgSharp.Graphics/ImageInfo.cs +++ b/StgSharp.Graphics/ImageInfo.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ImageInfo" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Collections.Generic; @@ -40,7 +20,8 @@ namespace StgSharp.Graphics ref int width, ref int height, ref int definedChannel, - int desiredChannel); + int desiredChannel + ); [StructLayout(LayoutKind.Sequential)] internal struct ImageInfo @@ -55,13 +36,10 @@ namespace StgSharp.Graphics public ImageChannel Channel { get => channel; - set { channel = value; } + set => channel = value; } - public int ChannelCount - { - get => GetChannelCount(channel); - } + public int ChannelCount => GetChannelCount(channel); public int Height { @@ -69,11 +47,8 @@ namespace StgSharp.Graphics set => height = value; } - public int StreamSize - { - get => width * height * GetPixelSize( + public int StreamSize => width * height * GetPixelSize( pixelLayout, channel); - } public int Width { @@ -101,7 +76,9 @@ namespace StgSharp.Graphics return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}"; } - internal static int GetChannelCount(ImageChannel channel) + internal static int GetChannelCount( + ImageChannel channel + ) { return channel switch { @@ -114,7 +91,10 @@ namespace StgSharp.Graphics }; } - internal static int GetPixelSize(PixelChannelLayout layout, ImageChannel channel) + internal static int GetPixelSize( + PixelChannelLayout layout, + ImageChannel channel + ) { return layout switch { diff --git a/StgSharp.Graphics/OpenGL/Buffer/AutoTexture.cs b/StgSharp.Graphics/OpenGL/Buffer/AutoTexture.cs index 3119cb3a..600b4800 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/AutoTexture.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/AutoTexture.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="AutoTexture" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.Graphics; using System; @@ -40,9 +20,9 @@ namespace StgSharp.Graphics.OpenGL { /// /// A collection of a sets of OpenGL textures. The collection can automatically select one of - /// the texture with minimum costs to upgrade pixels to BufferHandle. Usually is used for loading, but not for - /// target of . /// public sealed class AutoTextureGL @@ -60,7 +40,9 @@ namespace StgSharp.Graphics.OpenGL private TextureProperty _textureProperty; - private AutoTextureGL(TextureGL texture) + private AutoTextureGL( + TextureGL texture + ) { texturePackage = texture; _size = texture.Count; @@ -70,7 +52,10 @@ namespace StgSharp.Graphics.OpenGL propertyCache = new TextureProperty[_size]; } - public AutoTextureGL(int textureObjectSize, [NotNull]glRender binding) + public AutoTextureGL( + int textureObjectSize, + [NotNull]glRender binding + ) { this._size = textureObjectSize; imageIndexMap = new BidirectionalDictionary(); @@ -86,20 +71,22 @@ namespace StgSharp.Graphics.OpenGL set => _textureProperty = value; } - private OpenGLFunction GL - { - get => texturePackage.GL; - } + private OpenGLFunction GL => texturePackage.GL; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SelectTextureAndBind(Image i) + public void SelectTextureAndBind( + Image i + ) { TextureProperty property = _textureProperty; SelectTextureAndBind(i, property); } - public void SelectTextureAndBind([NotNull]Image i, TextureProperty property) + public void SelectTextureAndBind( + [NotNull]Image i, + TextureProperty property + ) { // usable texture with image match if (imageIndexMap.TryGetValue(i, out int index)) @@ -148,7 +135,9 @@ namespace StgSharp.Graphics.OpenGL } } - public static AutoTextureGL ToAuto([NotNull]TextureGL texture) + public static AutoTextureGL ToAuto( + [NotNull]TextureGL texture + ) { if (texture.IndexOfCurrentTexture != -1) { throw new InvalidOperationException("Texture to be converted has been editted."); diff --git a/StgSharp.Graphics/OpenGL/Buffer/EBO.cs b/StgSharp.Graphics/OpenGL/Buffer/EBO.cs index b137ca90..53de43dc 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/EBO.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/EBO.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="EBO" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; @@ -40,37 +20,52 @@ using System.Text; namespace StgSharp.Graphics.OpenGL { /// - /// A collection of handle to Element BufferHandle Object in OpenglFunc. Each value indexed from instance of this class this is the only handle to /// one Element BufferHandle Object. /// public sealed unsafe class ElementBuffer : GlBufferObjectBase { - internal ElementBuffer(int n, glRender binding) + internal ElementBuffer( + int n, + glRender binding + ) : base(binding) { _bufferHandle = GL.GenBuffers(n); } - public sealed override void Bind(int index) + public sealed override void Bind( + int index + ) { GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); } - public void SetValue(int index, T[] bufferArray, BufferUsage usage) where T: unmanaged, INumber + public void SetValue( + int index, + T[] bufferArray, + BufferUsage usage + ) where T : unmanaged, INumber { GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); GL.SetBufferData(BufferType.ElementArrayBuffer, bufferArray, usage); } - public void SetValue(int index, ReadOnlySpan bufferSpan, BufferUsage usage) where T: unmanaged, INumber + public void SetValue( + int index, + ReadOnlySpan bufferSpan, + BufferUsage usage + ) where T : unmanaged, INumber { GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); GL.SetBufferData(BufferType.ElementArrayBuffer, bufferSpan, usage); } - protected sealed override void Dispose(bool disposing) + protected sealed override void Dispose( + bool disposing + ) { if (disposing) { GL.DeleteBuffers(_bufferHandle); diff --git a/StgSharp.Graphics/OpenGL/Buffer/FBO.cs b/StgSharp.Graphics/OpenGL/Buffer/FBO.cs index dd295fe8..ccdc68b8 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/FBO.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/FBO.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="FBO" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using System; using System.Collections.Generic; diff --git a/StgSharp.Graphics/OpenGL/Buffer/GLBufferObjectBase.cs b/StgSharp.Graphics/OpenGL/Buffer/GLBufferObjectBase.cs index a3c5c756..fdcfd353 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/GLBufferObjectBase.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/GLBufferObjectBase.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GLBufferObjectBase" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; @@ -38,7 +18,9 @@ namespace StgSharp.Graphics.OpenGL private readonly glRender _contextBinding; - protected GlBufferObjectBase(glRender contextBinding) + protected GlBufferObjectBase( + glRender contextBinding + ) { binding = contextBinding; _contextBinding = contextBinding; diff --git a/StgSharp.Graphics/OpenGL/Buffer/RBO.cs b/StgSharp.Graphics/OpenGL/Buffer/RBO.cs index 13868597..891bdf96 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/RBO.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/RBO.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RBO" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using System; using System.Collections.Generic; @@ -36,25 +16,35 @@ namespace StgSharp.Graphics.OpenGL public sealed class RenderBuffer : GlBufferObjectBase { - public RenderBuffer(int count, glRender binding) + public RenderBuffer( + int count, + glRender binding + ) : base(binding) { _bufferHandle = GL.GenRenderBuffer(count); } - public override void Bind(int index) + public override void Bind( + int index + ) { GL.BindRenderBuffer(this[index]); } - public void Store(RenderBufferInternalFormat format, (int width, int height) size) + public void Store( + RenderBufferInternalFormat format, + (int width, int height) size + ) { if ((size.width > binding.Width) || (size.height > binding.Height)) { World.LogWarning("FrameBuffer is larger than current canvas binding"); } } - protected override void Dispose(bool disposing) + protected override void Dispose( + bool disposing + ) { foreach (GlHandle item in _bufferHandle) { diff --git a/StgSharp.Graphics/OpenGL/Buffer/TextureGL.cs b/StgSharp.Graphics/OpenGL/Buffer/TextureGL.cs index 2750151c..7123fb35 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/TextureGL.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/TextureGL.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TextureGL" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.HighPerformance.ProcessorAbstraction; using StgSharp.Mathematics; @@ -45,38 +25,41 @@ namespace StgSharp.Graphics.OpenGL private OpenGLFunction _gl; internal GlHandle[] _textureHandle; - internal TextureGL(int count, glRender binding) + internal TextureGL( + int count, + glRender binding + ) { // sourceList = new Image[count]; this._gl = binding.GL; _textureHandle = _gl.GenTextures(count); } - public GlHandle this[int index] + public GlHandle this[ + int index + ] { get => _textureHandle[index]; } - public int Count - { - get => _textureHandle.Length; - } + public int Count => _textureHandle.Length; // internal Image[] sourceList; - public int IndexOfCurrentTexture - { - get => currentEditingTextureIndex; - } + public int IndexOfCurrentTexture => currentEditingTextureIndex; internal OpenGLFunction GL => _gl; - public void ActivateAs(TextureUnit unit) + public void ActivateAs( + TextureUnit unit + ) { _gl.ActiveTextureUnit((uint)unit); } - public void Bind2D(int index) + public void Bind2D( + int index + ) { currentEditingTextureIndex = index; _gl.BindTexture(glConst.TEXTURE_2D, _textureHandle[index]); @@ -91,18 +74,25 @@ namespace StgSharp.Graphics.OpenGL /// /// /// - public unsafe void LoadTexture(int index, Image i) + public unsafe void LoadTexture( + int index, + Image i + ) { byte[] handle = i.PixelBuffer; - _gl.TextureImage2d(Texture2DTarget.Texture2D, 0, i.Channel, i.Width, i.Height, i.Channel, i.PixelLayout, - pixels:handle); + _gl.TextureImage2d(Texture2DTarget.Texture2D, 0, i.Channel, i.Width, i.Height, + i.Channel, i.PixelLayout, pixels:handle); _gl.GenerateMipmap(Texture2DTarget.Texture2D); } #region texture setting [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Set2dFilterProperty(int index, TextureFilter onMinify, TextureFilter onMagnify) + public void Set2dFilterProperty( + int index, + TextureFilter onMinify, + TextureFilter onMagnify + ) { #if DEBUG if (index != currentEditingTextureIndex) @@ -117,7 +107,11 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Set2dWrapProperty(int index, TextureWrap onHorizontial, TextureWrap onVertical) + public void Set2dWrapProperty( + int index, + TextureWrap onHorizontial, + TextureWrap onVertical + ) { #if DEBUG if (index != currentEditingTextureIndex) @@ -132,7 +126,10 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Set2dProperty(int index, TextureProperty property) + public void Set2dProperty( + int index, + TextureProperty property + ) { Set2dFilterProperty(index, property.FilterOnMinify, property.FilterOnMagnify); Set2dWrapProperty(index, property.WrapOnHorizontial, property.WrapOnVertical); @@ -156,7 +153,8 @@ namespace StgSharp.Graphics.OpenGL TextureFilter onMagnify, TextureFilter onMinify, TextureWrap onHorizontal, - TextureWrap onVertical) + TextureWrap onVertical + ) { FilterOnMagnify = onMagnify; FilterOnMinify = onMinify; @@ -188,14 +186,17 @@ namespace StgSharp.Graphics.OpenGL set => vert = value; } - public override bool Equals([NotNullWhen(true)] object obj) + public override bool Equals( + [NotNullWhen(true)] object obj + ) { return base.Equals(obj); } public override int GetHashCode() { - return HashCode.Combine(FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, WrapOnVertical); + return HashCode.Combine(FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, + WrapOnVertical); } public override string ToString() @@ -203,12 +204,18 @@ namespace StgSharp.Graphics.OpenGL return $"FilterOnMagnify:{FilterOnMagnify}, " + $"FilterOnMagnify:{FilterOnMagnify}, " + $"WrapOnHorizontial:{WrapOnHorizontial}, " + $"WrapOnVertical:{WrapOnVertical}"; } - public static bool operator !=(TextureProperty left, TextureProperty right) + public static bool operator !=( + TextureProperty left, + TextureProperty right + ) { return left.mask != right.mask; } - public static bool operator ==(TextureProperty left, TextureProperty right) + public static bool operator ==( + TextureProperty left, + TextureProperty right + ) { return left.mask == right.mask; } @@ -217,10 +224,12 @@ namespace StgSharp.Graphics.OpenGL ( TextureFilter onMagnify, TextureFilter onMinify, TextureWrap onHorizontial, TextureWrap onVertical - ) propertyValueTuple) + ) propertyValueTuple + ) { return new TextureProperty(propertyValueTuple.onMagnify, propertyValueTuple.onMinify, - propertyValueTuple.onHorizontial, propertyValueTuple.onVertical); + propertyValueTuple.onHorizontial, + propertyValueTuple.onVertical); } } diff --git a/StgSharp.Graphics/OpenGL/Buffer/VAO.cs b/StgSharp.Graphics/OpenGL/Buffer/VAO.cs index c81649d3..b95e8e28 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/VAO.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/VAO.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="VAO" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using System; using System.Collections.Generic; diff --git a/StgSharp.Graphics/OpenGL/Buffer/VBO.cs b/StgSharp.Graphics/OpenGL/Buffer/VBO.cs index 5451fe87..301e6ec1 100644 --- a/StgSharp.Graphics/OpenGL/Buffer/VBO.cs +++ b/StgSharp.Graphics/OpenGL/Buffer/VBO.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="VBO" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Mathematics; using StgSharp.Mathematics.Numeric; diff --git a/StgSharp.Graphics/OpenGL/ShaderEdit/IglConvertable.cs b/StgSharp.Graphics/OpenGL/ShaderEdit/IglConvertable.cs index b555891b..9b062825 100644 --- a/StgSharp.Graphics/OpenGL/ShaderEdit/IglConvertable.cs +++ b/StgSharp.Graphics/OpenGL/ShaderEdit/IglConvertable.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IglConvertable" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; @@ -46,7 +26,10 @@ namespace StgSharp.Graphics.ShaderEdit /// /// /// - public void GainAllUniforms(ShaderProgram source, params string[] uniformName); + public void GainAllUniforms( + ShaderProgram source, + params string[] uniformName + ); /// /// diff --git a/StgSharp.Graphics/OpenGL/ShaderEdit/Shader.cs b/StgSharp.Graphics/OpenGL/ShaderEdit/Shader.cs index fdddf91c..77e6f2b5 100644 --- a/StgSharp.Graphics/OpenGL/ShaderEdit/Shader.cs +++ b/StgSharp.Graphics/OpenGL/ShaderEdit/Shader.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Shader" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp; using StgSharp.Graphics; using StgSharp.Internal; diff --git a/StgSharp.Graphics/OpenGL/ShaderEdit/Uniform.cs b/StgSharp.Graphics/OpenGL/ShaderEdit/Uniform.cs index 76fc46e3..b48d4da8 100644 --- a/StgSharp.Graphics/OpenGL/ShaderEdit/Uniform.cs +++ b/StgSharp.Graphics/OpenGL/ShaderEdit/Uniform.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Uniform" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Mathematics.Graphics; using System.Diagnostics.CodeAnalysis; diff --git a/StgSharp.Graphics/OpenGL/glApiManager.Const.cs b/StgSharp.Graphics/OpenGL/glApiManager.Const.cs index ccea2fc6..43eba299 100644 --- a/StgSharp.Graphics/OpenGL/glApiManager.Const.cs +++ b/StgSharp.Graphics/OpenGL/glApiManager.Const.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glApiManagerConst" +// ----------------------------------------------------------------------------- +// file="glApiManager.Const" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Text; diff --git a/StgSharp.Graphics/OpenGL/glApiManager.Load.cs b/StgSharp.Graphics/OpenGL/glApiManager.Load.cs index c4686dff..d6b7d4d8 100644 --- a/StgSharp.Graphics/OpenGL/glApiManager.Load.cs +++ b/StgSharp.Graphics/OpenGL/glApiManager.Load.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glApiManager.Load" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using System; using System.Runtime.CompilerServices; @@ -36,7 +16,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore10( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core10) { @@ -103,7 +84,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore11( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core11) { @@ -145,7 +127,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore12( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core12) { @@ -172,7 +155,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore13( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core13) { @@ -208,7 +192,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore14( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core14) { @@ -244,7 +229,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore15( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core15) { @@ -289,7 +275,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore20( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core20) { @@ -467,7 +454,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore21( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core21) { @@ -498,7 +486,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore30( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core30) { @@ -667,7 +656,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore31( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core31) { @@ -715,7 +705,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore32( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core32) { @@ -765,7 +756,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore33( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core33) { @@ -836,7 +828,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore40( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core40) { @@ -938,7 +931,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore41( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core41) { @@ -1130,7 +1124,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore42( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core42) { @@ -1172,7 +1167,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore43( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core43) { @@ -1278,7 +1274,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore44( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core44) { @@ -1315,7 +1312,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore45( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core45) { @@ -1550,7 +1548,8 @@ namespace StgSharp.Graphics.OpenGL internal static unsafe bool LoadGLcore46( glContextShadow* contextPtr, - delegate*, IntPtr> load) + delegate*, IntPtr> load + ) { if (!core46) { @@ -1576,7 +1575,10 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static unsafe IntPtr LoadGLFunction(delegate*, IntPtr> load, ReadOnlySpan name) + private static unsafe IntPtr LoadGLFunction( + delegate*, IntPtr> load, + ReadOnlySpan name + ) { IntPtr ptr = load(name); if (ptr == IntPtr.Zero) { diff --git a/StgSharp.Graphics/OpenGL/glApiManager.cs b/StgSharp.Graphics/OpenGL/glApiManager.cs index 1b5a0848..d9a9bf74 100644 --- a/StgSharp.Graphics/OpenGL/glApiManager.cs +++ b/StgSharp.Graphics/OpenGL/glApiManager.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glApiManager" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Internal; using StgSharp.Mathematics; using StgSharp.Mathematics; diff --git a/StgSharp.Graphics/OpenGL/glConst.cs b/StgSharp.Graphics/OpenGL/glConst.cs index d2719020..eb616426 100644 --- a/StgSharp.Graphics/OpenGL/glConst.cs +++ b/StgSharp.Graphics/OpenGL/glConst.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glConst" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Drawing; @@ -4548,7 +4528,9 @@ namespace StgSharp.Graphics.OpenGL public const uint DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT; public const uint Stencil = glConst.STENCIL_ATTACHMENT; - public static uint Color(int i) + public static uint Color( + int i + ) { #if DEBUG if ((i > OpenGLFunction.CurrentGL.AttachmentColorRange) || (i < 0)) diff --git a/StgSharp.Graphics/OpenGL/glContext.cs b/StgSharp.Graphics/OpenGL/glContext.cs index ee76cc8d..0a53fd7b 100644 --- a/StgSharp.Graphics/OpenGL/glContext.cs +++ b/StgSharp.Graphics/OpenGL/glContext.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glContext" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glContextShadow.cs b/StgSharp.Graphics/OpenGL/glContextShadow.cs index b5cf4bce..9d3542bd 100644 --- a/StgSharp.Graphics/OpenGL/glContextShadow.cs +++ b/StgSharp.Graphics/OpenGL/glContextShadow.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glContextShadow" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Graphics/OpenGL/glEnum.cs b/StgSharp.Graphics/OpenGL/glEnum.cs index 9ab945b4..342b93f2 100644 --- a/StgSharp.Graphics/OpenGL/glEnum.cs +++ b/StgSharp.Graphics/OpenGL/glEnum.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glEnum" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Runtime.CompilerServices; namespace StgSharp.Graphics.OpenGL diff --git a/StgSharp.Graphics/OpenGL/glException.cs b/StgSharp.Graphics/OpenGL/glException.cs index 2cf1906b..6f6650ad 100644 --- a/StgSharp.Graphics/OpenGL/glException.cs +++ b/StgSharp.Graphics/OpenGL/glException.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glException" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics; @@ -38,7 +18,10 @@ namespace StgSharp.Graphics.OpenGL public sealed class GlErrorOverflowException : Exception { - public GlErrorOverflowException(int errorCount, uint errorCode) + public GlErrorOverflowException( + int errorCount, + uint errorCode + ) : base( "Too many opengl error detected at certain position. " + $"The amount of errors exceeds {errorCount}. " + $"Code of the last error is {errorCode}") { } @@ -47,20 +30,37 @@ namespace StgSharp.Graphics.OpenGL public sealed class GlExecutionException : Exception { - public GlExecutionException(uint errorCode) : base($"Critical OpenGL error: {errorCode}") { } + public GlExecutionException( + uint errorCode + ) + : base($"Critical OpenGL error: {errorCode}") { } } public sealed class GlArrayFormatException : Exception { - internal GlArrayFormatException(string message) : base(message) { } + internal GlArrayFormatException( + string message + ) + : base(message) { } - internal GlArrayFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { } + internal GlArrayFormatException( + SerializationInfo info, + StreamingContext context + ) + : base(info, context) { } - internal GlArrayFormatException(string message, Exception innerException) : base(message, innerException) { } + internal GlArrayFormatException( + string message, + Exception innerException + ) + : base(message, innerException) { } - public GlArrayFormatException(PixelChannelLayout layout, string arrayname) + public GlArrayFormatException( + PixelChannelLayout layout, + string arrayname + ) : base($"{arrayname} cannot be used as layout of {layout}") { } } @@ -68,7 +68,10 @@ namespace StgSharp.Graphics.OpenGL public static partial class GlHelper { - public static bool CheckArrayFormat(this Array array, PixelChannelLayout layout) + public static bool CheckArrayFormat( + this Array array, + PixelChannelLayout layout + ) { return layout switch { diff --git a/StgSharp.Graphics/OpenGL/glFunction.SourceManager.cs b/StgSharp.Graphics/OpenGL/glFunction.SourceManager.cs index 5d967a96..c8b9bf7f 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.SourceManager.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.SourceManager.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glFucntionSourceManager" +// ----------------------------------------------------------------------------- +// file="glFunction.SourceManager" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp; using System; @@ -39,11 +19,7 @@ namespace StgSharp.Graphics.OpenGL private readonly int textureUnitCountGetter; - public int TextureUnitCount - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => textureUnitCountGetter; - } + public int TextureUnitCount => textureUnitCountGetter; private ConcurrentQueue UnusedTextureImageUint { @@ -51,7 +27,9 @@ namespace StgSharp.Graphics.OpenGL get; } = []; - internal void ReturnAvailableUnit(IEnumerable source) + internal void ReturnAvailableUnit( + IEnumerable source + ) { int v = glConst.TEXTURE0 + TextureUnitCount; foreach (TextureUnit unit in source) @@ -63,7 +41,10 @@ namespace StgSharp.Graphics.OpenGL } } - internal int TryGetAvailableTextureUnit(int count, out IEnumerable result) + internal int TryGetAvailableTextureUnit( + int count, + out IEnumerable result + ) { result = new Queue(); for (int i = 0; i < count; i++) diff --git a/StgSharp.Graphics/OpenGL/glFunction.cs b/StgSharp.Graphics/OpenGL/glFunction.cs index 1e712421..717d3ce5 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics; using StgSharp.Internal; @@ -58,14 +38,10 @@ namespace StgSharp.Graphics.OpenGL textureUnitCountGetter = glConst.MAX_TEXTURE_IMAGE_UNITS; UnusedTextureImageUint = []; _attachmentColorRange = new Lazy( - () => { return GetMaskInteger((uint)glConst.MAX_COLOR_ATTACHMENTS); }); + () => GetMaskInteger((uint)glConst.MAX_COLOR_ATTACHMENTS)); } - public int AttachmentColorRange - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _attachmentColorRange.Value; - } + public int AttachmentColorRange => _attachmentColorRange.Value; public static OpenGLFunction CurrentGL { @@ -121,7 +97,7 @@ namespace StgSharp.Graphics.OpenGL /// /// Bind a frame BufferHandle to a frame BufferHandle target Same function as glBindFramebuffer. + /// /// href="https://docs._gl/gl3/glBindFramebuffer"> glBindFramebuffer . /// /// /// The frame BufferHandle target of the binding operation. @@ -270,9 +246,10 @@ namespace StgSharp.Graphics.OpenGL } /// - /// Delete a render BufferHandle object Very simlilar function as glDeleteRenderbuffers. The only - /// deifference is that this mehtod can only delete one renderbuffer at the same time. + /// Delete a render BufferHandle object Very simlilar function as glDeleteRenderbuffers . The + /// only deifference is that this mehtod can only delete one renderbuffer at the same + /// time. /// /// /// Handle to BufferHandle to delete. diff --git a/StgSharp.Graphics/OpenGL/glFunction.v3_3.cs b/StgSharp.Graphics/OpenGL/glFunction.v3_3.cs index f20162dd..836e7108 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v3_3.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v3_3.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v3_3" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; @@ -253,8 +233,8 @@ namespace StgSharp.Graphics.OpenGL uint filter ) { - _context->glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, - filter); + _context->glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, + mask, filter); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -436,7 +416,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* dataPtr = data) { _context->glCompressedTexImage1D(target, level, internalformat, width, border, - imageSize, dataPtr); + imageSize, dataPtr); } } @@ -453,8 +433,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (IntPtr* dataPtr = data) { - _context->glCompressedTexImage2D(target, level, internalformat, width, height, border, - imageSize, dataPtr); + _context->glCompressedTexImage2D(target, level, internalformat, width, height, + border, imageSize, dataPtr); } } @@ -472,8 +452,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (IntPtr* dataPtr = data) { - _context->glCompressedTexImage3D(target, level, internalformat, width, height, depth, - border, imageSize, dataPtr); + _context->glCompressedTexImage3D(target, level, internalformat, width, height, + depth, border, imageSize, dataPtr); } } @@ -489,8 +469,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (IntPtr* dataPtr = data) { - _context->glCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, - dataPtr); + _context->glCompressedTexSubImage1D(target, level, xoffset, width, format, + imageSize, dataPtr); } } @@ -509,7 +489,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* dataPtr = data) { _context->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, - format, imageSize, dataPtr); + format, imageSize, dataPtr); } } @@ -530,7 +510,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* dataPtr = data) { _context->glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, - height, depth, format, imageSize, dataPtr); + height, depth, format, imageSize, dataPtr); } } @@ -617,7 +597,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, - height); + height); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -879,7 +859,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (IntPtr* indicesPtr = indices) { - _context->glDrawElementsInstanced(mode, count, (uint)type, indicesPtr, instancecount); + _context->glDrawElementsInstanced(mode, count, (uint)type, indicesPtr, + instancecount); } } @@ -895,7 +876,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* indicesPtr = indices) { _context->glDrawElementsInstancedBaseVertex(mode, count, (uint)type, indicesPtr, - instancecount, basevertex); + instancecount, basevertex); } } @@ -927,7 +908,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* indicesPtr = indices) { _context->glDrawRangeElementsBaseVertex(mode, start, end, count, (uint)type, - indicesPtr, basevertex); + indicesPtr, basevertex); } } @@ -1016,7 +997,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glFramebufferRenderbuffer(target, attachment, renderbuffertarget, - renderbuffer.Value); + renderbuffer.Value); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1065,7 +1046,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glFramebufferTexture3D(target, attachment, textarget, texture.Value, level, - zoffset); + zoffset); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1209,7 +1190,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glGetActiveUniformBlockName(program.Value, uniformBlockIndex, bufSize, length, - uniformBlockName); + uniformBlockName); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1222,7 +1203,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glGetActiveUniformName(program.Value, uniformIndex, bufSize, length, - uniformName); + uniformName); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1235,8 +1216,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (uint* uniformIndicesPtr = uniformIndices) { - _context->glGetActiveUniformsiv(program.Value, uniformCount, uniformIndicesPtr, pname, - @params); + _context->glGetActiveUniformsiv(program.Value, uniformCount, uniformIndicesPtr, + pname, @params); } } @@ -1604,7 +1585,8 @@ namespace StgSharp.Graphics.OpenGL uint index ) { - return Marshal.PtrToStringAuto((nint)_context->glGetStringi(name, index)) ?? string.Empty; + return Marshal.PtrToStringAuto((nint)_context->glGetStringi(name, index)) ?? + string.Empty; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1704,8 +1686,8 @@ namespace StgSharp.Graphics.OpenGL byte* name ) { - _context->glGetTransformFeedbackVarying(program.Value, index, bufSize, length, size, type, - name); + _context->glGetTransformFeedbackVarying(program.Value, index, bufSize, length, size, + type, name); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1739,7 +1721,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (byte* uniformNamesPtr = uniformNames) { _context->glGetUniformIndices(program.Value, uniformCount, uniformNamesPtr, - uniformIndices); + uniformIndices); } } @@ -2012,7 +1994,8 @@ namespace StgSharp.Graphics.OpenGL fixed (int* countPtr = count) { fixed (IntPtr* indicesPtr = indices) { - _context->glMultiDrawElements(mode, countPtr, (uint)type, indicesPtr, drawcount); + _context->glMultiDrawElements(mode, countPtr, (uint)type, indicesPtr, + drawcount); } } } @@ -2033,7 +2016,8 @@ namespace StgSharp.Graphics.OpenGL { fixed (int* basevertexPtr = basevertex) { _context->glMultiDrawElementsBaseVertex(mode, countPtr, (uint)type, - indicesPtr, drawcount, basevertexPtr); + indicesPtr, drawcount, + basevertexPtr); } } } @@ -2191,7 +2175,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glRenderbufferStorageMultisample(target, samples, internalformat, width, - height); + height); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -2391,7 +2375,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexImage1D(target, level, internalformat, width, border, format, - (uint)type, pixelsPtr); + (uint)type, pixelsPtr); } } @@ -2410,7 +2394,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexImage2D(target, level, internalformat, width, height, border, format, - (uint)type, pixelsPtr); + (uint)type, pixelsPtr); } } @@ -2425,7 +2409,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glTexImage2DMultisample(target, samples, internalformat, width, height, - fixedsamplelocations); + fixedsamplelocations); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -2444,7 +2428,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexImage3D(target, level, internalformat, width, height, depth, border, - format, (uint)type, pixelsPtr); + format, (uint)type, pixelsPtr); } } @@ -2460,7 +2444,7 @@ namespace StgSharp.Graphics.OpenGL ) { _context->glTexImage3DMultisample(target, samples, internalformat, width, height, depth, - fixedsamplelocations); + fixedsamplelocations); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -2544,7 +2528,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexSubImage1D(target, level, xoffset, width, format, (uint)type, - pixelsPtr); + pixelsPtr); } } @@ -2563,7 +2547,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, - (uint)type, pixelsPtr); + (uint)type, pixelsPtr); } } @@ -2584,7 +2568,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pixelsPtr = pixels) { _context->glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, - depth, format, (uint)type, pixelsPtr); + depth, format, (uint)type, pixelsPtr); } } @@ -2597,7 +2581,8 @@ namespace StgSharp.Graphics.OpenGL ) { fixed (byte* varyingsPtr = varyings) { - _context->glTransformFeedbackVaryings(program.Value, count, varyingsPtr, bufferMode); + _context->glTransformFeedbackVaryings(program.Value, count, varyingsPtr, + bufferMode); } } @@ -3760,7 +3745,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (IntPtr* pointerPtr = pointer) { _context->glVertexAttribPointer(index, size, (uint)type, normalized, stride, - pointerPtr); + pointerPtr); } } diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_0.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_0.cs index 236ea9dd..10dc39d1 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_0.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_0.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_0" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_1.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_1.cs index 82810d51..aecc4184 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_1.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_1.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_1" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_2.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_2.cs index 666c5168..f36b350d 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_2.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_2.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_2" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_3.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_3.cs index 73c3de2a..32cd77a9 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_3.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_3.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_3" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_4.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_4.cs index 2ebcc672..ae453334 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_4.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_4.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_4" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_5.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_5.cs index 9e72156d..86f79d34 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_5.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_5.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_5" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glFunction.v4_6.cs b/StgSharp.Graphics/OpenGL/glFunction.v4_6.cs index f7bcec58..b975f848 100644 --- a/StgSharp.Graphics/OpenGL/glFunction.v4_6.cs +++ b/StgSharp.Graphics/OpenGL/glFunction.v4_6.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glFunction.v4_6" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/OpenGL/glHandle.cs b/StgSharp.Graphics/OpenGL/glHandle.cs index 4f0c2f7f..70be7b38 100644 --- a/StgSharp.Graphics/OpenGL/glHandle.cs +++ b/StgSharp.Graphics/OpenGL/glHandle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glHandle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Data.Common; @@ -53,17 +33,15 @@ namespace StgSharp.Graphics.OpenGL Unsafe.SkipInit(out this); } - public static GlHandle Zero + public static GlHandle Zero => new GlHandle { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => new GlHandle - { - Value = 0 - }; - } + Value = 0 + }; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GlHandle Create(uint value) + public static GlHandle Create( + uint value + ) { return new GlHandle { @@ -72,7 +50,9 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GlHandle CreateSigned(int value) + public static GlHandle CreateSigned( + int value + ) { return new GlHandle { diff --git a/StgSharp.Graphics/OpenGL/glRenderObjectGenrator.cs b/StgSharp.Graphics/OpenGL/glRenderObjectGenrator.cs index 7e5eb4d8..5edf3a2a 100644 --- a/StgSharp.Graphics/OpenGL/glRenderObjectGenrator.cs +++ b/StgSharp.Graphics/OpenGL/glRenderObjectGenrator.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glRenderObjectGenrator" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -39,7 +19,9 @@ namespace StgSharp.Graphics.OpenGL { [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected AutoTextureGL CreateAutoTexture(int count) + protected AutoTextureGL CreateAutoTexture( + int count + ) { return new AutoTextureGL(count, this); } @@ -54,19 +36,25 @@ namespace StgSharp.Graphics.OpenGL /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected ElementBuffer CreateElementBuffer(int count) + protected ElementBuffer CreateElementBuffer( + int count + ) { return new ElementBuffer(count, this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected FrameBuffer CreateFrameBuffer(int count) + protected FrameBuffer CreateFrameBuffer( + int count + ) { return new FrameBuffer(count, this); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected RenderBuffer CreateRenderBuffer(int count) + protected RenderBuffer CreateRenderBuffer( + int count + ) { return new RenderBuffer(count, this); } @@ -81,7 +69,9 @@ namespace StgSharp.Graphics.OpenGL /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected TextureGL CreateTexture(int count) + protected TextureGL CreateTexture( + int count + ) { return new TextureGL(count, this); } @@ -96,7 +86,9 @@ namespace StgSharp.Graphics.OpenGL /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected VertexArray CreateVertexArray(int count) + protected VertexArray CreateVertexArray( + int count + ) { return new VertexArray(count, this); } @@ -111,7 +103,9 @@ namespace StgSharp.Graphics.OpenGL /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected VertexBuffer CreateVertexBuffer(int count) + protected VertexBuffer CreateVertexBuffer( + int count + ) { return new VertexBuffer(count, this); } diff --git a/StgSharp.Graphics/OpenGL/glRenderStream.ThreadSecurity.cs b/StgSharp.Graphics/OpenGL/glRenderStream.ThreadSecurity.cs index 4476103d..0ba884bf 100644 --- a/StgSharp.Graphics/OpenGL/glRenderStream.ThreadSecurity.cs +++ b/StgSharp.Graphics/OpenGL/glRenderStream.ThreadSecurity.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glRenderThreadSecurity" +// ----------------------------------------------------------------------------- +// file="glRenderStream.ThreadSecurity" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/StgSharp.Graphics/OpenGL/glRenderStream.cs b/StgSharp.Graphics/OpenGL/glRenderStream.cs index 8abdae29..88e2ef3a 100644 --- a/StgSharp.Graphics/OpenGL/glRenderStream.cs +++ b/StgSharp.Graphics/OpenGL/glRenderStream.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glRenderStream" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; using StgSharp.Threading; @@ -138,8 +118,8 @@ namespace StgSharp.Graphics.OpenGL } protected sealed override Uniform NativeCameraUniform( - ShaderProgram source, - string name + ShaderProgram source, + string name ) { NativeCamera.GainAllUniforms(source, name); diff --git a/StgSharp.Graphics/OpenGL/glType.cs b/StgSharp.Graphics/OpenGL/glType.cs index f430fbad..3c540569 100644 --- a/StgSharp.Graphics/OpenGL/glType.cs +++ b/StgSharp.Graphics/OpenGL/glType.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glType" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/StgSharp.Graphics/Pixels.cs b/StgSharp.Graphics/Pixels.cs index c72ef34b..9b9c4edb 100644 --- a/StgSharp.Graphics/Pixels.cs +++ b/StgSharp.Graphics/Pixels.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Pixels" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -56,7 +36,9 @@ namespace StgSharp.Graphics public readonly int Size => 4; - public override bool Equals(object obj) + public override bool Equals( + object obj + ) { return obj is not null && obj is Pixel32RGBA pixel && this == pixel; } @@ -66,12 +48,18 @@ namespace StgSharp.Graphics return mask.GetHashCode(); } - public static bool operator !=(Pixel32RGBA left, Pixel32RGBA right) + public static bool operator !=( + Pixel32RGBA left, + Pixel32RGBA right + ) { return !(left == right); } - public static bool operator ==(Pixel32RGBA left, Pixel32RGBA right) + public static bool operator ==( + Pixel32RGBA left, + Pixel32RGBA right + ) { return left.mask == right.mask; } diff --git a/StgSharp.Graphics/PlainGeometryMesh.cs b/StgSharp.Graphics/PlainGeometryMesh.cs index cb4e5ad2..4d66bfe0 100644 --- a/StgSharp.Graphics/PlainGeometryMesh.cs +++ b/StgSharp.Graphics/PlainGeometryMesh.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PlainGeometryMesh" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Geometries; using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Graphics/RenderStream.cs b/StgSharp.Graphics/RenderStream.cs index eb1544c3..315fd11e 100644 --- a/StgSharp.Graphics/RenderStream.cs +++ b/StgSharp.Graphics/RenderStream.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RenderStream" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics.OpenGL; using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Graphics/ShaderEdit/ShaderGenerator.cs b/StgSharp.Graphics/ShaderEdit/ShaderGenerator.cs index 4850604f..6b0f18da 100644 --- a/StgSharp.Graphics/ShaderEdit/ShaderGenerator.cs +++ b/StgSharp.Graphics/ShaderEdit/ShaderGenerator.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ShaderGenerator" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using StgSharp.Mathematics; @@ -45,7 +25,10 @@ namespace StgSharp.Graphics.ShaderEdit private List codeList; private List usedShaderFunctions; - public Uniform DefineUniform(string name, int index) where T: unmanaged + public Uniform DefineUniform( + string name, + int index + ) where T : unmanaged { ShaderParameter p = new ShaderParameter(name, ShaderParameter.TypeMarshal()); uniformDefine.Add(index, p); @@ -66,7 +49,11 @@ namespace StgSharp.Graphics.ShaderEdit public int ParameterCount => inputList.Count; - public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams) + public void EmitCall( + ShaderFunction function, + ShaderParameter outPut, + params ShaderParameter[] inputParams + ) { if (inputParams.Length != function.ParameterCount) { @@ -112,14 +99,20 @@ namespace StgSharp.Graphics.ShaderEdit internal readonly InternalShaderType type; internal readonly string name; - public ShaderParameter(string name, InternalShaderType type) + public ShaderParameter( + string name, + InternalShaderType type + ) { this.name = name; this.type = type; isReadOnly = false; } - public static bool IsSameType(ShaderParameter param1, ShaderParameter param2) + public static bool IsSameType( + ShaderParameter param1, + ShaderParameter param2 + ) { if (param1.type != InternalShaderType.Struct) { @@ -130,7 +123,7 @@ namespace StgSharp.Graphics.ShaderEdit } } - public static InternalShaderType TypeMarshal() where T: unmanaged + public static InternalShaderType TypeMarshal() where T : unmanaged { switch (Type.GetTypeCode(typeof(T))) { diff --git a/StgSharp.Graphics/ShaderEdit/ShaderStruct.cs b/StgSharp.Graphics/ShaderEdit/ShaderStruct.cs index bc75b401..6790134f 100644 --- a/StgSharp.Graphics/ShaderEdit/ShaderStruct.cs +++ b/StgSharp.Graphics/ShaderEdit/ShaderStruct.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ShaderStruct" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; @@ -51,7 +31,9 @@ namespace StgSharp.Graphics.ShaderEdit internal ShaderStruct() { } - public ShaderStruct(params (GlHandle, ShaderStructMember)[] uniformPairs) + public ShaderStruct( + params (GlHandle, ShaderStructMember)[] uniformPairs + ) { uniformPair = new Dictionary(); if (uniformPairs.Length == 0) { diff --git a/StgSharp.Graphics/TexturePipeline.cs b/StgSharp.Graphics/TexturePipeline.cs index 3f43390e..a49fab59 100644 --- a/StgSharp.Graphics/TexturePipeline.cs +++ b/StgSharp.Graphics/TexturePipeline.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TexturePipeline" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.PipeLine; using System; @@ -40,7 +20,9 @@ namespace StgSharp.Graphics private Image _value; - public TexturePipeline(Image i) + public TexturePipeline( + Image i + ) { _value = i; } diff --git a/StgSharp.Graphics/TextureProvider.cs b/StgSharp.Graphics/TextureProvider.cs index 20c82578..062b9a57 100644 --- a/StgSharp.Graphics/TextureProvider.cs +++ b/StgSharp.Graphics/TextureProvider.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TextureProvider" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using System; @@ -56,11 +36,7 @@ namespace StgSharp.Graphics get => ref _texCoord[index]; } - public Span TextureCoordinate - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => new Span(_texCoord); - } + public Span TextureCoordinate => new Span(_texCoord); public Image ProvideImage() { diff --git a/StgSharp.Graphics/ViewPort.cs b/StgSharp.Graphics/ViewPort.cs index d79221db..598396de 100644 --- a/StgSharp.Graphics/ViewPort.cs +++ b/StgSharp.Graphics/ViewPort.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ViewPort" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Concurrent; using System.Diagnostics; diff --git a/StgSharp.Graphics/Vulkan/vkEnum.cs b/StgSharp.Graphics/Vulkan/vkEnum.cs index abac24ca..c780eb4b 100644 --- a/StgSharp.Graphics/Vulkan/vkEnum.cs +++ b/StgSharp.Graphics/Vulkan/vkEnum.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="vkEnum" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Text; diff --git a/StgSharp.Graphics/Vulkan/vkHandle.cs b/StgSharp.Graphics/Vulkan/vkHandle.cs index db4bd73d..46d6910b 100644 --- a/StgSharp.Graphics/Vulkan/vkHandle.cs +++ b/StgSharp.Graphics/Vulkan/vkHandle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="vkHandle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Graphics/framework.cs b/StgSharp.Graphics/framework.cs index 87bf5aae..e2b59cf2 100644 --- a/StgSharp.Graphics/framework.cs +++ b/StgSharp.Graphics/framework.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="framework" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.InteropServices; diff --git a/StgSharp.Graphics/frameworkSyncContext.cs b/StgSharp.Graphics/frameworkSyncContext.cs index 6644605c..d838be67 100644 --- a/StgSharp.Graphics/frameworkSyncContext.cs +++ b/StgSharp.Graphics/frameworkSyncContext.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="frameworkSyncContext" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -54,12 +34,18 @@ namespace StgSharp.Threading get; } = new FrameworkSyncContext(); - public override void Post(SendOrPostCallback d, object state) + public override void Post( + SendOrPostCallback d, + object state + ) { _syncContexts.Add(d); } - public override void Send(SendOrPostCallback d, object state) + public override void Send( + SendOrPostCallback d, + object state + ) { if (Thread.CurrentThread == _mainThread) { diff --git a/StgSharp.Graphics/gl.cs b/StgSharp.Graphics/gl.cs index 6d592c07..922f9821 100644 --- a/StgSharp.Graphics/gl.cs +++ b/StgSharp.Graphics/gl.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="gl.cs" +// ----------------------------------------------------------------------------- +// file="gl" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using StgSharp.Internal; @@ -55,41 +32,62 @@ namespace StgSharp.Graphics } [LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")] - [UnmanagedCallConv(CallConvs = [ typeof(CallConvCdecl) ])] + [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] #pragma warning disable CA5392 internal static partial int glCheckShaderStatus( ref OpenglContext context, uint shaderHandle, int key, - ref IntPtr logPtr); + ref IntPtr logPtr + ); #pragma warning restore CA5392 #region ssgc api define [LibraryImport(Native.LibName, EntryPoint = "initGL")] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] - internal static partial void InternalInitGL(int majorVersion, int minorVersion); + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] + internal static partial void InternalInitGL( + int majorVersion, + int minorVersion + ); - [LibraryImport(Native.LibName, EntryPoint = "loadGlfuncDefault", StringMarshalling = StringMarshalling.Utf8)] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] - internal static partial IntPtr InternalLoadGlFuncDefault(string name); + [LibraryImport( + Native.LibName, + EntryPoint = "loadGlfuncDefault", + StringMarshalling = StringMarshalling.Utf8)] + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] + internal static partial IntPtr InternalLoadGlFuncDefault( + string name + ); [LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] - internal static unsafe partial uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram); + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] + internal static unsafe partial uint InternalLinkShaderProgram( + OpenglContext* context, + uint shaderProgram + ); [LibraryImport(Native.LibName, EntryPoint = "readLog")] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] internal static unsafe partial IntPtr InternalReadSSCLog(); - [LibraryImport(Native.LibName, EntryPoint = "loadImageData", StringMarshalling = StringMarshalling.Utf8)] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] - internal static unsafe partial void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader); + [LibraryImport( + Native.LibName, + EntryPoint = "loadImageData", + StringMarshalling = StringMarshalling.Utf8)] + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] + internal static unsafe partial void InternalLoadImage( + string fileName, + ImageInfo* output, + ImageLoader loader + ); [LibraryImport(Native.LibName, EntryPoint = "unloadImageData")] - [UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])] - internal static unsafe partial void InternalUnloadImage(ImageInfo* output); + [UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])] + internal static unsafe partial void InternalUnloadImage( + ImageInfo* output + ); #endregion ssgc api define } diff --git a/StgSharp.Graphics/glfw.cs b/StgSharp.Graphics/glfw.cs index ac6e3c70..7906278c 100644 --- a/StgSharp.Graphics/glfw.cs +++ b/StgSharp.Graphics/glfw.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glfw" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Internal; using System; using System.Runtime.CompilerServices; diff --git a/StgSharp.Graphics/glfw.dtruct.cs b/StgSharp.Graphics/glfw.dtruct.cs index fce7234a..f956dc09 100644 --- a/StgSharp.Graphics/glfw.dtruct.cs +++ b/StgSharp.Graphics/glfw.dtruct.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="StructDefine" +// ----------------------------------------------------------------------------- +// file="glfw.dtruct" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; diff --git a/StgSharp.Graphics/glfw.function.cs b/StgSharp.Graphics/glfw.function.cs index c82fb862..50283218 100644 --- a/StgSharp.Graphics/glfw.function.cs +++ b/StgSharp.Graphics/glfw.function.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="glfw.function" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/StgSharp.Mathematics/AssemblyInfo.cs b/StgSharp.Mathematics/AssemblyInfo.cs index 3c6e853e..1ff331e7 100644 --- a/StgSharp.Mathematics/AssemblyInfo.cs +++ b/StgSharp.Mathematics/AssemblyInfo.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="AssemblyInfo" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + global using StgSharp.Internal; global using StgSharp.Mathematics.Internal; global using System; diff --git a/StgSharp.Mathematics/Geometries/Coordination/CoordinationBase.cs b/StgSharp.Mathematics/Geometries/Coordination/CoordinationBase.cs index 3faa49c4..c81c017e 100644 --- a/StgSharp.Mathematics/Geometries/Coordination/CoordinationBase.cs +++ b/StgSharp.Mathematics/Geometries/Coordination/CoordinationBase.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CoordinationBase" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using System.Runtime.CompilerServices; diff --git a/StgSharp.Mathematics/Geometries/Coordination/PlainCoordinate.cs b/StgSharp.Mathematics/Geometries/Coordination/PlainCoordinate.cs index de0b13bb..e4a28ce3 100644 --- a/StgSharp.Mathematics/Geometries/Coordination/PlainCoordinate.cs +++ b/StgSharp.Mathematics/Geometries/Coordination/PlainCoordinate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PlainCoordinate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Mathematics/Geometries/Coordination/SpaceCoordinate.cs b/StgSharp.Mathematics/Geometries/Coordination/SpaceCoordinate.cs index b0566805..6df10b73 100644 --- a/StgSharp.Mathematics/Geometries/Coordination/SpaceCoordinate.cs +++ b/StgSharp.Mathematics/Geometries/Coordination/SpaceCoordinate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SpaceCoordinate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -37,7 +17,13 @@ namespace StgSharp.Geometries public class SpaceCoordinate : CoordinationBase { - public SpaceCoordinate(CoordinationBase localCoordination, Point origin, Vec3 xAxis, Vec3 yAxis, Vec3 zAxis) + public SpaceCoordinate( + CoordinationBase localCoordination, + Point origin, + Vec3 xAxis, + Vec3 yAxis, + Vec3 zAxis + ) : base(localCoordination) { } } diff --git a/StgSharp.Mathematics/Geometries/Coordination/StreamLocalCoordinate.cs b/StgSharp.Mathematics/Geometries/Coordination/StreamLocalCoordinate.cs index 94b989f9..08455e8c 100644 --- a/StgSharp.Mathematics/Geometries/Coordination/StreamLocalCoordinate.cs +++ b/StgSharp.Mathematics/Geometries/Coordination/StreamLocalCoordinate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="StreamLocalCoordinate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using System; diff --git a/StgSharp.Mathematics/Geometries/GemoryException.cs b/StgSharp.Mathematics/Geometries/GemoryException.cs index d8117f18..92ab6313 100644 --- a/StgSharp.Mathematics/Geometries/GemoryException.cs +++ b/StgSharp.Mathematics/Geometries/GemoryException.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GemoryException" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.Serialization; @@ -33,13 +13,24 @@ namespace StgSharp.Geometries public unsafe class ToUpperDimensionException : Exception { - protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context) { } + protected ToUpperDimensionException( + SerializationInfo info, + StreamingContext context + ) + : base(info, context) { } public ToUpperDimensionException() { } - public ToUpperDimensionException(string message) : base(message) { } + public ToUpperDimensionException( + string message + ) + : base(message) { } - public ToUpperDimensionException(string message, Exception innerException) : base(message, innerException) { } + public ToUpperDimensionException( + string message, + Exception innerException + ) + : base(message, innerException) { } } @@ -49,13 +40,24 @@ namespace StgSharp.Geometries public class UnusedVertexException : Exception { - protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context) { } + protected UnusedVertexException( + SerializationInfo info, + StreamingContext context + ) + : base(info, context) { } public UnusedVertexException() { } - public UnusedVertexException(string message) : base(message) { } + public UnusedVertexException( + string message + ) + : base(message) { } - public UnusedVertexException(string message, Exception innerException) : base(message, innerException) { } + public UnusedVertexException( + string message, + Exception innerException + ) + : base(message, innerException) { } } } diff --git a/StgSharp.Mathematics/Geometries/GeometryOperation/GeometryOperation.cs b/StgSharp.Mathematics/Geometries/GeometryOperation/GeometryOperation.cs index 06522aea..74e539e5 100644 --- a/StgSharp.Mathematics/Geometries/GeometryOperation/GeometryOperation.cs +++ b/StgSharp.Mathematics/Geometries/GeometryOperation/GeometryOperation.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GeometryOperation" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using StgSharp.Timing; @@ -34,7 +14,10 @@ using System.Runtime.InteropServices; namespace StgSharp.Geometries { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate Vec3 GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation); + public delegate Vec3 GeometryMotionDelegate( + TimeSpanProvider timeSource, + out float rotation + ); public class GeometryMotion { @@ -48,7 +31,8 @@ namespace StgSharp.Geometries public unsafe GeometryMotion( bool isIncreament, TimeSpanProvider timeSource, - GeometryMotionDelegate motionDelegate) + GeometryMotionDelegate motionDelegate + ) { isIncrementMode = isIncreament; time = timeSource; @@ -69,17 +53,14 @@ namespace StgSharp.Geometries // sourceIsStatic = false; } - public bool IsIncrement - { - get => isIncrementMode; - } + public bool IsIncrement => isIncrementMode; - public static GeometryMotion DefaultMotion - { - get => new GeometryMotion(true, null, null); - } + public static GeometryMotion DefaultMotion => new GeometryMotion(true, null, null); - public unsafe void RunMotion(ref Vec3 coord, ref float rotation) + public unsafe void RunMotion( + ref Vec3 coord, + ref float rotation + ) { float rot; Vec3 vec; @@ -103,7 +84,10 @@ namespace StgSharp.Geometries } } - private static Vec3 defaultMotion(TimeSpanProvider provider, out float rotation) + private static Vec3 defaultMotion( + TimeSpanProvider provider, + out float rotation + ) { rotation = 0; return Vec3.Zero; diff --git a/StgSharp.Mathematics/Geometries/GeometryScaler/Angle.cs b/StgSharp.Mathematics/Geometries/GeometryScaler/Angle.cs index 5f2cacad..62e8a9c3 100644 --- a/StgSharp.Mathematics/Geometries/GeometryScaler/Angle.cs +++ b/StgSharp.Mathematics/Geometries/GeometryScaler/Angle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Angle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -133,10 +113,7 @@ namespace StgSharp.Mathematics _radius = radius; } - public static Radius Zero - { - get => new Radius(0); - } + public static Radius Zero => new Radius(0); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Radius operator -( diff --git a/StgSharp.Mathematics/Geometries/IGeometry.cs b/StgSharp.Mathematics/Geometries/IGeometry.cs index 009350c8..d863dd72 100644 --- a/StgSharp.Mathematics/Geometries/IGeometry.cs +++ b/StgSharp.Mathematics/Geometries/IGeometry.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IGeometry" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -40,7 +20,9 @@ namespace StgSharp.Geometries public interface IGeometry { - public Point this[int index] { get; set; } + public Point this[ + int index + ] { get; set; } #pragma warning disable CA1819 public Vec4[] VertexStream { get; } diff --git a/StgSharp.Mathematics/Geometries/IGeomtryBuffer.cs b/StgSharp.Mathematics/Geometries/IGeomtryBuffer.cs index 3cb80107..a757563f 100644 --- a/StgSharp.Mathematics/Geometries/IGeomtryBuffer.cs +++ b/StgSharp.Mathematics/Geometries/IGeomtryBuffer.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IGeomtryBuffer" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Mathematics/Geometries/IInstancing.cs b/StgSharp.Mathematics/Geometries/IInstancing.cs index eeeb5fce..1f0307f4 100644 --- a/StgSharp.Mathematics/Geometries/IInstancing.cs +++ b/StgSharp.Mathematics/Geometries/IInstancing.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IInstancing" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -41,16 +21,17 @@ namespace StgSharp.Geometries public interface IInstancing { - public float Rotation { get { return GlobalBuffer.CoordAndRotationList[BufferId].W; } set - { - Vec4 temp = GlobalBuffer.CoordAndRotationList[ + public float Rotation { get => GlobalBuffer.CoordAndRotationList[BufferId].W; set + { + Vec4 temp = GlobalBuffer.CoordAndRotationList[ BufferId]; - temp.W = value; - GlobalBuffer.CoordAndRotationList[ + temp.W = value; + GlobalBuffer.CoordAndRotationList[ BufferId] = temp; - } } + } } - public float Scale { get { return GlobalBuffer.ScalingList[BufferId]; } set { GlobalBuffer.ScalingList[BufferId] = value; } } + public float Scale { get => GlobalBuffer.ScalingList[BufferId]; set => GlobalBuffer.ScalingList[BufferId] = + value; } public GeometryMotion Motion { get; set; } @@ -60,7 +41,8 @@ namespace StgSharp.Geometries public Vec3 CenterPositionGlobal { get; internal set; } - public Vec3 Coord { get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; } set { GlobalBuffer.CoordAndRotationList[BufferId] = new Vec4(value.reg); } } + public Vec3 Coord { get => GlobalBuffer.CoordAndRotationList[BufferId].XYZ; set => GlobalBuffer.CoordAndRotationList[BufferId] = + new Vec4(value.reg); } public void Move() { diff --git a/StgSharp.Mathematics/Geometries/IInstancingBuffer.cs b/StgSharp.Mathematics/Geometries/IInstancingBuffer.cs index f1fd50bb..58cdae3e 100644 --- a/StgSharp.Mathematics/Geometries/IInstancingBuffer.cs +++ b/StgSharp.Mathematics/Geometries/IInstancingBuffer.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IInstancingBuffer" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Cordinate.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Cordinate.cs index 6fa362cf..319476a0 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Cordinate.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Cordinate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Cordinate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using System; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/GeometryOperation.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/GeometryOperation.cs index 1d59e151..5d2641cf 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/GeometryOperation.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/GeometryOperation.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GeometryOperation" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -36,7 +16,9 @@ namespace StgSharp.Geometries { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec3 DefaultMotion(int tick) + public static Vec3 DefaultMotion( + int tick + ) { return default(Vec3); } diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/IPlainEntity.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/IPlainEntity.cs index 72ba974d..ca46dfd3 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/IPlainEntity.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/IPlainEntity.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IPlainEntity" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -41,7 +21,9 @@ namespace StgSharp.Geometries public Vec2 CenterPosition { get; set; } - public bool CollideWith(IPlainEntity entity); + public bool CollideWith( + IPlainEntity entity + ); } @@ -50,12 +32,16 @@ namespace StgSharp.Geometries private PlainGeometry _shape; - public PlainEntity(PlainGeometry shape) + public PlainEntity( + PlainGeometry shape + ) { _shape = shape; } - bool IPlainEntity.CollideWith(IPlainEntity entity) + bool IPlainEntity.CollideWith( + IPlainEntity entity + ) { throw new NotImplementedException(); } diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/ParticleOnPlain.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/ParticleOnPlain.cs index ad6f2ac7..c82c7ecf 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/ParticleOnPlain.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/ParticleOnPlain.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ParticleOnPlain" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -41,7 +21,9 @@ namespace StgSharp.Geometries public class ParticleOnPlain : IInstancing, IPlainEntity { - public ParticleOnPlain(PlainInstancingBuffer buffer) + public ParticleOnPlain( + PlainInstancingBuffer buffer + ) { if (buffer == null) { throw new ArgumentNullException(paramName:nameof(buffer)); @@ -59,7 +41,9 @@ namespace StgSharp.Geometries Vec3 IInstancing.CenterPositionGlobal { get; set; } - bool IPlainEntity.CollideWith(IPlainEntity entity) + bool IPlainEntity.CollideWith( + IPlainEntity entity + ) { throw new NotImplementedException(); } diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainGeometry.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainGeometry.cs index f053b0ae..0d706771 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainGeometry.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainGeometry.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PlainGeometry" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp; using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs index 79183ce9..985895ce 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PlainInstancingBuffer" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; using StgSharp.Mathematics.Numeric.Graphics; @@ -44,7 +24,8 @@ using System.Threading.Tasks; namespace StgSharp.Geometries { - public class PlainInstancingBuffer : IDisposable, IEnumerable, IInstancingBuffer where T: IInstancing + public class PlainInstancingBuffer : IDisposable, IEnumerable, IInstancingBuffer + where T : IInstancing { private bool disposedValue; @@ -103,7 +84,9 @@ namespace StgSharp.Geometries } } - public void Remove(T instance) + public void Remove( + T instance + ) { mutex.WaitOne(); if (instance.GlobalBuffer != this) { @@ -132,7 +115,9 @@ namespace StgSharp.Geometries } } - protected virtual void Dispose(bool disposing) + protected virtual void Dispose( + bool disposing + ) { if (!disposedValue) { diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Parallelogram.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Parallelogram.cs index 9daaf692..dbe4182b 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Parallelogram.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Parallelogram.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Parallelogram" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -39,7 +19,16 @@ namespace StgSharp.Geometries internal Point center; - public Parallelogram(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + public Parallelogram( + float v0x, + float v0y, + float v1x, + float v1y, + float v2x, + float v2y, + float v3x, + float v3y + ) : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { #if DEBUG @@ -61,7 +50,8 @@ namespace StgSharp.Geometries float v2x, float v2y, float v3x, - float v3y) + float v3y + ) : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { #if DEBUG diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Plain.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Plain.cs index adc9690b..703c1f6d 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Plain.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Plain.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Plain" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -42,7 +22,11 @@ namespace StgSharp.Geometries internal Vec3 vec1; internal Vec3 vec2; - public Plain(Vec3 o, Vec3 v1, Vec3 v2) + public Plain( + Vec3 o, + Vec3 v1, + Vec3 v2 + ) { this._origin = o; this.vec1 = v1 - (v2 * (v1.Y / v2.Y)); //xz @@ -60,7 +44,11 @@ namespace StgSharp.Geometries plainParameter.Z = 1 / plainParameter.Z; } - public Plain(Point p1, Point p2, Point p3) + public Plain( + Point p1, + Point p2, + Point p3 + ) { Vec3 origin = p1.Coord; Vec3 v1 = p2.Coord - origin; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon4.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon4.cs index d7add70f..091e8bcf 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon4.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon4.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Polygon4" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon5.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon5.cs index 78740d31..9cfcc201 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon5.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon5.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Polygon5" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -64,7 +44,8 @@ namespace StgSharp.Geometries float v3x, float v3y, float v4x, - float v4y) + float v4y + ) : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[5]; @@ -86,7 +67,8 @@ namespace StgSharp.Geometries float v3x, float v3y, float v4x, - float v4y) + float v4y + ) : base(coordination) { vertexMat = new Vec4[5]; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon6.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon6.cs index 73490242..b185437a 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon6.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Polygon6.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Polygon6" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -65,7 +45,8 @@ namespace StgSharp.Geometries Vec2 vert3, Vec2 vert4, Vec2 vert5, - Vec2 vert6) + Vec2 vert6 + ) : base(coordination) { vertexMat = new Vec4[6]; diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Rectangle.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Rectangle.cs index 1052ab81..710fe13e 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Rectangle.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Rectangle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Rectangle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -36,7 +16,16 @@ namespace StgSharp.Geometries public class Rectangle : Parallelogram { - public Rectangle(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + public Rectangle( + float v0x, + float v0y, + float v1x, + float v1y, + float v2x, + float v2y, + float v3x, + float v3y + ) : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { #if DEBUG @@ -57,7 +46,8 @@ namespace StgSharp.Geometries float v2x, float v2y, float v3x, - float v3y) + float v3y + ) : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { #if DEBUG @@ -78,7 +68,9 @@ namespace StgSharp.Geometries /// /// /// - public virtual Vec3 MovCenter(uint tick) + public virtual Vec3 MovCenter( + uint tick + ) { return default(Vec3); } diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Square.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Square.cs index 15f04494..66f8cf78 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Square.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Square.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Square" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using System.Numerics; @@ -37,7 +17,16 @@ namespace StgSharp.Geometries public class Square : Rectangle { - public Square(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + public Square( + float v0x, + float v0y, + float v1x, + float v1y, + float v2x, + float v2y, + float v3x, + float v3y + ) : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { if (true) { } diff --git a/StgSharp.Mathematics/Geometries/PlainGeometry/Triangle.cs b/StgSharp.Mathematics/Geometries/PlainGeometry/Triangle.cs index 03ac7455..23dac646 100644 --- a/StgSharp.Mathematics/Geometries/PlainGeometry/Triangle.cs +++ b/StgSharp.Mathematics/Geometries/PlainGeometry/Triangle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Triangle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; diff --git a/StgSharp.Mathematics/Geometries/Point.cs b/StgSharp.Mathematics/Geometries/Point.cs index 93018ab6..c12487a8 100644 --- a/StgSharp.Mathematics/Geometries/Point.cs +++ b/StgSharp.Mathematics/Geometries/Point.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Point" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using System; @@ -70,7 +50,7 @@ namespace StgSharp.Geometries public Vec3 Coord { get => coord; - set { coord = value; } + set => coord = value; } } diff --git a/StgSharp.Mathematics/Geometries/SpaceGeometry/Class1.cs b/StgSharp.Mathematics/Geometries/SpaceGeometry/Class1.cs index 60e2a685..f9445dab 100644 --- a/StgSharp.Mathematics/Geometries/SpaceGeometry/Class1.cs +++ b/StgSharp.Mathematics/Geometries/SpaceGeometry/Class1.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Class1" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Text; diff --git a/StgSharp.Mathematics/Geometries/SpaceGeometry/TriangulatedSurface.cs b/StgSharp.Mathematics/Geometries/SpaceGeometry/TriangulatedSurface.cs index 0081bf65..c5b3128f 100644 --- a/StgSharp.Mathematics/Geometries/SpaceGeometry/TriangulatedSurface.cs +++ b/StgSharp.Mathematics/Geometries/SpaceGeometry/TriangulatedSurface.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TriangulatedSurface" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics; using StgSharp.Mathematics.Graphics; @@ -57,11 +37,7 @@ namespace StgSharp.Geometries } /**/ - public IEnumerable> SideIndicesEnumeratble - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _sideIndices ; - } + public IEnumerable> SideIndicesEnumeratble => _sideIndices; /* public Triangle GetTriangle( int index ) @@ -75,20 +51,16 @@ namespace StgSharp.Geometries } /**/ - public Span VertexSpan - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => CollectionsMarshal.AsSpan(_vertices); - } + public Span VertexSpan => CollectionsMarshal.AsSpan(_vertices); - public Span TriangleIndicesSpan - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => CollectionsMarshal.AsSpan(_triangleIndices); - } + public Span TriangleIndicesSpan => CollectionsMarshal.AsSpan(_triangleIndices); /**/ - public void AddIndicesByOrder(int v1, int v2, int v3) + public void AddIndicesByOrder( + int v1, + int v2, + int v3 + ) { _triangleIndices.Add(v1); _triangleIndices.Add(v2); @@ -104,7 +76,9 @@ namespace StgSharp.Geometries } } - public void AddVertexByOrder(Vec3 vertex) + public void AddVertexByOrder( + Vec3 vertex + ) { _vertices.Add(vertex); } diff --git a/StgSharp.Mathematics/Internal/ColumnSet2.cs b/StgSharp.Mathematics/Internal/ColumnSet2.cs index f7485a7e..ca2e086d 100644 --- a/StgSharp.Mathematics/Internal/ColumnSet2.cs +++ b/StgSharp.Mathematics/Internal/ColumnSet2.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="ColumnSet2.cs" +// ----------------------------------------------------------------------------- +// file="ColumnSet2" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Numerics; using System.Runtime.CompilerServices; @@ -52,7 +29,10 @@ namespace StgSharp.Mathematics.Internal [FieldOffset(0)] internal Vector4 colum0; [FieldOffset(4 * sizeof(float))] internal Vector4 colum1; - internal ColumnSet2(Vector4 c0, Vector4 c1) + internal ColumnSet2( + Vector4 c0, + Vector4 c1 + ) { Unsafe.SkipInit(out this); colum0 = c0; @@ -60,25 +40,35 @@ namespace StgSharp.Mathematics.Internal } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override bool Equals(object? obj) + public override bool Equals( + object? obj + ) { return (obj is ColumnSet2 mat) && Equals(mat); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(ColumnSet2 other) + public bool Equals( + ColumnSet2 other + ) { return colum0.Equals(other.colum0) && colum1.Equals(other.colum1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(ColumnSet2 left, ColumnSet2 right) + public static bool operator !=( + ColumnSet2 left, + ColumnSet2 right + ) { return !(left == right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(ColumnSet2 left, ColumnSet2 right) + public static bool operator ==( + ColumnSet2 left, + ColumnSet2 right + ) { return left.Equals(right); } diff --git a/StgSharp.Mathematics/Internal/ColumnSet3.cs b/StgSharp.Mathematics/Internal/ColumnSet3.cs index 59153acb..df9e89a1 100644 --- a/StgSharp.Mathematics/Internal/ColumnSet3.cs +++ b/StgSharp.Mathematics/Internal/ColumnSet3.cs @@ -1,32 +1,12 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ColumnSet3" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Mathematics.Internal; +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; +using StgSharp.Mathematics.Internal; using System; using System.Numerics; @@ -56,25 +36,37 @@ namespace StgSharp.Mathematics.Internal [FieldOffset(4 * sizeof(float))] internal Vector4 colum1; [FieldOffset(8 * sizeof(float))] internal Vector4 colum2; - public override bool Equals(object? obj) + public override bool Equals( + object? obj + ) { return (obj is ColumnSet3 mat) && Equals(mat); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(ColumnSet3 other) + public bool Equals( + ColumnSet3 other + ) { - return colum0.Equals(other.colum0) && colum1.Equals(other.colum1) && colum2.Equals(other.colum2); + return colum0.Equals(other.colum0) && + colum1.Equals(other.colum1) && + colum2.Equals(other.colum2); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(ColumnSet3 left, ColumnSet3 right) + public static bool operator !=( + ColumnSet3 left, + ColumnSet3 right + ) { return !(left == right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(ColumnSet3 left, ColumnSet3 right) + public static bool operator ==( + ColumnSet3 left, + ColumnSet3 right + ) { return left.Equals(right); } diff --git a/StgSharp.Mathematics/Internal/ColumnSet4.cs b/StgSharp.Mathematics/Internal/ColumnSet4.cs index 91d11d51..0cdd770f 100644 --- a/StgSharp.Mathematics/Internal/ColumnSet4.cs +++ b/StgSharp.Mathematics/Internal/ColumnSet4.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ColumnSet4" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp; using StgSharp.Mathematics.Internal; @@ -62,7 +42,12 @@ namespace StgSharp.Mathematics.Internal [FieldOffset(60)] public float m33; [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal ColumnSet4(Vector4 colum0, Vector4 colum1, Vector4 colum2, Vector4 colum3) + internal ColumnSet4( + Vector4 colum0, + Vector4 colum1, + Vector4 colum2, + Vector4 colum3 + ) { Unsafe.SkipInit(out this); this.colum0 = colum0; @@ -71,13 +56,17 @@ namespace StgSharp.Mathematics.Internal this.colum3 = colum3; } - public override bool Equals(object? obj) + public override bool Equals( + object? obj + ) { return (obj is ColumnSet4 mat) && Equals(mat); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(ColumnSet4 other) + public bool Equals( + ColumnSet4 other + ) { return colum0.Equals(other.colum0) && colum1.Equals(other.colum1) && @@ -86,13 +75,19 @@ namespace StgSharp.Mathematics.Internal } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(ColumnSet4 left, ColumnSet4 right) + public static bool operator !=( + ColumnSet4 left, + ColumnSet4 right + ) { return !(left == right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(ColumnSet4 left, ColumnSet4 right) + public static bool operator ==( + ColumnSet4 left, + ColumnSet4 right + ) { return left.Equals(right); } diff --git a/StgSharp.Mathematics/Internal/IntrinsicContext.cs b/StgSharp.Mathematics/Internal/IntrinsicContext.cs index eaedd2b1..98e2ec44 100644 --- a/StgSharp.Mathematics/Internal/IntrinsicContext.cs +++ b/StgSharp.Mathematics/Internal/IntrinsicContext.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IntrinsicContext" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Numeric.Runtime; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/StgSharp.Mathematics/Internal/MatrixKernel.cs b/StgSharp.Mathematics/Internal/MatrixKernel.cs index f00580d5..8c94f902 100644 --- a/StgSharp.Mathematics/Internal/MatrixKernel.cs +++ b/StgSharp.Mathematics/Internal/MatrixKernel.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixKernel" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Numerics; using System.Runtime.CompilerServices; @@ -41,7 +21,7 @@ namespace StgSharp.Mathematics [StructLayout(LayoutKind.Sequential)] [InlineArray(16)] - public unsafe struct MatrixKernel where T: unmanaged, INumber + public unsafe struct MatrixKernel where T : unmanaged, INumber { public static readonly int Size = 16 * sizeof(T); @@ -53,14 +33,19 @@ namespace StgSharp.Mathematics Unsafe.SkipInit(out this); } - public MatrixKernel(bool clear) + public MatrixKernel( + bool clear + ) { if (!clear) { Unsafe.SkipInit(out this); } } - public ref T this[int x, int y] + public ref T this[ + int x, + int y + ] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref Unsafe.Add(ref c0r0, (x * 4) + y); diff --git a/StgSharp.Mathematics/Internal/MatrixPanel.cs b/StgSharp.Mathematics/Internal/MatrixPanel.cs index edaf411e..217c8567 100644 --- a/StgSharp.Mathematics/Internal/MatrixPanel.cs +++ b/StgSharp.Mathematics/Internal/MatrixPanel.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixPanel" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Internal; using StgSharp.Mathematics.Numeric; using System; @@ -189,11 +169,7 @@ namespace StgSharp.Mathematics.Numeric get => ref Unsafe.Add(ref Head, row * MatrixPanel.ElementSideLength() + column); } - public Span Elements - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => MatrixPanel.Elements(ref Head); - } + public Span Elements => MatrixPanel.Elements(ref Head); } } diff --git a/StgSharp.Mathematics/Internal/SIMDID.cs b/StgSharp.Mathematics/Internal/SIMDID.cs index 94373441..d810e7b0 100644 --- a/StgSharp.Mathematics/Internal/SIMDID.cs +++ b/StgSharp.Mathematics/Internal/SIMDID.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SIMDID" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Mathematics/Internal/ScalarPacket.cs b/StgSharp.Mathematics/Internal/ScalarPacket.cs index fee451bf..65be666b 100644 --- a/StgSharp.Mathematics/Internal/ScalarPacket.cs +++ b/StgSharp.Mathematics/Internal/ScalarPacket.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ScalarPacket" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using System; using System.Collections.Generic; @@ -41,9 +21,11 @@ namespace StgSharp.Mathematics private fixed ulong data[8]; - public void BroadCast(int slotIndex, TScalar value) - where TScalar: unmanaged, INumber - where TRegister: unmanaged, IRegisterPresentation + public void BroadCast( + int slotIndex, + TScalar value + ) where TScalar : unmanaged, INumber + where TRegister : unmanaged, IRegisterPresentation { if (slotIndex is < 0 or >= 8) { throw new IndexOutOfRangeException(); @@ -52,7 +34,9 @@ namespace StgSharp.Mathematics register.BroadCastFrom(value); } - public ref T Data(int index) where T: unmanaged, INumber + public ref T Data( + int index + ) where T : unmanaged, INumber { if (index is < 0 or >= 8) { throw new IndexOutOfRangeException(); diff --git a/StgSharp.Mathematics/Internal/UnsafeCompute.cs b/StgSharp.Mathematics/Internal/UnsafeCompute.cs index 34fd965d..a1190ba8 100644 --- a/StgSharp.Mathematics/Internal/UnsafeCompute.cs +++ b/StgSharp.Mathematics/Internal/UnsafeCompute.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="UnsafeCompute" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Numeric; using System.Runtime.CompilerServices; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Cordination.cs b/StgSharp.Mathematics/Numeric/Graphics/Cordination.cs index 3e572ad8..393faba9 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Cordination.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Cordination.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Cordination" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + namespace StgSharp.Mathematics.Numeric.Graphics { public enum CoordinatePlain diff --git a/StgSharp.Mathematics/Numeric/Graphics/GraphicsMatrix.cs b/StgSharp.Mathematics/Numeric/Graphics/GraphicsMatrix.cs index 8c5d2ba0..71ff95b3 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/GraphicsMatrix.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/GraphicsMatrix.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GraphicsMatrix" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Internal; using StgSharp.Mathematics.Numeric; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vec2.cs b/StgSharp.Mathematics/Numeric/Graphics/Vec2.cs index 4c6e218e..bc8fc978 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vec2.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vec2.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vec2" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using StgSharp.Mathematics; using StgSharp.Mathematics.Numeric; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vec3.cs b/StgSharp.Mathematics/Numeric/Graphics/Vec3.cs index c77a4381..f2fca4c4 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vec3.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vec3.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vec3" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using StgSharp.Mathematics; using StgSharp.Mathematics.Numeric; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vec4.cs b/StgSharp.Mathematics/Numeric/Graphics/Vec4.cs index b9cdefea..8a9ed013 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vec4.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vec4.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vec4" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using StgSharp.Mathematics; using StgSharp.Mathematics.Internal; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vector.Cross.cs b/StgSharp.Mathematics/Numeric/Graphics/Vector.Cross.cs index f5681692..448a01aa 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vector.Cross.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vector.Cross.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vector.Cross" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; namespace StgSharp.Mathematics.Graphics @@ -32,12 +12,18 @@ namespace StgSharp.Mathematics.Graphics public static unsafe partial class Linear { - public static float Cross(Vec2 vec1, Vec2 vec2) + public static float Cross( + Vec2 vec1, + Vec2 vec2 + ) { return (vec1.X * vec2.Y) - (vec1.Y * vec2.X); } - public static Vec3 Cross(Vec3 vec1, Vec3 vec2) + public static Vec3 Cross( + Vec3 vec1, + Vec3 vec2 + ) { return new Vec3( (vec1.Y * vec2.Z) - (vec1.Z * vec2.Y), diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vector.GetAngle.cs b/StgSharp.Mathematics/Numeric/Graphics/Vector.GetAngle.cs index 86db82d0..d7ae26fb 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vector.GetAngle.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vector.GetAngle.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vector.GetAngle" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; namespace StgSharp.Mathematics.Graphics diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vector.GetLength.cs b/StgSharp.Mathematics/Numeric/Graphics/Vector.GetLength.cs index f9f0073f..c2333934 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vector.GetLength.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vector.GetLength.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vector.GetLength" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; namespace StgSharp.Mathematics.Graphics diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vector.Normalize.cs b/StgSharp.Mathematics/Numeric/Graphics/Vector.Normalize.cs index eb21a4b5..675640b4 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vector.Normalize.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vector.Normalize.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vector.Normalize" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using System.Numerics; @@ -33,7 +13,9 @@ namespace StgSharp.Mathematics.Graphics public static partial class Linear { - public static Vec4 Normalize(Vec4 vec) + public static Vec4 Normalize( + Vec4 vec + ) { return new Vec4 { @@ -41,7 +23,9 @@ namespace StgSharp.Mathematics.Graphics }; } - public static Vec3 Normalize(Vec3 vec) + public static Vec3 Normalize( + Vec3 vec + ) { return new Vec3 { @@ -49,7 +33,10 @@ namespace StgSharp.Mathematics.Graphics }; } - public static unsafe void Normalize(ref Vec4 source, ref Vec4 target) + public static unsafe void Normalize( + ref Vec4 source, + ref Vec4 target + ) { Vector4 s = source.vec; Vector4 t = target.vec; @@ -64,7 +51,10 @@ namespace StgSharp.Mathematics.Graphics target.vec = t; } - public static unsafe void Normalize(ref Vec3 source, ref Vec3 target) + public static unsafe void Normalize( + ref Vec3 source, + ref Vec3 target + ) { Vector3 s = source.v; Vector3 t = target.v; diff --git a/StgSharp.Mathematics/Numeric/Graphics/Vector.Orthogonalize.cs b/StgSharp.Mathematics/Numeric/Graphics/Vector.Orthogonalize.cs index a893663d..8978ed90 100644 --- a/StgSharp.Mathematics/Numeric/Graphics/Vector.Orthogonalize.cs +++ b/StgSharp.Mathematics/Numeric/Graphics/Vector.Orthogonalize.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Vector.Orthogonalize" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Graphics; using System.Numerics; @@ -33,7 +13,9 @@ namespace StgSharp.Mathematics.Graphics public static partial class Linear { - public static Vec4 Orthogonalize(this Vec4 vec) + public static Vec4 Orthogonalize( + this Vec4 vec + ) { return new Vec4 { @@ -41,7 +23,9 @@ namespace StgSharp.Mathematics.Graphics }; } - public static Vec3 Orthogonalize(Vec3 vec) + public static Vec3 Orthogonalize( + Vec3 vec + ) { return new Vec3 { @@ -49,7 +33,10 @@ namespace StgSharp.Mathematics.Graphics }; } - public static unsafe void Orthogonalize(this Vec4 source, ref Vec4 target) + public static unsafe void Orthogonalize( + this Vec4 source, + ref Vec4 target + ) { Vector4 s = source.vec; Vector4 t = target.vec; @@ -74,7 +61,10 @@ namespace StgSharp.Mathematics.Graphics /// /// /// - public static unsafe void Orthogonalize(this Vec3 source, ref Vec3 target) + public static unsafe void Orthogonalize( + this Vec3 source, + ref Vec3 target + ) { Vector3 s = source.v; Vector3 t = target.v; diff --git a/StgSharp.Mathematics/Numeric/Linear/Exception.cs b/StgSharp.Mathematics/Numeric/Linear/Exception.cs index c98cef98..7abf0a41 100644 --- a/StgSharp.Mathematics/Numeric/Linear/Exception.cs +++ b/StgSharp.Mathematics/Numeric/Linear/Exception.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Exception" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Mathematics/Numeric/Linear/IUnmanagedVector.cs b/StgSharp.Mathematics/Numeric/Linear/IUnmanagedVector.cs index 4b2cc294..6b0b9ec2 100644 --- a/StgSharp.Mathematics/Numeric/Linear/IUnmanagedVector.cs +++ b/StgSharp.Mathematics/Numeric/Linear/IUnmanagedVector.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="IUnmanagedVector" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -35,7 +15,7 @@ using System.Threading.Tasks; namespace StgSharp.Mathematics.Numeric { - public interface IUnmanagedVector where TSelf: unmanaged, IUnmanagedVector + public interface IUnmanagedVector where TSelf : unmanaged, IUnmanagedVector { public static abstract TSelf Zero { get; } diff --git a/StgSharp.Mathematics/Numeric/Linear/Matrix.Create.cs b/StgSharp.Mathematics/Numeric/Linear/Matrix.Create.cs index 6270dff2..a89c9562 100644 --- a/StgSharp.Mathematics/Numeric/Linear/Matrix.Create.cs +++ b/StgSharp.Mathematics/Numeric/Linear/Matrix.Create.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Matrix.Create" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics; using System; diff --git a/StgSharp.Mathematics/Numeric/Linear/Matrix.cs b/StgSharp.Mathematics/Numeric/Linear/Matrix.cs index d584c84a..88ac16c6 100644 --- a/StgSharp.Mathematics/Numeric/Linear/Matrix.cs +++ b/StgSharp.Mathematics/Numeric/Linear/Matrix.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Matrix" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics; using StgSharp.Mathematics.Numeric; using System; diff --git a/StgSharp.Mathematics/Numeric/Linear/MatrixCompute.Double.cs b/StgSharp.Mathematics/Numeric/Linear/MatrixCompute.Double.cs index 59b8cc8a..b2346c08 100644 --- a/StgSharp.Mathematics/Numeric/Linear/MatrixCompute.Double.cs +++ b/StgSharp.Mathematics/Numeric/Linear/MatrixCompute.Double.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="MatrixCompute.Sequential" +// ----------------------------------------------------------------------------- +// file="MatrixCompute.Double" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics.Numeric.Runtime; using System; @@ -38,9 +18,5 @@ using unsafe MkProc = delegate* unmanaged[Cdecl] end) { throw new ArgumentException("Begin index cannot be greater than end index."); @@ -55,13 +42,17 @@ namespace StgSharp.Mathematics.Numeric } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator MatrixIndex((int, int) range) + public static implicit operator MatrixIndex( + (int, int) range + ) { return new(range.Item1, range.Item2, false); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator MatrixIndex(int index) + public static implicit operator MatrixIndex( + int index + ) { return new(index, -1, false); } diff --git a/StgSharp.Mathematics/Numeric/Linear/MatrixMetadata.cs b/StgSharp.Mathematics/Numeric/Linear/MatrixMetadata.cs index 40c32b87..ec3341f7 100644 --- a/StgSharp.Mathematics/Numeric/Linear/MatrixMetadata.cs +++ b/StgSharp.Mathematics/Numeric/Linear/MatrixMetadata.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixMetadata" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/StgSharp.Mathematics/Numeric/Linear/MatrixStorage.cs b/StgSharp.Mathematics/Numeric/Linear/MatrixStorage.cs index 30130a40..592b1842 100644 --- a/StgSharp.Mathematics/Numeric/Linear/MatrixStorage.cs +++ b/StgSharp.Mathematics/Numeric/Linear/MatrixStorage.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixStorage" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics; using System; diff --git a/StgSharp.Mathematics/Numeric/NumericalModule.cs b/StgSharp.Mathematics/Numeric/NumericalModule.cs index a47d9970..6e090747 100644 --- a/StgSharp.Mathematics/Numeric/NumericalModule.cs +++ b/StgSharp.Mathematics/Numeric/NumericalModule.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="NumericalModule" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Mathematics.Internal; using System; using System.Collections.Generic; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixOperatorPolicy.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixOperatorPolicy.cs index 957779ab..03cc82cb 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixOperatorPolicy.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixOperatorPolicy.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixOperatorPolicy" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Numa.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Numa.cs index 85a93194..23b8d760 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Numa.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Numa.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallel.Numa" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using System; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Publish.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Publish.cs index ae1e9c0e..4d772fba 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Publish.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.Publish.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallel.Publish" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.cs index 57091ccb..eefd3fd9 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallel.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallel" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.ProcessorAbstraction; using System.Collections.Generic; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelQueue.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelQueue.cs index 67279aaa..dac2045a 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelQueue.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelQueue.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallelQueue" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.VisualBasic.FileIO; using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics.Numeric.Runtime; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelTask.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelTask.cs index bab82edf..f8894427 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelTask.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelTask.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallelTask" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.HighPerformance.ProcessorAbstraction; using System; diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.Sequential.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.Sequential.cs index 029007d8..6def297b 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.Sequential.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.Sequential.cs @@ -1,4 +1,11 @@ -using System; +// ----------------------------------------------------------------------------- +// file="MatrixParallelThread.Sequential" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +13,5 @@ using System.Threading.Tasks; namespace StgSharp.Mathematics.Numeric.Runtime { - internal class MatrixParallelThread - { - } + internal class MatrixParallelThread { } } diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.cs index d901cb77..8e93ff3f 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelThread.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallelThread" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.ProcessorAbstraction; using StgSharp.Internal; using StgSharp.Mathematics.Numeric.Runtime; @@ -59,7 +39,9 @@ namespace StgSharp.Mathematics.Numeric private volatile MatrixThreadState _target; private Thread _managedThread; - internal MatrixParallelThread(LogicalCore binded) + internal MatrixParallelThread( + LogicalCore binded + ) { _resetEvent = new ManualResetEventSlim(false); _managedThread = new Thread(MatrixParallelWorkLoad); @@ -99,7 +81,9 @@ namespace StgSharp.Mathematics.Numeric _managedThread.Join(); } - protected virtual void Dispose(bool disposing) + protected virtual void Dispose( + bool disposing + ) { if (!_disposed) { @@ -179,9 +163,14 @@ namespace StgSharp.Mathematics.Numeric [LibraryImport(Native.LibName, EntryPoint = "load_intrinsic_function")] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory)] - private static unsafe partial void LoadIntrinsicFunction(IntrinsicContext* context, ulong id); + private static unsafe partial void LoadIntrinsicFunction( + IntrinsicContext* context, + ulong id + ); - public bool Equals(MatrixParallelThread? other) + public bool Equals( + MatrixParallelThread? other + ) { return (other is not null) && ReferenceEquals(this, other); } diff --git a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelWrap.cs b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelWrap.cs index 2c9b4ade..9bf21880 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelWrap.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/MatrixParallelWrap.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixParallelWrap" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics.Numeric.Runtime; diff --git a/StgSharp.Mathematics/Numeric/Runtime/QueueFactory.cs b/StgSharp.Mathematics/Numeric/Runtime/QueueFactory.cs index b4cfb0f5..01a975ff 100644 --- a/StgSharp.Mathematics/Numeric/Runtime/QueueFactory.cs +++ b/StgSharp.Mathematics/Numeric/Runtime/QueueFactory.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="QueueFactory" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/Abstraction/AbstractSyntaxTree.cs b/StgSharp.RegularAnalysis/Abstraction/AbstractSyntaxTree.cs index b137801e..bcb76472 100644 --- a/StgSharp.RegularAnalysis/Abstraction/AbstractSyntaxTree.cs +++ b/StgSharp.RegularAnalysis/Abstraction/AbstractSyntaxTree.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="AbstractSyntaxTree" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using System; diff --git a/StgSharp.RegularAnalysis/Abstraction/CompileDepthState.cs b/StgSharp.RegularAnalysis/Abstraction/CompileDepthState.cs index 8cbadce1..7c5bc1bf 100644 --- a/StgSharp.RegularAnalysis/Abstraction/CompileDepthState.cs +++ b/StgSharp.RegularAnalysis/Abstraction/CompileDepthState.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CompileDepthState" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Data; @@ -44,14 +24,23 @@ namespace StgSharp.RegularAnalysis.Abstraction public class CompileDepthMark { - internal CompileDepthMark(int operatorBegin, int operandBegin, int usage) + internal CompileDepthMark( + int operatorBegin, + int operandBegin, + int usage + ) { OperatorBegin = operatorBegin; OperandBegin = operandBegin; Usage = usage; } - internal CompileDepthMark(int operatorBegin, int operandBegin, int usage, ICompileDepthState stateCache) + internal CompileDepthMark( + int operatorBegin, + int operandBegin, + int usage, + ICompileDepthState stateCache + ) { OperatorBegin = operatorBegin; OperandBegin = operandBegin; diff --git a/StgSharp.RegularAnalysis/Abstraction/CompileStack.cs b/StgSharp.RegularAnalysis/Abstraction/CompileStack.cs index a33cf88b..2d535986 100644 --- a/StgSharp.RegularAnalysis/Abstraction/CompileStack.cs +++ b/StgSharp.RegularAnalysis/Abstraction/CompileStack.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="CompileStack" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using System; @@ -50,23 +30,11 @@ namespace StgSharp.RegularAnalysis.Abstraction _depthMarks.Push(new DepthMark(0, 0, 0)); } - public int OperandInDepthCount - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _operands.Count - _depthMarks.Peek().OperandPos; - } + public int OperandInDepthCount => _operands.Count - _depthMarks.Peek().OperandPos; - public int OperatorInDepthCount - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _operators.Count - _depthMarks.Peek().OperatorPos; - } + public int OperatorInDepthCount => _operators.Count - _depthMarks.Peek().OperatorPos; - public int Depth - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _depthMarks.Count; - } + public int Depth => _depthMarks.Count; private record struct DepthMark( int OperandPos, diff --git a/StgSharp.RegularAnalysis/Abstraction/ISyntaxNode.cs b/StgSharp.RegularAnalysis/Abstraction/ISyntaxNode.cs index 86ab7806..b6144ca8 100644 --- a/StgSharp.RegularAnalysis/Abstraction/ISyntaxNode.cs +++ b/StgSharp.RegularAnalysis/Abstraction/ISyntaxNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ISyntaxNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using System; diff --git a/StgSharp.RegularAnalysis/Abstraction/ITokenParser.cs b/StgSharp.RegularAnalysis/Abstraction/ITokenParser.cs index 1c0aa3c2..4ea67e2b 100644 --- a/StgSharp.RegularAnalysis/Abstraction/ITokenParser.cs +++ b/StgSharp.RegularAnalysis/Abstraction/ITokenParser.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ITokenParser" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/Abstraction/ITokenReader.cs b/StgSharp.RegularAnalysis/Abstraction/ITokenReader.cs index 3d44aef2..37eb0ee4 100644 --- a/StgSharp.RegularAnalysis/Abstraction/ITokenReader.cs +++ b/StgSharp.RegularAnalysis/Abstraction/ITokenReader.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="ITokenReader" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; namespace StgSharp.RegularAnalysis.Abstraction diff --git a/StgSharp.RegularAnalysis/Abstraction/Token.cs b/StgSharp.RegularAnalysis/Abstraction/Token.cs index 851f38ee..0c17f3f9 100644 --- a/StgSharp.RegularAnalysis/Abstraction/Token.cs +++ b/StgSharp.RegularAnalysis/Abstraction/Token.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Token" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/StgSharp.RegularAnalysis/Global.cs b/StgSharp.RegularAnalysis/Global.cs index c9bc3b52..fb0bc749 100644 --- a/StgSharp.RegularAnalysis/Global.cs +++ b/StgSharp.RegularAnalysis/Global.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Global" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/GroupIndex.cs b/StgSharp.RegularAnalysis/GroupIndex.cs index f77a6c7c..9cb01b36 100644 --- a/StgSharp.RegularAnalysis/GroupIndex.cs +++ b/StgSharp.RegularAnalysis/GroupIndex.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="GroupIndex" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Runtime.InteropServices; namespace StgSharp.RegularAnalysis diff --git a/StgSharp.RegularAnalysis/SourceGenerate.cs b/StgSharp.RegularAnalysis/SourceGenerate.cs index 4830e842..ab5cb48e 100644 --- a/StgSharp.RegularAnalysis/SourceGenerate.cs +++ b/StgSharp.RegularAnalysis/SourceGenerate.cs @@ -1,4 +1,11 @@ -using System; +// ----------------------------------------------------------------------------- +// file="SourceGenerate" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +13,5 @@ using System.Threading.Tasks; namespace StgSharp.RegularAnalysis { - internal class SourceGenerate - { - } + internal class SourceGenerate { } } diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTGenerate.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTGenerate.cs similarity index 82% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTGenerate.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTGenerate.cs index cdfd36f9..90297e6b 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTGenerate.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTGenerate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexAnalyzer.ASTGenerate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections; @@ -35,7 +15,7 @@ using System.Threading.Tasks; namespace StgSharp.RegularAnalysis.Text { - public partial class RegexAnalyzerFrontEnd + public partial class RegexAnalyzer { private static AbstractSyntaxTree GenerateAST( diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTOptimize.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTOptimize.cs similarity index 91% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTOptimize.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTOptimize.cs index 875b18f9..b42f8199 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.ASTOptimize.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.ASTOptimize.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexAnalyzer.ASTOptimize" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; @@ -39,7 +19,7 @@ using System.Xml.Linq; namespace StgSharp.RegularAnalysis.Text { - public partial class RegexAnalyzerFrontEnd + public partial class RegexAnalyzer { private static RegexAstNode FlattenAlt( @@ -157,7 +137,7 @@ namespace StgSharp.RegularAnalysis.Text } private static void OptimizeTree( - AbstractSyntaxTree tree + AbstractSyntaxTree tree ) { // phase0: scan container and remove no parent nodes @@ -214,7 +194,6 @@ namespace StgSharp.RegularAnalysis.Text } } } - } private static void RotateConcat( diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IRGenerate.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.IRGenerate.cs similarity index 89% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IRGenerate.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.IRGenerate.cs index c46902d2..7f3baa97 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IRGenerate.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.IRGenerate.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexInterpreter.IRGenerate" +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.IRGenerate" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; @@ -40,7 +20,7 @@ using System.Xml; namespace StgSharp.RegularAnalysis.Text { - public partial class RegexAnalyzerFrontEnd + public partial class RegexAnalyzer { internal static List GenerateIR( diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IROptimize.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.IROptimize.cs similarity index 90% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IROptimize.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.IROptimize.cs index 02c7392e..8ca01d2d 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.IROptimize.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.IROptimize.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexAnalyzerFrontEnd.IROptimize" +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.IROptimize" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using System; using System.Collections.Generic; @@ -37,7 +17,7 @@ using System.Threading.Tasks; namespace StgSharp.RegularAnalysis.Text { - public partial class RegexAnalyzerFrontEnd + public partial class RegexAnalyzer { internal static void ScanAndOptimizeIR( @@ -243,7 +223,7 @@ namespace StgSharp.RegularAnalysis.Text if (min == 0) { return -1; } - string pattern = seq.Sequence; + string pattern = seq.Pattern; int pattern_size = pattern.Length; if (pattern_size > flatten_size) { opt.Add(ir); @@ -400,14 +380,14 @@ namespace StgSharp.RegularAnalysis.Text if (ir is IRegexCount { Min: 1, Max: 1 }) { string pattern; - switch (ir.Command & RegexIRCommand.Count) + switch (ir.CommandMask & RegexIRCommand.Count) { case RegexIRCommand.Count_Complex: RegexCountComplexIR complex = Unsafe.As(ir); return complex.CommandCount; case RegexIRCommand.Count_Seq: RegexCountSeqIR seq = Unsafe.As(ir); - pattern = seq.Sequence; + pattern = seq.Pattern; opt.Add(new RegexMatchSeqIR(pattern)); return 0; case RegexIRCommand.Count_Set: @@ -421,14 +401,14 @@ namespace StgSharp.RegularAnalysis.Text } else if (ir is IRegexCount { Min: 0, Max: 1 }) { string pattern; - switch (ir.Command & RegexIRCommand.Count) + switch (ir.CommandMask & RegexIRCommand.Count) { case RegexIRCommand.Count_Complex: RegexCountComplexIR complex = Unsafe.As(ir); return complex.CommandCount; case RegexIRCommand.Count_Seq: RegexCountSeqIR seq = Unsafe.As(ir); - pattern = seq.Sequence; + pattern = seq.Pattern; opt.Add(new RegexTryIR(1)); opt.Add(new RegexMatchSeqIR(pattern)); return 0; @@ -497,20 +477,20 @@ namespace StgSharp.RegularAnalysis.Text } bool is_greedy = count.IsGreedy; string pattern; - switch (ir.Command & RegexIRCommand.Count) + switch (ir.CommandMask & RegexIRCommand.Count) { case RegexIRCommand.Count_Complex: RegexCountComplexIR complex = Unsafe.As(ir); return complex.CommandCount; case RegexIRCommand.Count_Seq: RegexCountSeqIR seq = Unsafe.As(ir); - pattern = seq.Sequence; + pattern = seq.Pattern; opt.Add(new RegexMatchSeqIR(pattern)); opt.Add(new RegexCountSeqIR(0, -1, is_greedy, pattern)); return 0; case RegexIRCommand.Count_Set: RegexCountSeqIR set = Unsafe.As(ir); - pattern = set.Sequence; + pattern = set.Pattern; opt.Add(new RegexMatchSeqIR(pattern)); opt.Add(new RegexCountSeqIR(0, -1, is_greedy, pattern)); return 0; diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzer.InfoScan.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.InfoScan.cs new file mode 100644 index 00000000..a55217c9 --- /dev/null +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.InfoScan.cs @@ -0,0 +1,112 @@ +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.InfoScan" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.RegularAnalysis.Text +{ + public partial class RegexAnalyzer + { + + internal static RegexInterpreterInfo ScanInfo( + List ir + ) + { + RegexInterpreterInfo info = new(); + int process_count = 0; + + ReadOnlySpan irSpan = CollectionsMarshal.AsSpan(ir); + + int max_region = 0; + int min_length = 0; + int single_line_count = 0; + + ScanSpan(irSpan); + return info; + + void ScanSpan( + ReadOnlySpan ir_span + ) + { + do + { + int count = int.Min(8, ir_span.Length - process_count); + ReadOnlySpan window = ir_span.Slice(process_count, count); + RegexIRPrefix prefix; + if (window[0].CommandMask == RegexIRCommand.Match_Seq) + { + RegexMatchSeqIR match_seq = Unsafe.As(window[0]); + min_length += match_seq.Pattern.Length; + prefix = match_seq.Prefix; + max_region = int.Max(max_region, prefix.WorkingRegion); + if ((prefix.Mask & RegexIRPrefixMask.ObserveMethod) == RegexIRPrefixMask.Observe_Line) + { + int line_idx = prefix.ObserveSource; + RegexIR source = ir[line_idx]; + if (!source.SingleLineResultRequired) + { + source.SingleLineResultIndex = line_idx; + single_line_count++; + } + } + process_count++; + } else if (window[0] is RegexFindSeqIR find_seq) + { + min_length += find_seq.Pattern.Length; + prefix = find_seq.Prefix; + max_region = int.Max(max_region, prefix.WorkingRegion); + if ((prefix.Mask & RegexIRPrefixMask.ObserveMethod) == RegexIRPrefixMask.Observe_Line) + { + int line_idx = prefix.ObserveSource; + RegexIR source = ir[line_idx]; + if (!source.SingleLineResultRequired) + { + source.SingleLineResultIndex = line_idx; + single_line_count++; + } + } + process_count++; + } else if (window[0] is RegexCountSeqIR count_seq) + { + min_length += count_seq.Pattern.Length * count_seq.Min; + prefix = count_seq.Prefix; + max_region = int.Max(max_region, prefix.WorkingRegion); + if ((prefix.Mask & RegexIRPrefixMask.ObserveMethod) == RegexIRPrefixMask.Observe_Line) + { + int line_idx = prefix.ObserveSource; + RegexIR source = ir[line_idx]; + if (!source.SingleLineResultRequired) + { + source.SingleLineResultIndex = line_idx; + single_line_count++; + } + } + process_count++; + } else if (window[0] is RegexMatchSetIR) { } + } while (process_count < ir.Count); + } + } + + internal struct RegexInterpreterInfo + { + + public int RegionCount { get; set; } + + public int MinPredictLength { get; set; } + + public int SingleLineResultCount { get; set; } + + } + + } +} diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.PrefixEmit.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.PrefixEmit.cs similarity index 69% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.PrefixEmit.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.PrefixEmit.cs index b8675b86..11067614 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.PrefixEmit.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.PrefixEmit.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexAnalyzerFrontEnd.PrefixEmit" +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.PrefixEmit" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -34,7 +14,7 @@ using System.Threading.Tasks; namespace StgSharp.RegularAnalysis.Text { - public static partial class RegexAnalyzerFrontEnd + public static partial class RegexAnalyzer { internal static List EmitPrefix( @@ -65,22 +45,35 @@ namespace StgSharp.RegularAnalysis.Text emit_window = region[index..]; int emitResult; - if ((emitResult = TryEmitGroupFindPack(emit_window, result, currentRegion, lineBase)) > 0) + if ((emitResult = + TryEmitGroupFindPack(emit_window, result, currentRegion, lineBase)) > 0) { index += emitResult; - } else if ((emitResult = TryEmitTryGroupTail(emit_window, result, currentRegion, lineBase)) > 0) + } else if ((emitResult = + TryEmitTryGroupTail(emit_window, result, currentRegion, + lineBase)) > 0) { index += emitResult; - } else if ((emitResult = TryEmitAltChain(emit_window, result, currentRegion, lineBase)) > 0) + } else if ((emitResult = + TryEmitAltChain(emit_window, result, currentRegion, lineBase)) > 0) { index += emitResult; - } else if ((emitResult = TryEmitAltSuccessTail(emit_window, result, currentRegion, lineBase)) > 0) + } else if ((emitResult = + TryEmitAltSuccessTail(emit_window, result, currentRegion, + lineBase)) > 0) { index += emitResult; - } else if ((emitResult = TryEmitAltFailTail(emit_window, result, currentRegion, lineBase)) > 0) + } else if ((emitResult = + TryEmitAltFailTail(emit_window, result, currentRegion, + lineBase)) > 0) { index += emitResult; - } else if ((emitResult = TryEmitTryIR(emit_window, result, currentRegion, lineBase)) > 0) + } else if ((emitResult = + TryEmitComplexIR(emit_window, result, currentRegion, lineBase)) > 0) + { + index += emitResult; + } else if ((emitResult = + TryEmitTryIR(emit_window, result, currentRegion, lineBase)) > 0) { index += emitResult; } else @@ -111,12 +104,8 @@ namespace StgSharp.RegularAnalysis.Text } int tryOutputIndex = result.Count; - int emitCount = TryEmitTryIR( - origin, - result, - currentRegion, - lineBase, - foldSingleInstructionTry: false); + int emitCount = TryEmitTryIR(origin, result, currentRegion, lineBase, + foldSingleInstructionTry:false); if (emitCount <= 0 || result[tryOutputIndex] is not RegexTryIR emittedTry) { return -1; } @@ -125,18 +114,14 @@ namespace StgSharp.RegularAnalysis.Text int regionId = emittedTry.Prefix.WorkingRegion; RegexIR prefixedPop = CloneIR(pop, regionId); - ApplyPrefix( - prefixedPop, - regionId, - RegexIRPrefixMask.Prev_Fail | RegexIRPrefixMask.Observe_Region, - regionId); + ApplyPrefix(prefixedPop, regionId, + RegexIRPrefixMask.Prev_Fail | RegexIRPrefixMask.Observe_Region, + regionId); RegexIR prefixedPack = CloneIR(pack, regionId); - ApplyPrefix( - prefixedPack, - regionId, - RegexIRPrefixMask.Prev_Success | RegexIRPrefixMask.Observe_Region, - regionId); + ApplyPrefix(prefixedPack, regionId, + RegexIRPrefixMask.Prev_Success | RegexIRPrefixMask.Observe_Region, + regionId); result.Add(prefixedPop); result.Add(prefixedPack); @@ -164,12 +149,15 @@ namespace StgSharp.RegularAnalysis.Text { RegexIR previous = result[^1]; observeRegion = GetObservedRegion(previous, currentRegion); - GetObservation(previous, result, lineBase, currentRegion, out observeMask, out observeSource); - ApplyPrefix(previous, observeRegion, RegexIRPrefixMask.Pop_Success, observeRegion); + GetObservation(previous, result, lineBase, currentRegion, out observeMask, + out observeSource); + ApplyPrefix(previous, observeRegion, RegexIRPrefixMask.Pop_Success, + observeRegion); } RegexIRPrefixMask mask = RegexIRPrefixMask.Prev_Fail | observeMask; - int emit_count = TryEmitTryIR(origin[2..], result, currentRegion, lineBase, mask, observeSource, observeRegion); + int emit_count = TryEmitTryIR(origin[2..], result, currentRegion, lineBase, mask, + observeSource, observeRegion); return emit_count < 0 ? -1 : emit_count + 2; } @@ -211,23 +199,86 @@ namespace StgSharp.RegularAnalysis.Text return -1; } - GetObservation( - previous, - result, - lineBase, - currentRegion, - out RegexIRPrefixMask observeMask, - out int observeSource); + GetObservation(previous, result, lineBase, currentRegion, + out RegexIRPrefixMask observeMask, out int observeSource); RegexIR prefixedPop = CloneIR(pop, currentRegion); - ApplyPrefix( - prefixedPop, - currentRegion, - RegexIRPrefixMask.Prev_Fail | observeMask, - observeSource); + ApplyPrefix(prefixedPop, currentRegion, RegexIRPrefixMask.Prev_Fail | observeMask, + observeSource); result.Add(prefixedPop); return 1; } + int TryEmitComplexIR( + ReadOnlySpan origin, + List result, + int currentRegion, + int lineBase + ) + { + if (origin.Length == 0) { + return -1; + } + + if (origin[0] is RegexCountComplexIR count) + { + int commandCount = count.CommandCount; + if (origin.Length < commandCount + 1) { + return -1; + } + + List sub_ir = new(commandCount); + EmitPrefix(origin.Slice(1, commandCount), sub_ir, currentRegion, + lineBase + result.Count + 1); + + RegexCountComplexIR newCount = new(count.Min, count.Max, count.IsGreedy, + sub_ir.Count) + { + IsFullyOptimized = count.IsFullyOptimized, + Prefix = + new RegexIRPrefix( + count.Prefix.WorkingRegion == 0 ? + currentRegion : + count.Prefix.WorkingRegion, + count.Prefix.Mask, + count.Prefix.ObserveSource) + }; + + result.Add(newCount); + result.AddRange(sub_ir); + return commandCount + 1; + } + + if (origin[0] is RegexFindComplexIR { CommandCount: > 0 } find) + { + int commandCount = find.CommandCount; + if (origin.Length < commandCount + 1) { + return -1; + } + + List sub_ir = new(commandCount); + EmitPrefix(origin.Slice(1, commandCount), sub_ir, currentRegion, + lineBase + result.Count + 1); + + RegexFindComplexIR newFind = new(find.IsNearest, sub_ir.Count) + { + IsFullyOptimized = find.IsFullyOptimized, + Prefix = + new RegexIRPrefix( + find.Prefix.WorkingRegion == 0 ? + currentRegion : + find.Prefix.WorkingRegion, + find.Prefix.Mask, + find.Prefix.ObserveSource) + }; + + result.Add(newFind); + result.AddRange(sub_ir); + return commandCount + 1; + } + + return -1; + } + // convert TRY into region int TryEmitTryIR( ReadOnlySpan origin, @@ -256,7 +307,8 @@ namespace StgSharp.RegularAnalysis.Text if (foldSingleInstructionTry && commandCount == 1 && - IsFoldableSingleTryInstruction(origin[1])) { + IsFoldableSingleTryInstruction(origin[1])) + { RegexIR folded = CloneIR(origin[1], regionId); int foldedObserveSource = (mask & RegexIRPrefixMask.ObserveMethod) != 0 ? @@ -316,7 +368,8 @@ namespace StgSharp.RegularAnalysis.Text }; RegexPackIR newPack = new(pack.Condition, pack.GroupName) { - Prefix = new RegexIRPrefix( + Prefix = + new RegexIRPrefix( regionId, pack.Prefix.Mask | RegexIRPrefixMask.Prev_Success | RegexIRPrefixMask.Observe_Line, -1) @@ -362,7 +415,8 @@ namespace StgSharp.RegularAnalysis.Text for (int i = 0; i < result.Count; i++) { RegexIRPrefix prefix = result[i].Prefix; - if ((prefix.Mask & RegexIRPrefixMask.Observe_Line) == 0) { + if ((prefix.Mask & RegexIRPrefixMask.Observe_Line) == 0) + { continue; } @@ -386,12 +440,14 @@ namespace StgSharp.RegularAnalysis.Text RegexIR ir ) { - return ir is RegexMatchSeqIR or - RegexMatchSetIR or - RegexCountSeqIR or - RegexCountSetIR or - RegexFindSeqIR or - RegexFindComplexIR; + return ir is + RegexMatchSeqIR or + RegexMatchSetIR or + RegexCountSeqIR or + RegexCountSetIR or + RegexFindSeqIR or + //RegexFindSetIR or + RegexFindComplexIR; } static void ApplyPrefix( @@ -423,12 +479,16 @@ namespace StgSharp.RegularAnalysis.Text RegexMatchSetIR match => new RegexMatchSetIR(match.Charset), RegexConditionIR condition => new RegexConditionIR(condition.SuccessCase, condition.FailCase), RegexPackIR pack => new RegexPackIR(pack.Condition, pack.GroupName), - RegexCountComplexIR count => new RegexCountComplexIR(count.Min, count.Max, count.IsGreedy, count.CommandCount) + RegexCountComplexIR count => new RegexCountComplexIR(count.Min, count.Max, + count.IsGreedy, + count.CommandCount) { IsFullyOptimized = count.IsFullyOptimized }, - RegexCountSeqIR count => new RegexCountSeqIR(count.Min, count.Max, count.IsGreedy, count.Sequence), - RegexCountSetIR count => new RegexCountSetIR(count.Min, count.Max, count.IsGreedy, count.CharSet), + RegexCountSeqIR count => new RegexCountSeqIR(count.Min, count.Max, + count.IsGreedy, count.Pattern), + RegexCountSetIR count => new RegexCountSetIR(count.Min, count.Max, + count.IsGreedy, count.CharSet), RegexTryIR tryIR => new RegexTryIR(tryIR.CommandCount) { IsFullyOptimized = tryIR.IsFullyOptimized diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.CharSetEmitter.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.CharSetEmitter.cs similarity index 69% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.CharSetEmitter.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.CharSetEmitter.cs index bc7dc2c5..890bd449 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.CharSetEmitter.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.CharSetEmitter.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexAnalyzerBackEnd.CharSetEmitter" +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.SourceGen.CharSetEmitter" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Globalization; diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.cs new file mode 100644 index 00000000..fbaebf3a --- /dev/null +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.SourceGen.cs @@ -0,0 +1,64 @@ +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer.SourceGen" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using Microsoft.CodeAnalysis; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.RegularAnalysis.Text +{ + public partial class RegexAnalyzer + { + + internal static StringBuilder GenerateSource( + List ir + ) + { + StringBuilder sb = new(); + List sub_match_list = []; + + ReadOnlySpan source = CollectionsMarshal.AsSpan(ir); + RegexIR[] window = new RegexIR[8]; + Span scan_win = window; + + _ = sb.AppendLine(@"public abstract MatchResult Match(ReadOnlySpan text)")// + .AppendLine(@"{"); + + int index = 0; + do + { + int count = int.Min(8, source.Length - index); + source.Slice(index, count).CopyTo(scan_win); + } while (index < ir.Count); + + foreach (StringBuilder _sub in sub_match_list) + { + _ = sb.AppendLine() // + .Append(_sub); + } + + return sb; + /* + int TryGenerateMatch( + Span scan_win, + StringBuilder sb + ) + { + if (scan_win[0] is RegexMatchSeqIR seq) { + _ = sb.AppendLine(string.Empty); + } + } + /**/ + } + + } +} diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.cs similarity index 63% rename from StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.cs rename to StgSharp.RegularAnalysis/Text/RegexAnalyzer.cs index 23b3ae77..7c43a17c 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerFrontEnd.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAnalyzer.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexAnalyzerFrontEnd" +// ----------------------------------------------------------------------------- +// file="RegexAnalyzer" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; @@ -68,13 +48,14 @@ namespace StgSharp.RegularAnalysis.Text } - public static partial class RegexAnalyzerFrontEnd + public static partial class RegexAnalyzer { public static TextRegexSource Analyze( string regex ) { +#pragma warning disable CA1031 // RegexAnalyzer interpreter = new(); // interpreter._source = regex; AbstractSyntaxTree tree; @@ -106,6 +87,7 @@ namespace StgSharp.RegularAnalysis.Text { return new TextRegexSource(regex, tree, base_ir, null, ex); } +#pragma warning restore CA1031 } } diff --git a/StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.cs b/StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.cs deleted file mode 100644 index b06af26a..00000000 --- a/StgSharp.RegularAnalysis/Text/RegexAnalyzerBackEnd.cs +++ /dev/null @@ -1,48 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="RegexAnalyzerBackEnd" -// Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using Microsoft.CodeAnalysis; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.RegularAnalysis.Text -{ - internal static partial class RegexAnalyzerBackEnd - { - - internal static string GenerateSource( - List ir - ) - { - return string.Empty; - } - - } -} diff --git a/StgSharp.RegularAnalysis/Text/RegexAstNode.cs b/StgSharp.RegularAnalysis/Text/RegexAstNode.cs index ffa6da9e..3a06efeb 100644 --- a/StgSharp.RegularAnalysis/Text/RegexAstNode.cs +++ b/StgSharp.RegularAnalysis/Text/RegexAstNode.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexAstNode" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System.Runtime.CompilerServices; @@ -35,7 +15,9 @@ namespace StgSharp.RegularAnalysis.Text // private RegexAstNode _left, _right; - public RegexAstNode(Token source) + public RegexAstNode( + Token source + ) { Source = source; } @@ -87,14 +69,19 @@ namespace StgSharp.RegularAnalysis.Text public Token Source { get; private protected set; } - public void AppendNode(RegexAstNode nextToken) + public void AppendNode( + RegexAstNode nextToken + ) { Next = nextToken; nextToken.Previous = this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static (bool Valid, int Value) ComparePrecedence(RegexElementLabel left, RegexElementLabel right) + public static (bool Valid, int Value) ComparePrecedence( + RegexElementLabel left, + RegexElementLabel right + ) { left &= RegexElementLabel.OPERATOR; right &= RegexElementLabel.OPERATOR; @@ -106,19 +93,25 @@ namespace StgSharp.RegularAnalysis.Text } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(RegexAstNode node) + public static bool IsNullOrEmpty( + RegexAstNode node + ) { return node is null || ReferenceEquals(node, Empty); } /**/ - public void PrependNode(RegexAstNode previousNode) + public void PrependNode( + RegexAstNode previousNode + ) { Previous = previousNode; previousNode.Next = this; } - public void RemoveChild(RegexAstNode node) + public void RemoveChild( + RegexAstNode node + ) { if (Left == node) { @@ -136,7 +129,9 @@ namespace StgSharp.RegularAnalysis.Text return new EmptyRegexAstNode(); } - internal void RemoveAndAsChild(bool useLeft) + internal void RemoveAndAsChild( + bool useLeft + ) { if (useLeft) { @@ -161,7 +156,9 @@ namespace StgSharp.RegularAnalysis.Text /// /// The node to replace the current node with. /// - internal void ReplaceBy(RegexAstNode node) + internal void ReplaceBy( + RegexAstNode node + ) { Source = node.Source; Left = node.Left; diff --git a/StgSharp.RegularAnalysis/Text/RegexElementLabel.cs b/StgSharp.RegularAnalysis/Text/RegexElementLabel.cs index 96e3b61b..3d5676a4 100644 --- a/StgSharp.RegularAnalysis/Text/RegexElementLabel.cs +++ b/StgSharp.RegularAnalysis/Text/RegexElementLabel.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexElementLabel" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/Text/RegexIR.Abstraction.cs b/StgSharp.RegularAnalysis/Text/RegexIR.Abstraction.cs new file mode 100644 index 00000000..e4d209dd --- /dev/null +++ b/StgSharp.RegularAnalysis/Text/RegexIR.Abstraction.cs @@ -0,0 +1,75 @@ +// ----------------------------------------------------------------------------- +// file="RegexIR.Abstraction" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StgSharp.RegularAnalysis.Text +{ + internal interface IRegexComplex + { + + bool IsFullyOptimized { get; set; } + + int CommandCount { get; set; } + + } + + internal interface IRegexSequence + { + + string Pattern { get; } + + } + + internal interface IRegexCount + { + + bool IsGreedy { get; } + + bool IsStar { get; } + + bool IsPlus { get; } + + int Min { get; } + + int Max { get; } + + } + + internal abstract class RegexIR + { + + protected RegexIR( + RegexIRCommand command + ) + { + CommandMask = command; + } + + public bool SingleLineResultRequired { get; set; } + + public int SingleLineResultIndex { get; set; } + + public RegexIRPrefix Prefix { get; set; } + + internal RegexIRCommand CommandMask { get; init; } + + internal string AsCommand( + int lineNum + ) + { + return $"[{lineNum}]\t{Prefix}\t{AsCommand()}"; + } + + protected abstract string AsCommand(); + + } +} diff --git a/StgSharp.RegularAnalysis/Text/RegexIR.Prefix.cs b/StgSharp.RegularAnalysis/Text/RegexIR.Prefix.cs index f9952d31..3fc4b786 100644 --- a/StgSharp.RegularAnalysis/Text/RegexIR.Prefix.cs +++ b/StgSharp.RegularAnalysis/Text/RegexIR.Prefix.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexIR.Prefix" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -61,9 +41,9 @@ namespace StgSharp.RegularAnalysis.Text return $"{WorkingRegion:D4}, {DisplayMask(Mask , RegexIRPrefixMask.ExeCondition):D1}, {DisplayMask(Mask , RegexIRPrefixMask.PopCondition):D1}, {DisplayMask(Mask ,RegexIRPrefixMask.ObserveMethod):D1}, {ObserveSource:D4}"; } - private int DisplayMask( - RegexIRPrefixMask mask, - RegexIRPrefixMask range + private readonly int DisplayMask( + RegexIRPrefixMask mask, + RegexIRPrefixMask range ) { return range switch diff --git a/StgSharp.RegularAnalysis/Text/RegexIR.cs b/StgSharp.RegularAnalysis/Text/RegexIR.cs index 344a8c06..5e5b0faa 100644 --- a/StgSharp.RegularAnalysis/Text/RegexIR.cs +++ b/StgSharp.RegularAnalysis/Text/RegexIR.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexIR" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.CodeAnalysis.CSharp.Syntax; using System; using System.Collections.Generic; @@ -53,37 +33,14 @@ namespace StgSharp.RegularAnalysis.Text Match = Match_Seq | Match_Set, Count = Count_Seq | Count_Set | Count_Complex, - - } - - internal interface IRegexComplex - { - - bool IsFullyOptimized { get; set; } - - int CommandCount { get; set; } - - } - - internal interface IRegexCount - { - - bool IsGreedy { get; } - - bool IsStar { get; } - - bool IsPlus { get; } - - int Min { get; } - - int Max { get; } + Find = Find_Seq | Find_Set | Find_Complex, } internal sealed class RegexFindComplexIR( bool nearest, int count - ) : RegexIR, IRegexComplex + ) : RegexIR(RegexIRCommand.Find_Complex), IRegexComplex { public bool IsFullyOptimized { get; set; } @@ -92,8 +49,6 @@ namespace StgSharp.RegularAnalysis.Text public int CommandCount { get; set; } = count; - internal override RegexIRCommand Command => RegexIRCommand.Find_Complex; - protected override string AsCommand( ) @@ -103,36 +58,16 @@ namespace StgSharp.RegularAnalysis.Text } - internal abstract class RegexIR - { - - public RegexIRPrefix Prefix { get; set; } - - internal abstract RegexIRCommand Command { get; } - - internal string AsCommand( - int lineNum - ) - { - return $"[{lineNum}]\t{Prefix}\t{AsCommand()}"; - } - - protected abstract string AsCommand(); - - } - internal sealed class RegexFindSeqIR( string pattern, bool isFirst - ) : RegexIR + ) : RegexIR(RegexIRCommand.Find_Seq), IRegexSequence { public bool IsFirst { get; } = isFirst; public string Pattern { get; } = pattern; - internal override RegexIRCommand Command => RegexIRCommand.Find_Seq; - protected override string AsCommand( ) { @@ -146,13 +81,11 @@ namespace StgSharp.RegularAnalysis.Text /// internal sealed class RegexMatchSeqIR( string pattern - ) : RegexIR + ) : RegexIR(RegexIRCommand.Match_Seq), IRegexSequence { public string Pattern { get; } = pattern; - internal override RegexIRCommand Command => RegexIRCommand.Match_Seq; - protected override string AsCommand( ) @@ -164,13 +97,11 @@ namespace StgSharp.RegularAnalysis.Text internal sealed class RegexMatchSetIR( string charset - ) : RegexIR + ) : RegexIR(RegexIRCommand.Match_Set) { public string Charset { get; } = charset; - internal override RegexIRCommand Command => RegexIRCommand.Match_Set; - protected override string AsCommand( ) @@ -183,15 +114,13 @@ namespace StgSharp.RegularAnalysis.Text internal sealed class RegexConditionIR( int success, int fail - ) : RegexIR + ) : RegexIR(RegexIRCommand.Condition) { public int SuccessCase { get; } = success; public int FailCase { get; } = fail; - internal override RegexIRCommand Command => RegexIRCommand.Condition; - protected override string AsCommand( ) @@ -204,15 +133,13 @@ namespace StgSharp.RegularAnalysis.Text internal sealed class RegexPackIR( bool condition, string name = "" - ) : RegexIR + ) : RegexIR(RegexIRCommand.Pack) { public bool Condition { get; } = condition; public string GroupName { get; } = name; - internal override RegexIRCommand Command => RegexIRCommand.Pack; - protected override string AsCommand( ) @@ -227,7 +154,7 @@ namespace StgSharp.RegularAnalysis.Text int max, bool isGreedy, int operation - ) : RegexIR, IRegexCount, IRegexComplex + ) : RegexIR(RegexIRCommand.Count_Complex), IRegexCount, IRegexComplex { public bool IsGreedy { get; } = isGreedy; @@ -244,8 +171,6 @@ namespace StgSharp.RegularAnalysis.Text public int CommandCount { get; set; } = operation; - internal override RegexIRCommand Command { get; } = RegexIRCommand.Count_Complex; - protected override string AsCommand( ) @@ -260,7 +185,7 @@ namespace StgSharp.RegularAnalysis.Text int max, bool isGreedy, string seq - ) : RegexIR, IRegexCount + ) : RegexIR(RegexIRCommand.Count_Seq), IRegexCount, IRegexSequence { public bool IsGreedy { get; } = isGreedy; @@ -273,15 +198,13 @@ namespace StgSharp.RegularAnalysis.Text public int Max { get; } = max; - public string Sequence { get; } = seq.Length == 2 && seq[0] == '\\' ? seq[1..2] : seq; - - internal override RegexIRCommand Command { get; } = RegexIRCommand.Count_Seq; + public string Pattern { get; } = seq.Length == 2 && seq[0] == '\\' ? seq[1..2] : seq; protected override string AsCommand( ) { - return $"COUNT_SEQ {(IsGreedy ? "GREEDY" : "NON_GREEDY")} MIN: {Min} MAX: {Max} SEQ: \"{Sequence}\""; + return $"COUNT_SEQ {(IsGreedy ? "GREEDY" : "NON_GREEDY")} MIN: {Min} MAX: {Max} SEQ: \"{Pattern}\""; } } @@ -291,7 +214,7 @@ namespace StgSharp.RegularAnalysis.Text int max, bool isGreedy, string set - ) : RegexIR, IRegexCount + ) : RegexIR(RegexIRCommand.Count_Set), IRegexCount { public bool IsGreedy { get; } = isGreedy; @@ -308,8 +231,6 @@ namespace StgSharp.RegularAnalysis.Text public string CharSet { get; } = set; - internal override RegexIRCommand Command => RegexIRCommand.Count_Set; - protected override string AsCommand( ) @@ -321,15 +242,13 @@ namespace StgSharp.RegularAnalysis.Text internal sealed class RegexTryIR( int count - ) : RegexIR, IRegexComplex + ) : RegexIR(RegexIRCommand.Try), IRegexComplex { public bool IsFullyOptimized { get; set; } public int CommandCount { get; set; } = count; - internal override RegexIRCommand Command => RegexIRCommand.Try; - protected override string AsCommand( ) @@ -341,13 +260,11 @@ namespace StgSharp.RegularAnalysis.Text internal sealed class RegexPopIR( bool isSuccess - ) : RegexIR + ) : RegexIR(RegexIRCommand.Pop) { public bool IsSuccess { get; } = isSuccess; - internal override RegexIRCommand Command => RegexIRCommand.Pop; - protected override string AsCommand( ) diff --git a/StgSharp.RegularAnalysis/Text/RegexIRGenerator.cs b/StgSharp.RegularAnalysis/Text/RegexIRGenerator.cs index 190bd505..7784fec0 100644 --- a/StgSharp.RegularAnalysis/Text/RegexIRGenerator.cs +++ b/StgSharp.RegularAnalysis/Text/RegexIRGenerator.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexIRGenerator" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/Text/RegexTokenParser.cs b/StgSharp.RegularAnalysis/Text/RegexTokenParser.cs index 556bb4b7..dbe7eac3 100644 --- a/StgSharp.RegularAnalysis/Text/RegexTokenParser.cs +++ b/StgSharp.RegularAnalysis/Text/RegexTokenParser.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexTokenParser" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; diff --git a/StgSharp.RegularAnalysis/Text/RegexTokenReader.cs b/StgSharp.RegularAnalysis/Text/RegexTokenReader.cs index 9c8220a8..a324d099 100644 --- a/StgSharp.RegularAnalysis/Text/RegexTokenReader.cs +++ b/StgSharp.RegularAnalysis/Text/RegexTokenReader.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexTokenReader" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; diff --git a/StgSharp.RegularAnalysis/Text/RegexTokenUtil.cs b/StgSharp.RegularAnalysis/Text/RegexTokenUtil.cs index 1a32cc24..c0049c1e 100644 --- a/StgSharp.RegularAnalysis/Text/RegexTokenUtil.cs +++ b/StgSharp.RegularAnalysis/Text/RegexTokenUtil.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="RegexTokenUtil" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using System; using System.Collections.Generic; diff --git a/StgSharp.RegularAnalysis/Text/TextHelper.cs b/StgSharp.RegularAnalysis/Text/TextHelper.cs index 78d9b4d6..da8893f0 100644 --- a/StgSharp.RegularAnalysis/Text/TextHelper.cs +++ b/StgSharp.RegularAnalysis/Text/TextHelper.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TextHelper" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; diff --git a/StgSharp.RegularAnalysis/Text/TextRegex.cs b/StgSharp.RegularAnalysis/Text/TextRegex.cs index ba92d6d0..089991df 100644 --- a/StgSharp.RegularAnalysis/Text/TextRegex.cs +++ b/StgSharp.RegularAnalysis/Text/TextRegex.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TextRegex" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -36,17 +16,10 @@ namespace StgSharp.RegularAnalysis.Text public abstract class TextRegex { - public abstract bool IsMatch( - ReadOnlySpan text + public abstract MatchResult Match( + ReadOnlySpan text ); - public ref struct Match - { - - private ReadOnlySpan _sequence; - - } - } public ref struct MatchResult { } diff --git a/StgSharp.TerminalDialogue/PostOpration.cs b/StgSharp.TerminalDialogue/PostOpration.cs index 8465602b..59586153 100644 --- a/StgSharp.TerminalDialogue/PostOpration.cs +++ b/StgSharp.TerminalDialogue/PostOpration.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="PostOpration" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.IO; namespace StgSharpTerminalDialogue diff --git a/StgSharp.TerminalDialogue/Program.cs b/StgSharp.TerminalDialogue/Program.cs index f8ba6acb..73116e93 100644 --- a/StgSharp.TerminalDialogue/Program.cs +++ b/StgSharp.TerminalDialogue/Program.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Program" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Globalization; using System.IO; diff --git a/StgSharp.UserInterface/Attribute/PanelStateChangeBindingAttribute.cs b/StgSharp.UserInterface/Attribute/PanelStateChangeBindingAttribute.cs index 871dbb4a..3de6db3e 100644 --- a/StgSharp.UserInterface/Attribute/PanelStateChangeBindingAttribute.cs +++ b/StgSharp.UserInterface/Attribute/PanelStateChangeBindingAttribute.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateChangeBindingAttribute" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; using System.Linq; @@ -14,11 +21,11 @@ namespace StgSharp.UserInterface { public string StatePath { get; } = string.IsNullOrWhiteSpace(statePath) ? - throw new ArgumentException("Value cannot be null or whitespace.", nameof(statePath)) : + throw new ArgumentException("Value cannot be null or whitespace.", nameof(statePath)) : statePath; public string PanelHostPath { get; } = string.IsNullOrWhiteSpace(panelHostPath) ? - throw new ArgumentException("Value cannot be null or whitespace.", nameof(panelHostPath)) : + throw new ArgumentException("Value cannot be null or whitespace.", nameof(panelHostPath)) : panelHostPath; } diff --git a/StgSharp.UserInterface/Attribute/PanelStateNodeAttribute.cs b/StgSharp.UserInterface/Attribute/PanelStateNodeAttribute.cs index 96de2a06..64b58ab6 100644 --- a/StgSharp.UserInterface/Attribute/PanelStateNodeAttribute.cs +++ b/StgSharp.UserInterface/Attribute/PanelStateNodeAttribute.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateNodeAttribute" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + namespace StgSharp.UserInterface { [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] diff --git a/StgSharp.UserInterface/Framework/Service.Host.cs b/StgSharp.UserInterface/Framework/Service.Host.cs index 8313e47c..bee80a3b 100644 --- a/StgSharp.UserInterface/Framework/Service.Host.cs +++ b/StgSharp.UserInterface/Framework/Service.Host.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="Service.Host" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; using System.Threading.Tasks; diff --git a/StgSharp.UserInterface/Framework/Service.LoadAccomplishmentEvent.cs b/StgSharp.UserInterface/Framework/Service.LoadAccomplishmentEvent.cs index 54a95a59..5671bcdd 100644 --- a/StgSharp.UserInterface/Framework/Service.LoadAccomplishmentEvent.cs +++ b/StgSharp.UserInterface/Framework/Service.LoadAccomplishmentEvent.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="Service.LoadAccomplishmentEvent" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + namespace StgSharp.UserInterface { public sealed record ServiceLoadAccomplishmentEvent diff --git a/StgSharp.UserInterface/Framework/Service.LoadCommand.cs b/StgSharp.UserInterface/Framework/Service.LoadCommand.cs index b2bff7c5..a21f6957 100644 --- a/StgSharp.UserInterface/Framework/Service.LoadCommand.cs +++ b/StgSharp.UserInterface/Framework/Service.LoadCommand.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="Service.LoadCommand" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; diff --git a/StgSharp.UserInterface/Framework/State.AppState.cs b/StgSharp.UserInterface/Framework/State.AppState.cs index 2ee5a48b..996b9279 100644 --- a/StgSharp.UserInterface/Framework/State.AppState.cs +++ b/StgSharp.UserInterface/Framework/State.AppState.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="State.AppState" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; diff --git a/StgSharp.UserInterface/Framework/State.FrontCommandHost.cs b/StgSharp.UserInterface/Framework/State.FrontCommandHost.cs index a0418f9b..d6f90cb9 100644 --- a/StgSharp.UserInterface/Framework/State.FrontCommandHost.cs +++ b/StgSharp.UserInterface/Framework/State.FrontCommandHost.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="State.FrontCommandHost" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; using System.Threading.Tasks; diff --git a/StgSharp.UserInterface/Framework/State.Host.cs b/StgSharp.UserInterface/Framework/State.Host.cs index 7b31e3dd..7ae671de 100644 --- a/StgSharp.UserInterface/Framework/State.Host.cs +++ b/StgSharp.UserInterface/Framework/State.Host.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="State.Host" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; using System.Threading.Tasks; diff --git a/StgSharp.UserInterface/Framework/State.PanelState.cs b/StgSharp.UserInterface/Framework/State.PanelState.cs index 0b5e031d..19e7a170 100644 --- a/StgSharp.UserInterface/Framework/State.PanelState.cs +++ b/StgSharp.UserInterface/Framework/State.PanelState.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="State.PanelState" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; diff --git a/StgSharp.UserInterface/Framework/State.ServiceManager.cs b/StgSharp.UserInterface/Framework/State.ServiceManager.cs index 34f2a072..05c84807 100644 --- a/StgSharp.UserInterface/Framework/State.ServiceManager.cs +++ b/StgSharp.UserInterface/Framework/State.ServiceManager.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="State.ServiceManager" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; using System.Threading.Tasks; diff --git a/StgSharp.UserInterface/Framework/View.CommandResult.cs b/StgSharp.UserInterface/Framework/View.CommandResult.cs index c21d429b..a9c91bcc 100644 --- a/StgSharp.UserInterface/Framework/View.CommandResult.cs +++ b/StgSharp.UserInterface/Framework/View.CommandResult.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="View.CommandResult" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; namespace StgSharp.UserInterface diff --git a/StgSharp.UserInterface/Framework/View.ExecuteCommand.cs b/StgSharp.UserInterface/Framework/View.ExecuteCommand.cs index 6681aada..0ebddfaa 100644 --- a/StgSharp.UserInterface/Framework/View.ExecuteCommand.cs +++ b/StgSharp.UserInterface/Framework/View.ExecuteCommand.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="View.ExecuteCommand" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Collections.Generic; diff --git a/StgSharp.UserInterface/Framework/View.Host.cs b/StgSharp.UserInterface/Framework/View.Host.cs index d34a779d..2121a03e 100644 --- a/StgSharp.UserInterface/Framework/View.Host.cs +++ b/StgSharp.UserInterface/Framework/View.Host.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="View.Host" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; using System.Threading; using System.Threading.Tasks; diff --git a/StgSharp.UserInterface/Framework/View.StateChangeCommand.cs b/StgSharp.UserInterface/Framework/View.StateChangeCommand.cs index ce04d154..a2702e58 100644 --- a/StgSharp.UserInterface/Framework/View.StateChangeCommand.cs +++ b/StgSharp.UserInterface/Framework/View.StateChangeCommand.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="View.StateChangeCommand" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; namespace StgSharp.UserInterface diff --git a/StgSharp.UserInterface/Framework/View.StateValueCommand.cs b/StgSharp.UserInterface/Framework/View.StateValueCommand.cs index e0b0f8e8..0cf184f1 100644 --- a/StgSharp.UserInterface/Framework/View.StateValueCommand.cs +++ b/StgSharp.UserInterface/Framework/View.StateValueCommand.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="View.StateValueCommand" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; namespace StgSharp.UserInterface @@ -6,9 +13,10 @@ namespace StgSharp.UserInterface { public StateValueCommand( - string statePath, - TValue value - ) : base(statePath) + string statePath, + TValue value + ) + : base(statePath) { Value = value; } diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Analysis.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Analysis.cs index ca0a146a..54ba5fd0 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Analysis.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Analysis.cs @@ -1,50 +1,57 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.Analysis" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -namespace StgSharp.UserInterface.Generator; - -internal static class PanelStateIncrementalGeneratorAnalysis +namespace StgSharp.UserInterface.Generator { - public static PanelStateIncrementalGeneratorOutput Analyze( - PanelStateIncrementalGeneratorInput input - ) + internal static class PanelStateIncrementalGeneratorAnalysis { - if (input.TypeTargets.IsDefaultOrEmpty) - { - return new PanelStateIncrementalGeneratorOutput( - input.Compilation, - ImmutableArray.Empty); - } - HashSet emittedTypes = new(StringComparer.Ordinal); - ImmutableArray.Builder builder = - ImmutableArray.CreateBuilder(); - - foreach (PanelStateIncrementalGeneratorTypeTarget target in input.TypeTargets - .OrderBy(static item => item.TypeDisplayName, StringComparer.Ordinal)) + public static PanelStateIncrementalGeneratorOutput Analyze( + PanelStateIncrementalGeneratorInput input + ) { - if (!emittedTypes.Add(target.TypeDisplayName)) - { - continue; + if (input.TypeTargets.IsDefaultOrEmpty) { + return new PanelStateIncrementalGeneratorOutput( + input.Compilation, + ImmutableArray.Empty); } - PanelStateSymbolPartAnalysis stateSymbols = PanelStateIncrementalGeneratorStateSymbols.Analyze(target); - StateChangeBindingPartAnalysis stateChangeBindings = PanelStateIncrementalGeneratorStateChangeBindings.Analyze(target); + HashSet emittedTypes = new(StringComparer.Ordinal); + ImmutableArray.Builder builder = + ImmutableArray.CreateBuilder(); - builder.Add( - new PanelStateIncrementalGeneratorTypeAnalysis( - target, - stateSymbols, - stateChangeBindings, - PanelStateIncrementalGeneratorStateCommandHandlers.Analyze( - target, - stateSymbols, - stateChangeBindings))); + foreach (PanelStateIncrementalGeneratorTypeTarget target in input.TypeTargets + .OrderBy(static item => item.TypeDisplayName, StringComparer.Ordinal)) + { + if (!emittedTypes.Add(target.TypeDisplayName)) + { + continue; + } + + PanelStateSymbolPartAnalysis stateSymbols = PanelStateIncrementalGeneratorStateSymbols.Analyze(target); + StateChangeBindingPartAnalysis stateChangeBindings = PanelStateIncrementalGeneratorStateChangeBindings.Analyze(target); + + builder.Add( + new PanelStateIncrementalGeneratorTypeAnalysis(target, stateSymbols, + stateChangeBindings, + PanelStateIncrementalGeneratorStateCommandHandlers.Analyze( + target, + stateSymbols, + stateChangeBindings))); + } + + return new PanelStateIncrementalGeneratorOutput( + input.Compilation, + builder.ToImmutable()); } - return new PanelStateIncrementalGeneratorOutput( - input.Compilation, - builder.ToImmutable()); } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Diagnostics.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Diagnostics.cs index fcc9f2df..4067af9f 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Diagnostics.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Diagnostics.cs @@ -1,6 +1,16 @@ -namespace StgSharp.UserInterface.Generator; +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.Diagnostics" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- -internal static class PanelStateIncrementalGeneratorDiagnostics +namespace StgSharp.UserInterface.Generator { - public const string Category = "StgSharp.UserInterface.Generator"; + internal static class PanelStateIncrementalGeneratorDiagnostics + { + + public const string Category = "StgSharp.UserInterface.Generator"; + + } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Emitter.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Emitter.cs index 8b615b17..7fd7c526 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Emitter.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Emitter.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.Emitter" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; using System.Linq; @@ -31,8 +38,8 @@ namespace StgSharp.UserInterface.Generator foreach (string typeName in source.TypeAnalyses .Select(static analysis => analysis.Target.TypeDisplayName) - .Distinct() - .OrderBy(static name => name, StringComparer.Ordinal)) + .Distinct() + .OrderBy(static name => name, StringComparer.Ordinal)) { _ = builder.Append(" \""); _ = builder.Append(typeName.Replace("\"", "\"\"", StringComparison.Ordinal)); @@ -45,7 +52,7 @@ namespace StgSharp.UserInterface.Generator _ = builder.AppendLine(" {"); foreach (PanelStateIncrementalGeneratorTypeAnalysis analysis in source.TypeAnalyses - .OrderBy(static item => item.Target.TypeDisplayName, StringComparer.Ordinal)) + .OrderBy(static item => item.Target.TypeDisplayName, StringComparer.Ordinal)) { string summary = $"{analysis.Target.TypeDisplayName} | symbols={analysis.StateSymbols.Members.Length} | bindings={analysis.StateChangeBindings.Members.Length} | handlers={analysis.StateChangeCommandHandlers.Members.Length}"; _ = builder.Append(" \""); diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Models.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Models.cs index c2846e99..8e54f5a0 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Models.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Models.cs @@ -1,3 +1,10 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.Models" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.CodeAnalysis; using System.Collections.Immutable; @@ -14,7 +21,8 @@ namespace StgSharp.UserInterface.Generator string? metadataName ) { - return IsStateSymbolAttribute(metadataName) || metadataName == StateChangeBindingAttribute; + return IsStateSymbolAttribute(metadataName) || + metadataName == StateChangeBindingAttribute; } public static bool IsStateSymbolAttribute( diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Pipeline.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Pipeline.cs index 8d6d5948..43b5243b 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Pipeline.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.Pipeline.cs @@ -1,6 +1,13 @@ -using System.Collections.Immutable; +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.Pipeline" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; +using System.Collections.Immutable; using System.Threading; namespace StgSharp.UserInterface.Generator @@ -12,12 +19,13 @@ namespace StgSharp.UserInterface.Generator SyntaxNode node ) { - return node is TypeDeclarationSyntax typeDeclaration && HasAttributedMembers(typeDeclaration); + return node is TypeDeclarationSyntax typeDeclaration && + HasAttributedMembers(typeDeclaration); } public static PanelStateIncrementalGeneratorTypeTarget? Transform( - GeneratorSyntaxContext context, - CancellationToken cancellationToken + GeneratorSyntaxContext context, + CancellationToken cancellationToken ) { cancellationToken.ThrowIfCancellationRequested(); @@ -26,14 +34,12 @@ namespace StgSharp.UserInterface.Generator return null; } - if (context.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol typeSymbol) - { + if (context.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol typeSymbol) { return null; } ImmutableArray markedMembers = CollectMarkedMembers(typeSymbol); - if (markedMembers.IsDefaultOrEmpty) - { + if (markedMembers.IsDefaultOrEmpty) { return null; } @@ -43,6 +49,50 @@ namespace StgSharp.UserInterface.Generator markedMembers); } + private static ImmutableArray CollectMarkedMembers( + INamedTypeSymbol typeSymbol + ) + { + ImmutableArray.Builder builder = + ImmutableArray.CreateBuilder(); + + foreach (ISymbol member in typeSymbol.GetMembers()) + { + foreach (AttributeData attributeData in member.GetAttributes()) + { + string? metadataName = attributeData.AttributeClass?.ToDisplayString(); + if (!PanelStateIncrementalGeneratorKnownAttributes.IsKnown(metadataName)) + { + continue; + } + + builder.Add( + new PanelStateIncrementalGeneratorMarkedMember(member, metadataName!, + member.Name, + GetSymbolTypeName(member))); + break; + } + } + + return builder.ToImmutable(); + } + + private static string GetSymbolTypeName( + ISymbol symbol + ) + { + return symbol switch + { + IFieldSymbol fieldSymbol => fieldSymbol.Type + .ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), + IPropertySymbol propertySymbol => propertySymbol.Type + .ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), + IMethodSymbol methodSymbol => methodSymbol.ReturnType + .ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), + _ => symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + }; + } + private static bool HasAttributedMembers( TypeDeclarationSyntax typeDeclaration ) @@ -61,48 +111,5 @@ namespace StgSharp.UserInterface.Generator return false; } - private static ImmutableArray CollectMarkedMembers( - INamedTypeSymbol typeSymbol - ) - { - ImmutableArray.Builder builder = - ImmutableArray.CreateBuilder(); - - foreach (ISymbol member in typeSymbol.GetMembers()) - { - foreach (AttributeData attributeData in member.GetAttributes()) - { - string? metadataName = attributeData.AttributeClass?.ToDisplayString(); - if (!PanelStateIncrementalGeneratorKnownAttributes.IsKnown(metadataName)) - { - continue; - } - - builder.Add( - new PanelStateIncrementalGeneratorMarkedMember( - member, - metadataName!, - member.Name, - GetSymbolTypeName(member))); - break; - } - } - - return builder.ToImmutable(); - } - - private static string GetSymbolTypeName( - ISymbol symbol - ) - { - return symbol switch - { - IFieldSymbol fieldSymbol => fieldSymbol.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - IPropertySymbol propertySymbol => propertySymbol.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - IMethodSymbol methodSymbol => methodSymbol.ReturnType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), - _ => symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) - }; - } - } } diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateChangeBindings.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateChangeBindings.cs index 3df2bc18..9601c776 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateChangeBindings.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateChangeBindings.cs @@ -1,20 +1,30 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.StateChangeBindings" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Collections.Immutable; using System.Linq; -namespace StgSharp.UserInterface.Generator; - -internal static class PanelStateIncrementalGeneratorStateChangeBindings +namespace StgSharp.UserInterface.Generator { - public static StateChangeBindingPartAnalysis Analyze( - PanelStateIncrementalGeneratorTypeTarget target - ) + internal static class PanelStateIncrementalGeneratorStateChangeBindings { - ImmutableArray members = target.MarkedMembers - .Where(static member => member.AttributeMetadataName == PanelStateIncrementalGeneratorKnownAttributes.StateChangeBindingAttribute) - .ToImmutableArray(); - return new StateChangeBindingPartAnalysis( - target.TypeDisplayName, - members); + public static StateChangeBindingPartAnalysis Analyze( + PanelStateIncrementalGeneratorTypeTarget target + ) + { + ImmutableArray members = target.MarkedMembers + .Where(static member => member.AttributeMetadataName == PanelStateIncrementalGeneratorKnownAttributes.StateChangeBindingAttribute) + .ToImmutableArray(); + + return new StateChangeBindingPartAnalysis( + target.TypeDisplayName, + members); + } + } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateCommandHandlers.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateCommandHandlers.cs index c22dc4f6..cc113867 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateCommandHandlers.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateCommandHandlers.cs @@ -1,61 +1,70 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.StateCommandHandlers" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + +using Microsoft.CodeAnalysis; using System.Collections.Generic; using System.Collections.Immutable; -using Microsoft.CodeAnalysis; -namespace StgSharp.UserInterface.Generator; - -internal static class PanelStateIncrementalGeneratorStateCommandHandlers +namespace StgSharp.UserInterface.Generator { - public static StateChangeCommandHandlerPartAnalysis Analyze( - PanelStateIncrementalGeneratorTypeTarget target, - PanelStateSymbolPartAnalysis stateSymbols, - StateChangeBindingPartAnalysis stateChangeBindings - ) + internal static class PanelStateIncrementalGeneratorStateCommandHandlers { - ImmutableArray members = MergeMembers( - stateChangeBindings.Members, - stateSymbols.Members); - return new StateChangeCommandHandlerPartAnalysis( - target.TypeDisplayName, - members); - } - - private static ImmutableArray MergeMembers( - ImmutableArray primaryMembers, - ImmutableArray secondaryMembers - ) - { - if (primaryMembers.IsDefaultOrEmpty && secondaryMembers.IsDefaultOrEmpty) + public static StateChangeCommandHandlerPartAnalysis Analyze( + PanelStateIncrementalGeneratorTypeTarget target, + PanelStateSymbolPartAnalysis stateSymbols, + StateChangeBindingPartAnalysis stateChangeBindings + ) { - return ImmutableArray.Empty; + ImmutableArray members = MergeMembers( + stateChangeBindings.Members, + stateSymbols.Members); + + return new StateChangeCommandHandlerPartAnalysis( + target.TypeDisplayName, + members); } - HashSet seen = new(StringComparer.Ordinal); - ImmutableArray.Builder builder = - ImmutableArray.CreateBuilder(); - - AddMembers(builder, seen, primaryMembers); - AddMembers(builder, seen, secondaryMembers); - - return builder.ToImmutable(); - } - - private static void AddMembers( - ImmutableArray.Builder builder, - HashSet seen, - ImmutableArray members - ) - { - foreach (PanelStateIncrementalGeneratorMarkedMember member in members) + private static void AddMembers( + ImmutableArray.Builder builder, + HashSet seen, + ImmutableArray members + ) { - string key = member.Symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); - if (!seen.Add(key)) + foreach (PanelStateIncrementalGeneratorMarkedMember member in members) { - continue; + string key = member.Symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); + if (!seen.Add(key)) + { + continue; + } + + builder.Add(member); + } + } + + private static ImmutableArray MergeMembers( + ImmutableArray primaryMembers, + ImmutableArray secondaryMembers + ) + { + if (primaryMembers.IsDefaultOrEmpty && secondaryMembers.IsDefaultOrEmpty) { + return ImmutableArray.Empty; } - builder.Add(member); + HashSet seen = new(StringComparer.Ordinal); + ImmutableArray.Builder builder = + ImmutableArray.CreateBuilder(); + + AddMembers(builder, seen, primaryMembers); + AddMembers(builder, seen, secondaryMembers); + + return builder.ToImmutable(); } + } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateSymbols.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateSymbols.cs index 486d0c89..418a4212 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateSymbols.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.StateSymbols.cs @@ -1,20 +1,30 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator.StateSymbols" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System.Collections.Immutable; using System.Linq; -namespace StgSharp.UserInterface.Generator; - -internal static class PanelStateIncrementalGeneratorStateSymbols +namespace StgSharp.UserInterface.Generator { - public static PanelStateSymbolPartAnalysis Analyze( - PanelStateIncrementalGeneratorTypeTarget target - ) + internal static class PanelStateIncrementalGeneratorStateSymbols { - ImmutableArray members = target.MarkedMembers - .Where(static member => PanelStateIncrementalGeneratorKnownAttributes.IsStateSymbolAttribute(member.AttributeMetadataName)) - .ToImmutableArray(); - return new PanelStateSymbolPartAnalysis( - target.TypeDisplayName, - members); + public static PanelStateSymbolPartAnalysis Analyze( + PanelStateIncrementalGeneratorTypeTarget target + ) + { + ImmutableArray members = target.MarkedMembers + .Where(static member => PanelStateIncrementalGeneratorKnownAttributes.IsStateSymbolAttribute(member.AttributeMetadataName)) + .ToImmutableArray(); + + return new PanelStateSymbolPartAnalysis( + target.TypeDisplayName, + members); + } + } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.cs b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.cs index c47eb069..7f200baa 100644 --- a/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.cs +++ b/StgSharp.UserInterface/Generator/PanelStateIncrementalGenerator.cs @@ -1,37 +1,65 @@ -using System.Collections.Immutable; +// ----------------------------------------------------------------------------- +// file="PanelStateIncrementalGenerator" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using Microsoft.CodeAnalysis; +using System.Collections.Immutable; -namespace StgSharp.UserInterface.Generator; - -[Generator(LanguageNames.CSharp)] -public sealed class PanelStateIncrementalGenerator : IIncrementalGenerator +namespace StgSharp.UserInterface.Generator { - public void Initialize(IncrementalGeneratorInitializationContext context) + [Generator(LanguageNames.CSharp)] + public sealed class PanelStateIncrementalGenerator : IIncrementalGenerator { - IncrementalValuesProvider typeTargets = context.SyntaxProvider - .CreateSyntaxProvider( - static (node, _) => PanelStateIncrementalGeneratorPipeline.IsCandidate(node), - static (syntaxContext, cancellationToken) => - PanelStateIncrementalGeneratorPipeline.Transform(syntaxContext, cancellationToken)) - .Where(static target => target is not null) - .Select(static (target, _) => target!); - IncrementalValueProvider> collectedTypeTargets = typeTargets.Collect(); + public void Initialize( + IncrementalGeneratorInitializationContext context + ) + { + IncrementalValuesProvider typeTargets = context.SyntaxProvider + .CreateSyntaxProvider( + static( + node, + _ + ) => PanelStateIncrementalGeneratorPipeline.IsCandidate(node), + static( + syntaxContext, + cancellationToken + ) => PanelStateIncrementalGeneratorPipeline.Transform(syntaxContext, cancellationToken)) + .Where(static target => target is not null) + .Select(static( + target, + _ + ) => target!); - IncrementalValueProvider generatorInput = context.CompilationProvider - .Combine(collectedTypeTargets) - .Select( - static (pair, _) => new PanelStateIncrementalGeneratorInput( - pair.Left, - pair.Right)); + IncrementalValueProvider> collectedTypeTargets = typeTargets.Collect(); - IncrementalValueProvider generatorOutput = generatorInput - .Select( - static (input, _) => PanelStateIncrementalGeneratorAnalysis.Analyze(input)); + IncrementalValueProvider generatorInput = context.CompilationProvider + .Combine(collectedTypeTargets) + .Select( + static( + pair, + _ + ) => new PanelStateIncrementalGeneratorInput( + pair.Left, + pair.Right)); + + IncrementalValueProvider generatorOutput = generatorInput + .Select( + static( + input, + _ + ) => PanelStateIncrementalGeneratorAnalysis.Analyze(input)); + + context.RegisterSourceOutput( + generatorOutput, + static( + productionContext, + source + ) => PanelStateIncrementalGeneratorEmitter.Emit(productionContext, source)); + } - context.RegisterSourceOutput( - generatorOutput, - static (productionContext, source) => - PanelStateIncrementalGeneratorEmitter.Emit(productionContext, source)); } } \ No newline at end of file diff --git a/StgSharp.UserInterface/Global.cs b/StgSharp.UserInterface/Global.cs index fc3655a4..1d79fb67 100644 --- a/StgSharp.UserInterface/Global.cs +++ b/StgSharp.UserInterface/Global.cs @@ -1,3 +1,9 @@ +// ----------------------------------------------------------------------------- +// file="Global" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- global using System; global using System.Collections.Generic; diff --git a/StgSharp.UserInterface/Sample/PanelStateSample.cs b/StgSharp.UserInterface/Sample/PanelStateSample.cs index 673b278c..f440b493 100644 --- a/StgSharp.UserInterface/Sample/PanelStateSample.cs +++ b/StgSharp.UserInterface/Sample/PanelStateSample.cs @@ -1,33 +1,25 @@ +// ----------------------------------------------------------------------------- +// file="PanelStateSample" +// Project: StgSharp +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using System; namespace StgSharp.UserInterface.Sample { public sealed class PanelStateSample : PanelState { + public const string SampleStatePath = nameof(PanelStateSample) + "." + nameof(SampleState); private int sampleState; - public PanelStateSample() - : base(nameof(PanelStateSample)) - { - } + public PanelStateSample() : base(nameof(PanelStateSample)) { } public int SampleState => sampleState; - // 生成器拆分后,这里相当于某个节点 handler 的 guard, - // 对应 ICommand 语义中的 CanExecute。 - private static bool CanApplySampleStateChange( - int origin, - int current, - StateValueCommand command - ) - { - return string.Equals(command.StatePath, SampleStatePath, StringComparison.Ordinal) - && current >= 0 - && origin != current; - } - // 实际项目里这整个 StateChangeHandler 都由源生成器产出; // 这里手写展开,只是为了展示“没有生成器时 VSS 代码长什么样”。 public void ApplySampleStateChangeCommand( @@ -38,8 +30,7 @@ namespace StgSharp.UserInterface.Sample int origin = sampleState; int current = command.Value; - if (!CanApplySampleStateChange(origin, current, command)) - { + if (!CanApplySampleStateChange(origin, current, command)) { return; } @@ -50,8 +41,8 @@ namespace StgSharp.UserInterface.Sample // 生成器拆分后,这里相当于某个节点写入后的 post-change hook, // 对应手写体系里常见的 OnChange 位置。 private static void BroadcastSampleStateChanged( - int origin, - int current + int origin, + int current ) { _ = origin; @@ -61,5 +52,18 @@ namespace StgSharp.UserInterface.Sample // 这里只能继续手写内部同步/广播逻辑;正式版本由生成器织入。 } + // 生成器拆分后,这里相当于某个节点 handler 的 guard, + // 对应 ICommand 语义中的 CanExecute。 + private static bool CanApplySampleStateChange( + int origin, + int current, + StateValueCommand command + ) + { + return string.Equals(command.StatePath, SampleStatePath, StringComparison.Ordinal) && + current >= 0 && + origin != current; + } + } } diff --git a/StgSharpDebug/MatrixTest.cs b/StgSharpDebug/MatrixTest.cs index 7b6e9efe..9f3c9582 100644 --- a/StgSharpDebug/MatrixTest.cs +++ b/StgSharpDebug/MatrixTest.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="MatrixTest" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics.Numeric; using System; diff --git a/StgSharpDebug/Program.cs b/StgSharpDebug/Program.cs index 18a17107..f423d6c5 100644 --- a/StgSharpDebug/Program.cs +++ b/StgSharpDebug/Program.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Program" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Graphics; using StgSharp.HighPerformance.Memory; using StgSharp.Internal; @@ -43,7 +23,9 @@ namespace StgSharp private static string testExpPath = @"D:\Programmer\stepcode\data\ap203\ap203.exp"; - internal static unsafe void Main(string[] args) + internal static unsafe void Main( + string[] args + ) { try { diff --git a/StgSharpDebug/RenderStream/Partical.cs b/StgSharpDebug/RenderStream/Partical.cs index 8091aeb6..7774b1d9 100644 --- a/StgSharpDebug/RenderStream/Partical.cs +++ b/StgSharpDebug/RenderStream/Partical.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="Partical" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; diff --git a/StgSharpDebug/SlabStressTest.cs b/StgSharpDebug/SlabStressTest.cs index 5e8727ae..0e83cd5f 100644 --- a/StgSharpDebug/SlabStressTest.cs +++ b/StgSharpDebug/SlabStressTest.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="SlabStressTest" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; using System.Diagnostics; diff --git a/StgSharpDebug/TestRegexAnalyse.cs b/StgSharpDebug/TestRegexAnalyse.cs index e041d74b..67d6cc57 100644 --- a/StgSharpDebug/TestRegexAnalyse.cs +++ b/StgSharpDebug/TestRegexAnalyse.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TestRegexAnalyse" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.RegularAnalysis.Abstraction; using StgSharp.RegularAnalysis.Text; using System; @@ -40,7 +20,7 @@ namespace StgSharp { private static string[] regexSource = [ - @"[.]*", + @"(123(4|5)67){3,4}114514", /**/ @"http|https|ftp|ftps", @"abc[0-9]x|abc[0-9]y|abd[0-9]x|abd[0-9]y|xyz", @@ -54,7 +34,7 @@ namespace StgSharp { foreach (string regex in regexSource) { - TextRegexSource interpreterSource = RegexAnalyzerFrontEnd.Analyze(regex); + TextRegexSource interpreterSource = RegexAnalyzer.Analyze(regex); AbstractSyntaxTree tree = interpreterSource.Ast; Console.WriteLine($"result of \"{regex}\""); TreeEnumerator enumerator = new(tree); diff --git a/StgSharpDebug/TestRender.cs b/StgSharpDebug/TestRender.cs index 32e8694d..02d89265 100644 --- a/StgSharpDebug/TestRender.cs +++ b/StgSharpDebug/TestRender.cs @@ -1,33 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="TestRender.cs" +// ----------------------------------------------------------------------------- +// file="TestRender" // Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using StgSharp.Graphics; using System; diff --git a/StgSharpDebug/TestSwiss.cs b/StgSharpDebug/TestSwiss.cs index bcedf871..6cb088da 100644 --- a/StgSharpDebug/TestSwiss.cs +++ b/StgSharpDebug/TestSwiss.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TestSwiss" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.Collections; using System; using System.Collections.Generic; diff --git a/StgSharpDebug/TlsfStressTest.cs b/StgSharpDebug/TlsfStressTest.cs index b552d8cf..51438867 100644 --- a/StgSharpDebug/TlsfStressTest.cs +++ b/StgSharpDebug/TlsfStressTest.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="TlsfStressTest" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; using System.Collections.Generic; diff --git a/StgSharpDebug/hlsf-test.cs b/StgSharpDebug/hlsf-test.cs index a10790c5..ff41ac32 100644 --- a/StgSharpDebug/hlsf-test.cs +++ b/StgSharpDebug/hlsf-test.cs @@ -1,30 +1,10 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------------- // file="hlsf-test" // Project: StgSharp -// AuthorGroup: Nitload -// Copyright (c) Nitload. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- +// Copyright (c) Nitload. +// SPDX-License-Identifier: MIT +// ----------------------------------------------------------------------------- + using StgSharp.HighPerformance.Memory; using System; using System.Collections.Generic;