Exemple #1
0
        // Set the file system object to dirty if necssary.
        // The general logic is to set the parent to dirty as long as the priority is not the same for all the objects.
        // It is sound at this point since renamed and deleted files will never enter this method.
        private static void SetFileSystemObjectDirty(BaseCompareObject obj, int numOfPaths, ref int numExists, ref int posExists)
        {
            int priority = -1;

            for (int i = 0; i < numOfPaths; i++)
            {
                if (obj.Exists[i])
                {
                    numExists++;
                    posExists = i;

                    if (priority < 0)
                        priority = obj.Priority[i];
                    else
                    {
                        if (priority != obj.Priority[i])
                        {
                            obj.Parent.Dirty = true;
                            break;
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Adds a child to the <c>FolderCompareObject</c>.
 /// </summary>
 /// <param name="child"><see cref="BaseCompareObject"/> to add to to this <c>FolderCompareObject</c>.</param>
 public void AddChild(BaseCompareObject child)
 {
     _contents.Add(child.Name, child);
 }
 private void MergeFileSystemObject(BaseCompareObject actualObj, BaseCompareObject renameObj, List<int> deleteIndexes)
 {
     // Copy the information from the renamed object to the actual object.
     foreach (int i in deleteIndexes)
     {
         actualObj.ChangeType[i] = renameObj.ChangeType[i];
         actualObj.CreationTimeUtc[i] = renameObj.CreationTimeUtc[i];
         actualObj.Exists[i] = renameObj.Exists[i];
         actualObj.FinalState[i] = renameObj.FinalState[i];
         actualObj.Invalid = renameObj.Invalid;
         actualObj.MetaCreationTimeUtc[i] = renameObj.MetaCreationTimeUtc[i];
         actualObj.MetaExists[i] = renameObj.MetaExists[i];
         actualObj.MetaUpdated[i] = renameObj.MetaUpdated[i];
         actualObj.LastKnownState[i] = renameObj.LastKnownState[i];
     }
 }