Пример #1
0
 public AssemblyInfoReader(string filename)
 {
     using (TextReader reader = new StreamReader(filename))
     {
         AssemblyInfoVersionPatternProvider patternProvider = new AssemblyInfoVersionPatternProvider(Path.GetExtension(filename));
         Versions = Read(reader, patternProvider);
     }
 }
Пример #2
0
 private Dictionary<VersionType, VersionBase> Read(TextReader reader, AssemblyInfoVersionPatternProvider patternProvider)
 {
     Dictionary<VersionType, VersionBase> versions = new Dictionary<VersionType, VersionBase>();
     // read file content
     string content = reader.ReadToEnd();
     // search and extract versions using regular expression
     foreach (VersionType vt in Enum.GetValues(typeof(VersionType)))
     {
         string searchPattern = patternProvider.Pattern(vt, "Version");
         Regex regex = new Regex(searchPattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
         Match match = regex.Match(content);
         if (match.Success)
         {
             string version = match.Groups["Version"].Value;
             versions.Add(vt, VersionBase.Create(version, vt));
         }
     }
     return versions;
 }
Пример #3
0
 public AssemblyInfoReader(TextReader textReader, AssemblyInfoVersionPatternProvider patternProvider)
 {
     Versions = Read(textReader, patternProvider);
 }