Get the version information of the file:
FileversionInfo myfileversioninfo1 =
FileVersionInfo.getversionInfo ("D: //test.dll");
TEXTBOX1.TEXT = "version number:" myfileversioninfo1.
FileVersion;
Change the file properties, delete read-only files: The following will copy the E: /TEST.TXT file to D: /TMP/Test.txt, but d: /tmp/test.txt already exists. //File.copy ;True; use to copy files // When DestinationFile already exists, you cannot copy file file1 to the target file, so remove the Destination file first, file.delete () method cannot be deleted Read-only file, // therefore, if the file attribute is read-only ("readonly" in the Attributes property), then reset the file attribute to Normal, then delete: string file1 = "E: // Test .txt "; String destinationFile =" d: //tmp/test.txt "; if (fileinfo fi = new fileinfo (decimutes.tostring) {fileInfo fi = new fileinfo (decibutes.tostring (). Indexof ("Readonly")! = - 1) fi.attributes = fileAttributes.Normal (String FilePath) Decision Directory exists: Directory.exists ("D: // LastestVersion")
Read the file by line: int filecount = 0; // Open the file Just specified Such this no one else can use it it. Streamreader sr = new streamreader (TextBox1.Text.trim ()); while (sr.peek ()> -1) // streamreader.peek () Returns the next available character, but does not use it {listbox1.items.add (sr.readline ()); FileCount ;} sr.close ();
Write file by line: streamwriter sw = new streamwriter ("d: //Result.txt"); for (int i = 0; i <10; i ) {sw.writeline ("this is the first i.tostring () "Row data");