Пример #1
0
        public void SetUp()
        {
            stringBuilder = new StringBuilder();
            luaWriter     = LuaWriter.Create(stringBuilder);

            luaSerializer = new LuaSerializer();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var rawFeeds = new[]
            {
                FeedReader.Read("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
            };

            var feeds = rawFeeds.Select(feed => new
            {
                feed.Title,
                Items = feed.Items.Select(item => new
                {
                    item.Title,
                    item.Content
                }).ToArray()
            }).ToArray();

            using (var luaWriter = LuaWriter.Create("SavedVariables.lua", new LuaWriterSettings {
                Indent = true
            }))
            {
                var luaSerializer = new LuaSerializer();

                luaWriter.WriteStartAssignment("FEED_READER_FEEDS");
                luaSerializer.Serialize(luaWriter, feeds);
                luaWriter.WriteEndAssignment();
            }
        }
Пример #3
0
        public void SaveFeeds()
        {
            Feed[] feeds = this.GetTopLevelFeeds();
            if (feeds != null)
            {
                using (var luaWriter = LuaWriter.Create(savedVariablesPath))
                {
                    var luaSerializer = new LuaSerializer();

                    luaWriter.WriteStartAssignment(feedsVariableName);
                    luaSerializer.Serialize(luaWriter, feeds);
                    luaWriter.WriteEndAssignment();
                }
            }
        }