<summary> Directory Action Class </summary> public class Directoryhelper { Public Directoryhelper () { } <summary> Get all disk drives </summary> <returns></returns> Public string[] Alldrivers () { return directory.getlogicaldrives (); } ///<summary> / The current working directory of the application, Bin folder ///</summary> ///<returns></returns> Public String CurrentDirectory () { return directory.getcurrentdirectory (); } ///<summary> / Get the files in the path directory, excluding folders ///</summary> ///<param name= "path" ></PARAM> ///<returns></returns> public string[] Allfiles ( String path) { return Directory.GetFiles (path); } <summary> Create a directory if the directory exists, then the directory is not created </summary> <param name= "Directory" ></param> public void CreateDirectory (string directory) { DirectoryInfo info = new DirectoryInfo (directory); Info. Create (); DirectoryInfo info = directory.createdirectory (Directory); } <summary> Delete Directory </summary> <param name= "Path" ></param> public void DeleteDirectory (string path) { Directory.delete (path, false/* delete subdirectory */); The error occurs if the subdirectory is non-null. Directory.delete (path, true/* keep subdirectory */); Ignore subdirectory contents, no content deleted } ///<summary> / Directory of all files, hidden files are also visible, peeping? ///</summary> ///<param name= "path" ></PARAM> ///<returns ></returns> Public string[] allcontent (string path) { return directory.getfilesystementries (path);//Error } If path does not exist <summary> Copy file directory, copy complete original directory deletion </summary> <param name= "path1" ></param> <param name= "path2" ></param> public void CopyDirectory (string sourcepath/* must exist before replication is completed, */,string targetpath/* cannot exist before replication) { Directory.move (Sourcepath,targetpath); } <summary> Code, to tell the truth I did not use, do not know why. </summary> <returns></returns> public string codeing () { Encoding code = Encoding.default; byte[] bytes = code. GetBytes ("People's Republic of China"); byte[] bytes = code. GetBytes ("I ' m a smart boy"); Return encoding.getencoding ("UTF-8"). GetString (bytes); Does DOC environment not support Chinese? Chinese can not turn back normally, English is OK. } } |