123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System.Security.Cryptography;
- using System.Text;
- namespace AtlasUtility
- {
- using LitJson;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- using UnityEditor;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEditor.iOS.Xcode;
- [CustomEditor(typeof(Test))]
- public class TestEditor : Editor
- {
- #region Variable
- public Test Script;
- #endregion
- public void OnEnable()
- {
- Script = (Test) target;
- }
- public override void OnInspectorGUI()
- {
- base.OnInspectorGUI();
- if (GUILayout.Button("Test"))
- {
- MD5 md5 = new MD5CryptoServiceProvider();
- byte[] bytes1 = File.ReadAllBytes(@"C:\Users\Administrator\Desktop\MD5测试1.txt");
- byte[] md5Bytes1 = md5.ComputeHash(bytes1);
- byte[] bytes2 = File.ReadAllBytes(@"C:\Users\Administrator\Desktop\MD5测试2.txt");
- byte[] md5Bytes2 = md5.ComputeHash(bytes2);
- if (md5Bytes1.Length != md5Bytes2.Length)
- {
- Debug.Log("false");
- return;
- }
- else
- {
- for (int i = 0; i < md5Bytes1.Length; i++)
- {
- if (md5Bytes1[i] != md5Bytes2[i])
- {
- Debug.Log("false");
- return;
- }
- }
- Debug.Log("true");
- }
- }
- }
- }
- }
|