Exemple #1
0
        /// <summary>
        /// Sets the item data from an XML RPC struct
        /// </summary>
        /// <param name="item">The item to set the data on</param>
        /// <param name="rpcstruct">The struct to read the data from</param>
        private void SetItemData(Item item, XmlRpcStruct rpcstruct)
        {
            if (item != null)
            {
                var entry = new EntryItem(item);

                entry.BeginEdit();

                if (rpcstruct["title"] != null)
                    entry.Title.Field.Value = rpcstruct["title"].ToString();

                if (rpcstruct["description"] != null)
                    entry.Content.Field.Value = rpcstruct["description"].ToString();

                if (rpcstruct["categories"] != null)
                    entry.Category.Field.Value = GetCategoriesAsString(item, rpcstruct);

                if (rpcstruct["dateCreated"] != null)
                {
                    DateTime publishDate = DateTime.MinValue;
                    if (DateTime.TryParse(rpcstruct["dateCreated"].ToString(), out publishDate))
                        entry.InnerItem.Publishing.PublishDate = publishDate;
                }

                entry.EndEdit();
            }
        }