/// <summary> /// Instantiates a <c>XMLWriteFileObject</c>. Used for create and update. /// </summary> /// <param name="name">The name of the file.</param> /// <param name="parent">The parent of the file.</param> /// <param name="hash">The hash of the file.</param> /// <param name="size">The size of the file.</param> /// <param name="creationTimeUtc">The creation time of the file.</param> /// <param name="modifiedTimeUtc">The modified time of the file.</param> /// <param name="changeType">The change type of the file.</param> /// <param name="metaUpdatedUtc">The metadata updated time of the file.</param> public XMLWriteFileObject(string name, string parent, string hash, long size, long creationTimeUtc, long modifiedTimeUtc, MetaChangeType changeType, long metaUpdatedUtc) : base(name, parent, creationTimeUtc, changeType, metaUpdatedUtc) { _size = size; _hash = hash; _lastModifiedUtc = modifiedTimeUtc; }
/// <summary> /// Instantiates an instance of <c>BaseXMLWriteObject</c> for delete purposes. /// </summary> /// <param name="name">The name of the file or folder object.</param> /// <param name="parent">The parent of the file or folder object.</param> /// <param name="changeType">The type of change to write to XML.</param> /// <param name="metaUpdatedUtc">The time when the metadata was updated.</param> protected BaseXMLWriteObject(string name, string parent, MetaChangeType changeType, long metaUpdatedUtc) { _name = name; _parent = parent; _changeType = changeType; _metaUpdatedUtc = metaUpdatedUtc; }
// Update sort order when defaulted mod names change. private void OnMetaChange(MetaChangeType type, Mod mod, string?oldName) { if (type.HasFlag(MetaChangeType.Name) && oldName != null) { var old = oldName.FixName(); if (Find(old, out var child) && child is not Folder) { Rename(child, mod.Name.Text); } } }
/// <summary> /// Instantiates a <c>XMLWriteFileObject</c>. Used for delete. /// </summary> /// <param name="name">The name of the file.</param> /// <param name="parent">The parent of the file.</param> /// <param name="changeType">The change type of the file.</param> /// <param name="metaUpdatedUtc">The metadata updated time of the file.</param> public XMLWriteFileObject(string name, string parent, MetaChangeType changeType, long metaUpdatedUtc) : base(name, parent, changeType, metaUpdatedUtc) { }
/// <summary> /// Instantiates an instance of <c>XMLWriteFolderObject</c> for create and update purposes. /// </summary> /// <param name="name">The name of the folder object.</param> /// <param name="parent">The parent of the folder object.</param> /// <param name="creationTimeUtc">The creation time of the folder.</param> /// <param name="changeType">The type of change to write to XML.</param> /// <param name="metaUpdatedUtc">The time when the metadata was updated.</param> public XMLWriteFolderObject(string name, string parent, long creationTimeUtc, MetaChangeType changeType, long metaUpdatedUtc) : base(name, parent, creationTimeUtc, changeType, metaUpdatedUtc) { }
/// <summary> /// Instantiates an instance of <c>BaseXMLWriteObject</c> for rename purposes. /// </summary> /// <param name="name">The name of the file or folder object.</param> /// <param name="newName">The new name of the file or folder object.</param> /// <param name="parent">The parent of the file or folder object.</param> /// <param name="changeType">The type of change to write to XML.</param> /// <param name="metaUpdatedUtc">The time when the metadata was updated.</param> protected BaseXMLWriteObject(string name, string newName, string parent, MetaChangeType changeType, long metaUpdatedUtc) : this(name, parent, changeType, metaUpdatedUtc) { _newName = newName; }
/// <summary> /// Instantiates an instance of <c>BaseXMLWriteObject</c> for create and update purposes. /// </summary> /// <param name="name">The name of the file or folder object.</param> /// <param name="parent">The parent of the file or folder object.</param> /// <param name="creationTimeUtc">The creation time of the file or folder.</param> /// <param name="changeType">The type of change to write to XML.</param> /// <param name="metaUpdatedUtc">The time when the metadata was updated.</param> protected BaseXMLWriteObject(string name, string parent, long creationTimeUtc, MetaChangeType changeType, long metaUpdatedUtc) : this(name, parent, changeType, metaUpdatedUtc) { _creationTimeUtc = creationTimeUtc; }