internal virtual void Scalar(IIonHashValue ionValue) { this.HandleAnnotationsBegin(ionValue); this.BeginMarker(); dynamic ionValueValue = ionValue.CurrentIsNull ? null : ionValue.CurrentValue; IonType ionType = ionValue.CurrentIsNull ? IonType.None : ionValue.CurrentType; byte[] scalarBytes = this.GetBytes(ionValue.CurrentType, ionValueValue, ionValue.CurrentIsNull); ionValueValue = ionValue.CurrentType == IonType.Symbol ? ionValueValue : null; (byte tq, byte[] representation) = ((byte, byte[])) this.ScalarOrNullSplitParts( ionType, ionValueValue, ionValue.CurrentIsNull, scalarBytes); this.Update(new byte[] { tq }); if (representation.Length > 0) { this.Update(Escape(representation)); } this.EndMarker(); this.HandleAnnotationsEnd(ionValue); }
internal override void Scalar(IIonHashValue value) { this.scalarSerializer.HandleFieldName(value.CurrentFieldName); this.scalarSerializer.Scalar(value); byte[] digest = this.scalarSerializer.Digest(); this.AppendFieldHash(digest); }
private void HandleAnnotationsEnd(IIonHashValue ionValue, bool isContainer = false) { if ((ionValue != null && ionValue.Annotations.Count > 0) || (isContainer && this.hasContainerAnnotation)) { this.EndMarker(); if (isContainer) { this.hasContainerAnnotation = false; } } }
internal void HandleFieldName(IIonHashValue ionValue) { if (this.depth > 0 && ionValue.IsInStruct) { if (ionValue.CurrentFieldNameSymbol.Text == null && ionValue.CurrentFieldNameSymbol.Sid != 0) { throw new UnknownSymbolException(ionValue.CurrentFieldNameSymbol.Sid); } this.WriteSymbol(ionValue.CurrentFieldNameSymbol.Text); } }
internal void StepIn(IIonHashValue ionValue) { this.HandleFieldName(ionValue); this.HandleAnnotationsBegin(ionValue, true); this.BeginMarker(); byte tq = TQ(ionValue); if (ionValue.CurrentIsNull) { tq |= 0x0F; } this.Update(new byte[] { tq }); }
private void HandleAnnotationsBegin(IIonHashValue ionValue, bool isContainer = false) { IList <SymbolToken> annotations = ionValue.Annotations; if (annotations.Count > 0) { this.BeginMarker(); this.Update(Constants.TqAnnotatedValue); foreach (var annotation in annotations) { this.WriteSymbol(annotation.Text); } if (isContainer) { this.hasContainerAnnotation = true; } } }
internal void StepIn(IIonHashValue ionValue) { IIonHasher hashFunction = this.currentHasher.HashFunction; if (this.currentHasher is StructSerializer) { hashFunction = this.hasherProvider.NewHasher(); } if (ionValue.CurrentType == IonType.Struct) { this.currentHasher = new StructSerializer(hashFunction, this.Depth(), this.hasherProvider); } else { this.currentHasher = new Serializer(hashFunction, this.Depth()); } this.hasherStack.Push(this.currentHasher); this.currentHasher.StepIn(ionValue); }
internal void Scalar(IIonHashValue ionValue) { this.currentHasher.Scalar(ionValue); }
private static byte TQ(IIonHashValue ionValue) { byte typeCode = (byte)ionValue.CurrentType; return((byte)(typeCode << 4)); }