123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Collections.Generic;
- namespace hirdParty.DownloadSystem
- {
- [Serializable]
- public class AssetMD5Info
- {
- public List<MD5FileInfo> fileInfo;
- public void Deduplication()
- {
- if (fileInfo == null)
- {
- return;
- }
- List<string> allName = new List<string>();
- for (int i = 0; i < fileInfo.Count; i++)
- {
- string n = fileInfo[i].fileName;
- if (allName.Contains(n))
- {
- fileInfo.RemoveAt(i);
- i--;
- }
- allName.Add(n);
- }
- }
- public void Sort()
- {
- if (fileInfo == null)
- {
- return;
- }
- fileInfo.Sort(Stot);
- }
- private int Stot(MD5FileInfo a, MD5FileInfo b)
- {
- if (a.size > b.size)
- {
- return 1;
- }
- else if (a.size < b.size)
- {
- return -1;
- }
- return 0;
- }
- public AssetMD5Info(List<MD5FileInfo> a)
- {
- this.fileInfo = a;
- }
- }
- [Serializable]
- public class MD5FileInfo
- {
- public string fileName;
- public string md5;
- public long size;
- }
- }
|