Esempio n. 1
0
        public static string CreateSettingsFile(NCoverInfo ncoverInfo)
        {
            string tempFileName = FileUtilities.GetTempFileName(".settings");

            BuildTempSettingsXmlFile(ncoverInfo, tempFileName);
            return(tempFileName);
        }
Esempio n. 2
0
 private void CreateNCoverInfo()
 {
     string[] fileNames = this._ConvertStringCollectionToArray(this._assemblyFiles.FileNames);
     this._ncoverInfo = new NCoverInfo();
     this._ncoverInfo.SetNCoverPathAndVersion(this.ExeName, true);
     this._ncoverInfo.AssemblyList            = this._AppendAssemblyNames(this._assemblyList, fileNames);
     this._ncoverInfo.CoverageFile            = this._coverageFile;
     this._ncoverInfo.LogLevel                = this._logLevel;
     this._ncoverInfo.LogFile                 = this._logFile;
     this._ncoverInfo.ExcludeAttributes       = this._excludeAttributes;
     this._ncoverInfo.ProfileIIS              = this._profileIIS;
     this._ncoverInfo.ProfileService          = this._profileService;
     this._ncoverInfo.RegisterCoverLib        = this._registerProfiler;
     this._ncoverInfo.ProfiledProcessModule   = this._profiledProcessModule;
     this._ncoverInfo.ProjectName             = this._projectName;
     this._ncoverInfo.CoverageHtmlPath        = this._coverageHtmlDirectory;
     this._ncoverInfo.ExcludeAutoGenCode      = this._excludeCompilerCode;
     this._ncoverInfo.CoverageType            = this._coverageType;
     this._ncoverInfo.SymbolSearchPolicy      = this._symbolSearchPolicy;
     this._ncoverInfo.AdditionalArgs          = this._additionalArgs;
     this._ncoverInfo.TypeExclusionPatterns   = this._typeExclusionPatterns;
     this._ncoverInfo.MethodExclusionPatterns = this._methodExclusionPatterns;
     this._ncoverInfo.FileExclusionPatterns   = this._fileExclusionPatterns;
     this._ncoverInfo.ServiceTimeout          = this._serviceTimeoutSeconds;
 }
 public static string GetSettingsFileContent(NCoverInfo ncoverInfo)
 {
     string path = CreateSettingsFile(ncoverInfo);
     string str2 = File.ReadAllText(path);
     File.Delete(path);
     return str2;
 }
Esempio n. 4
0
        public static string GetSettingsFileContent(NCoverInfo ncoverInfo)
        {
            string path = CreateSettingsFile(ncoverInfo);
            string str2 = File.ReadAllText(path);

            File.Delete(path);
            return(str2);
        }
Esempio n. 5
0
 private static void _BuildTempSettingsFileForNCover2xx(NCoverInfo ncoverInfo, string settingsFile)
 {
     using (Stream stream = File.Create(settingsFile))
     {
         XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8);
         xmlTextWriter.Indentation = 2;
         xmlTextWriter.Formatting  = Formatting.Indented;
         xmlTextWriter.WriteStartDocument();
         xmlTextWriter.WriteStartElement("ProfilerSettings");
         xmlTextWriter.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         xmlTextWriter.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
         xmlTextWriter.WriteElementString("CommandLineExe", ncoverInfo.AppToProfileExe);
         if (!string.IsNullOrEmpty(ncoverInfo.AppToProfileArgs))
         {
             xmlTextWriter.WriteElementString("CommandLineArgs", ncoverInfo.AppToProfileArgs);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.WorkingDirectory))
         {
             xmlTextWriter.WriteElementString("WorkingDirectory", ncoverInfo.WorkingDirectory);
         }
         _WriteAssemblyNodes(ncoverInfo.AssemblyList, xmlTextWriter);
         if (!string.IsNullOrEmpty(ncoverInfo.CoverageFile))
         {
             xmlTextWriter.WriteElementString("CoverageXml", ncoverInfo.CoverageFile);
             xmlTextWriter.WriteElementString("XmlFormat", NCoverXmlFormat.Xml2.ToString());
         }
         if (ncoverInfo.LogLevel != NCoverLogLevel.Quiet)
         {
             if (string.IsNullOrEmpty(ncoverInfo.LogFile))
             {
                 ncoverInfo.LogFile = "coverage.log";
             }
             xmlTextWriter.WriteElementString("NoLog", XmlConvert.ToString(false));
             xmlTextWriter.WriteElementString("LogFile", ncoverInfo.LogFile);
             bool flag = ncoverInfo.LogLevel == NCoverLogLevel.Verbose;
             xmlTextWriter.WriteElementString("VerboseLog", flag.ToString().ToLower());
         }
         xmlTextWriter.WriteElementString("ProfileIIS", XmlConvert.ToString(ncoverInfo.ProfileIIS));
         if (!string.IsNullOrEmpty(ncoverInfo.ProfileService))
         {
             xmlTextWriter.WriteElementString("ProfileService", ncoverInfo.ProfileService);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ProfiledProcessModule))
         {
             xmlTextWriter.WriteElementString("ProfileProcessModule", ncoverInfo.ProfiledProcessModule);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ExcludeAttributes))
         {
             foreach (string str in ncoverInfo.ExcludeAttributes.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("ExclusionAttributes", str);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.TypeExclusionPatterns))
         {
             foreach (string str2 in ncoverInfo.TypeExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("TypeExclusionPatterns", str2);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.MethodExclusionPatterns))
         {
             foreach (string str3 in ncoverInfo.MethodExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("MethodExclusionPatterns", str3);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.FileExclusionPatterns))
         {
             foreach (string str4 in ncoverInfo.FileExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("FileExclusionPatterns", str4);
             }
         }
         xmlTextWriter.WriteElementString("RegisterForUser", ncoverInfo.RegisterCoverLib ? "true" : "false");
         if (!string.IsNullOrEmpty(ncoverInfo.CoverageHtmlPath))
         {
             xmlTextWriter.WriteElementString("CoverageHtmlPath", ncoverInfo.CoverageHtmlPath);
         }
         if (!ncoverInfo.ExcludeAutoGenCode)
         {
             xmlTextWriter.WriteElementString("AutoExclude", "false");
         }
         if (ncoverInfo.CoverageType != (NCoverCoverageType.Branch | NCoverCoverageType.SequencePoint))
         {
             xmlTextWriter.WriteElementString("CoverageType", ncoverInfo.CoverageType.ToString());
         }
         if (ncoverInfo.SymbolSearchPolicy != 15)
         {
             xmlTextWriter.WriteElementString("SymbolSearchPolicy", ncoverInfo.SymbolSearchPolicy.ToString());
         }
         if (ncoverInfo.ServiceTimeout > 0)
         {
             xmlTextWriter.WriteElementString("ServiceTimeout", ncoverInfo.ServiceTimeout.ToString());
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ProjectName))
         {
             xmlTextWriter.WriteElementString("ProjectName", ncoverInfo.ProjectName);
         }
         xmlTextWriter.WriteEndElement();
         xmlTextWriter.WriteEndDocument();
         xmlTextWriter.Flush();
         stream.Close();
     }
 }
Esempio n. 6
0
 public static string BuildTempSettingsXmlFile(NCoverInfo ncoverInfo, string settingsFileName)
 {
     _BuildTempSettingsFileForNCover2xx(ncoverInfo, settingsFileName);
     return("//r");
 }
 private static void _BuildTempSettingsFileForNCover2xx(NCoverInfo ncoverInfo, string settingsFile)
 {
     using (Stream stream = File.Create(settingsFile))
     {
         XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8);
         xmlTextWriter.Indentation = 2;
         xmlTextWriter.Formatting = Formatting.Indented;
         xmlTextWriter.WriteStartDocument();
         xmlTextWriter.WriteStartElement("ProfilerSettings");
         xmlTextWriter.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         xmlTextWriter.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
         xmlTextWriter.WriteElementString("CommandLineExe", ncoverInfo.AppToProfileExe);
         if (!string.IsNullOrEmpty(ncoverInfo.AppToProfileArgs))
         {
             xmlTextWriter.WriteElementString("CommandLineArgs", ncoverInfo.AppToProfileArgs);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.WorkingDirectory))
         {
             xmlTextWriter.WriteElementString("WorkingDirectory", ncoverInfo.WorkingDirectory);
         }
         _WriteAssemblyNodes(ncoverInfo.AssemblyList, xmlTextWriter);
         if (!string.IsNullOrEmpty(ncoverInfo.CoverageFile))
         {
             xmlTextWriter.WriteElementString("CoverageXml", ncoverInfo.CoverageFile);
             xmlTextWriter.WriteElementString("XmlFormat", NCoverXmlFormat.Xml2.ToString());
         }
         if (ncoverInfo.LogLevel != NCoverLogLevel.Quiet)
         {
             if (string.IsNullOrEmpty(ncoverInfo.LogFile))
             {
                 ncoverInfo.LogFile = "coverage.log";
             }
             xmlTextWriter.WriteElementString("NoLog", XmlConvert.ToString(false));
             xmlTextWriter.WriteElementString("LogFile", ncoverInfo.LogFile);
             bool flag = ncoverInfo.LogLevel == NCoverLogLevel.Verbose;
             xmlTextWriter.WriteElementString("VerboseLog", flag.ToString().ToLower());
         }
         xmlTextWriter.WriteElementString("ProfileIIS", XmlConvert.ToString(ncoverInfo.ProfileIIS));
         if (!string.IsNullOrEmpty(ncoverInfo.ProfileService))
         {
             xmlTextWriter.WriteElementString("ProfileService", ncoverInfo.ProfileService);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ProfiledProcessModule))
         {
             xmlTextWriter.WriteElementString("ProfileProcessModule", ncoverInfo.ProfiledProcessModule);
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ExcludeAttributes))
         {
             foreach (string str in ncoverInfo.ExcludeAttributes.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("ExclusionAttributes", str);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.TypeExclusionPatterns))
         {
             foreach (string str2 in ncoverInfo.TypeExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("TypeExclusionPatterns", str2);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.MethodExclusionPatterns))
         {
             foreach (string str3 in ncoverInfo.MethodExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("MethodExclusionPatterns", str3);
             }
         }
         if (!string.IsNullOrEmpty(ncoverInfo.FileExclusionPatterns))
         {
             foreach (string str4 in ncoverInfo.FileExclusionPatterns.Split(new char[] { ';' }))
             {
                 xmlTextWriter.WriteElementString("FileExclusionPatterns", str4);
             }
         }
         xmlTextWriter.WriteElementString("RegisterForUser", ncoverInfo.RegisterCoverLib ? "true" : "false");
         if (!string.IsNullOrEmpty(ncoverInfo.CoverageHtmlPath))
         {
             xmlTextWriter.WriteElementString("CoverageHtmlPath", ncoverInfo.CoverageHtmlPath);
         }
         if (!ncoverInfo.ExcludeAutoGenCode)
         {
             xmlTextWriter.WriteElementString("AutoExclude", "false");
         }
         if (ncoverInfo.CoverageType != (NCoverCoverageType.Branch | NCoverCoverageType.SequencePoint))
         {
             xmlTextWriter.WriteElementString("CoverageType", ncoverInfo.CoverageType.ToString());
         }
         if (ncoverInfo.SymbolSearchPolicy != 15)
         {
             xmlTextWriter.WriteElementString("SymbolSearchPolicy", ncoverInfo.SymbolSearchPolicy.ToString());
         }
         if (ncoverInfo.ServiceTimeout > 0)
         {
             xmlTextWriter.WriteElementString("ServiceTimeout", ncoverInfo.ServiceTimeout.ToString());
         }
         if (!string.IsNullOrEmpty(ncoverInfo.ProjectName))
         {
             xmlTextWriter.WriteElementString("ProjectName", ncoverInfo.ProjectName);
         }
         xmlTextWriter.WriteEndElement();
         xmlTextWriter.WriteEndDocument();
         xmlTextWriter.Flush();
         stream.Close();
     }
 }
 public static string CreateSettingsFile(NCoverInfo ncoverInfo)
 {
     string tempFileName = FileUtilities.GetTempFileName(".settings");
     BuildTempSettingsXmlFile(ncoverInfo, tempFileName);
     return tempFileName;
 }
 public static string BuildTempSettingsXmlFile(NCoverInfo ncoverInfo, string settingsFileName)
 {
     _BuildTempSettingsFileForNCover2xx(ncoverInfo, settingsFileName);
     return "//r";
 }
Esempio n. 10
0
 private void _CreateNCoverInfo()
 {
     string[] fileNames = this._ConvertStringCollectionToArray(this._assemblyFiles.FileNames);
     this._ncoverInfo = new NCoverInfo();
     this._ncoverInfo.SetNCoverPathAndVersion(this.ExeName, true);
     this._ncoverInfo.AppToProfileExe = this._commandLineExe;
     this._ncoverInfo.AppToProfileArgs = this._commandLineArgs;
     this._ncoverInfo.WorkingDirectory = this._workingDirectory;
     this._ncoverInfo.AssemblyList = this._AppendAssemblyNames(this._assemblyList, fileNames);
     this._ncoverInfo.CoverageFile = this._coverageFile;
     this._ncoverInfo.LogLevel = this._logLevel;
     this._ncoverInfo.LogFile = this._logFile;
     this._ncoverInfo.ExcludeAttributes = this._excludeAttributes;
     this._ncoverInfo.ProfileIIS = this._profileIIS;
     this._ncoverInfo.ProfileService = this._profileService;
     this._ncoverInfo.RegisterCoverLib = this._registerProfiler;
     this._ncoverInfo.ProfiledProcessModule = this._profiledProcessModule;
     this._ncoverInfo.ProjectName = this._projectName;
     this._ncoverInfo.CoverageHtmlPath = this._coverageHtmlDirectory;
     this._ncoverInfo.ExcludeAutoGenCode = this._excludeCompilerCode;
     this._ncoverInfo.CoverageType = this._coverageType;
     this._ncoverInfo.SymbolSearchPolicy = this._symbolSearchPolicy;
     this._ncoverInfo.AdditionalArgs = this._additionalArgs;
     this._ncoverInfo.TypeExclusionPatterns = this._typeExclusionPatterns;
     this._ncoverInfo.MethodExclusionPatterns = this._methodExclusionPatterns;
     this._ncoverInfo.FileExclusionPatterns = this._fileExclusionPatterns;
     this._ncoverInfo.ServiceTimeout = this._serviceTimeoutSeconds;
 }