From 784b5980ba35b1f00e077041bb03bc37f848588e Mon Sep 17 00:00:00 2001 From: slavara Date: Wed, 13 Apr 2016 21:07:58 +0300 Subject: [PATCH 1/2] Cleanup... --- AntPanel/PluginUI.cs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/AntPanel/PluginUI.cs b/AntPanel/PluginUI.cs index cdbd134..22c3351 100644 --- a/AntPanel/PluginUI.cs +++ b/AntPanel/PluginUI.cs @@ -177,12 +177,9 @@ AntTreeNode GetBuildFileNode(string file) xml.Load(file); var documentElement = xml.DocumentElement; Debug.Assert(documentElement != null, "documentElement != null"); - var defTargetAttr = documentElement.Attributes["default"]; - var defaultTarget = defTargetAttr?.InnerText ?? ""; - var nameAttr = documentElement.Attributes["name"]; - var projectName = nameAttr?.InnerText ?? file; - var descrAttr = documentElement.Attributes["description"]; - var description = descrAttr?.InnerText ?? ""; + var defaultTarget = documentElement.Attributes["default"]?.InnerText ?? ""; + var projectName = documentElement.Attributes["name"]?.InnerText ?? file; + var description = documentElement.Attributes["description"]?.InnerText ?? ""; if (string.IsNullOrEmpty(projectName)) projectName = file; var rootNode = new AntTreeNode(projectName, IconFile) { @@ -200,11 +197,9 @@ AntTreeNode GetBuildFileNode(string file) if (node.Name != "target") continue; var attributes = node.Attributes; Debug.Assert(attributes != null, "attributes != null"); - if (!string.IsNullOrEmpty(attributes["description"]?.InnerText)) - { - skipHiddenTargets = true; - break; - } + if (string.IsNullOrEmpty(attributes["description"]?.InnerText)) continue; + skipHiddenTargets = true; + break; } } foreach (XmlNode node in documentElement.ChildNodes) @@ -213,8 +208,7 @@ AntTreeNode GetBuildFileNode(string file) // skip private and optionally hidden targets var attributes = node.Attributes; Debug.Assert(attributes != null, "attributes != null"); - var targetNameAttr = attributes["name"]; - var targetName = targetNameAttr?.InnerText; + var targetName = attributes["name"]?.InnerText; if (!string.IsNullOrEmpty(targetName) && (targetName[0] == '-')) continue; if (skipHiddenTargets && string.IsNullOrEmpty(attributes["description"]?.InnerText)) @@ -231,10 +225,8 @@ AntTreeNode GetBuildTargetNode(XmlNode node, string defaultTarget) { var attributes = node.Attributes; Debug.Assert(attributes != null, "attributes != null"); - var nameAttr = attributes["name"]; - var targetName = nameAttr?.InnerText ?? string.Empty; - var descrAttr = attributes["description"]; - var description = descrAttr?.InnerText ?? string.Empty; + var targetName = attributes["name"]?.InnerText ?? string.Empty; + var description = attributes["description"]?.InnerText ?? string.Empty; AntTreeNode result; if (targetName == defaultTarget) { From 7643a6614f8d0f4f7ec6f7a9afb1f7e555fbc1c8 Mon Sep 17 00:00:00 2001 From: slavara Date: Wed, 13 Apr 2016 21:30:55 +0300 Subject: [PATCH 2/2] Minor... --- AntPanel/PluginMain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AntPanel/PluginMain.cs b/AntPanel/PluginMain.cs index c2feb87..76c59df 100644 --- a/AntPanel/PluginMain.cs +++ b/AntPanel/PluginMain.cs @@ -137,7 +137,7 @@ public void RemoveBuildFile(string file) public void RunTarget(string file, string target) { var antPath = ((Settings)Settings).AntPath; - var command = PluginBase.MainForm.CommandPromptExecutable ?? Path.Combine(Environment.SystemDirectory, "cmd.exe"); + var command = /*PluginBase.MainForm.CommandPromptExecutable ??*/ Path.Combine(Environment.SystemDirectory, "cmd.exe"); var arguments = "/c "; if (string.IsNullOrEmpty(antPath)) arguments += "ant"; else arguments += Path.Combine(Path.Combine(antPath, "bin"), "ant");