IBaseMessage IComponent.Execute(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            Trace.WriteLine("DotNetTypesToJsonConverter Pipeline - Entered Execute()");
            Trace.WriteLine("DotNetTypesToJsonConverter Pipeline - TypeName is set to: " + TypeName);

            IBaseMessagePart bodyPart = pInMsg.BodyPart;

            if (bodyPart != null)
            {
                Stream originalStream = bodyPart.GetOriginalDataStream();
                if (originalStream != null)
                {
                    Type myClassType = Type.GetType(TypeName);

                    object reqObj = PcHelper.FromXml(originalStream, myClassType);

                    string jsonText = JsonConvert.SerializeObject(reqObj, myClassType, Formatting.None,
                                                                  new JsonSerializerSettings());
                    Trace.WriteLine("DotNetTypesToJsonConverter output: " + jsonText);

                    byte[] outBytes = Encoding.ASCII.GetBytes(jsonText);

                    var memStream = new MemoryStream();
                    memStream.Write(outBytes, 0, outBytes.Length);
                    memStream.Position = 0;

                    bodyPart.Data = memStream;
                    pContext.ResourceTracker.AddResource(memStream);
                }
            }
            Trace.WriteLine("DotNetTypesToJsonConverter Pipeline - Exited Execute()");
            return(pInMsg);
        }
Ejemplo n.º 2
0
        void IPersistPropertyBag.Load(IPropertyBag propertyBag, int errorLog)
        {
            object obj1 = PcHelper.ReadPropertyBag(propertyBag, "RootNode");

            if (obj1 != null)
            {
                Rootnode = (string)obj1;
            }
        }
        void IPersistPropertyBag.Load(IPropertyBag propertyBag, int errorLog)
        {
            object obj1 = PcHelper.ReadPropertyBag(propertyBag, "TypeName");

            if (obj1 != null)
            {
                TypeName = (string)obj1;
            }
        }
Ejemplo n.º 4
0
        void IPersistPropertyBag.Load(IPropertyBag propertyBag, int errorLog)
        {
            object obj1 = PcHelper.ReadPropertyBag(propertyBag, "RemoveAtTheRateChar");

            if (obj1 != null)
            {
                RemoveAtTheRateChar = (bool)obj1;
            }

            obj1 = PcHelper.ReadPropertyBag(propertyBag, "OmitRootObject");
            if (obj1 != null)
            {
                OmitRootObject = (bool)obj1;
            }
        }
Ejemplo n.º 5
0
 void IPersistPropertyBag.Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
 {
     PcHelper.WritePropertyBag(propertyBag, "RemoveAtTheRateChar", RemoveAtTheRateChar);
     PcHelper.WritePropertyBag(propertyBag, "OmitRootObject", OmitRootObject);
 }
Ejemplo n.º 6
0
 void IPersistPropertyBag.Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
 {
     PcHelper.WritePropertyBag(propertyBag, "RootNode", Rootnode);
 }
 void IPersistPropertyBag.Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
 {
     PcHelper.WritePropertyBag(propertyBag, "TypeName", TypeName);
 }