public static bool Restore(string p_strCategoryPath)
{
string strSuffix = "." + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bad";
if (File.Exists(p_strCategoryPath))
FileUtil.Move(p_strCategoryPath, p_strCategoryPath + strSuffix, true);
string strBackupCategoryPath = p_strCategoryPath + ".bak";
if (IsValid(strBackupCategoryPath))
{
File.Copy(strBackupCategoryPath, p_strCategoryPath, true);
return true;
}
if (File.Exists(strBackupCategoryPath))
FileUtil.Move(strBackupCategoryPath, strBackupCategoryPath + strSuffix, true);
for (Int32 i = 1; i < 6; i++)
{
if (IsValid(strBackupCategoryPath + i))
{
FileUtil.Move(strBackupCategoryPath + i, p_strCategoryPath, true);
return true;
}
if (File.Exists(strBackupCategoryPath + i))
FileUtil.Move(strBackupCategoryPath + i, strBackupCategoryPath + i + strSuffix, true);
}
return false;
}