Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. public static byte[] getAssemblyHash()
  2. {
  3. #if UNITY_EDITOR
  4. string path_0 = new DirectoryInfo(Application.dataPath).Parent+"/Builds/Test/Unturned_Data/Managed/Assembly-CSharp.dll";
  5. string path_1 = new DirectoryInfo(Application.dataPath).Parent+"/Builds/Test/Unturned_Data/Managed/Other-Assembly-CSharp.dll";
  6. string path_2 = new DirectoryInfo(Application.dataPath).Parent+"/Builds/Test/Unturned_Data/Managed/Assembly-CSharp-firstpass.dll";
  7. string path_3 = new DirectoryInfo(Application.dataPath).Parent+"/Builds/Test/Unturned_Data/Managed/Other-Assembly-CSharp-firstpass.dll";
  8. #elif UNITY_STANDALONE_OSX
  9. string path_0 = PATH + "/Unturned.app/Contents/Data/Managed/Other-Assembly-CSharp.dll";
  10. string path_1 = PATH + "/Unturned.app/Contents/Data/Managed/Assembly-CSharp.dll";
  11. string path_2 = PATH + "/Unturned.app/Contents/Data/Managed/Other-Assembly-CSharp-firstpass.dll";
  12. string path_3 = PATH + "/Unturned.app/Contents/Data/Managed/Assembly-CSharp-firstpass.dll";
  13. #else
  14. string path_0 = PATH + "/Unturned_Data/Managed/Assembly-CSharp.dll";
  15. string path_1 = PATH + "/Unturned_Data/Managed/Other-Assembly-CSharp.dll";
  16. string path_2 = PATH + "/Unturned_Data/Managed/Assembly-CSharp-firstpass.dll";
  17. string path_3 = PATH + "/Unturned_Data/Managed/Other-Assembly-CSharp-firstpass.dll";
  18. #endif
  19.  
  20. FileStream stream_0 = new FileStream(path_0, FileMode.Open, FileAccess.Read, FileShare.Read);
  21. byte[] bytes_0 = new byte[stream_0.Length];
  22. stream_0.Close();
  23. stream_0.Dispose();
  24.  
  25. #if DEV
  26. return Hash.SHA1(bytes_0);
  27. #else
  28. FileStream stream_1 = new FileStream(path_1, FileMode.Open, FileAccess.Read, FileShare.Read);
  29. byte[] bytes_1 = new byte[stream_1.Length];
  30. stream_1.Close();
  31. stream_1.Dispose();
  32.  
  33. FileStream stream_2 = new FileStream(path_2, FileMode.Open, FileAccess.Read, FileShare.Read);
  34. byte[] bytes_2 = new byte[stream_2.Length];
  35. stream_2.Close();
  36. stream_2.Dispose();
  37.  
  38. FileStream stream_3 = new FileStream(path_3, FileMode.Open, FileAccess.Read, FileShare.Read);
  39. byte[] bytes_3 = new byte[stream_3.Length];
  40. stream_3.Close();
  41. stream_3.Dispose();
  42.  
  43. return Hash.combine(Hash.SHA1(bytes_0), Hash.SHA1(bytes_1), Hash.SHA1(bytes_2), Hash.SHA1(bytes_3));
  44. #endif
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement