Exemple #1
0
        /// <summary>
        /// Gets Part Properties from XLANGPart
        /// </summary>
        /// <param name="partId"></param>
        /// <param name="part"></param>
        /// <returns></returns>
        private List <PartProperty> GetPartProperties(Guid partId, XLANGPart part)
        {
            List <PartProperty> prtProperties = new List <PartProperty>();

            if (part is PartWrapperForUserCode)
            {
                PartWrapperForUserCode     partWrapper = (PartWrapperForUserCode)part;
                Microsoft.XLANGs.Core.Part xPart       = (Microsoft.XLANGs.Core.Part)(partUnwrapMethod.Invoke(partWrapper, null));

                if (xPart != null)
                {
                    XmlQNameTable propertyTable = xPart.GetPartProperties();
                    if (propertyTable != null)
                    {
                        int propertyIndex = 0;
                        foreach (DictionaryEntry property in propertyTable)
                        {
                            XmlQName     qName   = (XmlQName)property.Key;
                            PartProperty prtProp = new PartProperty();

                            prtProp.PartId        = partId;
                            prtProp.PropertyIndex = propertyIndex;
                            prtProp.Name          = qName.Name;
                            prtProp.Namespace     = qName.Namespace;
                            prtProp.Value         = property.Value.ToString();

                            propertyIndex++;
                            prtProperties.Add(prtProp);
                        }
                    }
                }
            }

            return(prtProperties);
        }
Exemple #2
0
        /// <summary>
        /// Gets Part Properties from IBaseMessagePart
        /// </summary>
        /// <param name="partId"></param>
        /// <param name="part"></param>
        /// <returns></returns>
        private List <PartProperty> GetPartProperties(Guid partId, IBaseMessagePart part)
        {
            int propertyCount = (int)part.PartProperties.CountProperties;
            List <PartProperty> prtProperties = new List <PartProperty>();

            for (int propertyIndex = 0; propertyIndex < propertyCount; propertyIndex++)
            {
                PartProperty prtProp           = new PartProperty();
                string       propertyName      = null;
                string       propertyNamespace = null;
                object       propertyValue     = part.PartProperties.ReadAt(propertyIndex, out propertyName, out propertyNamespace);

                prtProp.PartId        = partId;
                prtProp.PropertyIndex = propertyIndex;
                prtProp.Name          = propertyName;
                prtProp.Namespace     = propertyNamespace;
                prtProp.Value         = (string)propertyValue;

                prtProperties.Add(prtProp);
            }

            return(prtProperties);
        }