public Package.ObjectMap[] GetNeededObjects(bool skipWhenFileMatches = true) { var objects = GetMetaDataFilesOrderedBySize().ToList(); var validObjects = new List <FileObjectMapping>(); foreach (var o in objects) { ProcessObject(skipWhenFileMatches, o, validObjects); } objects.RemoveAll(validObjects); var newObjects = objects.Select(x => new Package.ObjectMap(x)).ToArray(); var missingObjects = GetMissingObjectMapping(newObjects).ToList(); if (missingObjects.Any()) { HandleMissingObjects(missingObjects); } Repository.Log("Local object matches {0}, left: {1}", MetaData.Files.Count - objects.Count, objects.Count); return(newObjects); }
void PrintDetailedChanges(Package.ChangeList changeAg, bool withRemoval) { var overview = new StringBuilder(); var full = new StringBuilder(); BuildLogInfos(changeAg.Equal, overview, full, changeAg.Copy, changeAg.Update, withRemoval ? changeAg.Remove : new List <string>(), changeAg.New, changeAg.ChangedCase); this.Logger().Info(full.ToString()); Repository.Log(overview.ToString()); }
void PrintChangeOverview(IEnumerable <IAbsoluteFilePath> files, IEnumerable <FileObjectMapping> mappings) { var overview = new StringBuilder(); var full = new StringBuilder(); BuildShortLogInfo("Current files", files.Select(x => x.FileName), overview, full); BuildShortLogInfo("Needed files", mappings.Select(x => x.FilePath), overview, full); this.Logger().Info(full.ToString()); Repository.Log(overview.ToString()); }
void HandleMissingObjects(List <Package.ObjectMap> missingObjects) { var currentPackage = MetaData.GetFullName(); var packages = Repository.GetPackagesList() .Where(x => !x.Equals(currentPackage)) .OrderByDescending(x => x.StartsWith(MetaData.Name)).ToArray(); if (packages.Any()) { ProcessMissingObjects(missingObjects, packages); } var resolvableObjects = missingObjects.Where(x => x.ExistingObject != null).ToArray(); StatusRepo.Reset(RepoStatus.Copying, resolvableObjects.Length); foreach (var o in resolvableObjects) { this.Logger() .Info("Found local previous version match for {0}", o.FO.FilePath, o.ExistingObject, o.FO.Checksum); missingObjects.Remove(o); } StatusRepo.Reset(RepoStatus.Packing, missingObjects.Count); var resolvedObjects = new List <Package.ObjectMap>(); foreach (var o in missingObjects) { ProcessMissingObject(o, resolvedObjects); } Repository.ReAddObject(resolvedObjects.Select(x => x.ExistingObject).ToArray()); foreach (var o in resolvedObjects) { missingObjects.Remove(o); } Repository.Log( "\nFound {0} missing objects, resolved {1} candidates from other packages and {2} from uncompressed files", missingObjects.Count + resolvedObjects.Count + resolvableObjects.Length, resolvableObjects.Length, resolvedObjects.Count); }