public Folder creatNewFolder(Folder afolder, string num, string name1, string name2, string prefixname, string postfixname) { string apath = afolder.getpath(); int length = afolder.getLength(); String[] newname; newname = new string[length]; if (num != "") { int anum = Convert.ToInt32(num); for (int i = 0; i < length; i++) { newname[i] = apath + "\\" + prefixname + name1 + anum.ToString() + postfixname + "." + name2; anum++; } } if (num == "") { for (int i = 0; i < length; i++) { newname[i] = apath + "\\" + prefixname + name1 + postfixname + "." + name2; } } Folder newfolder = new Folder(newname); return(newfolder); }
public Folder creatNewFolder(Folder afolder, string num, string name1, string name2,string prefixname,string postfixname) { string apath = afolder.getpath() ; int length = afolder.getLength(); String[] newname ; newname = new string[length]; if (num != "") { int anum = Convert.ToInt32(num); for (int i = 0; i < length; i++) { newname[i] = apath + "\\" + prefixname + name1 + anum.ToString() + postfixname + "." + name2; anum++; } } if (num == "") { for (int i = 0; i < length; i++) { newname[i] = apath + "\\" + prefixname + name1 + postfixname + "." + name2; } } Folder newfolder = new Folder(newname); return newfolder; }
private void buttonSave_Click(object sender, EventArgs e) { if (mainfunction.wheSave(folder1, folder2, numBox.Text, textBox1.Text, ExtensionBox.Text)) { mainfunction.reName(folder1, folder2); mainfunction.openFolder(folder1.getpath()); } }
public void TestFolder() { String[] s = {"C:\\test\\abc2.c","C:\\test\\abc3.c","C:\\test\\we2.png"}; var folder = new Folder(s); // Assert.AreEqual(); Assert.AreEqual(folder.getExpName(),"c"); Assert.AreEqual(folder.getFirstFileName(), "abc2"); Assert.AreEqual(folder.getLength(),3); Assert.AreEqual(folder.getName(), "C:\\test\\abc2.c"); Assert.AreEqual(folder.getpath(),"C:\\test"); }