/// <summary> /// 比较两个文件夹是否一样 /// </summary> /// <param name="bean"></param> public bool Equals(RecordBean bean) { return(Size == bean.Size && FileCount == bean.FileCount && DirCount == bean.DirCount && SpaceUsage == bean.SpaceUsage); }
/// <summary> /// 将另外一个RecordBean中的相关数据加入的该bean中 /// </summary> /// <param name="bean">要添加的bean</param> public void Add(RecordBean bean) { //继承文件或文件夹的大小和数量 if (Size == null) { Size = new BigInteger(0); } Size += bean.Size; if (SpaceUsage == null) { SpaceUsage = new BigInteger(0); } SpaceUsage += bean.SpaceUsage; FileCount += bean.FileCount; // 继承是否被改变 IsChange = IsChange || bean.IsChange; // 若是文件,则继承子一级文件的异常码; if (bean.IsFile) { ExceptionCode = bean.ExceptionCode | ExceptionCode; } else { DirCount += bean.DirCount + 1; } // 继承最新的修改和访问时间 if (ModifyTime == null) { ModifyTime = bean.ModifyTime; } else { if (bean.ModifyTime > ModifyTime) { ModifyTime = bean.ModifyTime; } } if (VisitTime == null) { VisitTime = bean.VisitTime; } else { if (bean.VisitTime > VisitTime) { VisitTime = bean.VisitTime; } } }