Ejemplo n.º 1
0
        /// <summary>
        /// Returns a JSON string for the elements
        /// </summary>
        internal string GenerateJson(IDataSource source, string[] streamsToPublish, bool userMayEdit)
        {
#pragma warning disable 612
            var ser = new OldContentBlockJsonSerialization(userMayEdit);
#pragma warning restore 612

            var y = streamsToPublish
                    .Where(k => source.Out.ContainsKey(k))
                    .ToDictionary(k => k, s => new
            {
                List = source.Out[s].List.Select(c => ser.PrepareOldFormat(c)).ToList()
            });

            return(JsonConvert.SerializeObject(y));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a JSON string for the elements
        /// </summary>
        internal string GetJsonFromStreams(IDataSource source, string[] streamsToPublish)
        {
#pragma warning disable 612
            var ser = new OldContentBlockJsonSerialization(_blockBuilder.UserMayEdit);
#pragma warning restore 612

            var y = streamsToPublish
                    .Where(k => source.Out.ContainsKey(k))
                    .ToDictionary(k => k, s => new
            {
                List = (from c in source.Out[s].List select ser.PrepareOldFormat(c)).ToList()
            });

            return(JsonConvert.SerializeObject(y));
        }