diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2017-02-24 22:01:02 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2017-02-24 22:01:02 +0300 |
commit | 8f7b0421655a3c4679822dd79f2ceb71d12fc251 (patch) | |
tree | 2d400e78f0fa35bf25cdfc25c61a7a319492a07e /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates | |
parent | f310684351059c1696c9ad50c2bc105f6ddf703b (diff) | |
parent | 441f99e5e80d320af2828db788b5d347935aa8ab (diff) |
Merge remote-tracking branch 'origin/master' into recent-templates
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates')
3 files changed, 55 insertions, 38 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeTranslationFileDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeTranslationFileDescriptionTemplate.cs index 396ff970fb..3ff4f09faa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeTranslationFileDescriptionTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CodeTranslationFileDescriptionTemplate.cs @@ -65,7 +65,7 @@ namespace MonoDevelop.Ide.Templates string showAutogen = filenode.GetAttribute ("ShowAutogenerationNotice"); if ((showAutogen != null) && (showAutogen.Length > 0)) { try { - showAutogenerationNotice = bool.Parse (showAutogen.ToLower()); + showAutogenerationNotice = bool.Parse (showAutogen); } catch (FormatException) { throw new InvalidOperationException ("Invalid value for ShowAutogenerationNotice in template."); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs index 78a24d98b3..b22295fcd5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs @@ -100,7 +100,7 @@ namespace MonoDevelop.Ide.Templates if (xmlElement ["Packages"] != null) { foreach (XmlNode xmlNode in xmlElement["Packages"].ChildNodes) { if (xmlNode is XmlElement) { - var packageReference = ProjectTemplatePackageReference.Create ((XmlElement)xmlNode); + var packageReference = ProjectTemplatePackageReference.Create ((XmlElement)xmlNode, baseDirectory); projectDescriptor.packageReferences.Add (packageReference); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatePackageReference.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatePackageReference.cs index 555df5fb9c..83d90a2b6f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatePackageReference.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplatePackageReference.cs @@ -1,60 +1,68 @@ -//
-// ProjectTemplatePackageReference.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
+// +// ProjectTemplatePackageReference.cs +// +// Author: +// Matt Ward <matt.ward@xamarin.com> +// +// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + using System;
using System.Xml;
-
+using MonoDevelop.Core; + namespace MonoDevelop.Ide.Templates
{
public class ProjectTemplatePackageReference
{
public static ProjectTemplatePackageReference Create (XmlElement xmlElement)
+ { + return Create (xmlElement, FilePath.Null);
+ }
+
+ internal static ProjectTemplatePackageReference Create (XmlElement xmlElement, FilePath baseDirectory)
{
- return new ProjectTemplatePackageReference {
- Id = GetAttribute (xmlElement, "id"),
- Version = GetAttribute (xmlElement, "version"),
- CreateCondition = GetAttribute (xmlElement, "if"),
- IsLocalPackage = GetBoolAttribute (xmlElement, "local")
- };
+ return new ProjectTemplatePackageReference { + Id = GetAttribute (xmlElement, "id"), + Version = GetAttribute (xmlElement, "version"), + CreateCondition = GetAttribute (xmlElement, "if"), + IsLocalPackage = GetBoolAttribute (xmlElement, "local"), + Directory = GetPath (xmlElement, "directory", baseDirectory) + }; }
public string Id { get; private set; }
public string Version { get; private set; }
public string CreateCondition { get; private set; }
- internal bool IsLocalPackage { get; private set; }
+ internal bool IsLocalPackage { get; private set; } + internal FilePath Directory { get; private set; }
- static string GetAttribute (XmlElement xmlElement, string attributeName)
+ static string GetAttribute (XmlElement xmlElement, string attributeName, string defaultValue = "")
{
foreach (XmlAttribute attribute in xmlElement.Attributes) {
if (attributeName.Equals (attribute.Name, StringComparison.OrdinalIgnoreCase)) {
return attribute.Value;
}
}
- return "";
+ return defaultValue;
}
static bool GetBoolAttribute (XmlElement xmlElement, string attributeName)
@@ -66,6 +74,15 @@ namespace MonoDevelop.Ide.Templates return result;
return false;
+ } + + static FilePath GetPath (XmlElement xmlElement, string attributeName, FilePath baseDirectory) + { + string directory = GetAttribute (xmlElement, attributeName, null); + if (directory == null) + return FilePath.Null; + + return baseDirectory.Combine (directory).FullPath; }
}
}
|