void ChangeState(UpdateMethod method, FileVerificationLevel level) { var proj = UpdatePackageBuilder.Instance.AuProject; if (proj == null) { return; } if (method == UpdateMethod.AsProject) { //跟随项目,则删除 var pi = proj.FindProjectItem(RelativePath); if (pi != null) { proj.Files.Remove(pi); } } else { var pi = proj.FindProjectItem(RelativePath); if (pi == null) { pi = new ProjectItem() { Path = RelativePath }; proj.Files.Add(pi); } pi.FileVerificationLevel = level; pi.UpdateMethod = method; } }
public static FileVerificationLevel SetOrClearUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag, bool add) { if (add) { return(SetUpdateMethodFlag(method, flag)); } return(ClearUpdateMethodFlag(method, flag)); }
public FileTreeItem(FileInfo fileInfo, UpdateMethod method, FileVerificationLevel level, string relativePath, string flag) { FileInfo = fileInfo; RelativePath = relativePath; _updateMethod = method; _verificationLevel = level; _flag = flag; }
/// <summary> /// 获得显示的字符串 /// </summary> /// <param name="fv"></param> /// <returns></returns> public static string ToDisplayString(this FileVerificationLevel fv) { var fvd = new List <string>(); if ((fv & FileVerificationLevel.Version) == FileVerificationLevel.Version) { fvd.Add("版本"); } if ((fv & FileVerificationLevel.Hash) == FileVerificationLevel.Hash) { fvd.Add("MD5"); } if ((fv & FileVerificationLevel.Size) == FileVerificationLevel.Size) { fvd.Add("大小"); } return(string.Join(";", fvd.ToArray())); }
/// <summary> /// 清除指定的标记位 /// </summary> /// <param name="method"></param> /// <param name="flag"></param> /// <returns></returns> public static FileVerificationLevel SetUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag) { method |= flag; return method; }
/// <summary> /// 清除指定的标记位 /// </summary> /// <param name="method"></param> /// <param name="flag"></param> /// <returns></returns> public static FileVerificationLevel ClearUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag) { method &= (~flag); return method; }
/// <summary> /// 测试是否具有指定的更新方式 /// </summary> /// <param name="method"></param> /// <param name="targetMethod"></param> /// <returns></returns> public static bool HasMethod(FileVerificationLevel method, FileVerificationLevel targetMethod) { return (method & targetMethod) > 0; }
public static FileVerificationLevel SetOrClearUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag, bool add) { if (add) return SetUpdateMethodFlag(method, flag); return ClearUpdateMethodFlag(method, flag); }
/// <summary> /// 清除指定的标记位 /// </summary> /// <param name="method"></param> /// <param name="flag"></param> /// <returns></returns> public static FileVerificationLevel SetUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag) { method |= flag; return(method); }
/// <summary> /// 清除指定的标记位 /// </summary> /// <param name="method"></param> /// <param name="flag"></param> /// <returns></returns> public static FileVerificationLevel ClearUpdateMethodFlag(FileVerificationLevel method, FileVerificationLevel flag) { method &= (~flag); return(method); }
/// <summary> /// 测试是否具有指定的更新方式 /// </summary> /// <param name="method"></param> /// <param name="targetMethod"></param> /// <returns></returns> public static bool HasMethod(FileVerificationLevel method, FileVerificationLevel targetMethod) { return((method & targetMethod) > 0); }
/// <summary> /// 确定是否有此标记位 /// </summary> /// <param name="level"></param> /// <returns></returns> internal bool HasVerifyFlag(FileVerificationLevel level) { return (level & VerificationLevel) > 0; }
/// <summary> /// 确定是否有此标记位 /// </summary> /// <param name="level"></param> /// <returns></returns> internal bool HasVerifyFlag(FileVerificationLevel level) { return((level & VerificationLevel) > 0); }
void ChangeState(UpdateMethod method, FileVerificationLevel level) { var proj = UpdatePackageBuilder.Instance.AuProject; if (proj == null) return; if (method == UpdateMethod.AsProject) { //跟随项目,则删除 var pi = proj.FindProjectItem(RelativePath); if (pi != null) proj.Files.Remove(pi); } else { var pi = proj.FindProjectItem(RelativePath); if (pi == null) { pi = new ProjectItem() { Path = RelativePath }; proj.Files.Add(pi); } pi.FileVerificationLevel = level; pi.UpdateMethod = method; } }