public static void RenameFile(FixFile myFile) { if (myFile.NewTN == "") { myFile.NewTN = myFile.TN; } System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string auditPath = config.AppSettings.Settings["AuditPath"].Value; string oldFileName; string newFileName; foreach (var FileName in myFile.MyFiles) { oldFileName = myFile.TN + "_" + FileName.OldName + myFile.Extension; newFileName = myFile.NewTN + "_" + FileName.NewName + myFile.Extension; try { File.Delete(myFile.NewPath + "\\" + newFileName); } catch { } File.Copy(myFile.OldPath + "\\" + oldFileName, myFile.NewPath + "\\" + newFileName); File.Delete(myFile.OldPath + "\\" + oldFileName); } }
public void ResetNew(FixFile myFile) { for (int i = 0; i < myFile.MyFiles.Count; i++) { myFile.MyFiles[i].NewName = myFile.MyFiles[i].OldName; } }
private void LoadFiles(string oldPath, string newPath) { FixItObj = new FixFile(Directory.GetFiles(oldPath), oldPath, newPath); ExtensionBox.Text = FixItObj.Extension; PrefixBox.Text = FixItObj.TN; CreateTable(FixItObj); }
private void CreateTable(FixFile FixItObj) { OldNameListTable.ItemsSource = FixItObj.MyFiles; NewNameListTable.ItemsSource = FixItObj.MyFiles; }