public SyncTask(string name, string source, string target, bool type, bool srcOnRemovable, bool destOnRemovable, TaskSettings settings, Filters filters) { this._name = name.Trim(); this._sourceFolder = source.Trim(); this._targetFolder = target.Trim(); this._settings = settings; this._filters = filters; this._typeOfSync = type; this._lastRun = "Never"; this._result = ""; this._srcOnRemovable = srcOnRemovable; this._destOnRemovable = destOnRemovable; }
public Reconciler(FileList srcList, FileList tgtList, SyncTask task, String metaDataDir) { _srcList = srcList; _tgtList = tgtList; _taskSettings = task.Settings; _srcPath = task.Source; _tgtPath = task.Target; _taskName = task.Name; _errorDetected = false; _previewFilesList = new CustomDictionary<string, string, PreviewUnit>(); _previewFoldersList = new CustomDictionary<string, string, PreviewUnit>(); _updatedList = new CustomDictionary<string, string, FileUnit>(); _srcRenameList = new CustomDictionary<string, string, FileUnit>(); _tgtRenameList = new CustomDictionary<string, string, FileUnit>(); _summary = new SyncSummary(); _summary.logFile = metaDataDir + @"\" + task.Name + ".log"; }
public static void update(Detector detector, TaskSettings settings) { Dictionary<string, FileUnit> sMeta = new Dictionary<string, FileUnit>(); Dictionary<string, FileUnit> tMeta = new Dictionary<string, FileUnit>(); foreach (FileUnit u in detector.NewSourceFilesList) { if (!u.IsDirectory) updateFile(u, null, true, false, sMeta, tMeta); else updateDir(u, null, true, false, sMeta, tMeta); } foreach (FileUnit u in detector.NewTargetFilesList) { if (!u.IsDirectory) updateFile(null, u, false, true, sMeta, tMeta); else updateDir(null, u, false, true, sMeta, tMeta); } foreach (FileUnit u in detector.ConflictFilesList) { if (u.Match != null) updateFile(u, u.Match, true, true, sMeta, tMeta); else { if (u.AbsolutePath.StartsWith(detector.Source)) updateFile(u, null, true, true, sMeta, tMeta); else updateFile(null, u, true, true, sMeta, tMeta); } } detector.DeleteSourceFilesList.Reverse(); foreach (FileUnit u in detector.DeleteSourceFilesList) { switch (chkFileDelete(u, null)) { case SyncAction.DeleteSourceFile: if (!u.IsDirectory) File.Delete(u.AbsolutePath); deleteEmptyFolders(u); break; } } detector.DeleteTargetFilesList.Reverse(); foreach (FileUnit u in detector.DeleteTargetFilesList) { switch (chkFileDelete(null, u)) { case SyncAction.DeleteTargetFile: if (!u.IsDirectory) File.Delete(u.AbsolutePath); deleteEmptyFolders(u); break; } } detector.UnChangedFilesList.Reverse(); foreach (FileUnit u in detector.UnChangedFilesList) { sMeta.Add(u.AbsolutePath, u); tMeta.Add(u.Match.AbsolutePath, u.Match); u.Match.Match = null; u.Match = null; if (u.IsDirectory) deleteEmptyFolders(u); } SyncMetaData.WriteMetaData(detector.Source, sMeta); SyncMetaData.WriteMetaData(detector.Target, tMeta); }
private void ResetSettings() { _curFilters = new Filters(); _curSettings = new TaskSettings(); _curSettings.IgnoreTimeChange = 0; }