Skip to content
Permalink
Browse files

Refactored code for the post step.

  • Loading branch information...
michaellwest committed May 20, 2019
1 parent 23cb3eb commit c603b0e775dfffe368ce5f6a0cbc6e904b0a9b3c
Showing with 8 additions and 8 deletions.
  1. +8 −8 Cognifide.PowerShell.Package/Install/PackagePostStep.cs
@@ -16,18 +16,18 @@ public class PackagePostStep : IPostStep
public void Run(ITaskOutput output, NameValueCollection metaData)
{
var text = metaData["Comment"] ?? string.Empty;
if (String.IsNullOrEmpty(text)) { return; }
if (string.IsNullOrEmpty(text)) { return; }

var xelement = ToXElement(text);
if (xelement == null) { return; }
var contentXml = ToXElement(text);
if (contentXml == null) { return; }

var items = xelement.Element(Constants.ItemsPrefix);
var items = contentXml.Element(Constants.ItemsPrefix);
if (items != null)
{
DeleteItems(items);
}

var files = xelement.Element(Constants.FilesPrefix);
var files = contentXml.Element(Constants.FilesPrefix);
if (files == null) { return; }

DeleteFiles(files);
@@ -65,17 +65,17 @@ private static void DeleteItems(XContainer items)
private static XElement ToXElement(string text)
{
Assert.ArgumentNotNull(text, "text");
XDocument xdocument;
XDocument document;
try
{
xdocument = XDocument.Parse(text);
document = XDocument.Parse(text);
}
catch
{
return null;
}

return xdocument.Root;
return document.Root;
}
}
}

0 comments on commit c603b0e

Please sign in to comment.
You can’t perform that action at this time.