2012-08-11 13:06:29 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2012-11-04 08:46:52 +00:00
|
|
|
|
using System.Linq;
|
2012-08-11 13:06:29 +00:00
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
2012-08-14 08:44:12 +00:00
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
|
|
2012-08-11 13:06:29 +00:00
|
|
|
|
namespace ProjectConverter.Platforms
|
|
|
|
|
{
|
|
|
|
|
public class LinuxConverter : Converter
|
|
|
|
|
{
|
|
|
|
|
public override string Postfix
|
|
|
|
|
{
|
2012-10-23 07:37:08 +00:00
|
|
|
|
get { return "Linux"; }
|
2012-08-11 13:06:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-23 07:37:08 +00:00
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "linux"; }
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-11 13:06:29 +00:00
|
|
|
|
#region ConvertImport
|
|
|
|
|
protected override void ConvertImport(XElement element, XAttribute projectAttribute)
|
|
|
|
|
{
|
|
|
|
|
if (projectAttribute != null &&
|
|
|
|
|
(projectAttribute.Value.EndsWith(XnaGameStudioTarget) ||
|
|
|
|
|
projectAttribute.Value.EndsWith(XnaPipelineExtensionTarget)))
|
|
|
|
|
{
|
|
|
|
|
element.Remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2012-11-04 08:46:52 +00:00
|
|
|
|
private string[] referencesToRemove = new string[] { "ANX.RenderSystem.Windows.DX10",
|
|
|
|
|
"ANX.RenderSystem.Windows.DX11",
|
|
|
|
|
"XInput",
|
|
|
|
|
"XAudio",
|
|
|
|
|
"SharpDX",
|
|
|
|
|
"ANX.PlatformSystem.Windows",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#region ConvertReference
|
|
|
|
|
protected override void ConvertReference(XElement element)
|
|
|
|
|
{
|
|
|
|
|
XAttribute includeAttribute = element.Attribute("Include");
|
|
|
|
|
if (includeAttribute != null)
|
|
|
|
|
{
|
|
|
|
|
string value = includeAttribute.Value;
|
|
|
|
|
foreach (var reference in referencesToRemove)
|
|
|
|
|
{
|
|
|
|
|
if (value.ToLowerInvariant().Contains(reference.ToLowerInvariant()))
|
|
|
|
|
{
|
|
|
|
|
element.Remove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ConvertReference
|
|
|
|
|
protected override void ConvertProjectReference(XElement element)
|
|
|
|
|
{
|
|
|
|
|
XAttribute includeAttribute = element.Attribute("Include");
|
|
|
|
|
if (includeAttribute != null)
|
|
|
|
|
{
|
|
|
|
|
string value = includeAttribute.Value;
|
|
|
|
|
foreach (var reference in referencesToRemove)
|
|
|
|
|
{
|
|
|
|
|
if (value.ToLowerInvariant().Contains(reference.ToLowerInvariant()))
|
|
|
|
|
{
|
|
|
|
|
element.Remove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ConvertMainPropertyGroup
|
|
|
|
|
protected override void ConvertMainPropertyGroup(XElement element)
|
2012-08-11 13:06:29 +00:00
|
|
|
|
{
|
|
|
|
|
DeleteNodeIfExists(element, "ProjectTypeGuids");
|
|
|
|
|
DeleteNodeIfExists(element, "TargetFrameworkProfile");
|
|
|
|
|
|
|
|
|
|
XElement outputTypeNode = GetOrCreateNode(element, "OutputType");
|
|
|
|
|
if (outputTypeNode.Value == "WinExe" ||
|
|
|
|
|
outputTypeNode.Value == "appcontainerexe")
|
|
|
|
|
{
|
|
|
|
|
outputTypeNode.Value = "Exe";
|
|
|
|
|
}
|
|
|
|
|
else if (String.IsNullOrEmpty(outputTypeNode.Value))
|
|
|
|
|
{
|
|
|
|
|
outputTypeNode.Value = "Library";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|