コード例 #1
0
ファイル: Activity.cs プロジェクト: YHZX2013/exchange_diff
        private void SerializeCustomPropertiesDictionary(IDictionary <string, string> data, out bool isTruncatedResult)
        {
            if (data == null || data.Count == 0)
            {
                isTruncatedResult = false;
                return;
            }
            AbstractCustomPropertySerializer serializer = CustomPropertySerializerFactory.GetSerializer();

            if (serializer == null)
            {
                isTruncatedResult = false;
                return;
            }
            byte[] array = serializer.Serialize(data, out isTruncatedResult);
            if (array != null)
            {
                this.propertyBag.SetProperty(ActivitySchema.CustomProperties, array);
            }
        }
コード例 #2
0
        public static AbstractCustomPropertySerializer GetDeserializer(byte[] bytes)
        {
            ArgumentValidator.ThrowIfNull("bytes", bytes);
            if (bytes.Length < 3)
            {
                InferenceDiagnosticsLog.Log("CustomPropertySerializerFactory.GetDeserializer", string.Format("Cannot deserialize a byte array that does not have a header. Length of bytes: '{0}'", bytes.Length));
                return(null);
            }
            int num  = (int)bytes[0];
            int num2 = (int)bytes[1];

            if (num <= CustomPropertySerializerFactory.maxVersion)
            {
                return(CustomPropertySerializerFactory.GetSerializer(num));
            }
            if (num2 <= CustomPropertySerializerFactory.maxVersion)
            {
                return(CustomPropertySerializerFactory.GetSerializer(CustomPropertySerializerFactory.maxVersion));
            }
            InferenceDiagnosticsLog.Log("Activity.DeserializeCustomPropertiesDictionary", string.Format("Unable to find a serializer for deserializing. Version used for serializing '{0}', MinVersion supported '{1}', MaxVersion understood by factory '{2}'", num, num2, CustomPropertySerializerFactory.maxVersion));
            return(null);
        }
コード例 #3
0
 public static AbstractCustomPropertySerializer GetSerializer()
 {
     return(CustomPropertySerializerFactory.GetSerializer(CustomPropertySerializerFactory.maxVersion));
 }