This commit is contained in:
43
PROMS/AdjustBuildRevision/Program.cs
Normal file
43
PROMS/AdjustBuildRevision/Program.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AdjustBuildRevision
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// args[0] - FileName
|
||||
FileInfo fi = new FileInfo(args[0]);
|
||||
if (fi.Exists)
|
||||
{
|
||||
StreamReader sr = fi.OpenText();
|
||||
string content = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
StreamWriter sw = fi.CreateText();
|
||||
string[] seps = { "\r\n" };
|
||||
string[] lines = content.Split(seps, StringSplitOptions.None);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string outline = line;
|
||||
if (line.Contains("AssemblyVersion") || line.Contains("AssemblyFileVersion"))
|
||||
{
|
||||
Console.WriteLine("Before: '{0}'", line);
|
||||
outline = Regex.Replace(line,@"([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("yyMM.dHH")+"\")");
|
||||
Console.WriteLine("After: '{0}'", outline);
|
||||
}
|
||||
sw.WriteLine(outline);
|
||||
}
|
||||
sw.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("File " + fi.FullName + " does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user