//添加文件 public void AddUFile(ref UFileInfo file) { if (!FileList.Contains(file)) { FileList.Add(file); } }
/// <summary> /// 差异输出 自己有 别人有 比较md5 不同就加入 自己有 别人没有 不管 /// </summary> /// <param name="other"></param> /// <returns></returns> public UFileInfoList DiffWithOther(ref UFileInfoList other) { UFileInfoList ret = new UFileInfoList(); if (FileList.Count == 0) { ret = null; return(other); } if (other == null || other.FileList.Count == 0) { return(null); } for (int i = 0; i < other.FileList.Count; i++) { UFileInfo uf = other.FileList[i]; bool isDiff = false; bool isFind = false; for (int j = 0; j < FileList.Count; j++) { UFileInfo sf = FileList[j]; if (sf.FileName.Equals(uf.FileName)) { isFind = true; if (!sf.MD5Num.Equals(uf.MD5Num)) { isDiff = true; break; } break; } } // if (isDiff || (isFind == false)) { ret.AddUFile(ref uf); } } return(ret); }