Пример #1
0
        public void Generate(List <Article> articles)
        {
            StringBuilder sb        = new StringBuilder();
            var           samplexml = OpFile.GetFileToXml(articles[0].XmlSampleFileName);

            if (samplexml != null)
            {
                //var node = samplexml.SelectSingleNode("PartnerConfig/FeedConfig/Feed[@href='default']/ContentConfig[@type='article']/UniqueContentId/DefaultPrefix");
                var feedRootNode    = samplexml.SelectSingleNode("PartnerConfig/FeedConfig");
                var bedrockRootNode = samplexml.SelectSingleNode("PartnerConfig/BedrockConfig");
                //var feedNode = articles[0].ConfigMetaData.SelectSingleNode("root/ContentType[@FeedType='" + articles[0].FeedType + "']/Feed");
                foreach (Article article in articles)
                {
                    //var guidNode = itemNode.SelectSingleNode("//DefaultPrefix");
                    //guidNode.InnerText= article.Market + "." + article.App + "." + article.Provider;
                    //samplexml.ImportNode(
                    var feedNode = GenerateFeed(article);
                    feedNode = samplexml.ImportNode(feedNode, true);
                    feedRootNode.AppendChild(feedNode);

                    var articleNode = this.GenerateArticleFeed(article);
                    articleNode = samplexml.ImportNode(articleNode, true);
                    bedrockRootNode.AppendChild(articleNode);
                }
                samplexml.Save(articles[0].XmlOutputFileName);
            }
            else
            {
                MessageBox.Show("Can not loading the xaml file.");
            }
        }
Пример #2
0
        public void Generate(List <Article> articles)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Article article in articles)
            {
                sb.AppendLine(article.FeedUrl);
            }

            OpFile.WriteStringToFile(articles[0].Folder, articles[0].TsvOutputFileName, sb.ToString());
        }
Пример #3
0
        public void Generate(Article article)
        {
            FileInfo fi = new FileInfo(article.XamlSampleFileName);

            if (fi.Extension == ".xaml")
            {
                if (!string.IsNullOrEmpty(OpFile.GetFileToString(fi)))
                {
                    var str = OpFile.GetFileToString(fi);
                    str = str.Replace("{0}", article.Provider + article.App + "Generic");
                    OpFile.WriteStringToFile(article.Folder, article.XamlOutputFileName, str);
                }
                else
                {
                    MessageBox.Show("Can not loading the xaml file.");
                }
            }
        }
Пример #4
0
        public void Generate(Article article)
        {
            FileInfo      fi = new FileInfo(article.IniSampleFileName);
            StringBuilder sb = new StringBuilder();

            if (fi.Extension == ".ini")
            {
                if (!string.IsNullOrEmpty(OpFile.GetFileToString(fi)))
                {
                    sb.Append(OpFile.GetFileToString(fi));
                    //sb.AppendFormat(OpFile.GetFileToString(fi), articles[0].Provider + articles[0].App, articles[0].App);
                    sb = sb.Replace("{TsvFile}", article.Provider + article.App + "Generic.tsv");
                    sb = sb.Replace("{ConfigFile}", article.Provider + article.App + "GenericConfig.xml");
                    sb = sb.Replace("{Environment}", article.Provider + article.App);
                    sb = sb.Replace("{App}", article.App);
                    OpFile.WriteStringToFile(article.Folder, article.IniOutputFileName, sb.ToString());
                }
                else
                {
                    MessageBox.Show("Can not loading the xaml file.");
                }
            }
        }