Exemple #1
0
        public bool Execute(string packageName, XmlNode xmlData)
        {
            Initialize(xmlData);

            if (TargetFile != null)
            {
                XElement root = TargetFile.Root;
                if (root == null)
                {
                    root = new XElement(SourceFile.Root.Name);
                    TargetFile.Add(root);
                }
                if (!fileMoved)
                {
                    MergeElement(SourceFile.Root, root);

                    //Save file
                    TargetFile.Save(TargetFilePath, SaveOptions.None);

                    if (!embeddedResource)
                    {
                        File.Delete(HostingEnvironment.MapPath(SourceFilePath));
                    }
                }
            }

            return(true);
        }
Exemple #2
0
 public void Uninstall()
 {
     if (TargetFile != null)
     {
         if (!DeleteTargetFileOnUndo)
         {
             CleanFile();
             TargetFile.Save(TargetFilePath, SaveOptions.None);
         }
         else
         {
             File.Delete(TargetFilePath);
         }
     }
 }
Exemple #3
0
        public bool Undo(string packageName, XmlNode xmlData)
        {
            Initialize(xmlData);

            if (TargetFile != null)
            {
                if (!deleteTargetFileOnUndo)
                {
                    CleanFile();
                    TargetFile.Save(TargetFilePath, SaveOptions.None);
                }
                else
                {
                    File.Delete(TargetFilePath);
                }
            }

            return(true);
        }
Exemple #4
0
        public void Install()
        {
            if (TargetFile != null)
            {
                XElement root = TargetFile.Root;
                if (root == null)
                {
                    root = new XElement(SourceFile.Root.Name);
                    TargetFile.Add(root);
                }
                if (!fileMoved)
                {
                    MergeElement(SourceFile.Root, root);

                    //Save file
                    TargetFile.Save(TargetFilePath, SaveOptions.None);

                    if (!EmbeddedResource)
                    {
                        File.Delete(HostingEnvironment.MapPath(SourceFilePath));
                    }
                }
            }
        }