diff --git a/LibCLCC.NET/Collections/ReactableList.cs b/LibCLCC.NET/Collections/ReactableList.cs
index f532016..f41e6a4 100644
--- a/LibCLCC.NET/Collections/ReactableList.cs
+++ b/LibCLCC.NET/Collections/ReactableList.cs
@@ -29,8 +29,8 @@ public ReactableList() { }
/// Clear the list.
///
public new void Clear() {
- base.Clear();
ClearReactChain.Invoke(this);
+ base.Clear();
}
///
/// Add an item.
diff --git a/LibCLCC.NET/Data/RefString.cs b/LibCLCC.NET/Data/RefString.cs
index 8e21da4..352b79b 100644
--- a/LibCLCC.NET/Data/RefString.cs
+++ b/LibCLCC.NET/Data/RefString.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
@@ -9,7 +10,7 @@ namespace LibCLCC.NET.Data
/// Reference String.
/// Use for reduce memory consumption.
///
- public struct RefString
+ public struct RefString : IEnumerable, IEnumerable
{
///
/// The NULL reference.
@@ -34,7 +35,7 @@ public struct RefString
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public RefString(string string_value, int offset, int length)
+ public RefString(string string_value , int offset , int length)
{
Ref = string_value;
Offset = offset;
@@ -45,12 +46,12 @@ public RefString(string string_value, int offset, int length)
///
///
///
- public char this[int index]
+ public char this [ int index ]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- return Ref[index + Offset];
+ return Ref [ index + Offset ];
}
}
@@ -65,7 +66,7 @@ public char this[int index]
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator RefString(string s) => new RefString { Ref = s, Offset = 0, Length = s.Length };
+ public static implicit operator RefString(string s) => new RefString { Ref = s , Offset = 0 , Length = s.Length };
///
/// Convert a RefString to ReadOnlySpan
///
@@ -77,7 +78,7 @@ public static implicit operator ReadOnlySpan(RefString s)
{
throw new IndexOutOfRangeException();
}
- return s.Ref.AsSpan(s.Offset,s.Length);
+ return s.Ref.AsSpan(s.Offset , s.Length);
}
///
/// If the referred string is null.
@@ -100,7 +101,7 @@ public static implicit operator ReadOnlySpan(RefString s)
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static RefString operator +(RefString L, int R)
+ public static RefString operator +(RefString L , int R)
{
RefString result = L;
result.Offset += R;
@@ -116,7 +117,7 @@ public static implicit operator ReadOnlySpan(RefString s)
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static RefString operator -(RefString L, int R)
+ public static RefString operator -(RefString L , int R)
{
RefString result = L;
result.Offset -= R;
@@ -141,7 +142,7 @@ public readonly RefString Substring(int StartIndex)
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly RefString Substring(int StartIndex, int SubStringLength)
+ public readonly RefString Substring(int StartIndex , int SubStringLength)
{
var r = this + StartIndex;
r.Length = SubStringLength;
@@ -156,7 +157,7 @@ public readonly RefString Substring(int StartIndex, int SubStringLength)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly int IndexOf(char c)
{
- return Ref.IndexOf(c, Offset);
+ return Ref.IndexOf(c , Offset , Length);
}
///
/// Returns a zero-based index of the first appearance of a given string within this sturct.
@@ -167,7 +168,7 @@ public readonly int IndexOf(char c)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly int IndexOf(string str)
{
- return Ref.IndexOf(str, Offset);
+ return Ref.IndexOf(str , Offset , Length);
}
///
/// Returns a zero-based index of the first appearance of a given char within this sturct.
@@ -178,9 +179,36 @@ public readonly int IndexOf(string str)
///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly int IndexOf(char c, int offset)
+ public readonly int IndexOf(char c , int offset)
{
- return Ref.IndexOf(c, Offset + offset);
+ return Ref.IndexOf(c , Offset + offset , Length);
+ }
+ ///
+ /// Returns a zero-based index of the first appearance of a given char within this sturct.
+ /// The method returns -1 if the target is not found in this instance.
+ /// The search starts at a given position.
+ ///
+ ///
+ ///
+ ///
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public readonly int IndexOf(char c , int offset , int count)
+ {
+ return Ref.IndexOf(c , Offset + offset , Math.Min(Length , count));
+ }
+ ///
+ /// Returns a zero-based index of the first appearance of a given string within this sturct.
+ /// The method returns -1 if the target is not found in this instance.
+ /// The search starts at a given position.
+ ///
+ ///
+ ///
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public readonly int IndexOf(string str , int offset)
+ {
+ return Ref.IndexOf(str , Offset + offset, Length);
}
///
/// Returns a zero-based index of the first appearance of a given string within this sturct.
@@ -189,11 +217,33 @@ public readonly int IndexOf(char c, int offset)
///
///
///
+ ///
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly int IndexOf(string str, int offset)
+ public readonly int IndexOf(string str, int offset , int count)
+ {
+ return Ref.IndexOf(str , Offset + offset , Math.Min(Length , count));
+ }
+ ///
+ /// Iterate through characters in range [offset..offset+length].
+ ///
+ ///
+
+ public IEnumerator GetEnumerator()
+ {
+ return iterate();
+ }
+ IEnumerator iterate()
+ {
+ for (int i = Offset ; i < Length ; i++)
+ {
+ yield return Ref [ i ];
+ }
+ yield break;
+ }
+ IEnumerator IEnumerable.GetEnumerator()
{
- return Ref.IndexOf(str, Offset + offset);
+ return iterate();
}
}
}
diff --git a/LibCLCC.NET/LibCLCC.NET.csproj b/LibCLCC.NET/LibCLCC.NET.csproj
index c50b0a0..47f8103 100644
--- a/LibCLCC.NET/LibCLCC.NET.csproj
+++ b/LibCLCC.NET/LibCLCC.NET.csproj
@@ -2,7 +2,7 @@
netstandard2.1
- $(VersionPrefix)1.22.23.0
+ $(VersionPrefix)1.23.24.0
LICENSE.txt
False
README.md