public new string BackUp(string str, bool isDelete = false) { string sourcePath = str; string backupPath = String.Empty; if (CanEdit(str)) { if (str.Contains(MenusLib.BackUpName)) { backupPath = DelBackupName(str); } else { backupPath = AddBackupName(str);; } if (isDelete) { RegHelper.BackUpByBranch(sourcePath, backupPath, true); } else { RegHelper.BackUpByBranch(sourcePath, backupPath); } } return(backupPath); }
public new string CopyBranch(string sourceBranch) { string shellPath = @"HKEY_CLASSES_ROOT\txtfile\shell"; string shellExPath = @"HKEY_CLASSES_ROOT\txtfile\shellex\ContextMenuHandlers"; string[] strArr = sourceBranch.Split('\\'); StringBuilder sb = new StringBuilder(); string result = string.Empty; for (int i = 0; i < strArr.Length; i++) { if (strArr[i].ToLower() == "shell".ToLower()) { for (int j = i + 1; j < strArr.Length; j++) { sb.Append("\\" + strArr[j]); } result = shellPath + sb.ToString(); } } for (int i = 0; i < strArr.Length; i++) { if (strArr[i].ToLower() == "ContextMenuHandlers".ToLower()) { for (int j = i + 1; j < strArr.Length; j++) { sb.Append("\\" + strArr[j]); } } result = shellExPath + sb.ToString(); } if (!string.IsNullOrEmpty(result)) { RegHelper.BackUpByBranch(sourceBranch, result); } return(result); }