Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            TimeLineDataJsCode timeLineDataJsCode = new TimeLineDataJsCode();

            //读取已有的js文件
            timeLineDataJsCode.ReadFromJsFile(_source_Timeline_Js_Path);

            //在js代码中查找intro中含有“草长莺飞”字符串的data.push语句,并逐条删除
            List <TimeLineData> dataList = timeLineDataJsCode.Find("草长莺飞");

            foreach (TimeLineData data in dataList)
            {
                timeLineDataJsCode.Remove(data);
            }

            //创建一个新的data.push语句
            TimeLineData tlData = new TimeLineData();

            tlData.AddOrUpdate("date", "2017-07=20");
            tlData.AddOrUpdate("intro", "创建一个新的date.push");
            tlData.AddOrUpdate("media", "<img src=\"images / psb.jpeg\" width=\"370\" >");
            tlData.AddOrUpdate("like", "0");
            tlData.AddOrUpdate("comment", "0");
            timeLineDataJsCode.Add(tlData);

            //保存成新的js文件
            timeLineDataJsCode.WriteToJsFile(_target_Timeline_Js_Path);
        }
Exemple #2
0
        private void SaveToJsFile(string jsFileName, string jsonText)
        {
            TimeLineDataJsCode timeLineDataJsCode = new TimeLineDataJsCode();
            TimeLineData       data  = new TimeLineData();
            string             jText = data.GetDataCodeString(jsonText);

            jText = timeLineDataJsCode.WrapJsHead(jText);
            timeLineDataJsCode.WriteToJsFile(jsFileName, jText);
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            TimeLineDataJsCode TimeLineDataJsCode = new TimeLineDataJsCode();

            //读取已有的js文件
            TimeLineDataJsCode.ReadFromJsFile(@"H:\VSProjects\TimeLineDataEditor\data.js");
            List <TimeLineData> dataList = TimeLineDataJsCode.Find("草长莺飞");

            foreach (TimeLineData data in dataList)
            {
                TimeLineDataJsCode.Remove(data);
            }
            TimeLineDataJsCode.WriteToJsFile(@"H:\AA.JS");
        }