7 using System.Xml.XPath;
9 namespace SiliconStudio.
Paradox.ProjectGenerator
17 this.projectType = projectType;
22 var doc = context.Document;
23 var ns = context.Document.Root.Name.Namespace;
25 var fullPath = context.Project.FullPath;
28 fullPath = fullPath.Replace(
".Windows", string.Empty);
31 fullPath = Path.Combine(Path.GetDirectoryName(fullPath), Path.GetFileNameWithoutExtension(fullPath) +
"." + projectType + Path.GetExtension(fullPath));
33 if (
File.Exists(fullPath))
36 context.Modified =
true;
39 var newDoc = XDocument.Load(fullPath);
42 var oldItemGroups = doc.XPathSelectElements(
"/x:Project/x:ItemGroup", context.NamespaceManager).ToArray();
43 var newItemGroups = newDoc.XPathSelectElements(
"/x:Project/x:ItemGroup", context.NamespaceManager).ToArray();
46 foreach (var itemGroup
in newItemGroups)
48 var nonTaggedElements = GetUserElements(itemGroup);
49 foreach (var nonTaggedElement
in nonTaggedElements)
51 nonTaggedElement.Remove();
57 var insertionItemGroup = newItemGroups.Length >= 2 ? newItemGroups[1] : newItemGroups[0];
58 foreach (var itemGroup
in oldItemGroups)
60 var nonTaggedElements = GetUserElements(itemGroup);
61 foreach (var nonTaggedElement
in nonTaggedElements)
63 insertionItemGroup.Add(
new XElement(nonTaggedElement));
68 foreach (var itemGroup
in newItemGroups.ToArray())
70 if (!itemGroup.HasElements)
75 context.Document = newDoc;
84 private static XElement[] GetUserElements(XElement itemGroup)
88 .Where(x => !x.Attributes().Any(
y => y.Name ==
"Label" && y.Value ==
"Paradox.DoNotSync"))
92 private static void GenerateInfoFile(
string infoFile,
string bundleDisplayName,
string bundleIdentifier)
94 var doc =
new XDocument(
95 new XDeclaration(
"1.0",
"UTF-8",
"yes"),
96 new XDocumentType(
"plist",
"-//Apple//DTD PLIST 1.0//EN",
"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null),
97 new XElement(
"plist",
new XAttribute(
"version",
"1.0"),
99 new XElement(
"key",
"UIDeviceFamily"),
100 new XElement(
"array",
101 new XElement(
"integer",
"1"),
102 new XElement(
"integer",
"2")
104 new XElement(
"key",
"UISupportedInterfaceOrientations"),
105 new XElement(
"array",
106 new XElement(
"string",
"UIInterfaceOrientationPortrait"),
107 new XElement(
"string",
"UIInterfaceOrientationLandscapeLeft"),
108 new XElement(
"string",
"UIInterfaceOrientationLandscapeRight")
110 new XElement(
"key",
"UISupportedInterfaceOrientations~ipad"),
111 new XElement(
"array",
112 new XElement(
"string",
"UIInterfaceOrientationPortrait"),
113 new XElement(
"string",
"UIInterfaceOrientationPortraitUpsideDown"),
114 new XElement(
"string",
"UIInterfaceOrientationLandscapeRight"),
115 new XElement(
"string",
"UIInterfaceOrientationLandscapeRight")
117 new XElement(
"key",
"MinimumOSVersion"),
118 new XElement(
"string",
"3.2"),
119 new XElement(
"key",
"CFBundleDisplayName"),
120 new XElement(
"string", bundleDisplayName),
121 new XElement(
"key",
"CFBundleIdentifier"),
122 new XElement(
"string", bundleIdentifier)
127 using (var fileStream =
new StreamWriter(infoFile))
129 fileStream.Write(doc.ToString());
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ float size_t y
void Process(ProjectProcessorContext context)
SynchronizeProjectProcessor(ProjectType projectType)