Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the NextCabinetEventArgs class
 /// </summary>
 /// <param name="c">The FciCurrentCab class instance for this event.</param>
 /// <param name="cb">Size of the previous cabinet.</param>
 /// <param name="uData">User data.</param>
 /// <remarks></remarks>
 public NextCabinetEventArgs(FciCurrentCab c, int cb, object uData)
 {
     Trace.WriteLine("NextCabinetEventArgs constructor");
     ccab      = c;
     cbPrevCab = cb;
     userData  = uData;
     result    = true;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the FilePlacedEventArgs class
 /// </summary>
 /// <param name="c">Cabinet file parameters of type FciCurrentCab.</param>
 /// <param name="fname">Name of the file being placed.</param>
 /// <param name="cb">Size of the file.</param>
 /// <param name="fCont">A value indicating whether this is a continuation.</param>
 /// <param name="udata">User data object.</param>
 /// <remarks></remarks>
 public FilePlacedEventArgs(FciCurrentCab c, string fname, Int32 cb,
                            bool fCont, object udata)
 {
     ccab          = c;
     fileName      = fname;
     cbFile        = cb;
     fContinuation = fCont;
     userData      = udata;
 }
Exemple #3
0
        /// <summary>
        /// Receives notification when a file is placed on the cabinet.
        /// </summary>
        /// <param name="ccab">Current cab file parameters.</param>
        /// <param name="fileName">Name of the file that was placed.</param>
        /// <param name="cbFile">Size of the placed file.</param>
        /// <param name="fContinuation">A flag that indicates whether this file is a continuation from another folder or cabinet.</param>
        /// <param name="pUserData">User data object.</param>
        /// <returns>Returns 0 on success.  Returns -1 on failure.</returns>
        /// <remarks>The File Compression Interface calls this function when a file has been placed in a cabinet.
        /// This is purely a notification message.  Clients that want to be notified of this event must handle the
        /// FilePlaced event raised by this function.</remarks>
        protected virtual int FilePlacedCallback(
            FciCurrentCab ccab,
            string fileName,
            Int32 cbFile,
            bool fContinuation,
            IntPtr pUserData)
        {
            Trace.WriteLine("FilePlacedCallback");
            Trace.WriteLine(string.Format("UserDataPointer = {0}", pUserData));
            Trace.Flush();
            FilePlacedEventArgs e = new FilePlacedEventArgs(ccab, fileName, cbFile, fContinuation,
                                                            GetUserDataObject(pUserData));

            try
            {
                OnFilePlaced(e);
            }
            catch (Exception)
            {
                e.Result = -1;
            }
            return(e.Result);
        }
Exemple #4
0
        /// <summary>
        /// Gets the name of the next cabinet file.
        /// </summary>
        /// <param name="ccab">Current cabinet information.</param>
        /// <param name="cbPrevCab">Number of the previous cabinet file.</param>
        /// <param name="pUserData">User data object.</param>
        /// <returns>Returns True on success, and the name of the new cabinet file is stored in ccab.CabName.
        /// Returns False on error.</returns>
        /// <remarks>The File Compression Interface (FCI) calls this function to get the name of the next cabinet file.
        /// Clients must respond to the NextCabinet event raised by this function and supply the next cabinet file name.</remarks>
        protected virtual bool GetNextCabinet(
            FciCurrentCab ccab,
            int cbPrevCab,
            IntPtr pUserData)
        {
            Trace.WriteLine("GetNextCabinet");
            Trace.WriteLine(string.Format("UserDataPointer = {0}", pUserData));
            Trace.Flush();
            Trace.WriteLine(string.Format("UserData = {0}", GetUserDataObject(pUserData)));
            Trace.Flush();
            NextCabinetEventArgs e = new NextCabinetEventArgs(ccab, cbPrevCab, GetUserDataObject(pUserData));

            Trace.WriteLine("Created event args");
            try
            {
                OnNextCabinet(e);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                e.Result = false;
            }
            return(e.Result);
        }