Ejemplo n.º 1
0
        public void UpdateAllRegisteredFiles()
        {
            Log("Update All Files");

            foreach (var f in filenamesRegistered)
            {
                Log("Updating : " + f);
                vfu.PerformUpdate(f.Item1, f.Item2);
                b.Verbose.Log($"Update Completed {f.Item1} : {f.Item2}");
            }
        }
Ejemplo n.º 2
0
        public void IncrementAndUpdateAll()
        {
            b.Verbose.Log("IncrementAndUpdateAll called");
            ValidateForUpdate();
            LoadVersioningComponent();
            b.Verbose.Log("Versioning Loaded ");
            ver.Increment();
            b.Verbose.Log("Saving");
            SaveVersioningComponent();
            b.Verbose.Log($"Searching {BaseSearchDir} there are {pendingUpdates.Count} pends.");

            var  enumer         = Directory.EnumerateFiles(BaseSearchDir, "*.*", SearchOption.AllDirectories).GetEnumerator();
            bool shouldContinue = true;

            while (shouldContinue)
            {
                try {
                    shouldContinue = enumer.MoveNext();
                    if (shouldContinue)
                    {
                        var v = enumer.Current;

                        // Check every file that we have returned.
                        foreach (var chk in pendingUpdates.Keys)
                        {
                            var mm = new Minimatcher(chk, new Options {
                                AllowWindowsPaths = true, IgnoreCase = true
                            });
                            b.Verbose.Log($"Checking {chk} against {v}");
                            if (mm.IsMatch(v))
                            {
                                b.Info.Log("Match...");
                                // TODO Cache this and make it less loopey
                                VersionFileUpdater sut = new VersionFileUpdater(ver);
                                foreach (var updateType in pendingUpdates[chk])
                                {
                                    b.Verbose.Log($"Perform update {v}");
                                    sut.PerformUpdate(v, updateType);
                                }
                            }
                        }
                    }
                } catch (System.UnauthorizedAccessException) {
                    // If you run through all the filles in a directory you can hit areas of the filesystem
                    // that you dont have access to - this skips those files and then continues.
                    b.Verbose.Log("Unauthorised area of the filesystem, skipping");
                }
            }

            VersionString = ver.GetVersionString();
        }