/// <summary> /// Processes the changes. If anything fails, a false is returned. /// </summary> /// <returns></returns> public bool Process() { // Clear any past status this.Status = new List <string>(); bool returnValue = true; Dictionary <String, Dictionary <String, List <ProcessItem> > > processList = this.GetUpdateList(false); AcquireContentWindow contentWindow = new AcquireContentWindow(null, false); contentWindow.DisplayContent = "Processing records....."; foreach (KeyValuePair <String, Dictionary <String, List <ProcessItem> > > kvp in processList) { this.RecordStatus(String.Format("Processing Classification : {0}", kvp.Key)); foreach (KeyValuePair <String, List <ProcessItem> > kvpInner in kvp.Value) { this.RecordStatus(String.Format("Moving Items: {0} -> {1}", kvp.Key, kvpInner.Key)); foreach (ProcessItem item in kvpInner.Value) { // Set flag if ANYTHING fails this.RecordStatus(String.Format("\t{0}", item.Name)); this.RecordStatus(String.Format("\t{0} ->", item.OriginalLocation)); this.RecordStatus(String.Format("\t\t{0}", item.NewLocation)); try { // Because we may have files with the same name already in the new location, // just make sure it's ok... if (System.IO.File.Exists(item.NewLocation)) { int attempt = 0; String fileFormat = this.GetFileFormatDuplicate(item.NewLocation); do { item.NewLocation = String.Format(fileFormat, ++attempt); } while (System.IO.File.Exists(item.NewLocation)); } System.IO.File.Move(item.OriginalLocation, item.NewLocation); } catch (Exception ex) { returnValue = false; String message = String.Format("Failed to move {0} -> {1}", item.Name, ex.Message); this.Status.Add(message); this.RecordStatus(message); } } } } contentWindow.Close(); return(returnValue); }