protected virtual bool IsFieldDifferent(IItemFieldValue sourceField, Dictionary <Guid, IItemFieldValue> targetFields, Guid fieldId) { // note that returning "true" means the values DO NOT MATCH EACH OTHER. if (sourceField == null) { return(false); } // it's a "match" if the target item does not contain the source field IItemFieldValue targetField; if (!targetFields.TryGetValue(fieldId, out targetField)) { return(true); } var fieldComparer = FieldComparers.FirstOrDefault(comparer => comparer.CanCompare(sourceField, targetField)); if (fieldComparer == null) { throw new InvalidOperationException("Unable to find a field comparison for " + sourceField.NameHint); } return(!fieldComparer.AreEqual(sourceField, targetField)); }
public void SkippedPastingIgnoredField(Item item, IItemFieldValue field) { string status = $"{DateTime.Now:h:mm:ss tt} [SKIPPED] Skipped an ignored field {field.NameHint} in item {item.DisplayName} - {item.ID} "; AddToLog(status); Log.Info(status, this); }
protected virtual bool IsFieldDifferent(IItemFieldValue sourceField, Dictionary <Guid, IItemFieldValue> targetFields, Guid fieldId) { // note that returning "true" means the values DO NOT MATCH EACH OTHER. if (sourceField == null) { return(false); } // it's a "match" if the target item does not contain the source field IItemFieldValue targetField; if (!targetFields.TryGetValue(fieldId, out targetField)) { return(true); } IFieldComparer comparer; // ReSharper disable once ForCanBeConvertedToForeach for (var index = 0; index < FieldComparers.Count; index++) { comparer = FieldComparers[index]; if (!comparer.CanCompare(sourceField, targetField)) { continue; } return(!comparer.AreEqual(sourceField, targetField)); } throw new InvalidOperationException("Unable to find a field comparison for " + sourceField.NameHint); }
public RainbowField(IItemFieldValue itemFieldValue) { this.Id = itemFieldValue.FieldId.ToString("B"); this.Name = itemFieldValue.NameHint; this.Key = itemFieldValue.FieldType; this.Value = itemFieldValue.Value; }
public override string Format(IItemFieldValue field) { if (string.IsNullOrWhiteSpace(field.Value)) { return(field.Value); } try { XDocument doc = XDocument.Parse(field.Value); XmlWriterSettings settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, NewLineOnAttributes = !UseLegacyFormatting, }; StringBuilder result = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(result, settings)) { doc.WriteTo(writer); } return(result.ToString()); } catch (Exception ex) { Log.Error($"Error while formatting XML field {field.FieldId} ({field.NameHint}). The raw value will be used instead. Raw value was {field.Value}", ex, this); return(field.Value); } }
public RainbowField(IItemFieldValue itemFieldValue) { this.Id = itemFieldValue.FieldId.ToString("B"); this.Name = itemFieldValue.NameHint; this.Key = itemFieldValue.FieldType; this.Value = itemFieldValue.Value; }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) && string.IsNullOrWhiteSpace(field2.Value)) { return(true); } if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) { return(false); } try { var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return(XNode.DeepEquals(x1, x2)); } catch (XmlException xe) { Log.Error($"Field {field1.NameHint ?? field2.NameHint} contained an invalid XML value. Falling back to string comparison.", xe, this); return(new DefaultComparison().AreEqual(field1, field2)); } }
public ProxyFieldValue(IItemFieldValue fieldToProxy) { Value = fieldToProxy.Value; FieldType = fieldToProxy.FieldType; FieldId = fieldToProxy.FieldId; NameHint = fieldToProxy.NameHint; BlobId = fieldToProxy.BlobId; }
public bool CanFormat(IItemFieldValue field) { Assert.ArgumentNotNull(field, "field"); if (field.FieldType == null) return false; return SupportedFieldTypes.Any(type => type.Equals(field.FieldType, StringComparison.OrdinalIgnoreCase)); }
public void WroteBlobStream(Item item, IItemFieldValue field) { BeginEvent(item, "Wrote Blob", GetSrc(ThemeManager.GetIconImage(item, 32, 32, "", "")), false); string status = $"{DateTime.Now:h:mm:ss tt} [WROTE BLOB] Wrote blob stream for item {item.DisplayName} - {item.ID}"; AddToLog(status); Log.Info(status, this); }
public ProxyFieldValue(IItemFieldValue fieldToProxy) { Value = fieldToProxy.Value; FieldType = fieldToProxy.FieldType; FieldId = fieldToProxy.FieldId; NameHint = fieldToProxy.NameHint; BlobId = fieldToProxy.BlobId; }
public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) _logger.Debug("* [U] {0}".FormatWith(itemField.Name)); else _logger.Debug("* [U] {0}#{1}: {2}".FormatWith(item.Language.Name, item.Version.Number, itemField.Name)); }
public virtual bool CanCompare(IItemFieldValue field1, IItemFieldValue field2) { var typeToCompare = field1.FieldType ?? field2.FieldType; if(typeToCompare == null) throw new Exception("Cannot compare two fields without a type."); return SupportedFieldTypes.Any(type => type.Equals(typeToCompare, StringComparison.OrdinalIgnoreCase)); }
public override string Format(IItemFieldValue field) { if (field.Value.Equals("1", StringComparison.Ordinal) || field.Value.Equals("true", StringComparison.OrdinalIgnoreCase)) { return("1"); } return("0"); }
public override string Format(IItemFieldValue field) { var values = ID.ParseArray(field.Value); if (values.Length == 0 && field.Value.Length > 0) return field.Value; return string.Join(Environment.NewLine, (IEnumerable<ID>)values); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) return false; var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return XNode.DeepEquals(x1, x2); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.Value == null || field2.Value == null) return false; string v1 = Regex.Replace(field1.Value, "(\r|\n)+", string.Empty); string v2 = Regex.Replace(field2.Value, "(\r|\n)+", string.Empty); return v1.Equals(v2); }
public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) _logger.Debug($"* [U] {itemField.Name}"); else if(itemField.Unversioned) _logger.Debug($"* [U] {item.Language.Name}: {itemField.Name}"); else _logger.Debug($"* [U] {item.Language.Name}#{item.Version.Number}: {itemField.Name}"); }
public bool CanFormat(IItemFieldValue field) { Assert.ArgumentNotNull(field, "field"); if (field.FieldType == null) return false; if(_fieldTypeSet == null) _fieldTypeSet = new HashSet<string>(SupportedFieldTypes, StringComparer.OrdinalIgnoreCase); return _fieldTypeSet.Contains(field.FieldType); }
public override string Format(IItemFieldValue field) { var values = ID.ParseArray(field.Value); if (values.Length == 0 && field.Value.Length > 0) { return(field.Value); } return(string.Join(Environment.NewLine, (IEnumerable <ID>)values)); }
private static RenderingField GetRenderingField(IItemFieldValue field) { return(new RenderingField { Id = field.FieldId, Name = field.NameHint, Value = field.Value, Type = field.FieldType, BlobId = field.BlobId }); }
public virtual bool CanCompare(IItemFieldValue field1, IItemFieldValue field2) { var typeToCompare = field1.FieldType ?? field2.FieldType; if (typeToCompare == null) { throw new Exception("Cannot compare two fields without a type."); } return(SupportedFieldTypes.Any(type => type.Equals(typeToCompare, StringComparison.OrdinalIgnoreCase))); }
public virtual bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.BlobId.HasValue && field2.BlobId.HasValue) return field1.BlobId.Value.Equals(field2.BlobId.Value); var field1Value = field1.Value; var field2Value = field2.Value; if (field1Value == null || field2Value == null) return false; return field1Value.Equals(field2Value); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.Value == null || field2.Value == null) { return(false); } string v1 = Regex.Replace(field1.Value, "(\r|\n)+", string.Empty); string v2 = Regex.Replace(field2.Value, "(\r|\n)+", string.Empty); return(v1.Equals(v2)); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { var field1Value = field1.Value; var field2Value = field2.Value; if (field1Value == null || field2Value == null) return false; // certain Sitecore multilists - I'm looking at YOU __Masters - seem to like to add a trailing pipe to their values // this can cause a sync right after a reserialize to have 'changes' as Unicorn fixes Sitecore's problems! // so to avoid confusion, we'll just ignore leading or trailing pipes when comparing a multilist return field1Value.Trim('|').Equals(field2Value.Trim('|')); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.Value == null || field2.Value == null) { return(false); } var v1 = StripEndlines(field1.Value); var v2 = StripEndlines(field2.Value); return(v1.Equals(v2)); }
public override string Format(IItemFieldValue field) { try { XDocument doc = XDocument.Parse(field.Value); return doc.ToString(); } catch (Exception) { return field.Value; } }
public override string Format(IItemFieldValue field) { try { XDocument doc = XDocument.Parse(field.Value); return(doc.ToString()); } catch (Exception ex) { Log.Error($"Error while formatting XML field {field.FieldId} ({field.NameHint}). The raw value will be used instead.", ex, this); return(field.Value); } }
public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) { _logger.Debug("* [U] {0}".FormatWith(itemField.Name)); } else { _logger.Debug("* [U] {0}#{1}: {2}".FormatWith(item.Language.Name, item.Version.Number, itemField.Name)); } }
public override string Format(IItemFieldValue field) { try { XDocument doc = XDocument.Parse(field.Value); return doc.ToString(); } catch (Exception ex) { Log.Error($"Error while formatting XML field {field.FieldId} ({field.NameHint}). The raw value will be used instead.", ex, this); return field.Value; } }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.Value == null || field2.Value == null) { return(false); } var formatter = new CheckboxFieldFormatter(); string v1 = formatter.Format(field1); string v2 = formatter.Format(field2); return(v1.Equals(v2, StringComparison.Ordinal)); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { var field1Value = field1.Value; var field2Value = field2.Value; if (field1Value == null || field2Value == null) { return(false); } // certain Sitecore multilists - I'm looking at YOU __Masters - seem to like to add a trailing pipe to their values // this can cause a sync right after a reserialize to have 'changes' as Unicorn fixes Sitecore's problems! // so to avoid confusion, we'll just ignore leading or trailing pipes when comparing a multilist return(field1Value.Trim('|').Equals(field2Value.Trim('|'))); }
private bool AreFieldsEqual(Field local, IItemFieldValue remote) { var localField = new ItemFieldValue(local, local.Value); foreach (IFieldComparer comparer in Comparers) { if (!comparer.CanCompare(localField, remote)) { continue; } return(comparer.AreEqual(localField, remote)); } return(false); }
public bool CanFormat(IItemFieldValue field) { Assert.ArgumentNotNull(field, "field"); if (field.FieldType == null) { return(false); } if (_fieldTypeSet == null) { _fieldTypeSet = new HashSet <string>(SupportedFieldTypes, StringComparer.OrdinalIgnoreCase); } return(_fieldTypeSet.Contains(field.FieldType)); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) return false; try { var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return XNode.DeepEquals(x1, x2); } catch (XmlException xe) { throw new InvalidOperationException($"Unable to compare {field1.NameHint ?? field2.NameHint} field due to invalid XML value.", xe); } }
public virtual bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (field1.BlobId.HasValue && field2.BlobId.HasValue) { return(field1.BlobId.Value.Equals(field2.BlobId.Value)); } var field1Value = field1.Value; var field2Value = field2.Value; if (field1Value == null || field2Value == null) { return(false); } return(field1Value.Equals(field2Value, StringComparison.Ordinal)); }
public virtual void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { var itemField = item.Fields[new ID(field.FieldId)]; if (itemField.Shared) { _logger.Debug($"* [U] {itemField.Name}"); } else if (itemField.Unversioned) { _logger.Debug($"* [U] {item.Language.Name}: {itemField.Name}"); } else { _logger.Debug($"* [U] {item.Language.Name}#{item.Version.Number}: {itemField.Name}"); } }
public void GetChildren(string guid, string path) { using (SerializationBlobStorageDataStore dataStore = this.CreateDataStore(this.useBlobListCache)) { IItemData parentItem = dataStore.GetById(Guid.Parse(guid), "master"); IEnumerable <IItemData> items = dataStore.GetChildren(parentItem); Assert.NotNull(items); Assert.Equal(2, items.Count()); IItemData rootItem = Assert.Single(items, x => x.Name == "Root"); Assert.Equal(1, rootItem.Versions.First().Fields.Count()); IItemFieldValue enCreatedField = rootItem.Versions.FirstOrDefault()?.Fields.FirstOrDefault(x => x.FieldId == Guid.Parse("25bed78c-4957-4165-998a-ca1b52f67497")); Assert.NotNull(enCreatedField?.Value); } }
public void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { string status = $"{DateTime.Now:h:mm:ss tt} [FIELD CHANGED] Field {field.NameHint} value changed for item {item.DisplayName} - {item.ID} from {oldValue} to {item[new ID(field.FieldId)]}"; AddToLog(status); Log.Info(status, this); if (!LinesSupport.ContainsKey(item.ID.Guid.ToString())) { LinesSupport[item.ID.Guid.ToString()] = new { Events = new Dictionary <string, List <Tuple <string, string> > >() } } ; if (!LinesSupport[item.ID.Guid.ToString()].Events.ContainsKey(item.Language.Name + " v" + item.Version.Number)) { LinesSupport[item.ID.Guid.ToString()].Events[item.Language.Name + " v" + item.Version.Number] = new List <Tuple <string, string> >(); } LinesSupport[item.ID.Guid.ToString()].Events[item.Language.Name + " v" + item.Version.Number].Add(new Tuple <string, string>(field.NameHint, HtmlDiff.HtmlDiff.Execute(HttpUtility.HtmlEncode(oldValue), HttpUtility.HtmlEncode(item[new ID(field.FieldId)])))); }
public override bool AreEqual(IItemFieldValue field1, IItemFieldValue field2) { if (string.IsNullOrWhiteSpace(field1.Value) || string.IsNullOrWhiteSpace(field2.Value)) { return(false); } try { var x1 = XElement.Parse(field1.Value); var x2 = XElement.Parse(field2.Value); return(XNode.DeepEquals(x1, x2)); } catch (XmlException xe) { throw new InvalidOperationException($"Unable to compare {field1.NameHint ?? field2.NameHint} field due to invalid XML value.", xe); } }
public void LoadFrom(IItemFieldValue field, IFieldFormatter[] formatters) { Id = field.FieldId; NameHint = field.NameHint; BlobId = field.BlobId; string value = field.Value; foreach (var formatter in formatters) { if (formatter.CanFormat(field)) { value = formatter.Format(field); Type = field.FieldType; break; } } Value = value ?? string.Empty; }
protected virtual bool IsFieldDifferent(IItemFieldValue sourceField, Dictionary <Guid, IItemFieldValue> targetFields, Guid fieldId) { // note that returning "true" means the values DO NOT MATCH EACH OTHER. if (sourceField == null) { return(false); } // it's a "match" if the target item does not contain the source field IItemFieldValue targetField; if (!targetFields.TryGetValue(fieldId, out targetField)) { return(true); } if (sourceField.Value == null && targetField.Value == null) { return(false); // 2.0.6-pre3 - added this. It makes no sense to loop through field comparers, asking them to compare two null values. } // Relates to issue https://github.com/SitecoreUnicorn/Unicorn/issues/319 IFieldComparer comparer; // ReSharper disable once ForCanBeConvertedToForeach for (var index = 0; index < FieldComparers.Count; index++) { comparer = FieldComparers[index]; if (!comparer.CanCompare(sourceField, targetField)) { continue; } return(!comparer.AreEqual(sourceField, targetField)); } throw new InvalidOperationException("Unable to find a field comparison for " + sourceField.NameHint); }
public virtual bool CanCompare(IItemFieldValue field1, IItemFieldValue field2) { if (FieldTypeLookup == null) { lock (SyncLock) { if (FieldTypeLookup == null) { FieldTypeLookup = new HashSet <string>(SupportedFieldTypes, StringComparer.OrdinalIgnoreCase); } } } var typeToCompare = field1.FieldType ?? field2.FieldType; if (typeToCompare == null) { throw new Exception("Cannot compare two fields without a type."); } return(FieldTypeLookup.Contains(typeToCompare)); }
public void UpdatedChangedFieldValue(Item item, IItemFieldValue field, string oldValue) { //Log.Info($"Field {field.NameHint} value changed for item {item.ID} from {oldValue} to {item[new ID(field.FieldId)]}", this); }
protected virtual bool IsFieldDifferent(IItemFieldValue sourceField, Dictionary<Guid, IItemFieldValue> targetFields, Guid fieldId) { // note that returning "true" means the values DO NOT MATCH EACH OTHER. if (sourceField == null) return false; // it's a "match" if the target item does not contain the source field IItemFieldValue targetField; if (!targetFields.TryGetValue(fieldId, out targetField)) return true; var fieldComparer = FieldComparers.FirstOrDefault(comparer => comparer.CanCompare(sourceField, targetField)); if (fieldComparer == null) throw new InvalidOperationException("Unable to find a field comparison for " + sourceField.NameHint); return !fieldComparer.AreEqual(sourceField, targetField); }
public void SkippedPastingIgnoredField(Item item, IItemFieldValue field) { //Log.Info($"Skipped an ignored field {field.NameHint} in item {item.ID} ", this); }
public abstract bool AreEqual(IItemFieldValue field1, IItemFieldValue field2);
/// <summary> /// Inserts field value into item. /// </summary> /// <param name="item">The item.</param> /// <param name="field">The field.</param> /// <param name="creatingNewItem">Whether the item under update is new or not (controls logging verbosity)</param> /// <exception cref="T:Sitecore.Data.Serialization.Exceptions.FieldIsMissingFromTemplateException"/> protected virtual bool PasteField(Item item, IItemFieldValue field, bool creatingNewItem) { if (!_fieldFilter.Includes(field.FieldId)) { _logger.SkippedPastingIgnoredField(item, field); return false; } Template template = AssertTemplate(item.Database, item.TemplateID, item.Paths.Path); if (template.GetField(new ID(field.FieldId)) == null) { item.Database.Engines.TemplateEngine.Reset(); template = AssertTemplate(item.Database, item.TemplateID, item.Paths.Path); } if (template.GetField(new ID(field.FieldId)) == null) { throw new TemplateMissingFieldException(item.TemplateName, item.Database.Name + ":" + item.Paths.FullPath, field); } Field itemField = item.Fields[new ID(field.FieldId)]; if (itemField.IsBlobField) { if (!field.BlobId.HasValue) throw new InvalidOperationException("Field " + field.FieldId + " is a blob field, but it had no blob ID."); // check if existing blob is here with the same ID; abort if so Guid existingBlobId; if (Guid.TryParse(itemField.Value, out existingBlobId) && existingBlobId == field.BlobId.Value) return false; byte[] buffer = Convert.FromBase64String(field.Value); // if an existing blob of a different ID exists, drop it from the database if (existingBlobId != default(Guid)) ItemManager.RemoveBlobStream(existingBlobId, item.Database); // write the new blob to the database ItemManager.SetBlobStream(new MemoryStream(buffer, false), field.BlobId.Value, item.Database); // set the value of the blob field to the correct blob ID itemField.SetValue(MainUtil.GuidToString(field.BlobId.Value), true); if (!creatingNewItem) _logger.WroteBlobStream(item, field); return true; } if (field.Value != null && !field.Value.Equals(itemField.Value)) { var oldValue = itemField.Value; itemField.SetValue(field.Value, true); if (!creatingNewItem) _logger.UpdatedChangedFieldValue(item, field, oldValue); return true; } return false; }
public virtual void SkippedMissingTemplateField(Item item, IItemFieldValue field) { _logger.Warn("* [S] field {0} because it did not exist on template {1}.".FormatWith(field.FieldId, item.TemplateName)); }
/// <summary> /// Inserts field value into item. /// </summary> /// <param name="item">The item.</param> /// <param name="field">The field.</param> /// <param name="creatingNewItem">Whether the item under update is new or not (controls logging verbosity)</param> /// <exception cref="T:Sitecore.Data.Serialization.Exceptions.FieldIsMissingFromTemplateException"/> protected virtual bool PasteField(Item item, IItemFieldValue field, bool creatingNewItem) { if (!_fieldFilter.Includes(field.FieldId)) { _logger.SkippedPastingIgnoredField(item, field); return false; } Template template = AssertTemplate(item.Database, item.TemplateID, item.Paths.Path); if (template.GetField(new ID(field.FieldId)) == null) { item.Database.Engines.TemplateEngine.Reset(); template = AssertTemplate(item.Database, item.TemplateID, item.Paths.Path); } if (template.GetField(new ID(field.FieldId)) == null) { throw new TemplateMissingFieldException(item.TemplateName, item.Database.Name + ":" + item.Paths.FullPath, field); } Field itemField = item.Fields[new ID(field.FieldId)]; if (itemField.IsBlobField && !ID.IsID(field.Value)) { if(!field.BlobId.HasValue) throw new InvalidOperationException("Field " + field.FieldId + " is a blob field, but it had no blob ID."); byte[] buffer = Convert.FromBase64String(field.Value); ItemManager.SetBlobStream(new MemoryStream(buffer, false), field.BlobId.Value, item.Database); if (!creatingNewItem) _logger.WroteBlobStream(item, field); return true; } if (!field.Value.Equals(itemField.Value)) { var oldValue = itemField.Value; itemField.SetValue(field.Value, true); if (!creatingNewItem) _logger.UpdatedChangedFieldValue(item, field, oldValue); return true; } return false; }
public abstract bool AreEqual(IItemFieldValue field1, IItemFieldValue field2);
public ProxyItemVersion(CultureInfo language, int versionNumber) { Language = language; VersionNumber = versionNumber; Fields = new IItemFieldValue[] { new ProxyFieldValue(FieldIDs.Created.Guid, DateUtil.IsoNowWithTicks) }; }
public void SkippedPastingIgnoredField(Item item, IItemFieldValue field) { }
public abstract string Format(IItemFieldValue field);
public TemplateMissingFieldException(string templateName, string itemIdentifier, IItemFieldValue field) : this(templateName, itemIdentifier, new[] { field }) { }
public virtual bool CanCompare(IItemFieldValue field1, IItemFieldValue field2) { return field1 != null && field2 != null; }
protected virtual void AddSyncField(BulkLoadContext context, BulkLoadItem bulkItem, IItemFieldValue itemField, string language = null, int versionNumber = 1) { var fieldId = itemField.FieldId; var fieldValue = itemField.Value; var fieldName = itemField.NameHint; var isBlob = itemField.BlobId.HasValue; Func <Stream> blob = null; if (isBlob) { byte[] blobBytes; try { blobBytes = Convert.FromBase64String(fieldValue); } catch (Exception ex) { blobBytes = new byte[] { }; context.Log.Error( $"Unable to read blob from field '{fieldId}' in item with id '{bulkItem.Id}', " + $"item path '{bulkItem.ParentId}' and source info '{bulkItem.SourceInfo}', defaulting to empty value.", ex); } blob = () => new MemoryStream(blobBytes); // Field value needs to be set to the blob id. fieldValue = itemField.BlobId.Value.ToString("B").ToUpper(); } if (language == null) { bulkItem.AddSharedField(fieldId, fieldValue, blob, isBlob, fieldName); } else { bulkItem.AddVersionedField(fieldId, language, versionNumber, fieldValue, blob, isBlob, fieldName); } }
public FieldComparisonResult(IItemFieldValue sourceField, IItemFieldValue targetField) { SourceField = sourceField; TargetField = targetField; }
public void WroteBlobStream(Item item, IItemFieldValue field) { //Log.Info($"Wrote blob stream for item {item.ID}", this); }
public virtual void WroteBlobStream(Item item, IItemFieldValue field) { }