/** * Change a direction by a given difference * * This functions returns a new direction of the given direction * which is rotated by the given difference. * * @param d The direction to get a new direction from * @param delta The offset/drift applied to the direction * @return The new direction */ //inline public static Direction ChangeDir(this Direction d, DirDiff delta) { if (d.IsValidDirection() == false) { throw new ArgumentOutOfRangeException(nameof(d)); } /* Cast to uint so compiler can use bitmask. Result can never be negative. */ return((Direction)(((int)d + (int)delta) % 8)); }
public override int GetHashCode() { var hashCode = -1869096446; hashCode = hashCode * -1521134295 + DirDiff.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ToolName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LeftSHA); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RightSHA); return(hashCode); }
public IReadOnlyList <FileDiff> run() { Regex reex = null; Regex re = null; maxTasks = BUCommon.IOUtils.DefaultTasks(maxTasks); var ll = new LocalLister(); var localfiles = ll.getList(pathRoot, exclude, filter); var remoteFiles = (new FileList { account = account, cache = cache, container = container, versions = false, useRemote = useRemote, pathRE = null } ).run(); if (!string.IsNullOrWhiteSpace(filter)) { re = new Regex(filter, RegexOptions.Compiled | RegexOptions.IgnoreCase); remoteFiles = remoteFiles.Where(x => re.IsMatch(x.path)).ToList(); } if (!string.IsNullOrWhiteSpace(exclude)) { reex = new Regex(exclude, RegexOptions.Compiled | RegexOptions.IgnoreCase); remoteFiles = remoteFiles.Where(x => !reex.IsMatch(x.path)).ToList(); } var dd = new DirDiff(); if (useHash) { dd.usehash = true; dd.privateKey = privateKey; dd.pathRoot = pathRoot; } dd.maxTasks = this.maxTasks; var diffs = dd.compare(localfiles, remoteFiles); /* filter out unknowns, sames */ return(diffs .Where(x => x.type == DiffType.created || x.type == DiffType.updated || x.type == DiffType.deleted) .ToList()); }
/** * Applies two differences together * * This function adds two differences together and returns the resulting * difference. So adding two DIRDIFF_REVERSE together results in the * DIRDIFF_SAME difference. * * @param d The first difference * @param delta The second difference to add on * @return The resulting difference */ //inline public static DirDiff ChangeDirDiff(this DirDiff d, DirDiff delta) { /* Cast to uint so compiler can use bitmask. Result can never be negative. */ return((DirDiff)(((int)d + (int)delta) % 8)); }