文文小星的blog
asp.net技术,C#,atlas

string path=@"\Setup\Installer";
var files = Directory.GetFiles(path);
foreach (var item in files)
{

string content = File.ReadAllText(item);

Regex r = new Regex("Guid=\"(\\S*)\"");
MatchCollection maches = r.Matches(content);
for (int i = maches.Count-1; i >=0; i--)
{
Match match = maches[i];
content = content.Remove(match.Index, match.Length).Insert(match.Index, "Guid=\""+Guid.NewGuid().ToString().ToUpper()+"\"");
}


Console.WriteLine(content);
File.WriteAllText(item, content);

}

posted on 2014-04-22 15:57  冯文元  阅读(207)  评论(0编辑  收藏  举报