first commit

This commit is contained in:
Beyhan Oğur
2026-09-03 04:45:36 +03:00
commit d5f52cc3d3
1038 changed files with 169579 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
using System;
using System.Linq;
namespace ClassicAssist.Misc
{
public class Utility
{
public static T GetEnumValueByName<T>( string value )
{
//TODO robust enough?
value = value.ToLower().Replace( ' ', '_' );
string[] enumValues = Enum.GetNames( typeof( T ) );
string enumValue = enumValues.FirstOrDefault( ev => ev.ToLower() == value );
T enumEntry = (T) Enum.Parse( typeof( T ), enumValue ?? throw new InvalidOperationException() );
return enumEntry;
}
public static (byte[] data, int length) CopyBuffer( byte[] source, int sourceLength )
{
byte[] data = new byte[sourceLength];
int dataLength = sourceLength;
Buffer.BlockCopy( source, 0, data, 0, sourceLength );
return ( data, dataLength );
}
}
}