Reversible

static void SaveMSIToTxt(string fileNameSoucre, string fileNameDest)
{
byte[] bytes = System.IO.File.ReadAllBytes(fileNameSoucre);
string str = Convert.ToBase64String(bytes);
System.IO.File.WriteAllText(fileNameDest, str);
}

static void ExtractMSIFromTxt(string txtFileName, string msiFileName)
{
string str = System.IO.File.ReadAllText(txtFileName);
byte[] bytes = Convert.FromBase64String(str);
FileStream fs
= new FileStream(msiFileName, FileMode.Create);
BinaryWriter bw
= new BinaryWriter(fs);
bw.Write(bytes);
bw.Close();
fs.Close();
}
posted @ 2011-07-01 09:53  cnbwang  阅读(199)  评论(3编辑  收藏  举报