Added mono module
This commit is contained in:
parent
29b44801b2
commit
e36fb95c50
92 changed files with 19622 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using Microsoft.Build.Construction;
|
||||
|
||||
namespace GodotSharpTools.Project
|
||||
{
|
||||
public static class ProjectExtensions
|
||||
{
|
||||
public static bool HasItem(this ProjectRootElement root, string itemType, string include)
|
||||
{
|
||||
string includeNormalized = include.NormalizePath();
|
||||
|
||||
foreach (var itemGroup in root.ItemGroups)
|
||||
{
|
||||
if (itemGroup.Condition.Length != 0)
|
||||
continue;
|
||||
|
||||
foreach (var item in itemGroup.Items)
|
||||
{
|
||||
if (item.ItemType == itemType)
|
||||
{
|
||||
if (item.Include.NormalizePath() == includeNormalized)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void AddItemChecked(this ProjectRootElement root, string itemType, string include)
|
||||
{
|
||||
if (!root.HasItem(itemType, include))
|
||||
{
|
||||
root.AddItem(itemType, include);
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid GetGuid(this ProjectRootElement root)
|
||||
{
|
||||
foreach (var property in root.Properties)
|
||||
{
|
||||
if (property.Name == "ProjectGuid")
|
||||
return Guid.Parse(property.Value);
|
||||
}
|
||||
|
||||
return Guid.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue