/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="path">The path to the patch from the root content file.</param> /// <param name="assetName">The normalized asset name to intercept.</param> /// <param name="conditions">The conditions which determine whether this patch should be applied.</param> /// <param name="fromFile">The normalized asset key from which to load entries (if applicable), including tokens.</param> /// <param name="records">The data records to edit.</param> /// <param name="fields">The data fields to edit.</param> /// <param name="moveRecords">The records to reorder, if the target is a list asset.</param> /// <param name="updateRate">When the patch should be updated.</param> /// <param name="contentPack">The content pack which requested the patch.</param> /// <param name="parentPatch">The parent patch for which this patch was loaded, if any.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> /// <param name="normalizeAssetName">Normalize an asset name.</param> /// <param name="tryParseFields">Parse the data change fields for an <see cref="PatchType.EditData"/> patch.</param> public EditDataPatch(LogPathBuilder path, IManagedTokenString assetName, IEnumerable <Condition> conditions, IManagedTokenString fromFile, IEnumerable <EditDataPatchRecord> records, IEnumerable <EditDataPatchField> fields, IEnumerable <EditDataPatchMoveRecord> moveRecords, UpdateRate updateRate, ManagedContentPack contentPack, IPatch parentPatch, IMonitor monitor, Func <string, string> normalizeAssetName, TryParseFieldsDelegate tryParseFields) : base( path: path, type: PatchType.EditData, assetName: assetName, conditions: conditions, updateRate: updateRate, contentPack: contentPack, parentPatch: parentPatch, normalizeAssetName: normalizeAssetName, fromAsset: fromFile ) { // set fields this.Records = records?.ToArray(); this.Fields = fields?.ToArray(); this.MoveRecords = moveRecords?.ToArray(); this.Monitor = monitor; this.TryParseFields = tryParseFields; // track contextuals this.Contextuals .Add(this.Records) .Add(this.Fields) .Add(this.MoveRecords) .Add(this.Conditions); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="logName">A unique name for this patch shown in log messages.</param> /// <param name="contentPack">The content pack which requested the patch.</param> /// <param name="assetName">The normalised asset name to intercept.</param> /// <param name="conditions">The conditions which determine whether this patch should be applied.</param> /// <param name="fromFile">The normalised asset key from which to load entries (if applicable), including tokens.</param> /// <param name="records">The data records to edit.</param> /// <param name="fields">The data fields to edit.</param> /// <param name="moveRecords">The records to reorder, if the target is a list asset.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> /// <param name="normaliseAssetName">Normalise an asset name.</param> /// <param name="tryParseFields">Parse the data change fields for an <see cref="PatchType.EditData"/> patch.</param> public EditDataPatch(string logName, ManagedContentPack contentPack, ITokenString assetName, IEnumerable <Condition> conditions, IParsedTokenString fromFile, IEnumerable <EditDataPatchRecord> records, IEnumerable <EditDataPatchField> fields, IEnumerable <EditDataPatchMoveRecord> moveRecords, IMonitor monitor, Func <string, string> normaliseAssetName, TryParseFieldsDelegate tryParseFields) : base(logName, PatchType.EditData, contentPack, assetName, conditions, normaliseAssetName, fromAsset: fromFile) { // set fields this.Records = records?.ToArray(); this.Fields = fields?.ToArray(); this.MoveRecords = moveRecords?.ToArray(); this.Monitor = monitor; this.TryParseFields = tryParseFields; // track contextuals this.Contextuals .Add(this.Records) .Add(this.Fields) .Add(this.MoveRecords) .Add(this.Conditions); }