-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathPreviousPlatforms.linq
38 lines (31 loc) · 1.4 KB
/
PreviousPlatforms.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<Query Kind="Statements" />
// This script can be run periodically from within LINQPad (https://www.linqpad.net)
// to generate aggregate data for get_contract_platform in helpers.h
var doc = XDocument.Load(@"C:\Program Files (x86)\Windows Kits\10\Platforms\UAP\10.0.19041.0\PreviousPlatforms.xml");
XNamespace pp = "http://microsoft.com/schemas/Windows/SDK/PreviousPlatforms";
var contracts =
from platform in doc.Elements().Elements()
let PlatformName = platform.Attribute("friendlyName").Value
let PlatformVersion = platform.Attribute("version").Value
from contract in platform.Elements(pp + "ContainedApiContracts").Elements()
let ContractName = contract.Attribute("name").Value
let ContractVersion = contract.Attribute("version").Value
let ContractNumber = int.Parse(ContractVersion.Replace(".0.0.0",""))
orderby ContractName, ContractNumber, PlatformVersion
group new{ContractNumber, PlatformVersion} by ContractName;
foreach(var contract in contracts)
{
String.Format(
@" {{ ""{0}"",
{{", contract.Key).Dump();
int ContractNumber = 0;
foreach(var mapping in contract)
{
if(mapping.ContractNumber == ContractNumber) continue;
ContractNumber= mapping.ContractNumber;
String.Format(
@" {{ {0}, ""{1}"" }},", mapping.ContractNumber, mapping.PlatformVersion).Dump();
}
@" }
},".Dump();
}