Example #1
0
        /// <summary>
        ///   This starts the <see cref="BackgroundWorkerProgressDialog" /> to build the fomod.
        /// </summary>
        /// <remarks>
        ///   This method is called by implementers of this abstract class to instantiate the
        ///   <see cref="BackgroundWorkerProgressDialog" /> that will be used to generate the fomod. The
        ///   <see cref="BackgroundWorkerProgressDialog" /> calls <see cref="DoGenerateFomod(object)" />,
        ///   which must be overridden in the implementer, to actually do the work.
        /// </remarks>
        /// <param name="p_gfaArgs">
        ///   The arguments to pass the the <see cref="DoGenerateFomod(object)" />
        ///   method.
        /// </param>
        /// <returns>The atual path of the generated fomod.</returns>
        protected string GenerateFomod(GenerateFomodArgs p_gfaArgs)
        {
            var strPackedPath = p_gfaArgs.PackedPath;

            if (!CheckFileName(ref strPackedPath))
            {
                return(null);
            }
            p_gfaArgs.PackedPath = strPackedPath;

            try
            {
                using (ProgressDialog = new BackgroundWorkerProgressDialog(DoGenerateFomod))
                {
                    ProgressDialog.OverallMessage      = OverallProgressMessage;
                    ProgressDialog.ShowItemProgress    = true;
                    ProgressDialog.OverallProgressStep = 1;
                    ProgressDialog.WorkMethodArguments = p_gfaArgs;
                    if (ProgressDialog.ShowDialog() == DialogResult.Cancel)
                    {
                        FileUtil.ForceDelete(strPackedPath);
                        return(null);
                    }
                }
            }
            finally
            {
                foreach (var strFolder in m_lltTempFolders)
                {
                    FileUtil.ForceDelete(strFolder);
                }
            }
            return(strPackedPath);
        }
Example #2
0
    /// <summary>
    ///   This starts the <see cref="BackgroundWorkerProgressDialog" /> to build the fomod.
    /// </summary>
    /// <remarks>
    ///   This method is called by implementers of this abstract class to instantiate the
    ///   <see cref="BackgroundWorkerProgressDialog" /> that will be used to generate the fomod. The
    ///   <see cref="BackgroundWorkerProgressDialog" /> calls <see cref="DoGenerateFomod(object)" />,
    ///   which must be overridden in the implementer, to actually do the work.
    /// </remarks>
    /// <param name="p_gfaArgs">
    ///   The arguments to pass the the <see cref="DoGenerateFomod(object)" />
    ///   method.
    /// </param>
    /// <returns>The atual path of the generated fomod.</returns>
    protected string GenerateFomod(GenerateFomodArgs p_gfaArgs)
    {
      var strPackedPath = p_gfaArgs.PackedPath;
      if (!CheckFileName(ref strPackedPath))
      {
        return null;
      }
      p_gfaArgs.PackedPath = strPackedPath;

      try
      {
        using (ProgressDialog = new BackgroundWorkerProgressDialog(DoGenerateFomod))
        {
          ProgressDialog.OverallMessage = OverallProgressMessage;
          ProgressDialog.ShowItemProgress = true;
          ProgressDialog.OverallProgressStep = 1;
          ProgressDialog.WorkMethodArguments = p_gfaArgs;
          if (ProgressDialog.ShowDialog() == DialogResult.Cancel)
          {
            FileUtil.ForceDelete(strPackedPath);
            return null;
          }
        }
      }
      finally
      {
        foreach (var strFolder in m_lltTempFolders)
        {
          FileUtil.ForceDelete(strFolder);
        }
      }
      return strPackedPath;
    }