//--------------------------------------------------------------------- public override void Update(Commands.UpdateItemCommand Command) { if (this._Root.Length == 0) { throw new Exceptions.InvalidOperationException("Update", "FileSystem root is undefined"); } Pathname ItemPathname = Pathname.Append(this._Root, Command.in_Pathname); Pathname DestItemPathname = Pathname.Append(this._Root, Command.in_Item.Pathname); bool needs_move = !ItemPathname.Equals(DestItemPathname); //bool needs_move = !ItemPathname.Path.Equals( DestItemPathname.Path, StringComparison.InvariantCultureIgnoreCase ); FileSystemItem item = this.ItemFromPathname(ItemPathname); if (item.Exists) { if (item.IsFolder) { if (needs_move) { Directory.Move(ItemPathname, DestItemPathname); } if (Command.in_Item.DateCreated.HasValue) { Directory.SetCreationTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateCreated); } else { Directory.SetCreationTimeUtc(DestItemPathname, (DateTime)item.DateCreated); } if (Command.in_Item.DateLastWrite.HasValue) { Directory.SetLastWriteTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateLastWrite); } else { Directory.SetLastWriteTimeUtc(DestItemPathname, (DateTime)item.DateLastWrite); } if (Command.in_Item.DateLastRead.HasValue) { Directory.SetLastAccessTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateLastRead); } else { Directory.SetLastAccessTimeUtc(DestItemPathname, (DateTime)item.DateLastRead); } } else { if (needs_move) { File.Move(ItemPathname, DestItemPathname); } if (Command.in_Item.DateCreated.HasValue) { File.SetCreationTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateCreated); } else { File.SetCreationTimeUtc(DestItemPathname, (DateTime)item.DateCreated); } if (Command.in_Item.DateLastWrite.HasValue) { File.SetLastWriteTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateLastWrite); } else { File.SetLastWriteTimeUtc(DestItemPathname, (DateTime)item.DateLastWrite); } if (Command.in_Item.DateLastRead.HasValue) { File.SetLastAccessTimeUtc(DestItemPathname, (DateTime)Command.in_Item.DateLastRead); } else { File.SetLastAccessTimeUtc(DestItemPathname, (DateTime)item.DateLastRead); } } Command.out_Item = this.ItemFromPathname(DestItemPathname); } else { throw new Exceptions.InvalidOperationException("Update", "Item does not exist."); } return; }