Exemplo n.º 1
0
        public void Run(IIntegrationResult result)
        {
            foreach (FilePair Pair in this.FilePairs)
            {
                string XmlFilePath = Pair.XmlFile;
                if (!Path.IsPathRooted(XmlFilePath))
                {
                    XmlFilePath = Path.Combine(result.WorkingDirectory, XmlFilePath);
                }

                string XslFilePath = Pair.XslFile;
                if (!Path.IsPathRooted(XslFilePath))
                {
                    XslFilePath = Path.Combine(result.WorkingDirectory, XslFilePath);
                }

                string XslFileName = Path.GetFileName(XslFilePath);
                if (!File.Exists(XslFilePath))
                {
                    Log.Warning("File not Found: " + XslFileName);
                }

                WildCardPath Pattern = new WildCardPath(XmlFilePath);
                FileInfo[]   Files   = Pattern.GetFiles();
                foreach (FileInfo XmlFileInfo in Files)
                {
                    Log.Info(String.Format("Merging file {0} through {1}", XmlFileInfo, XslFileName));
                    if (XmlFileInfo.Exists)
                    {
                        string Data;
                        String Contents;
                        using (TextReader Reader = XmlFileInfo.OpenText())
                        {
                            Contents = Reader.ReadToEnd();
                        }
                        XslTransformer Transformer = new XslTransformer();

                        Dictionary <string, string> XslParms = new Dictionary <string, string>();
                        XslParms.Add("CCNetServer", this.DashboardServerName);
                        XslParms.Add("CCNetBuild", new LogFile(result).Filename);
                        XslParms.Add("CCNetProject", result.ProjectName);
                        XslParms.Add("XmlSourceName", Path.GetFileName(XmlFilePath));
                        XslParms.Add("XmlSourcePath", XmlFileInfo.FullName);

                        Data = Transformer.Transform(Contents, XslFilePath, XslParms);
                        result.AddTaskResult((new XslMergerTaskResult(Data)));
                    }
                    else
                    {
                        Log.Warning("File not Found: " + XmlFileInfo);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Run(IIntegrationResult result)
        {
            foreach (FilePair Pair in this.FilePairs)
            {
                string XmlFilePath = Pair.XmlFile;
                if (!Path.IsPathRooted(XmlFilePath))
                {
                    XmlFilePath = Path.Combine(result.WorkingDirectory, XmlFilePath);
                }

                string XslFilePath = Pair.XslFile;
                if (!Path.IsPathRooted(XslFilePath))
                {
                    XslFilePath = Path.Combine(result.WorkingDirectory, XslFilePath);
                }

                string XslFileName = Path.GetFileName(XslFilePath);
                if (!File.Exists(XslFilePath))
                {
                    Log.Warning("File not Found: " + XslFileName);
                }

                WildCardPath Pattern = new WildCardPath(XmlFilePath);
                FileInfo[]   Files   = Pattern.GetFiles();
                foreach (FileInfo XmlFileInfo in Files)
                {
                    Log.Info(String.Format("Merging file {0} through {1}", XmlFileInfo, XslFileName));
                    if (XmlFileInfo.Exists)
                    {
                        string Data;
                        String Contents;
                        using (TextReader Reader = XmlFileInfo.OpenText())
                        {
                            Contents = Reader.ReadToEnd();
                        }
                        XslTransformer Transformer = new XslTransformer();
                        Data = Transformer.Transform(Contents, XslFilePath);
                        result.AddTaskResult((new XslMergerTaskResult(Data)));
                    }
                    else
                    {
                        Log.Warning("File not Found: " + XmlFileInfo);
                    }
                }
            }
        }