Example #1
0
        /// <summary>
        /// Backs up file.
        /// </summary>
        /// <param name="dest">The dest.</param>
        /// <param name="installType">Type of the install.</param>
        /// <returns></returns>
        public UnInstallItem BackUpFile(string dest, string installType)
        {
            UnInstallItem unInstallItem = new UnInstallItem();

            if (File.Exists(dest) && !BackUpExist(dest))
            {
                if (MpeInstaller.TransformInTemplatePath(dest).StartsWith("%"))
                {
                    unInstallItem.BackUpFile = string.Format("{0}BackUp\\{1}", LocationFolder,
                                                             MpeInstaller.TransformInTemplatePath(dest));
                }
                else
                {
                    unInstallItem.BackUpFile = string.Format("{0}BackUp\\Unknow\\{1}", LocationFolder,
                                                             Path.GetFileName(dest));
                }

                string s = Path.GetDirectoryName(unInstallItem.BackUpFile);
                if (!Directory.Exists(s))
                {
                    Directory.CreateDirectory(s);
                }
                File.Copy(dest, unInstallItem.BackUpFile, true);
            }
            unInstallItem.OriginalFile = dest;
            unInstallItem.InstallType  = installType;
            return(unInstallItem);
        }
    /// <summary>
    /// Backs up file.
    /// </summary>
    /// <param name="dest">The dest.</param>
    /// <param name="installType">Type of the install.</param>
    /// <returns></returns>
    public UnInstallItem BackUpFile(string dest, string installType)
    {
      UnInstallItem unInstallItem = new UnInstallItem();
      if (File.Exists(dest) && !BackUpExist(dest))
      {
        if (MpeInstaller.TransformInTemplatePath(dest).StartsWith("%"))
        {
          unInstallItem.BackUpFile = string.Format("{0}BackUp\\{1}", LocationFolder,
                                                   MpeInstaller.TransformInTemplatePath(dest));
        }
        else
        {
          unInstallItem.BackUpFile = string.Format("{0}BackUp\\Unknow\\{1}", LocationFolder,
                                                   Path.GetFileName(dest));
        }

        string s = Path.GetDirectoryName(unInstallItem.BackUpFile);
        if (!Directory.Exists(s))
          Directory.CreateDirectory(s);
        File.Copy(dest, unInstallItem.BackUpFile, true);
      }
      unInstallItem.OriginalFile = dest;
      unInstallItem.InstallType = installType;
      return unInstallItem;
    }
Example #3
0
 public void Uninstall(PackageClass packageClass, UnInstallItem fileItem)
 {
   // should not be called, since Install creates a UnInstallItem with type CopyFile
 }