code clean up

This commit is contained in:
Youmu Liu
2025-10-17 10:49:00 +08:00
parent d3e0b5d005
commit 1927f4fdf3
223 changed files with 5675 additions and 6160 deletions
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="BidirectionalDictionary.cs" // file="BidirectionalDictionary"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -49,49 +46,49 @@ namespace StgSharp.Commom.Collections
_reverse = new Dictionary<TSecond, TFirst>(); _reverse = new Dictionary<TSecond, TFirst>();
} }
public TFirst this[ TSecond key ] public TFirst this[TSecond key]
{ {
get get
{ {
if( _reverse.TryGetValue( key, out TFirst value ) ) { if (_reverse.TryGetValue(key, out TFirst value)) {
return value; return value;
} }
throw new ArgumentException( $"Cannot find key {key!.ToString()} in dictionary." ); throw new ArgumentException($"Cannot find key {key!.ToString()} in dictionary.");
} }
set set
{ {
if( _reverse.TryGetValue( key, out TFirst origin ) ) if (_reverse.TryGetValue(key, out TFirst origin))
{ {
_reverse[ key ] = value; _reverse[key] = value;
_forward.Remove( origin ); _forward.Remove(origin);
} else } else
{ {
_reverse.Add( key, value ); _reverse.Add(key, value);
} }
_forward.Add( value, key ); _forward.Add(value, key);
} }
} }
public TSecond this[ TFirst key ] public TSecond this[TFirst key]
{ {
get get
{ {
if( _forward.TryGetValue( key, out TSecond value ) ) { if (_forward.TryGetValue(key, out TSecond value)) {
return value; return value;
} }
throw new ArgumentException( $"Cannot find key {key!.ToString()} in dictionary." ); throw new ArgumentException($"Cannot find key {key!.ToString()} in dictionary.");
} }
set set
{ {
if( _forward.TryGetValue( key, out TSecond origin ) ) if (_forward.TryGetValue(key, out TSecond origin))
{ {
_forward[ key ] = value; _forward[key] = value;
_reverse.Remove( origin ); _reverse.Remove(origin);
} else } else
{ {
_forward.Add( key, value ); _forward.Add(key, value);
} }
_reverse.Add( value, key ); _reverse.Add(value, key);
} }
} }
@@ -104,27 +101,27 @@ namespace StgSharp.Commom.Collections
public int Count => _forward.Count; public int Count => _forward.Count;
public IReadOnlyDictionary<TFirst, TSecond> Forward => new ReadOnlyDictionary<TFirst, TSecond>( public IReadOnlyDictionary<TFirst, TSecond> Forward => new ReadOnlyDictionary<TFirst, TSecond>(
_forward ); _forward);
public IReadOnlyDictionary<TSecond, TFirst> Reverse => new ReadOnlyDictionary<TSecond, TFirst>( public IReadOnlyDictionary<TSecond, TFirst> Reverse => new ReadOnlyDictionary<TSecond, TFirst>(
_reverse ); _reverse);
public void Add( KeyValuePair<TFirst, TSecond> item ) public void Add(KeyValuePair<TFirst, TSecond> item)
{ {
if( _forward.ContainsKey( item.Key ) || _reverse.ContainsKey( item.Value ) ) { if (_forward.ContainsKey(item.Key) || _reverse.ContainsKey(item.Value)) {
throw new ArgumentException( "Duplicate key or value." ); throw new ArgumentException("Duplicate key or value.");
} }
_forward.Add( item.Key, item.Value ); _forward.Add(item.Key, item.Value);
_reverse.Add( item.Value, item.Key ); _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 ) ) { if (_forward.ContainsKey(key) || _reverse.ContainsKey(value)) {
throw new ArgumentException( "Duplicate key or value." ); throw new ArgumentException("Duplicate key or value.");
} }
_forward.Add( key, value ); _forward.Add(key, value);
_reverse.Add( value, key ); _reverse.Add(value, key);
} }
public void Clear() public void Clear()
@@ -133,68 +130,66 @@ namespace StgSharp.Commom.Collections
_reverse.Clear(); _reverse.Clear();
} }
public bool Contains( KeyValuePair<TFirst, TSecond> item ) public bool Contains(KeyValuePair<TFirst, TSecond> item)
{ {
return _forward.Contains( item ) && return _forward.Contains(item) && _reverse.TryGetValue(item.Value, out TFirst var) && var!.Equals(item.Key);
_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 ); return _reverse.ContainsKey(key);
} }
public bool Contains( TFirst key ) public bool Contains(TFirst key)
{ {
return _forward.ContainsKey( key ); return _forward.ContainsKey(key);
} }
public void CopyTo( KeyValuePair<TFirst, TSecond>[] array, int arrayIndex ) public void CopyTo(KeyValuePair<TFirst, TSecond>[] array, int arrayIndex)
{ {
if( array == null ) { if (array == null) {
throw new ArgumentNullException( nameof( array ) ); throw new ArgumentNullException(nameof(array));
} }
if( arrayIndex < 0 || arrayIndex > array.Length ) { if (arrayIndex < 0 || arrayIndex > array.Length) {
throw new ArgumentOutOfRangeException( nameof( arrayIndex ) ); throw new ArgumentOutOfRangeException(nameof(arrayIndex));
} }
if( array.Length - arrayIndex < _forward.Count ) { if (array.Length - arrayIndex < _forward.Count) {
throw new ArgumentException( "The array is too small to copy the elements." ); throw new ArgumentException("The array is too small to copy the elements.");
} }
foreach( KeyValuePair<TFirst, TSecond> pair in _forward ) { foreach (KeyValuePair<TFirst, TSecond> pair in _forward) {
array[ arrayIndex++ ] = pair; array[arrayIndex++] = pair;
} }
} }
public IEnumerator<KeyValuePair<TFirst, TSecond>> GetEnumerator() public IEnumerator<KeyValuePair<TFirst, TSecond>> GetEnumerator()
{ {
foreach( KeyValuePair<TFirst, TSecond> pair in _forward ) { foreach (KeyValuePair<TFirst, TSecond> pair in _forward) {
yield return pair; yield return pair;
} }
} }
public bool Remove( TFirst key ) public bool Remove(TFirst key)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public bool Remove( KeyValuePair<TFirst, TSecond> item ) public bool Remove(KeyValuePair<TFirst, TSecond> item)
{ {
if( _forward.Remove( item.Key ) ) { if (_forward.Remove(item.Key)) {
return _reverse.Remove( item.Value ); return _reverse.Remove(item.Value);
} }
return false; return false;
} }
public bool TryGetValue( TFirst key, out TSecond value ) public bool TryGetValue(TFirst key, out TSecond value)
{ {
return _forward.TryGetValue( key, out 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 ); return _reverse.TryGetValue(key, out value);
} }
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="CachePool.cs" // file="CachePool"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using System; using System;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IBidrirectionalDictionary.cs" // file="IBidrirectionalDictionary"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the ¡°Software¡±), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -38,7 +35,7 @@ namespace StgSharp.Commom.Collections
public interface IBidirectionalDictionary<TFirst, TSecond> : IDictionary<TFirst, TSecond> public interface IBidirectionalDictionary<TFirst, TSecond> : IDictionary<TFirst, TSecond>
{ {
public TFirst this[ TSecond key ] { get; set; } public TFirst this[TSecond key] { get; set; }
public ICollection<TFirst> FirstIndex { get; } public ICollection<TFirst> FirstIndex { get; }
@@ -59,7 +56,7 @@ namespace StgSharp.Commom.Collections
/// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an /// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an
/// element with the specified key; otherwise, false. /// element with the specified key; otherwise, false.
/// </returns> /// </returns>
public bool Contains( TSecond key ); public bool Contains(TSecond key);
/// <summary> /// <summary>
/// Determines whether the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> /// Determines whether the <see cref="IBidirectionalDictionary{TFirst, TSecond}" />
@@ -72,16 +69,16 @@ namespace StgSharp.Commom.Collections
/// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an /// true if the <see cref="IBidirectionalDictionary{TFirst, TSecond}" /> contains an
/// element with the specified key; otherwise, false. /// element with the specified key; otherwise, false.
/// </returns> /// </returns>
public bool Contains( TFirst key ); public bool Contains(TFirst key);
public bool TryGetValue( TSecond key, out TFirst value ); public bool TryGetValue(TSecond key, out TFirst value);
#pragma warning disable CA1033 #pragma warning disable CA1033
ICollection<TFirst> IDictionary<TFirst, TSecond>.Keys => FirstIndex; ICollection<TFirst> IDictionary<TFirst, TSecond>.Keys => FirstIndex;
ICollection<TSecond> IDictionary<TFirst, TSecond>.Values => SecondIndex; ICollection<TSecond> IDictionary<TFirst, TSecond>.Values => SecondIndex;
bool IDictionary<TFirst, TSecond>.ContainsKey( TFirst key ) => Contains( key ); bool IDictionary<TFirst, TSecond>.ContainsKey(TFirst key) => Contains(key);
#pragma warning restore CA1033 #pragma warning restore CA1033
} }
} }
+34 -29
View File
@@ -1,35 +1,31 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IHashMultiplexer.cs" // file="IHashMultiplexer"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace StgSharp.Collections namespace StgSharp.Collections
{ {
@@ -38,11 +34,20 @@ namespace StgSharp.Collections
int RemainedMultiplexCount { get; set; } int RemainedMultiplexCount { get; set; }
void CacheHash( T obj, int count ); /// <summary>
/// Cache hash result for obj with counts.
/// </summary>
/// <param name="obj">
///
/// </param>
/// <param name="count">
///
/// </param>
void CacheHash(T obj, int count);
void ExtendCache( int count ); void ExtendCache(int count);
int ForceComputeHash( T count ); int ForceComputeHash(T count);
} }
} }
+46 -49
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ListSegment.cs" // file="ListSegment"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -53,35 +50,35 @@ namespace StgSharp.Collections
private int _length; private int _length;
private List<T> _collection; private List<T> _collection;
public ListSegment( List<T> collection, int begin, int length ) public ListSegment(List<T> collection, int begin, int length)
{ {
ArgumentNullException.ThrowIfNull( collection ); ArgumentNullException.ThrowIfNull(collection);
ArgumentOutOfRangeException.ThrowIfLessThan( begin, 0 ); ArgumentOutOfRangeException.ThrowIfLessThan(begin, 0);
ArgumentOutOfRangeException.ThrowIfLessThan( length, 0 ); ArgumentOutOfRangeException.ThrowIfLessThan(length, 0);
ArgumentOutOfRangeException.ThrowIfLessThan( begin + length, collection.Count ); ArgumentOutOfRangeException.ThrowIfLessThan(begin + length, collection.Count);
_collection = collection; _collection = collection;
_begin = begin; _begin = begin;
_length = length; _length = length;
} }
public T this[ int indexValue ] public T this[int indexValue]
{ {
get get
{ {
ArgumentOutOfRangeException.ThrowIfLessThan( indexValue, 0 ); ArgumentOutOfRangeException.ThrowIfLessThan(indexValue, 0);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual( indexValue, _length ); ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(indexValue, _length);
return _collection[ indexValue + _begin ]; return _collection[indexValue + _begin];
} }
} }
public T this[ Index i ] public T this[Index i]
{ {
get get
{ {
int offset = i.IsFromEnd ? _length - i.Value : i.Value; int offset = i.IsFromEnd ? _length - i.Value : i.Value;
ArgumentOutOfRangeException.ThrowIfLessThan( offset, 0 ); ArgumentOutOfRangeException.ThrowIfLessThan(offset, 0);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual( offset, _length ); ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(offset, _length);
return _collection[ offset + _begin ]; return _collection[offset + _begin];
} }
} }
@@ -89,28 +86,28 @@ namespace StgSharp.Collections
public int Count => _length; public int Count => _length;
public bool Contains( T item ) public bool Contains(T item)
{ {
int index = _collection.IndexOf( item ); int index = _collection.IndexOf(item);
return index >= _begin && index < _length + index; return index >= _begin && index < _length + index;
} }
public void CopyTo( T[] array, int arrayIndex ) public void CopyTo(T[] array, int arrayIndex)
{ {
ArgumentNullException.ThrowIfNull( array ); ArgumentNullException.ThrowIfNull(array);
Span<T> span = CollectionsMarshal.AsSpan<T>( _collection ).Slice( _begin, _length ); Span<T> span = CollectionsMarshal.AsSpan<T>(_collection).Slice(_begin, _length);
Span<T> target = new Span<T>( array, arrayIndex, _length ); Span<T> target = new Span<T>(array, arrayIndex, _length);
span.CopyTo( target ); span.CopyTo(target);
} }
public IEnumerator<T> GetEnumerator() public IEnumerator<T> GetEnumerator()
{ {
for( int i = _begin; i < _length; i++ ) { for (int i = _begin; i < _length; i++) {
yield return this[ i ]; yield return this[i];
} }
} }
void ICollection<T>.Add( T item ) void ICollection<T>.Add(T item)
{ {
throw new NotSupportedException(); throw new NotSupportedException();
} }
@@ -120,7 +117,7 @@ namespace StgSharp.Collections
throw new NotSupportedException(); throw new NotSupportedException();
} }
bool ICollection<T>.Remove( T item ) bool ICollection<T>.Remove(T item)
{ {
throw new NotSupportedException(); throw new NotSupportedException();
} }
@@ -1,4 +1,31 @@
using System; //-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="NotEnumerableList"
// 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 System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace StgSharp.Collections namespace StgSharp.Collections
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="PartialDictionary.cs" // file="PartialDictionary"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -45,61 +42,58 @@ namespace StgSharp.Collections
private readonly HashSet<TKey> _keys; private readonly HashSet<TKey> _keys;
private readonly PartialDictionaryValues _values; private readonly PartialDictionaryValues _values;
public PartialDictionary( Dictionary<TKey, TValue> source, TKey[] index ) public PartialDictionary(Dictionary<TKey, TValue> source, TKey[] index)
{ {
_source = source; _source = source;
_keys = new HashSet<TKey>( index ); _keys = new HashSet<TKey>(index);
foreach( TKey item in _keys ) foreach (TKey item in _keys)
{ {
if( !_source.ContainsKey( item ) ) { if (!_source.ContainsKey(item)) {
_source.Add( item, default! ); _source.Add(item, default!);
} }
} }
_values = new PartialDictionaryValues( this ); _values = new PartialDictionaryValues(this);
} }
public PartialDictionary( Dictionary<TKey, TValue> source, HashSet<TKey> keys ) public PartialDictionary(Dictionary<TKey, TValue> source, HashSet<TKey> keys)
{ {
_source = source; _source = source;
_keys = keys; _keys = keys;
foreach( TKey item in _keys ) foreach (TKey item in _keys)
{ {
if( !_source.ContainsKey( item ) ) { if (!_source.ContainsKey(item)) {
_source.Add( item, default! ); _source.Add(item, default!);
} }
} }
_values = new PartialDictionaryValues( this ); _values = new PartialDictionaryValues(this);
} }
public PartialDictionary( public PartialDictionary(Dictionary<TKey, TValue> source, TKey[] index, IHashMultiplexer<TKey> multiplexer)
Dictionary<TKey, TValue> source,
TKey[] index,
IHashMultiplexer<TKey> multiplexer )
{ {
_source = source; _source = source;
_keys = new HashSet<TKey>( index ); _keys = new HashSet<TKey>(index);
foreach( TKey item in _keys ) foreach (TKey item in _keys)
{ {
if( !_source.ContainsKey( item ) ) { if (!_source.ContainsKey(item)) {
_source.Add( item, default! ); _source.Add(item, default!);
} }
} }
_values = new PartialDictionaryValues( this ); _values = new PartialDictionaryValues(this);
} }
public TValue this[ TKey key ] public TValue this[TKey key]
{ {
get get
{ {
if( _keys.Contains( key ) ) { if (_keys.Contains(key)) {
return _source[ key ]; return _source[key];
} }
throw new KeyNotFoundException(); throw new KeyNotFoundException();
} }
set set
{ {
if( _keys.Contains( key ) ) { if (_keys.Contains(key)) {
_source[ key ] = value; _source[key] = value;
} }
throw new KeyNotFoundException(); throw new KeyNotFoundException();
} }
@@ -111,40 +105,40 @@ namespace StgSharp.Collections
public int Count => _keys.Count; public int Count => _keys.Count;
public bool Contains( KeyValuePair<TKey, TValue> item ) public bool Contains(KeyValuePair<TKey, TValue> item)
{ {
return _keys.Contains( item.Key ) && _source.Contains( item ); return _keys.Contains(item.Key) && _source.Contains(item);
} }
public bool ContainsKey( TKey key ) public bool ContainsKey(TKey key)
{ {
return _keys.Contains( key ); return _keys.Contains(key);
} }
public void CopyTo( KeyValuePair<TKey, TValue>[] array, int arrayIndex ) public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{ {
foreach( TKey item in _keys ) { foreach (TKey item in _keys) {
yield return new KeyValuePair<TKey, TValue>( item, _source[ item ] ); yield return new KeyValuePair<TKey, TValue>(item, _source[item]);
} }
} }
public bool TryGetValue( TKey key, out TValue value ) public bool TryGetValue(TKey key, out TValue value)
{ {
if( _keys.Contains( key ) ) if (_keys.Contains(key))
{ {
value = _source[ key ]; value = _source[key];
return true; return true;
} }
value = default!; value = default!;
return false; return false;
} }
void ICollection<KeyValuePair<TKey, TValue>>.Add( KeyValuePair<TKey, TValue> item ) void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
{ {
return; return;
} }
@@ -154,19 +148,19 @@ namespace StgSharp.Collections
throw new NotSupportedException(); throw new NotSupportedException();
} }
bool ICollection<KeyValuePair<TKey, TValue>>.Remove( KeyValuePair<TKey, TValue> item ) bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
{ {
throw new NotSupportedException(); throw new NotSupportedException();
} }
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => true; bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => true;
void IDictionary<TKey, TValue>.Add( TKey key, TValue value ) void IDictionary<TKey, TValue>.Add(TKey key, TValue value)
{ {
return; return;
} }
bool IDictionary<TKey, TValue>.Remove( TKey key ) bool IDictionary<TKey, TValue>.Remove(TKey key)
{ {
throw new NotSupportedException(); throw new NotSupportedException();
} }
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="RandomAccessibleStack.cs" // file="RandomAccessibleStack"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="StringHashMultiplexer.cs" // file="StringHashMultiplexer"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
@@ -50,47 +47,47 @@ namespace StgSharp.Collections
set => _initCount = value; set => _initCount = value;
} }
public void CacheHash( string obj, int count ) public void CacheHash(string obj, int count)
{ {
_hashCache = ForceComputeHash( obj ); _hashCache = ForceComputeHash(obj);
_initCount = count; _initCount = count;
_remainedCount = _initCount; _remainedCount = _initCount;
_source = obj; _source = obj;
} }
public bool Equals( string x, string y ) public bool Equals(string x, string y)
{ {
return x == y; return x == y;
} }
public void ExtendCache( int count ) public void ExtendCache(int count)
{ {
_initCount += count; _initCount += count;
_remainedCount += count; _remainedCount += count;
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int ForceComputeHash( [NotNull] string obj ) public unsafe int ForceComputeHash([NotNull] string obj)
{ {
int hash; int hash;
fixed( char* cPtr = obj.AsSpan() ) { fixed (char* cPtr = obj.AsSpan()) {
hash = InternalIO.Intrinsic.city_hash_simplify( cPtr, obj.Length ); hash = InternalIO.Intrinsic.city_hash_simplify(cPtr, obj.Length);
} }
return hash; return hash;
} }
public int GetHashCode( string obj ) public int GetHashCode(string obj)
{ {
if( _remainedCount > 0 && ReferenceEquals( _source, obj ) ) if (_remainedCount > 0 && ReferenceEquals(_source, obj))
{ {
_remainedCount--; _remainedCount--;
return _hashCache; return _hashCache;
} }
if( ReferenceEquals( _sourceLast, obj ) ) { if (ReferenceEquals(_sourceLast, obj)) {
return _hashLast; return _hashLast;
} }
_sourceLast = obj; _sourceLast = obj;
_hashLast = ForceComputeHash( obj ); _hashLast = ForceComputeHash(obj);
return _hashLast; return _hashLast;
} }
@@ -101,7 +98,7 @@ namespace StgSharp.Collections
private bool disposedValue; private bool disposedValue;
private readonly ThreadLocal<StringHashMultiplexer> _multiplexers = private readonly ThreadLocal<StringHashMultiplexer> _multiplexers =
new( () => new StringHashMultiplexer() ); new(() => new StringHashMultiplexer());
public int RemainedMultiplexCount public int RemainedMultiplexCount
{ {
@@ -109,51 +106,51 @@ namespace StgSharp.Collections
set => _multiplexers.Value.RemainedMultiplexCount = value; set => _multiplexers.Value.RemainedMultiplexCount = value;
} }
public void CacheHash( string obj, int count ) public void CacheHash(string obj, int count)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
// ~ConcurrentStringHashMultiplexer() // ~ConcurrentStringHashMultiplexer()
// { // {
// Dispose(disposing: false); // Dispose(disposing: false);
// } // }
public void Dispose() public void Dispose()
{ {
Dispose( disposing: true ); Dispose(disposing:true);
GC.SuppressFinalize( this ); GC.SuppressFinalize(this);
} }
public bool Equals( string x, string y ) public bool Equals(string x, string y)
{ {
return x == y; return x == y;
} }
public void ExtendCache( int count ) public void ExtendCache(int count)
{ {
_multiplexers.Value.ExtendCache( count ); _multiplexers.Value.ExtendCache(count);
} }
public unsafe int ForceComputeHash( [NotNull] string obj ) public unsafe int ForceComputeHash([NotNull] string obj)
{ {
int hash; int hash;
fixed( char* cPtr = obj.AsSpan() ) { fixed (char* cPtr = obj.AsSpan()) {
hash = InternalIO.Intrinsic.city_hash_simplify( cPtr, obj.Length ); hash = InternalIO.Intrinsic.city_hash_simplify(cPtr, obj.Length);
} }
return hash; return hash;
} }
public int GetHashCode( string obj ) public int GetHashCode(string obj)
{ {
return _multiplexers.Value.GetHashCode( obj ); return _multiplexers.Value.GetHashCode(obj);
} }
private void Dispose( bool disposing ) private void Dispose(bool disposing)
{ {
if( !disposedValue ) if (!disposedValue)
{ {
if( disposing ) { if (disposing) {
_multiplexers.Dispose(); _multiplexers.Dispose();
} }
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="BattleField.cs" // file="BattleField"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ButtonGroup" // file="ButtonGroup"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="CharacterIndexImage" // file="CharacterIndexImage"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ControllingIntem" // file="ControllingIntem"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="DecorationBox" // file="DecorationBox"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="MarkingLable" // file="MarkingLable"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="TriggerButton" // file="TriggerButton"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="KeyEnum.cs" // file="KeyEnum"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics; using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using StgSharp.Internal.OpenGL; using StgSharp.Internal.OpenGL;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="KeyEventAttribute.cs" // file="KeyEventAttribute"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -36,7 +33,7 @@ using System.Threading.Tasks;
namespace StgSharp namespace StgSharp
{ {
[AttributeUsage( AttributeTargets.Method )] [AttributeUsage(AttributeTargets.Method)]
public class KeyEventAttribute : Attribute public class KeyEventAttribute : Attribute
{ {
@@ -44,25 +41,25 @@ namespace StgSharp
internal int _keyStat; internal int _keyStat;
internal int _keyTarget; internal int _keyTarget;
public KeyEventAttribute( KeyboardKey key, KeyStatus status ) public KeyEventAttribute(KeyboardKey key, KeyStatus status)
{ {
_equipment = ( int )InputEquipment.Keyboard; _equipment = (int)InputEquipment.Keyboard;
_keyTarget = ( int )key; _keyTarget = (int)key;
_keyStat = ( int )status; _keyStat = (int)status;
} }
public KeyEventAttribute( Joystick joystick, KeyStatus status ) public KeyEventAttribute(Joystick joystick, KeyStatus status)
{ {
_equipment = ( int )InputEquipment.Keyboard; _equipment = (int)InputEquipment.Keyboard;
_keyTarget = ( int )joystick; _keyTarget = (int)joystick;
_keyStat = ( int )status; _keyStat = (int)status;
} }
public KeyEventAttribute( Mouse mouse, KeyStatus status ) public KeyEventAttribute(Mouse mouse, KeyStatus status)
{ {
_equipment = ( int )InputEquipment.Keyboard; _equipment = (int)InputEquipment.Keyboard;
_keyTarget = ( int )mouse; _keyTarget = (int)mouse;
_keyStat = ( int )status; _keyStat = (int)status;
} }
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IClickTrigger.cs" // file="IClickTrigger"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="JoystickTrigger.cs" // file="JoystickTrigger"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -40,13 +37,13 @@ namespace StgSharp.Controlling.UsrActivity
private readonly Joystick _stick; private readonly Joystick _stick;
private readonly KeyStatus _status; private readonly KeyStatus _status;
public JoystickTrigger( Joystick targetKey, KeyStatus status ) public JoystickTrigger(Joystick targetKey, KeyStatus status)
{ {
this._stick = targetKey; this._stick = targetKey;
_status = status; _status = status;
} }
public int TargetKeyOrButtonID => ( int )_stick; public int TargetKeyOrButtonID => (int)_stick;
public Joystick Stick public Joystick Stick
{ {
@@ -55,14 +52,14 @@ namespace StgSharp.Controlling.UsrActivity
public KeyStatus TriggeredStatus => _status; public KeyStatus TriggeredStatus => _status;
public override bool Equals( object obj ) public override bool Equals(object obj)
{ {
return base.Equals( obj ); return base.Equals(obj);
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return ( ( int )_stick ) + ( 17 * ( ( int )_status ) ); return ((int)_stick) + (17 * ((int)_status));
} }
public override string ToString() public override string ToString()
@@ -70,17 +67,17 @@ namespace StgSharp.Controlling.UsrActivity
return $"Key {_stick} triggered when {_status}"; return $"Key {_stick} triggered when {_status}";
} }
public static bool operator !=( JoystickTrigger left, JoystickTrigger right ) public static bool operator !=(JoystickTrigger left, JoystickTrigger right)
{ {
return !( left == right ); return !(left == right);
} }
public static bool operator ==( JoystickTrigger left, JoystickTrigger right ) public static bool operator ==(JoystickTrigger left, JoystickTrigger right)
{ {
return ( left._status == right._status ) && ( left._stick == right._stick ); return (left._status == right._status) && (left._stick == right._stick);
} }
bool IEquatable<JoystickTrigger>.Equals( JoystickTrigger other ) bool IEquatable<JoystickTrigger>.Equals(JoystickTrigger other)
{ {
return other == this; return other == this;
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="KeyTrigger.cs" // file="KeyTrigger"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
@@ -41,24 +38,24 @@ namespace StgSharp.Controlling.UsrActivity
private readonly KeyboardKey _targetKey; private readonly KeyboardKey _targetKey;
private readonly KeyStatus _triggerStat; private readonly KeyStatus _triggerStat;
public KeyTrigger( KeyboardKey targetKey, KeyStatus targetStat ) public KeyTrigger(KeyboardKey targetKey, KeyStatus targetStat)
{ {
this._targetKey = targetKey; this._targetKey = targetKey;
this._triggerStat = targetStat; this._triggerStat = targetStat;
} }
public int TargetKeyOrButtonID => ( int )_targetKey; public int TargetKeyOrButtonID => (int)_targetKey;
public KeyStatus TriggeredStatus => _triggerStat; public KeyStatus TriggeredStatus => _triggerStat;
public override bool Equals( object obj ) public override bool Equals(object obj)
{ {
return base.Equals( obj ); return base.Equals(obj);
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return ( ( int )_targetKey ) + ( 17 * ( ( int )_triggerStat ) ); return ((int)_targetKey) + (17 * ((int)_triggerStat));
} }
public override string ToString() public override string ToString()
@@ -66,18 +63,17 @@ namespace StgSharp.Controlling.UsrActivity
return $"Key {_targetKey} triggered when {_triggerStat}"; return $"Key {_targetKey} triggered when {_triggerStat}";
} }
public static bool operator !=( KeyTrigger left, KeyTrigger right ) public static bool operator !=(KeyTrigger left, KeyTrigger right)
{ {
return !( left == right ); return !(left == right);
} }
public static bool operator ==( KeyTrigger left, KeyTrigger right ) public static bool operator ==(KeyTrigger left, KeyTrigger right)
{ {
return ( left._triggerStat == right._triggerStat ) && return (left._triggerStat == right._triggerStat) && (left._targetKey == right._targetKey);
( left._targetKey == right._targetKey );
} }
bool IEquatable<KeyTrigger>.Equals( KeyTrigger other ) bool IEquatable<KeyTrigger>.Equals(KeyTrigger other)
{ {
return other == this; return other == this;
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="MouseTrigger.cs" // file="MouseTrigger"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Mathematics; using StgSharp.Mathematics;
using System; using System;
@@ -43,27 +40,27 @@ namespace StgSharp.Controlling.UsrActivity
private readonly KeyStatus _status; private readonly KeyStatus _status;
private readonly Mouse _mouse; private readonly Mouse _mouse;
public MouseTrigger( Mouse mouse, KeyStatus status ) public MouseTrigger(Mouse mouse, KeyStatus status)
{ {
_mouse = mouse; _mouse = mouse;
_status = status; _status = status;
} }
public int TargetKeyOrButtonID => ( int )_mouse; public int TargetKeyOrButtonID => (int)_mouse;
public KeyStatus TriggeredStatus => _status; public KeyStatus TriggeredStatus => _status;
public bool Equals( MouseTrigger other ) public bool Equals(MouseTrigger other)
{ {
return this == other; return this == other;
} }
public static bool operator !=( MouseTrigger left, MouseTrigger right ) public static bool operator !=(MouseTrigger left, MouseTrigger right)
{ {
return left._mouse != right._mouse || left._status != right._status; return left._mouse != right._mouse || left._status != right._status;
} }
public static bool operator ==( MouseTrigger left, MouseTrigger right ) public static bool operator ==(MouseTrigger left, MouseTrigger right)
{ {
return left._mouse == right._mouse && left._status == right._status; return left._mouse == right._mouse && left._status == right._status;
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="TriggetFactory.cs" // file="TriggetFactory"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Mathematics; using StgSharp.Mathematics;
using System; using System;
@@ -39,52 +36,52 @@ namespace StgSharp.Controlling.UsrActivity
public static class TriggetBuilder public static class TriggetBuilder
{ {
private const int JoystickMax = ( int )Joystick.Last + 1; private const int JoystickMax = (int)Joystick.Last + 1;
private const int JoystickMin = ( int )Joystick.First - 1; private const int JoystickMin = (int)Joystick.First - 1;
private const int KeyboardMax = ( int )KeyboardKey.Last + 1; private const int KeyboardMax = (int)KeyboardKey.Last + 1;
private const int KeyboardMin = ( int )KeyboardKey.First - 1; private const int KeyboardMin = (int)KeyboardKey.First - 1;
private const int MouseMax = ( int )Mouse.Last + 1; private const int MouseMax = (int)Mouse.Last + 1;
private const int MouseMin = ( int )Mouse.First - 1; private const int MouseMin = (int)Mouse.First - 1;
private static KeyTrigger keyboardtemp; private static KeyTrigger keyboardtemp;
private static MouseTrigger mousetemp; private static MouseTrigger mousetemp;
public static JoystickTrigger BuildJoystickClickTrigger( int keyCode, KeyStatus status ) public static JoystickTrigger BuildJoystickClickTrigger(int keyCode, KeyStatus status)
{ {
if( keyCode > MouseMin && keyCode < MouseMax ) { if (keyCode > MouseMin && keyCode < MouseMax) {
return new JoystickTrigger( ( Joystick )keyCode, status ); return new JoystickTrigger((Joystick)keyCode, status);
} }
throw new InvalidOperationException( "Known key code or key is not on joystick." ); throw new InvalidOperationException("Known key code or key is not on joystick.");
} }
public static KeyTrigger BuildKeyboardClickTrigger( int keyCode, KeyStatus status ) public static KeyTrigger BuildKeyboardClickTrigger(int keyCode, KeyStatus status)
{ {
if( keyCode > KeyboardMin && keyCode < KeyboardMax ) { if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger( ( KeyboardKey )keyCode, status ); return new KeyTrigger((KeyboardKey)keyCode, status);
} }
throw new InvalidOperationException( "Known key code or kay is not on keyboard." ); throw new InvalidOperationException("Known key code or kay is not on keyboard.");
} }
public static MouseTrigger BuildMouseClickTrigger( int keyCode, KeyStatus status ) public static MouseTrigger BuildMouseClickTrigger(int keyCode, KeyStatus status)
{ {
if( keyCode >= MouseMin && keyCode <= MouseMax ) { if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger( ( Mouse )keyCode, status ); return new MouseTrigger((Mouse)keyCode, status);
} }
throw new InvalidOperationException( "Known key code or key is not on mouse." ); throw new InvalidOperationException("Known key code or key is not on mouse.");
} }
public static IClickTrigger BuildTrigger( int keyCode, KeyStatus status ) public static IClickTrigger BuildTrigger(int keyCode, KeyStatus status)
{ {
if( keyCode > KeyboardMin && keyCode < KeyboardMax ) { if (keyCode > KeyboardMin && keyCode < KeyboardMax) {
return new KeyTrigger( ( KeyboardKey )keyCode, status ); return new KeyTrigger((KeyboardKey)keyCode, status);
} }
if( keyCode > JoystickMin && keyCode < JoystickMax ) { if (keyCode > JoystickMin && keyCode < JoystickMax) {
return new JoystickTrigger( ( Joystick )keyCode, status ); return new JoystickTrigger((Joystick)keyCode, status);
} }
if( keyCode >= MouseMin && keyCode <= MouseMax ) { if (keyCode >= MouseMin && keyCode <= MouseMax) {
return new MouseTrigger( ( Mouse )keyCode, status ); return new MouseTrigger((Mouse)keyCode, status);
} }
throw new InvalidOperationException( "Known key code." ); throw new InvalidOperationException("Known key code.");
} }
} }
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Counter.cs" // file="Counter"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Numerics; using System.Numerics;
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="root.cs" // file="root"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+26 -24
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="RandomGenerator.cs" // file="RandomGenerator"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -56,7 +53,12 @@ namespace StgSharp.Data
string data = sw.ToString(); string data = sw.ToString();
originKey = Encoding.Unicode.GetBytes(data); originKey = Encoding.Unicode.GetBytes(data);
} }
currentKey = [0,0,0,0]; currentKey = [
0,
0,
0,
0
];
fixed (byte* o = originKey, c = currentKey) { fixed (byte* o = originKey, c = currentKey) {
*(int*)c = UnsafeCompute.CityHashSimplify((char*)o, 0, originKey.Length / 2); *(int*)c = UnsafeCompute.CityHashSimplify((char*)o, 0, originKey.Length / 2);
} }
@@ -65,9 +67,9 @@ namespace StgSharp.Data
public int TotalGeneratedRandom public int TotalGeneratedRandom
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get; get;
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private set; private set;
} }
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Area.cs" // file="Area"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Internal.FileIO; using StgSharp.Internal.FileIO;
using System; using System;
+38 -41
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="DataHead.cs" // file="DataHead"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.HighPerformance; using StgSharp.HighPerformance;
using System; using System;
@@ -36,41 +33,41 @@ using System.Runtime.InteropServices;
namespace StgSharp.Internal namespace StgSharp.Internal
{ {
[StructLayout( LayoutKind.Explicit, Size = 16 )] [StructLayout(LayoutKind.Explicit, Size = 16)]
public struct SSDSegmentHead public struct SSDSegmentHead
{ {
[FieldOffset( 12 )] internal byte size; [FieldOffset(12)] internal byte size;
[FieldOffset( 0 )] internal M128 data; [FieldOffset(0)] internal M128 data;
[FieldOffset( 13 )] public byte selfDefine_1; [FieldOffset(13)] public byte selfDefine_1;
[FieldOffset( 14 )] public byte selfDefine_2; [FieldOffset(14)] public byte selfDefine_2;
[FieldOffset( 15 )] public byte selfDefine_3; [FieldOffset(15)] public byte selfDefine_3;
[FieldOffset( 0 )] public int globalID; [FieldOffset(0)] public int globalID;
[FieldOffset( 4 )] public int nextID; [FieldOffset(4)] public int nextID;
[FieldOffset( 8 )] public int previousHash; [FieldOffset(8)] public int previousHash;
public int Size public int Size
{ {
get => ( ( int )size ) + 1; get => ((int)size) + 1;
set set
{ {
if( ( value > 256 ) || ( value < 0 ) ) { if ((value > 256) || (value < 0)) {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
size = ( byte )( value - 1 ); size = (byte)(value - 1);
} }
} }
public unsafe byte[] GetBytes() public unsafe byte[] GetBytes()
{ {
byte[] ret = new byte[16]; byte[] ret = new byte[16];
fixed( M128* vptr = &data ) fixed (M128* vptr = &data)
{ {
byte* bptr = ( byte* )vptr; byte* bptr = (byte*)vptr;
for( int i = 0; i < 15; i++ ) { for (int i = 0; i < 15; i++) {
ret[ i ] = *bptr; ret[i] = *bptr;
} }
} }
return ret; return ret;
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="DataSegment.cs" // file="DataSegment"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+25 -28
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="SSD.cs" // file="SSD"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Internal.FileIO; using StgSharp.Internal.FileIO;
using System; using System;
@@ -50,15 +47,15 @@ namespace StgSharp.Internal
fileList = new Dictionary<string, SSDraw>(); fileList = new Dictionary<string, SSDraw>();
} }
public SSD( FileStream fileStream ) public SSD(FileStream fileStream)
{ {
fileList = new Dictionary<string, SSDraw>(); fileList = new Dictionary<string, SSDraw>();
file = fileStream; file = fileStream;
} }
public static SSD FromFile( string fileRoute ) public static SSD FromFile(string fileRoute)
{ {
return new SSD( new FileStream( fileRoute, FileMode.Open, FileAccess.Read ) ) return new SSD(new FileStream(fileRoute, FileMode.Open, FileAccess.Read))
{ {
}; };
} }
+29 -32
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="SSDVirtualFolder.cs" // file="SSDVirtualFolder"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Internal.FileIO; using StgSharp.Internal.FileIO;
using System; using System;
@@ -49,15 +46,15 @@ namespace StgSharp.Internal
folders = new Dictionary<string, SSDFolder>(); folders = new Dictionary<string, SSDFolder>();
} }
internal SSDFolder( string name ) internal SSDFolder(string name)
{ {
if( name == "root" ) { if (name == "root") {
throw new ArgumentException( throw new ArgumentException(
"Name cannot be root," + "it is preserved for root file indexer." ); "Name cannot be root," + "it is preserved for root file indexer.");
} }
if( name == "default" ) { if (name == "default") {
throw new ArgumentException( throw new ArgumentException(
"Name cannot be default," + "it is preserved for default file id provider." ); "Name cannot be default," + "it is preserved for default file id provider.");
} }
_name = name; _name = name;
folders = new Dictionary<string, SSDFolder>(); folders = new Dictionary<string, SSDFolder>();
@@ -65,12 +62,12 @@ namespace StgSharp.Internal
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.VirtualFolder; public SerializableTypeCode SSDTypeCode => SerializableTypeCode.VirtualFolder;
public void FromBytes( byte[] stream ) public void FromBytes(byte[] stream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
//TODO TOUGH TO Get Bytes from virtual folders // TODO TOUGH TO Get Bytes from virtual folders
public byte[] GetBytes() public byte[] GetBytes()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
+27 -30
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="SSDraw.cs" // file="SSDraw"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.ShaderEdit; using StgSharp.Graphics.ShaderEdit;
using System; using System;
@@ -50,14 +47,14 @@ namespace StgSharp.Internal.FileIO
private byte[] data; private byte[] data;
public SSDraw( string name, Stream streamSource ) public SSDraw(string name, Stream streamSource)
{ {
if( ( streamSource == null ) || ( streamSource.Length == 0 ) ) { if ((streamSource == null) || (streamSource.Length == 0)) {
throw new ArgumentNullException( nameof( streamSource ) ); throw new ArgumentNullException(nameof(streamSource));
} }
Name = name; Name = name;
data = new byte[streamSource.Length]; data = new byte[streamSource.Length];
streamSource.Read( data.AsSpan() ); streamSource.Read(data.AsSpan());
} }
public SSDrawHead Head { get; set; } public SSDrawHead Head { get; set; }
@@ -66,6 +63,6 @@ namespace StgSharp.Internal.FileIO
} }
[StructLayout( LayoutKind.Explicit, Size = 32 * 16 )] [StructLayout(LayoutKind.Explicit, Size = 32 * 16)]
public unsafe struct SSDrawHead { } public unsafe struct SSDrawHead { }
} }
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Define.cs" // file="Define"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ISSDSerializable.cs" // file="ISSDSerializable"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -43,7 +40,7 @@ namespace StgSharp.Internal
public byte[] GetBytes(); public byte[] GetBytes();
internal void FromBytes( byte[] stream ); internal void FromBytes(byte[] stream);
} }
@@ -65,16 +62,16 @@ namespace StgSharp.Internal
public static partial class Serializer public static partial class Serializer
{ {
public static T Deserialize<T>( byte[] stream ) where T: ISSDSerializable public static T Deserialize<T>(byte[] stream) where T: ISSDSerializable
{ {
T serializableObject = Activator.CreateInstance<T>(); T serializableObject = Activator.CreateInstance<T>();
serializableObject.FromBytes( stream ); serializableObject.FromBytes(stream);
return serializableObject; return serializableObject;
} }
public static string GetNameTail( SerializableTypeCode typeCode ) public static string GetNameTail(SerializableTypeCode typeCode)
{ {
switch( typeCode ) switch (typeCode)
{ {
case SerializableTypeCode.IndexTable: case SerializableTypeCode.IndexTable:
return "_idt"; return "_idt";
@@ -93,11 +90,11 @@ namespace StgSharp.Internal
case SerializableTypeCode.VirtualFolder: case SerializableTypeCode.VirtualFolder:
return "_fod"; return "_fod";
default: default:
throw new ArgumentException( "Unknown file type" ); throw new ArgumentException("Unknown file type");
} }
} }
public static byte[] Serialize( ISSDSerializable serializableObject ) public static byte[] Serialize(ISSDSerializable serializableObject)
{ {
return serializableObject.GetBytes(); return serializableObject.GetBytes();
} }
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ValueBox.cs" // file="ValueBox"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="BehaviorArgs.cs" // file="BehaviorArgs"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
namespace StgSharp.Entities namespace StgSharp.Entities
{ {
public abstract class BehaviorArgs { } public abstract class BehaviorArgs { }
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Enemy.cs" // file="Enemy"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
namespace StgSharp.Entities namespace StgSharp.Entities
{ {
public class Enemy : IEntity public class Enemy : IEntity
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="EntityPartical.cs" // file="EntityPartical"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
namespace StgSharp.Entities namespace StgSharp.Entities
{ {
public abstract class EntityPartical : IEntity { } public abstract class EntityPartical : IEntity { }
+23 -26
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IEntity.cs" // file="IEntity"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Geometries; using StgSharp.Geometries;
using StgSharp.Mathematics; using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphic; using StgSharp.Mathematics.Graphic;
@@ -84,7 +81,7 @@ namespace StgSharp
public abstract void OnRenderFrame(); public abstract void OnRenderFrame();
public void SetLocation( Point p ) public void SetLocation(Point p)
{ {
_pos = p; _pos = p;
} }
+2 -2
View File
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Launcher" // file="Launcher"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Partical.cs" // file="Partical"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
namespace StgSharp namespace StgSharp
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Player.cs" // file="Player"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
namespace StgSharp namespace StgSharp
{ {
public abstract class Player : IEntity public abstract class Player : IEntity
+52 -54
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Dialogue.cs" // file="Dialogue"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@@ -54,30 +51,30 @@ namespace StgSharp
public static bool NeedShowWhenStartup { get; set; } public static bool NeedShowWhenStartup { get; set; }
public static void PostError( Exception ex ) public static void PostError(Exception ex)
{ {
CreateDialogueProcessIfNotExist(); CreateDialogueProcessIfNotExist();
_dw.WriteLine( $"posterror {ex.Message}" ); _dw.WriteLine($"posterror {ex.Message}");
_dialogueProcess!.Exited -= DialogueProcessExitCallback; _dialogueProcess!.Exited -= DialogueProcessExitCallback;
} }
public static void SetReadAndWriteThread( Thread thread ) public static void SetReadAndWriteThread(Thread thread)
{ {
_readAndWriteThreadId = thread.ManagedThreadId; _readAndWriteThreadId = thread.ManagedThreadId;
} }
internal static void CreateDialogueProcessIfNotExist() internal static void CreateDialogueProcessIfNotExist()
{ {
if( _dialogueProcess != null ) { if (_dialogueProcess != null) {
return; return;
} }
if( !File.Exists( _dialogueProcessInfo.FileName ) ) { } if (!File.Exists(_dialogueProcessInfo.FileName)) { }
_dialogueProcess = Process.Start( _dialogueProcessInfo ); _dialogueProcess = Process.Start(_dialogueProcessInfo);
_dr = new StreamReader( _dialogueClientPipe ); _dr = new StreamReader(_dialogueClientPipe);
_dw = new StreamWriter( _dialogueServerPipe ); _dw = new StreamWriter(_dialogueServerPipe);
_dialogueProcess!.Exited += DialogueProcessExitCallback; _dialogueProcess!.Exited += DialogueProcessExitCallback;
@@ -88,49 +85,50 @@ namespace StgSharp
internal static void LoadDialogue() internal static void LoadDialogue()
{ {
_dialogueServerPipe = new AnonymousPipeServerStream( _dialogueServerPipe = new AnonymousPipeServerStream(
PipeDirection.Out, HandleInheritability.Inheritable ); PipeDirection.Out, HandleInheritability.Inheritable);
_dialogueClientPipe = new AnonymousPipeServerStream( _dialogueClientPipe = new AnonymousPipeServerStream(
PipeDirection.In, HandleInheritability.Inheritable ); PipeDirection.In, HandleInheritability.Inheritable);
string route = Assembly.GetAssembly( typeof( World ) ).Location; string route = Assembly.GetAssembly(typeof(World)).Location;
string path = Path.GetDirectoryName( route ); string path = Path.GetDirectoryName(route);
string exeName; string exeName;
if( RuntimeInformation.IsOSPlatform( OSPlatform.Windows ) ) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
exeName = ".exe"; exeName = ".exe";
} else if( RuntimeInformation.IsOSPlatform( OSPlatform.Linux ) || } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) ) RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{ {
exeName = string.Empty; exeName = string.Empty;
} else } else
{ {
throw new PlatformNotSupportedException( "Unknown OS platform" ); throw new PlatformNotSupportedException("Unknown OS platform");
} }
string consoleRoute = Path.Combine( string consoleRoute = Path.Combine(
path, @"StgSharpTerminalDialogue", $@"StgSharpTerminalDialogue{exeName}" ); path, @"StgSharpTerminalDialogue", $@"StgSharpTerminalDialogue{exeName}");
_dialogueProcessInfo = new ProcessStartInfo _dialogueProcessInfo = new ProcessStartInfo
{ {
FileName = consoleRoute, FileName = consoleRoute,
Arguments = $"{_dialogueServerPipe.GetClientHandleAsString()} {_dialogueClientPipe.GetClientHandleAsString()}", Arguments =
$"{_dialogueServerPipe.GetClientHandleAsString()} {_dialogueClientPipe.GetClientHandleAsString()}",
UseShellExecute = true, UseShellExecute = true,
RedirectStandardOutput = false, RedirectStandardOutput = false,
}; };
} }
internal static void PostMessage( string instruction, params string[] operands ) internal static void PostMessage(string instruction, params string[] operands)
{ {
CreateDialogueProcessIfNotExist(); CreateDialogueProcessIfNotExist();
_dw.WriteLine( $"{instruction} {operands}" ); _dw.WriteLine($"{instruction} {operands}");
} }
internal static void UnloadDialogue() internal static void UnloadDialogue()
{ {
if( _dialogueProcess != null ) { if (_dialogueProcess != null) {
_dialogueProcess.Kill(); _dialogueProcess.Kill();
} }
_dialogueProcess = null; _dialogueProcess = null;
@@ -139,9 +137,9 @@ namespace StgSharp
_dialogueClientPipe.Dispose(); _dialogueClientPipe.Dispose();
} }
internal static string WaitCertainReturn( string target ) internal static string WaitCertainReturn(string target)
{ {
if( _dialogueProcess == null ) { if (_dialogueProcess == null) {
return string.Empty; return string.Empty;
} }
@@ -150,25 +148,25 @@ namespace StgSharp
{ {
temp = _dr.ReadLine(); temp = _dr.ReadLine();
temp = temp ?? string.Empty; temp = temp ?? string.Empty;
if( !temp!.StartsWith( target ) ) if (!temp!.StartsWith(target))
{ {
break; break;
} }
} while (true); } while (true);
int index = temp.IndexOf( ' ' ); int index = temp.IndexOf(' ');
return index != -1 ? temp.Substring( index + 1 ) : string.Empty; return index != -1 ? temp.Substring(index + 1) : string.Empty;
} }
private static void AssertThread() private static void AssertThread()
{ {
if( _readAndWriteThreadId != Environment.CurrentManagedThreadId ) { if (_readAndWriteThreadId != Environment.CurrentManagedThreadId) {
throw new InvalidOperationException( throw new InvalidOperationException(
"Communication with dialogue can only call from certain thread." ); "Communication with dialogue can only call from certain thread.");
} }
} }
private static void DialogueProcessExitCallback( object? sender, EventArgs e ) private static void DialogueProcessExitCallback(object? sender, EventArgs e)
{ {
_dialogueProcess = null; _dialogueProcess = null;
_dr.Close(); _dr.Close();
+24 -27
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ErrorDefine.cs" // file="ErrorDefine"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -39,9 +36,9 @@ namespace StgSharp
public class UniformEmptyReferenceException : Exception public class UniformEmptyReferenceException : Exception
{ {
public UniformEmptyReferenceException( string program, string name ) public UniformEmptyReferenceException(string program, string name)
: base( : base(
$"Location -1 returned when trying to find uniform {name} in shader program {program}" ) { } $"Location -1 returned when trying to find uniform {name} in shader program {program}") { }
} }
} }
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GlobalSetting.cs" // file="GlobalSetting"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Monitors.cs" // file="Monitors"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+2 -2
View File
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Platform" // file="Platform"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+24 -27
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="globalKeyStat.cs" // file="globalKeyStat"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@@ -43,9 +40,9 @@ namespace StgSharp
private static ConcurrentDictionary<int, KeyStatus> keyListener private static ConcurrentDictionary<int, KeyStatus> keyListener
= new ConcurrentDictionary<int, KeyStatus>(); = new ConcurrentDictionary<int, KeyStatus>();
public static KeyStatus CheckKey( KeyboardKey key ) public static KeyStatus CheckKey(KeyboardKey key)
{ {
return keyListener.GetOrAdd( ( int )key, KeyStatus.RELEASE ); return keyListener.GetOrAdd((int)key, KeyStatus.RELEASE);
} }
} }
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="CoordinationBase" // file="CoordinationBase"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="PlainCoordinate" // file="PlainCoordinate"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="SpaceCoordinate" // file="SpaceCoordinate"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="StreamLocalCoordinate.cs" // file="StreamLocalCoordinate"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Mathematics; using StgSharp.Mathematics;
using System; using System;
+28 -35
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GemoryException.cs" // file="GemoryException"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Runtime.Serialization; using System.Runtime.Serialization;
@@ -36,15 +33,13 @@ namespace StgSharp.Geometries
public unsafe class ToUpperDimensionException : Exception public unsafe class ToUpperDimensionException : Exception
{ {
protected ToUpperDimensionException( SerializationInfo info, StreamingContext context ) protected ToUpperDimensionException(SerializationInfo info, StreamingContext context) : base(info, context) { }
: base( info, context ) { }
public ToUpperDimensionException() { } public ToUpperDimensionException() { }
public ToUpperDimensionException( string message ) : base( message ) { } public ToUpperDimensionException(string message) : base(message) { }
public ToUpperDimensionException( string message, Exception innerException ) public ToUpperDimensionException(string message, Exception innerException) : base(message, innerException) { }
: base( message, innerException ) { }
} }
@@ -54,15 +49,13 @@ namespace StgSharp.Geometries
public class UnusedVertexException : Exception public class UnusedVertexException : Exception
{ {
protected UnusedVertexException( SerializationInfo info, StreamingContext context ) protected UnusedVertexException(SerializationInfo info, StreamingContext context) : base(info, context) { }
: base( info, context ) { }
public UnusedVertexException() { } public UnusedVertexException() { }
public UnusedVertexException( string message ) : base( message ) { } public UnusedVertexException(string message) : base(message) { }
public UnusedVertexException( string message, Exception innerException ) public UnusedVertexException(string message, Exception innerException) : base(message, innerException) { }
: base( message, innerException ) { }
} }
} }
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GeometryOperation" // file="GeometryOperation"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Angle.cs" // file="Angle"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -42,46 +39,46 @@ namespace StgSharp.Mathematics
internal const float DegToRad = 180 / Scaler.Pi; internal const float DegToRad = 180 / Scaler.Pi;
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Cos( Radius r ) public static float Cos(Radius r)
{ {
return MathF.Cos( r._radius ); return MathF.Cos(r._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Cos( Degree r ) public static float Cos(Degree r)
{ {
return MathF.Cos( r._degree / DegToRad ); return MathF.Cos(r._degree / DegToRad);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Sin( Radius r ) public static float Sin(Radius r)
{ {
return MathF.Sin( r._radius ); return MathF.Sin(r._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Sin( Degree r ) public static float Sin(Degree r)
{ {
return MathF.Sin( r._degree / DegToRad ); return MathF.Sin(r._degree / DegToRad);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Tan( Radius r ) public static float Tan(Radius r)
{ {
return MathF.Tan( r._radius ); return MathF.Tan(r._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Tan( Degree r ) public static float Tan(Degree r)
{ {
return MathF.Tan( r._degree / DegToRad ); return MathF.Tan(r._degree / DegToRad);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Degree ToDegree( float value ) public static Degree ToDegree(float value)
{ {
return new Degree( value ); return new Degree(value);
} }
} }
@@ -91,14 +88,14 @@ namespace StgSharp.Mathematics
internal float _degree; internal float _degree;
public Degree( float dgree ) public Degree(float dgree)
{ {
_degree = dgree; _degree = dgree;
} }
public static implicit operator Radius( Degree d ) public static implicit operator Radius(Degree d)
{ {
return new Radius( d._degree / GeometryScaler.DegToRad ); return new Radius(d._degree / GeometryScaler.DegToRad);
} }
} }
@@ -108,70 +105,70 @@ namespace StgSharp.Mathematics
internal float _radius; internal float _radius;
[Obsolete( "Unsafe, you may forget this is radius.", true )] [Obsolete("Unsafe, you may forget this is radius.", true)]
public Radius() { } public Radius() { }
public Radius( float radius ) public Radius(float radius)
{ {
_radius = radius; _radius = radius;
} }
public static Radius Zero public static Radius Zero
{ {
get => new Radius( 0 ); get => new Radius(0);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator -( Radius r ) public static Radius operator -(Radius r)
{ {
return new Radius( -r._radius ); return new Radius(-r._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator -( Radius left, Radius Right ) public static Radius operator -(Radius left, Radius Right)
{ {
return new Radius( left._radius - Right._radius ); return new Radius(left._radius - Right._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=( Radius left, Radius right ) public static bool operator !=(Radius left, Radius right)
{ {
return left._radius != right._radius; return left._radius != right._radius;
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator *( Radius left, float right ) public static Radius operator *(Radius left, float right)
{ {
return new Radius( left._radius * right ); return new Radius(left._radius * right);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator /( Radius left, float right ) public static Radius operator /(Radius left, float right)
{ {
return new Radius( left._radius / right ); return new Radius(left._radius / right);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float operator /( Radius left, Radius right ) public static float operator /(Radius left, Radius right)
{ {
return left._radius / right._radius; return left._radius / right._radius;
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator +( Radius left, Radius Right ) public static Radius operator +(Radius left, Radius Right)
{ {
return new Radius( left._radius + Right._radius ); return new Radius(left._radius + Right._radius);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==( Radius left, Radius right ) public static bool operator ==(Radius left, Radius right)
{ {
return left._radius == right._radius; return left._radius == right._radius;
} }
public static implicit operator Degree( Radius r ) public static implicit operator Degree(Radius r)
{ {
return new Degree( ( r._radius * 180 ) / Scaler.Pi ); return new Degree((r._radius * 180) / Scaler.Pi);
} }
} }
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IGeometry.cs" // file="IGeometry"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+22 -25
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IGeomtryBuffer.cs" // file="IGeomtryBuffer"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
+2 -2
View File
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IInstancing" // file="IInstancing"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IInstancingBuffer" // file="IInstancingBuffer"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Cordinate.cs" // file="Cordinate"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GeometryOperation" // file="GeometryOperation"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IPlainEntity.cs" // file="IPlainEntity"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ParticleOnPlain" // file="ParticleOnPlain"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="PlainGeometry" // file="PlainGeometry"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="PlainInstancingBuffer" // file="PlainInstancingBuffer"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Parallelogram" // file="Parallelogram"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -43,12 +43,12 @@ namespace StgSharp.Geometries
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) : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
{ {
#if DEBUG #if DEBUG
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) if (this[0].Coord + this[2].Coord != this[1].Coord + this[3].Coord)
{ {
InternalIO.InternalWriteLog( InternalIO.InternalWriteLog(
"Init of geometry item failed, because four vertices cannot form a rectangle.", "Init of geometry item failed, because four vertices cannot form a rectangle.",
LogType.Warning ); LogType.Warning);
} }
#endif #endif
} }
@@ -65,12 +65,12 @@ namespace StgSharp.Geometries
float v3y) float v3y)
: base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
{ {
#if DEBUG #if DEBUG
if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) if (this[0].Coord + this[2].Coord != this[1].Coord + this[3].Coord)
{ {
InternalIO.InternalWriteLog( InternalIO.InternalWriteLog(
"Init of geometry item failed, because four vertices cannot form a rectangle.", "Init of geometry item failed, because four vertices cannot form a rectangle.",
LogType.Warning ); LogType.Warning);
} }
#endif #endif
} }
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Plain" // file="Plain"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Polygon4" // file="Polygon4"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,14 @@ namespace StgSharp.Geometries
public class Polygon4 : PlainGeometry public class Polygon4 : PlainGeometry
{ {
protected static int[] Indices = [ 0, 1, 2, 0, 2, 3 ]; protected static int[] Indices = [
0,
1,
2,
0,
2,
3
];
internal Polygon4() internal Polygon4()
: base(PlainCoordinate.StandardPlainCoordination) : base(PlainCoordinate.StandardPlainCoordination)
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Polygon5" // file="Polygon5"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,17 @@ namespace StgSharp.Geometries
public unsafe class Polygon5 : PlainGeometry public unsafe class Polygon5 : PlainGeometry
{ {
internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4 ]; internal static int[] Indices = [
0,
1,
2,
0,
2,
3,
0,
3,
4
];
public unsafe Polygon5() public unsafe Polygon5()
: base(PlainCoordinate.StandardPlainCoordination) : base(PlainCoordinate.StandardPlainCoordination)
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Polygon6" // file="Polygon6"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,20 @@ namespace StgSharp.Geometries
public class Polygon6 : PlainGeometry public class Polygon6 : PlainGeometry
{ {
internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 ]; internal static int[] Indices = [
0,
1,
2,
0,
2,
3,
0,
3,
4,
0,
4,
5
];
public Polygon6() public Polygon6()
: base(PlainCoordinate.StandardPlainCoordination) : base(PlainCoordinate.StandardPlainCoordination)
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Rectangle.cs" // file="Rectangle"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -42,10 +39,10 @@ namespace StgSharp.Geometries
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) : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
{ {
#if DEBUG #if DEBUG
Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY; Vec2 side0 = (this[0].Coord - this[1].Coord).XY;
Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY; Vec2 side1 = (this[2].Coord - this[1].Coord).XY;
if( side0.Cross( side1 ) == 0 ) { if (side0.Cross(side1) == 0) {
throw new ArgumentException(); throw new ArgumentException();
} }
#endif #endif
@@ -63,10 +60,10 @@ namespace StgSharp.Geometries
float v3y) float v3y)
: base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
{ {
#if DEBUG #if DEBUG
Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY; Vec2 side0 = (this[0].Coord - this[1].Coord).XY;
Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY; Vec2 side1 = (this[2].Coord - this[1].Coord).XY;
if( side0.Cross( side1 ) == 0 ) { if (side0.Cross(side1) == 0) {
throw new ArgumentException(); throw new ArgumentException();
} }
#endif #endif
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Square.cs" // file="Square"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Mathematics; using StgSharp.Mathematics;
using System.Numerics; using System.Numerics;
@@ -40,18 +37,10 @@ namespace StgSharp.Geometries
public class Square : Rectangle public class Square : Rectangle
{ {
public Square( public Square(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y)
float v0x, : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y)
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 ) { } if (true) { }
} }
} }
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Triangle.cs" // file="Triangle"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -40,7 +37,11 @@ namespace StgSharp.Geometries
public unsafe class Triangle : PlainGeometry public unsafe class Triangle : PlainGeometry
{ {
internal static int[] Indices = [ 0, 1, 2 ]; internal static int[] Indices = [
0,
1,
2
];
public Triangle() public Triangle()
: base(PlainCoordinate.StandardPlainCoordination) : base(PlainCoordinate.StandardPlainCoordination)
+2 -2
View File
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Point" // file="Point"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Class1.cs" // file="Class1"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="TriangulatedSurface" // file="TriangulatedSurface"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+19 -27
View File
@@ -1,38 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Global.cs" // file="Global"
// Project: StepVisualizer // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
global using StgSharp.Internal; global using StgSharp.Internal;
global using StgSharp.Internal.Intrinsic; global using StgSharp.Internal.Intrinsic;
global using StgSharp.Internal.OpenGL; global using StgSharp.Internal.OpenGL;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IImageProvider.cs" // file="IImageProvider"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="ImageHelper.cs" // file="ImageHelper"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -38,23 +35,23 @@ namespace StgSharp.Graphics
public static class ImageHelper 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 ) { if (i == null) {
throw new ArgumentNullException( nameof( i ) ); throw new ArgumentNullException(nameof(i));
} }
if( i.Size == (width, height) ) { if (i.Size == (width, height)) {
return; return;
} }
if( !Enum.IsDefined( typeof( ImageMovement ), move ) ) { if (!Enum.IsDefined(typeof(ImageMovement), move)) {
throw new InvalidEnumArgumentException( nameof( move ) ); throw new InvalidEnumArgumentException(nameof(move));
} }
byte[] oldData = i.Data; byte[] oldData = i.Data;
i.Data = new byte[width * height * i.PixelSize]; i.Data = new byte[width * height * i.PixelSize];
i.Height = height; i.Height = height;
i.Width = width; i.Width = width;
i.PixelUpdateCount++; i.PixelUpdateCount++;
switch( move ) switch (move)
{ {
case ImageMovement.Discard: case ImageMovement.Discard:
break; break;
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="BufferObjectBase.cs" // file="BufferObjectBase"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+23 -29
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IGraphicAPIs.cs" // file="IGraphicAPIs"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -37,10 +34,7 @@ namespace StgSharp.Graphics
public interface IGraphicAPIs public interface IGraphicAPIs
{ {
public IntPtr GraphicApiPackageHandle public IntPtr GraphicApiPackageHandle { get; }
{
get;
}
} }
} }
+40 -46
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Image.cs" // file="Image"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using StgSharp.Internal; using StgSharp.Internal;
using StgSharp.Mathematics; using StgSharp.Mathematics;
@@ -56,12 +53,12 @@ namespace StgSharp.Graphics
_rawInfo = new ImageInfo(); _rawInfo = new ImageInfo();
} }
internal Image( ImageInfo information ) internal Image(ImageInfo information)
{ {
_rawInfo = information; _rawInfo = information;
_data = Array.Empty<byte>(); _data = Array.Empty<byte>();
//int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel; // int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel;
} }
public (int width, int height) Size public (int width, int height) Size
@@ -73,7 +70,7 @@ namespace StgSharp.Graphics
{ {
get get
{ {
if( ( _data.Length == 0 ) || ( _data == null ) ) if ((_data.Length == 0) || (_data == null))
{ {
GetBytes(); GetBytes();
return _data!; return _data!;
@@ -107,7 +104,7 @@ namespace StgSharp.Graphics
internal set => _rawInfo.Width = value; internal set => _rawInfo.Width = value;
} }
public int PixelSize => ImageInfo.GetPixelSize( _rawInfo.pixelLayout, _rawInfo.Channel ); public int PixelSize => ImageInfo.GetPixelSize(_rawInfo.pixelLayout, _rawInfo.Channel);
public PixelChannelLayout PixelLayout public PixelChannelLayout PixelLayout
{ {
@@ -122,21 +119,18 @@ namespace StgSharp.Graphics
get => ref _data; get => 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(); Image ret = new Image();
fixed( ImageInfo* iptr = &ret._rawInfo ) { fixed (ImageInfo* iptr = &ret._rawInfo) {
InternalIO.InternalLoadImage( route, iptr, loader ); InternalIO.InternalLoadImage(route, iptr, loader);
} }
return ret; return ret;
} }
public static Image FromMemory( public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream)
(int width, int height) size,
ImageChannel channel,
byte[] stream )
{ {
ImageInfo _info = new ImageInfo ImageInfo _info = new ImageInfo
{ {
@@ -145,7 +139,7 @@ namespace StgSharp.Graphics
Channel = channel, Channel = channel,
StreamPtr = IntPtr.Zero StreamPtr = IntPtr.Zero
}; };
Image ret = new Image( _info ); Image ret = new Image(_info);
ret.PixelLayout = PixelChannelLayout.Byte; ret.PixelLayout = PixelChannelLayout.Byte;
ret._data = stream; ret._data = stream;
return ret; return ret;
@@ -155,7 +149,7 @@ namespace StgSharp.Graphics
(int width, int height) size, (int width, int height) size,
ImageChannel channel, ImageChannel channel,
PixelChannelLayout layout, PixelChannelLayout layout,
byte[] stream ) byte[] stream)
{ {
ImageInfo _info = new ImageInfo ImageInfo _info = new ImageInfo
{ {
@@ -164,7 +158,7 @@ namespace StgSharp.Graphics
Channel = channel, Channel = channel,
StreamPtr = IntPtr.Zero StreamPtr = IntPtr.Zero
}; };
Image ret = new Image( _info ); Image ret = new Image(_info);
ret.PixelLayout = layout; ret.PixelLayout = layout;
ret._data = stream; ret._data = stream;
return ret; return ret;
@@ -172,12 +166,12 @@ namespace StgSharp.Graphics
public unsafe byte[] GetBytes() public unsafe byte[] GetBytes()
{ {
if( _data.Length == 0 ) if (_data.Length == 0)
{ {
int size = Width * Height * ImageInfo.GetPixelSize( PixelLayout, Channel ); int size = Width * Height * ImageInfo.GetPixelSize(PixelLayout, Channel);
_data = new Span<byte>( ( byte* )_rawInfo.StreamPtr, size ).ToArray(); _data = new Span<byte>((byte*)_rawInfo.StreamPtr, size).ToArray();
fixed( ImageInfo* pptr = &_rawInfo ) { fixed (ImageInfo* pptr = &_rawInfo) {
InternalIO.InternalUnloadImage( pptr ); InternalIO.InternalUnloadImage(pptr);
} }
_rawInfo.StreamPtr = IntPtr.Zero; _rawInfo.StreamPtr = IntPtr.Zero;
} }
@@ -186,7 +180,7 @@ namespace StgSharp.Graphics
public Image ProvideImage() => this; public Image ProvideImage() => this;
internal static Image FromMemory( ImageInfo info, byte[] data, int operationCount ) internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount)
{ {
return new Image return new Image
{ {
+37 -16
View File
@@ -1,21 +1,46 @@
using System; //-----------------------------------------------------------------------
using System.Collections.Generic; // -----------------------------------------------------------------------
using System.Text; // file="ImageInfo"
using System.Runtime.CompilerServices; // 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.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics namespace StgSharp.Graphics
{ {
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)] [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate IntPtr ImageLoader( public delegate IntPtr ImageLoader(
string name, string name,
ref int width, ref int width,
ref int height, ref int height,
ref int definedChannel, ref int definedChannel,
int desiredChannel); int desiredChannel);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct ImageInfo internal struct ImageInfo
@@ -76,7 +101,6 @@ namespace StgSharp.Graphics
return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}"; return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}";
} }
internal static int GetChannelCount(ImageChannel channel) internal static int GetChannelCount(ImageChannel channel)
{ {
return channel switch return channel switch
@@ -90,9 +114,7 @@ namespace StgSharp.Graphics
}; };
} }
internal static int GetPixelSize( internal static int GetPixelSize(PixelChannelLayout layout, ImageChannel channel)
PixelChannelLayout layout,
ImageChannel channel)
{ {
return layout switch return layout switch
{ {
@@ -137,5 +159,4 @@ namespace StgSharp.Graphics
WithAlphaChannel = glConst.RGBA, WithAlphaChannel = glConst.RGBA,
} }
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="AutoTexture.cs" // file="AutoTexture"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Commom.Collections; using StgSharp.Commom.Collections;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -62,22 +59,22 @@ namespace StgSharp.Graphics.OpenGL
private TextureProperty _textureProperty; private TextureProperty _textureProperty;
private AutoTextureGL( TextureGL texture ) private AutoTextureGL(TextureGL texture)
{ {
texturePackage = texture; texturePackage = texture;
_size = texture.Count; _size = texture.Count;
imageIndexMap = new BidirectionalDictionary<Image, int>(); imageIndexMap = new BidirectionalDictionary<Image, int>();
unusedTextureUnitIndex = new Queue<int>( Enumerable.Range( 0, _size ) ); unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
usedTextureIndex = new LinkedList<int>(); usedTextureIndex = new LinkedList<int>();
propertyCache = new TextureProperty[_size]; propertyCache = new TextureProperty[_size];
} }
public AutoTextureGL( int textureObjectSize, [NotNull]glRender binding ) public AutoTextureGL(int textureObjectSize, [NotNull]glRender binding)
{ {
this._size = textureObjectSize; this._size = textureObjectSize;
imageIndexMap = new BidirectionalDictionary<Image, int>(); imageIndexMap = new BidirectionalDictionary<Image, int>();
texturePackage = new TextureGL( textureObjectSize, binding ); texturePackage = new TextureGL(textureObjectSize, binding);
unusedTextureUnitIndex = new Queue<int>( Enumerable.Range( 0, _size ) ); unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
usedTextureIndex = new LinkedList<int>(); usedTextureIndex = new LinkedList<int>();
propertyCache = new TextureProperty[_size]; propertyCache = new TextureProperty[_size];
} }
@@ -93,69 +90,69 @@ namespace StgSharp.Graphics.OpenGL
get => texturePackage.GL; get => texturePackage.GL;
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SelectTextureAndBind( Image i ) public void SelectTextureAndBind(Image i)
{ {
TextureProperty property = _textureProperty; TextureProperty property = _textureProperty;
SelectTextureAndBind( i, property ); SelectTextureAndBind(i, property);
} }
public void SelectTextureAndBind( [NotNull]Image i, TextureProperty property ) public void SelectTextureAndBind([NotNull]Image i, TextureProperty property)
{ {
//usable texture with image match // usable texture with image match
if( imageIndexMap.TryGetValue( i, out int index ) ) if (imageIndexMap.TryGetValue(i, out int index))
{ {
//prop setting match // prop setting match
if( propertyCache[ index ] == property ) if (propertyCache[index] == property)
{ {
_currentIndex = index; //GL.Assert(true); _currentIndex = index; //GL.Assert(true);
texturePackage.Bind2D( index ); //GL.Assert(true); texturePackage.Bind2D(index); //GL.Assert(true);
if( i.PixelUpdateCount != imageUpdateIndex[ i ] ) if (i.PixelUpdateCount != imageUpdateIndex[i])
{ {
texturePackage.LoadTexture( index, i ); //GL.Assert(true); texturePackage.LoadTexture(index, i); //GL.Assert(true);
} }
} else } else
{ {
_currentIndex = index; //GL.Assert(true); _currentIndex = index; //GL.Assert(true);
texturePackage.Bind2D( index ); //GL.Assert(true); texturePackage.Bind2D(index); //GL.Assert(true);
texturePackage.Set2dProperty( index, property ); //GL.Assert(true); texturePackage.Set2dProperty(index, property); //GL.Assert(true);
if( i.PixelUpdateCount != imageUpdateIndex[ i ] ) if (i.PixelUpdateCount != imageUpdateIndex[i])
{ {
texturePackage.LoadTexture( index, i ); //GL.Assert(true); texturePackage.LoadTexture(index, i); //GL.Assert(true);
} }
} }
} else } else
{ {
if( unusedTextureUnitIndex.TryDequeue( out int newIndex ) ) if (unusedTextureUnitIndex.TryDequeue(out int newIndex))
{ {
//has extra unused texture object // has extra unused texture object
imageIndexMap.Add( i, index ); imageIndexMap.Add(i, index);
texturePackage.Bind2D( index ); texturePackage.Bind2D(index);
texturePackage.Set2dProperty( index, property ); texturePackage.Set2dProperty(index, property);
texturePackage.LoadTexture( index, i ); texturePackage.LoadTexture(index, i);
usedTextureIndex.AddLast( newIndex ); usedTextureIndex.AddLast(newIndex);
propertyCache[ newIndex ] = property; propertyCache[newIndex] = property;
imageUpdateIndex[ i ] = i.PixelUpdateCount; imageUpdateIndex[i] = i.PixelUpdateCount;
} else } else
{ {
//recycle from current // recycle from current
int reusedIndex = usedTextureIndex.First!.Value; int reusedIndex = usedTextureIndex.First!.Value;
usedTextureIndex.RemoveFirst(); usedTextureIndex.RemoveFirst();
usedTextureIndex.AddLast( reusedIndex ); usedTextureIndex.AddLast(reusedIndex);
imageIndexMap[ i ] = reusedIndex; imageIndexMap[i] = reusedIndex;
propertyCache[ newIndex ] = property; propertyCache[newIndex] = property;
imageUpdateIndex[ i ] = i.PixelUpdateCount; imageUpdateIndex[i] = i.PixelUpdateCount;
} }
} }
} }
public static AutoTextureGL ToAuto( [NotNull]TextureGL texture ) public static AutoTextureGL ToAuto([NotNull]TextureGL texture)
{ {
if( texture.IndexOfCurrentTexture != -1 ) { if (texture.IndexOfCurrentTexture != -1) {
throw new InvalidOperationException( "Texture to be converted has been editted." ); throw new InvalidOperationException("Texture to be converted has been editted.");
} }
return new AutoTextureGL( texture ); return new AutoTextureGL(texture);
} }
} }
+20 -25
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="EBO.cs" // file="EBO"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -61,15 +58,13 @@ namespace StgSharp.Graphics.OpenGL
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
} }
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage) public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage) where T: unmanaged, INumber<T>
where T: unmanaged, INumber<T>
{ {
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferArray, usage); GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferArray, usage);
} }
public void SetValue<T>(int index, ReadOnlySpan<T> bufferSpan, BufferUsage usage) public void SetValue<T>(int index, ReadOnlySpan<T> bufferSpan, BufferUsage usage) where T: unmanaged, INumber<T>
where T: unmanaged, INumber<T>
{ {
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]); GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferSpan, usage); GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferSpan, usage);
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="FBO.cs" // file="FBO"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GLBufferObjectBase.cs" // file="GLBufferObjectBase"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using System; using System;
@@ -41,7 +38,7 @@ namespace StgSharp.Graphics.OpenGL
private readonly glRender _contextBinding; private readonly glRender _contextBinding;
protected GlBufferObjectBase( glRender contextBinding ) protected GlBufferObjectBase(glRender contextBinding)
{ {
binding = contextBinding; binding = contextBinding;
_contextBinding = contextBinding; _contextBinding = contextBinding;
+34 -37
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="RBO.cs" // file="RBO"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using System; using System;
@@ -40,30 +37,30 @@ namespace StgSharp.Graphics.OpenGL
public sealed class RenderBuffer : GlBufferObjectBase public sealed class RenderBuffer : GlBufferObjectBase
{ {
public RenderBuffer( int count, glRender binding ) public RenderBuffer(int count, glRender binding)
: base( binding ) : base(binding)
{ {
_bufferHandle = GL.GenRenderBuffer( count ); _bufferHandle = GL.GenRenderBuffer(count);
} }
public override void Bind( int index ) public override void Bind(int index)
{ {
GL.BindRenderBuffer( this[ 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 ) ) { if ((size.width > binding.Width) || (size.height > binding.Height)) {
World.LogWarning( "FrameBuffer is larger than current canvas binding" ); 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 ) foreach (GlHandle item in _bufferHandle)
{ {
Console.WriteLine( "removing a render buffer" ); Console.WriteLine("removing a render buffer");
GL.DeleteRenderBuffer( item ); GL.DeleteRenderBuffer(item);
} }
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="TextureGL.cs" // file="TextureGL"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.HighPerformance; using StgSharp.HighPerformance;
using System; using System;
@@ -46,16 +43,16 @@ namespace StgSharp.Graphics.OpenGL
private OpenGLFunction _gl; private OpenGLFunction _gl;
internal GlHandle[] _textureHandle; internal GlHandle[] _textureHandle;
internal TextureGL( int count, glRender binding ) internal TextureGL(int count, glRender binding)
{ {
//sourceList = new Image[count]; // sourceList = new Image[count];
this._gl = binding.GL; this._gl = binding.GL;
_textureHandle = _gl.GenTextures( count ); _textureHandle = _gl.GenTextures(count);
} }
public GlHandle this[ int index ] public GlHandle this[int index]
{ {
get => _textureHandle[ index ]; get => _textureHandle[index];
} }
public int Count public int Count
@@ -63,7 +60,7 @@ namespace StgSharp.Graphics.OpenGL
get => _textureHandle.Length; get => _textureHandle.Length;
} }
//internal Image[] sourceList; // internal Image[] sourceList;
public int IndexOfCurrentTexture public int IndexOfCurrentTexture
{ {
@@ -72,15 +69,15 @@ namespace StgSharp.Graphics.OpenGL
internal OpenGLFunction GL => _gl; internal OpenGLFunction GL => _gl;
public void ActivateAs( TextureUnit unit ) public void ActivateAs(TextureUnit unit)
{ {
_gl.ActiveTextureUnit( ( uint )unit ); _gl.ActiveTextureUnit((uint)unit);
} }
public void Bind2D( int index ) public void Bind2D(int index)
{ {
currentEditingTextureIndex = index; currentEditingTextureIndex = index;
_gl.BindTexture( glConst.TEXTURE_2D, _textureHandle[ index ] ); _gl.BindTexture(glConst.TEXTURE_2D, _textureHandle[index]);
} }
/// <summary> /// <summary>
@@ -92,79 +89,73 @@ namespace StgSharp.Graphics.OpenGL
/// <param _label="i"> /// <param _label="i">
/// ///
/// </param> /// </param>
public unsafe void LoadTexture( int index, Image i ) public unsafe void LoadTexture(int index, Image i)
{ {
byte[] handle = i.PixelBuffer; byte[] handle = i.PixelBuffer;
_gl.TextureImage2d( _gl.TextureImage2d(
Texture2DTarget.Texture2D, 0, i.Channel, ( uint )i.Width, ( uint )i.Height, Texture2DTarget.Texture2D, 0, i.Channel, (uint)i.Width, (uint)i.Height, i.Channel, i.PixelLayout,
i.Channel, i.PixelLayout, pixels: handle ); pixels:handle);
_gl.GenerateMipmap( Texture2DTarget.Texture2D ); _gl.GenerateMipmap(Texture2DTarget.Texture2D);
} }
#region texture setting #region texture setting
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dFilterProperty( public void Set2dFilterProperty(int index, TextureFilter onMinify, TextureFilter onMagnify)
int index,
TextureFilter onMinify,
TextureFilter onMagnify )
{ {
#if DEBUG #if DEBUG
if( index != currentEditingTextureIndex ) if (index != currentEditingTextureIndex)
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
"Texture to be editted is not the one being activated." ); "Texture to be editted is not the one being activated.");
} }
#endif #endif
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER, ( int )onMinify ); _gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER, (int)onMinify);
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER, _gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
( int )onMagnify ); (int)onMagnify);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dWrapProperty( public void Set2dWrapProperty(int index, TextureWrap onHorizontial, TextureWrap onVertical)
int index,
TextureWrap onHorizontial,
TextureWrap onVertical )
{ {
#if DEBUG #if DEBUG
if( index != currentEditingTextureIndex ) if (index != currentEditingTextureIndex)
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
"Texture to be editted is not the one being activated." ); "Texture to be editted is not the one being activated.");
} }
#endif #endif
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S, _gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
( int )onHorizontial ); (int)onHorizontial);
_gl.TextureParameter( glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, ( int )onVertical ); _gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, (int)onVertical);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dProperty( int index, TextureProperty property ) public void Set2dProperty(int index, TextureProperty property)
{ {
Set2dFilterProperty( index, property.FilterOnMinify, property.FilterOnMagnify ); Set2dFilterProperty(index, property.FilterOnMinify, property.FilterOnMagnify);
Set2dWrapProperty( index, property.WrapOnHorizontial, property.WrapOnVertical ); Set2dWrapProperty(index, property.WrapOnHorizontial, property.WrapOnVertical);
} }
#endregion texture setting #endregion texture setting
} }
[StructLayout( LayoutKind.Explicit )] [StructLayout(LayoutKind.Explicit)]
public struct TextureProperty public struct TextureProperty
{ {
[FieldOffset( 0 )] private M128 mask; [FieldOffset(0)] private M128 mask;
[FieldOffset( 0 )] private TextureFilter mag; [FieldOffset(0)] private TextureFilter mag;
[FieldOffset( 4 )] private TextureFilter min; [FieldOffset(4)] private TextureFilter min;
[FieldOffset( 8 )] private TextureWrap hori; [FieldOffset(8)] private TextureWrap hori;
[FieldOffset( 12 )] private TextureWrap vert; [FieldOffset(12)] private TextureWrap vert;
public TextureProperty( public TextureProperty(
TextureFilter onMagnify, TextureFilter onMagnify,
TextureFilter onMinify, TextureFilter onMinify,
TextureWrap onHorizontial, TextureWrap onHorizontial,
TextureWrap onVertical ) TextureWrap onVertical)
{ {
FilterOnMagnify = onMagnify; FilterOnMagnify = onMagnify;
FilterOnMinify = onMinify; FilterOnMinify = onMinify;
@@ -196,15 +187,15 @@ namespace StgSharp.Graphics.OpenGL
set => vert = value; set => vert = value;
} }
public override bool Equals( [NotNullWhen( true )] object obj ) public override bool Equals([NotNullWhen(true)] object obj)
{ {
return base.Equals( obj ); return base.Equals(obj);
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return HashCode.Combine( return HashCode.Combine(
FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, WrapOnVertical ); FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, WrapOnVertical);
} }
public override string ToString() public override string ToString()
@@ -212,12 +203,12 @@ namespace StgSharp.Graphics.OpenGL
return $"FilterOnMagnify:{FilterOnMagnify}, " + $"FilterOnMagnify:{FilterOnMagnify}, " + $"WrapOnHorizontial:{WrapOnHorizontial}, " + $"WrapOnVertical:{WrapOnVertical}"; 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; 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; return left.mask == right.mask;
} }
@@ -226,11 +217,11 @@ namespace StgSharp.Graphics.OpenGL
( (
TextureFilter onMagnify, TextureFilter onMinify, TextureFilter onMagnify, TextureFilter onMinify,
TextureWrap onHorizontial, TextureWrap onVertical TextureWrap onHorizontial, TextureWrap onVertical
) propertyValueTuple ) ) propertyValueTuple)
{ {
return new TextureProperty( return new TextureProperty(
propertyValueTuple.onMagnify, propertyValueTuple.onMinify, propertyValueTuple.onMagnify, propertyValueTuple.onMinify,
propertyValueTuple.onHorizontial, propertyValueTuple.onVertical ); propertyValueTuple.onHorizontial, propertyValueTuple.onVertical);
} }
} }
+36 -40
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="VAO.cs" // file="VAO"
// Project: StepVisualizer // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -38,41 +35,40 @@ namespace StgSharp.Graphics.OpenGL
public sealed unsafe class VertexArray : GlBufferObjectBase public sealed unsafe class VertexArray : GlBufferObjectBase
{ {
internal VertexArray( int n, glRender binding ) internal VertexArray(int n, glRender binding)
: base( binding ) : base(binding)
{ {
_bufferHandle = GL.GenVertexArrays( n ); _bufferHandle = GL.GenVertexArrays(n);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override sealed void Bind( int index ) public sealed override void Bind(int index)
{ {
GL.BindVertexArray( _bufferHandle[ index ] ); GL.BindVertexArray(_bufferHandle[index]);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindNull() public static void BindNull()
{ {
OpenGLFunction.CurrentGL.BindVertexArray( GlHandle.Zero ); OpenGLFunction.CurrentGL.BindVertexArray(GlHandle.Zero);
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute( public void SetVertexAttribute(
uint attributeIndex, uint attributeIndex,
int vertexLength, int vertexLength,
TypeCode dataType, TypeCode dataType,
bool isNomalized, bool isNomalized,
uint stride, uint stride,
int pointer ) int pointer)
{ {
GL.SetVertexAttribute( GL.SetVertexAttribute(attributeIndex, vertexLength, dataType, isNomalized, stride, pointer);
attributeIndex, vertexLength, dataType, isNomalized, stride, pointer );
} }
protected override sealed void Dispose( bool disposing ) protected sealed override void Dispose(bool disposing)
{ {
if( disposing ) { if (disposing) {
GL.DeleteVertexArrays( _bufferHandle ); GL.DeleteVertexArrays(_bufferHandle);
} }
} }
@@ -2,8 +2,8 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="VBO" // file="VBO"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
+26 -29
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="GLfixed.cs" // file="GLfixed"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -37,13 +34,13 @@ using System.Threading.Tasks;
namespace StgSharp.Internal namespace StgSharp.Internal
{ {
[StructLayout( LayoutKind.Explicit, Size = 8 )] [StructLayout(LayoutKind.Explicit, Size = 8)]
public struct GLfixed public struct GLfixed
{ {
[FieldOffset( 0 )] public int All; [FieldOffset(0)] public int All;
[FieldOffset( 0 )] public short Decimals; [FieldOffset(0)] public short Decimals;
[FieldOffset( 4 )] public short Inertger; [FieldOffset(4)] public short Inertger;
} }
} }
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="IglConvertable.cs" // file="IglConvertable"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp.Graphics.OpenGL; using StgSharp.Graphics.OpenGL;
using System; using System;
@@ -49,7 +46,7 @@ namespace StgSharp.Graphics.ShaderEdit
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void GainAllUniforms( ShaderProgram source, params string[] uniformName ); public void GainAllUniforms(ShaderProgram source, params string[] uniformName);
/// <summary> /// <summary>
/// ///
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Shader.cs" // file="Shader"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using StgSharp; using StgSharp;
using StgSharp.Internal; using StgSharp.Internal;
@@ -52,13 +49,13 @@ namespace StgSharp.Graphics.OpenGL
/// New instance of <see cref="Shader" /> instance. /// New instance of <see cref="Shader" /> instance.
/// </returns> /// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override sealed ShaderProgram CreateShaderProgram() protected sealed override ShaderProgram CreateShaderProgram()
{ {
return new ShaderProgram(this); return new ShaderProgram(this);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override sealed Shader CreateShaderSegment(ShaderType type, int count) protected sealed override Shader CreateShaderSegment(ShaderType type, int count)
{ {
return new Shader(GL.CreateShaderSet(count, type), type, this); return new Shader(GL.CreateShaderSet(count, type), type, this);
} }
@@ -221,8 +218,7 @@ namespace StgSharp.Graphics.OpenGL
/// <returns> /// <returns>
/// ///
/// </returns> /// </returns>
public unsafe Uniform<T, U, V> GetUniform<T, U, V>(string name) where T: unmanaged public unsafe Uniform<T, U, V> GetUniform<T, U, V>(string name) where T: unmanaged where U: struct
where U: struct
where V: struct where V: struct
{ {
return new Uniform<T, U, V>(GL.GetUniformLocation(this.handle, name)); return new Uniform<T, U, V>(GL.GetUniformLocation(this.handle, name));
@@ -237,8 +233,7 @@ namespace StgSharp.Graphics.OpenGL
/// <returns> /// <returns>
/// ///
/// </returns> /// </returns>
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>(string name) where T: unmanaged public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>(string name) where T: unmanaged where U: struct
where U: struct
where V: struct where V: struct
where W: struct where W: struct
{ {
@@ -251,8 +246,7 @@ namespace StgSharp.Graphics.OpenGL
public unsafe void Link() public unsafe void Link()
{ {
if (InternalIO.InternalLinkShaderProgram( if (InternalIO.InternalLinkShaderProgram(
(OpenglContext*)this.GL.ContextHandle, handle.Value) == (OpenglContext*)this.GL.ContextHandle, handle.Value) == 0)
0)
{ {
IntPtr logPtr = InternalIO.InternalReadSSCLog(); IntPtr logPtr = InternalIO.InternalReadSSCLog();
try try
@@ -281,7 +275,7 @@ namespace StgSharp.Graphics.OpenGL
~ShaderProgram() ~ShaderProgram()
{ {
//handle.Dispose(); // handle.Dispose();
} }
} }
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="Uniform.cs" // file="Uniform"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
+23 -26
View File
@@ -1,40 +1,37 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="glAPICalling.cs" // file="glAPICalling"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace StgSharp.Graphics.OpenGL namespace StgSharp.Graphics.OpenGL
{ {
[AttributeUsage( AttributeTargets.Method )] [AttributeUsage(AttributeTargets.Method)]
public sealed class OpenGLAPICallingAttribute : Attribute public sealed class OpenGLAPICallingAttribute : Attribute
{ {
+18 -21
View File
@@ -1,30 +1,27 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="glApiManager.cs" // file="glApiManager"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="glApiManagerConst.cs" // file="glApiManagerConst"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
+32 -35
View File
@@ -1,33 +1,30 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="glClampf.cs" // file="glClampf"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -40,25 +37,25 @@ namespace StgSharp.Internal
/// <summary> /// <summary>
/// OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1]. /// OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1].
/// </summary> /// </summary>
[StructLayout( LayoutKind.Sequential )] [StructLayout(LayoutKind.Sequential)]
public struct GLclampf public struct GLclampf
{ {
public float value; public float value;
public GLclampf( float a ) public GLclampf(float a)
{ {
value = a; value = a;
} }
public static explicit operator float( GLclampf v ) public static explicit operator float(GLclampf v)
{ {
return v.value; return v.value;
} }
public static explicit operator GLclampf( float v ) public static explicit operator GLclampf(float v)
{ {
return new GLclampf( v ); return new GLclampf(v);
} }
} }
@@ -67,25 +64,25 @@ namespace StgSharp.Internal
/// OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the /// OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the
/// range [0,1]. /// range [0,1].
/// </summary> /// </summary>
[StructLayout( LayoutKind.Sequential )] [StructLayout(LayoutKind.Sequential)]
public struct GLclampd public struct GLclampd
{ {
public double value; public double value;
public GLclampd( double a ) public GLclampd(double a)
{ {
value = a; value = a;
} }
public static explicit operator double( GLclampd v ) public static explicit operator double(GLclampd v)
{ {
return v.value; return v.value;
} }
public static explicit operator GLclampd( double v ) public static explicit operator GLclampd(double v)
{ {
return new GLclampd( v ); return new GLclampd(v);
} }
} }
+26 -29
View File
@@ -1,39 +1,36 @@
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
// file="glConst.cs" // file="glConst"
// Project: StgSharp // Project: StgSharp
// AuthorGroup: Nitload Space // AuthorGroup: Nitload
// Copyright (c) Nitload Space. All rights reserved. // Copyright (c) Nitload. All rights reserved.
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person obtaining a copy
// obtaining a copy of this software and associated documentation // of this software and associated documentation files (the "Software"), to deal
// files (the “Software”), to deal in the Software without restriction, // in the Software without restriction, including without limitation the rights
// including without limitation the rights to use, copy, modify, merge, // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// publish, distribute, sublicense, and/or sell copies of the Software, // copies of the Software, and to permit persons to whom the Software is
// and to permit persons to whom the Software is furnished to do so, // furnished to do so, subject to the following conditions:
// subject to the following conditions:
// //
// The above copyright notice and // The above copyright notice and this permission notice shall be included in all
// this permission notice shall be included in all copies // copies or substantial portions of the Software.
// or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED “AS IS”, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// ARISING FROM, OUT OF OR IN CONNECTION WITH // SOFTWARE.
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
//----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Drawing; using System.Drawing;
namespace StgSharp.Graphics.OpenGL namespace StgSharp.Graphics.OpenGL
{ {
//rename types in style of glConst // rename types in style of glConst
public static unsafe class glConst public static unsafe class glConst
{ {
@@ -4848,15 +4845,15 @@ namespace StgSharp.Graphics.OpenGL
public const uint DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT; public const uint DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT;
public const uint Stencil = glConst.STENCIL_ATTACHMENT; public const uint Stencil = glConst.STENCIL_ATTACHMENT;
public static uint Color( int i ) public static uint Color(int i)
{ {
#if DEBUG #if DEBUG
if( ( i > OpenGLFunction.CurrentGL.AttachmentColorRange ) || ( i < 0 ) ) if ((i > OpenGLFunction.CurrentGL.AttachmentColorRange) || (i < 0))
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
#endif #endif
return ( uint )( glConst.COLOR_ATTACHMENT0 + i ); return (uint)(glConst.COLOR_ATTACHMENT0 + i);
} }
} }

Some files were not shown because too many files have changed in this diff Show More