public static void decomp_NotifyCopyFile(object sender, NotifyEventArgs e) { string response = "Y"; #if DO_OUTPUT Console.Write("Copy File\n" + " File name in cabinet = {0}\n" + " Uncompressed file size = {1}\n" + " Copy this file? (y/n): ", e.args.str1, e.args.Size); do { response = Console.ReadLine().ToUpper(); } while (response != "Y" && response != "N"); #endif if (response == "Y") { int err = 0; string destFilename = destinationDirectory + e.args.str1; #if DO_OUTPUT Console.WriteLine(destFilename); #endif IntPtr fHandle = CabIO.FileOpen(destFilename, FileAccess.Write, FileShare.ReadWrite, FileMode.Create, ref err); e.Result = (int)fHandle; } else { e.Result = 0; } }
public static void decomp_NotifyCloseFile(object sender, NotifyEventArgs e) { #if DO_OUTPUT Console.WriteLine("Close File Info\n" + " File name in cabinet = {0}", e.args.str1); #endif string fname = destinationDirectory + e.args.str1; // TODO: Most of this function probably should be encapsulated in the parent object. int err = 0; CabIO.FileClose(e.args.FileHandle, ref err, null); // set file date and time DateTime fileDateTime = FCntl.DateTimeFromDosDateTime(e.args.FileDate, e.args.FileTime); File.SetCreationTime(fname, fileDateTime); File.SetLastWriteTime(fname, fileDateTime); // get relevant file attributes and set attributes on the file FileAttributes fa = FCntl.FileAttributesFromFAttrs(e.args.FileAttributes); File.SetAttributes(fname, fa); e.Result = 1; }