mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-30 21:17:09 +01:00 
			
		
		
		
	CHANGED TO MIRROR
This commit is contained in:
		
							
								
								
									
										40
									
								
								Assets/Mirror/Runtime/Extensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Assets/Mirror/Runtime/Extensions.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace Mirror | ||||
| { | ||||
|     public static class Extensions | ||||
|     { | ||||
|         // string.GetHashCode is not guaranteed to be the same on all machines, but | ||||
|         // we need one that is the same on all machines. simple and stupid: | ||||
|         public static int GetStableHashCode(this string text) | ||||
|         { | ||||
|             unchecked | ||||
|             { | ||||
|                 int hash = 23; | ||||
|                 foreach (char c in text) | ||||
|                     hash = hash * 31 + c; | ||||
|                 return hash; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // previously in DotnetCompatibility.cs | ||||
|         // leftover from the UNET days. supposedly for windows store? | ||||
|         internal static string GetMethodName(this Delegate func) | ||||
|         { | ||||
| #if NETFX_CORE | ||||
|             return func.GetMethodInfo().Name; | ||||
| #else | ||||
|             return func.Method.Name; | ||||
| #endif | ||||
|         } | ||||
|  | ||||
|         // helper function to copy to List<T> | ||||
|         // C# only provides CopyTo(T[]) | ||||
|         public static void CopyTo<T>(this IEnumerable<T> source, List<T> destination) | ||||
|         { | ||||
|             // foreach allocates. use AddRange. | ||||
|             destination.AddRange(source); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 DerTyp187
					DerTyp187