Exemple #1
0
        /// <summary>
        /// Copies the manifest.xml to the destination directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void decomp_NotifyCopyFile(object sender, CAB.NotifyEventArgs e)
        {
            if(string.Compare(Constants.manifestFileName,e.args.str1,true).Equals(0))
            {
                int err = 0;

                string destFilename = destinationDirectory + e.args.str1;
                IntPtr fHandle = CAB.CabIO.FileOpen(destFilename, FileAccess.Write,
                    FileShare.ReadWrite, FileMode.Create, ref err);
                e.Result = (int)fHandle;
                _manifestFound = true;

            }
            else
            {
                e.Result = 0;
            }
        }
Exemple #2
0
        /// <summary>
        /// Closes the Manifest.xml file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void decomp_NotifyCloseFile(object sender, CAB.NotifyEventArgs e)
        {
            string fname = destinationDirectory + e.args.str1;

            // TODO:  Most of this function probably should be encapsulated in the parent object.
            int err = 0;
            CAB.CabIO.FileClose(e.args.FileHandle, ref err, null);

            try
            {
                // set file date and time
                DateTime fileDateTime = CAB.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 = CAB.FCntl.FileAttributesFromFAttrs(e.args.FileAttributes);
                File.SetAttributes(fname, fa);
            }
            catch (ArgumentOutOfRangeException)
            {

            }
            e.Result = 1;
        }