-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
50 lines (45 loc) · 1.83 KB
/
Copy pathProgram.cs
File metadata and controls
50 lines (45 loc) · 1.83 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
namespace NugetAssetExtractor
{
internal static class Program
{
public static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("USAGE mono NugetAssetExtractor.exe path/to/project.assets.json");
return;
}
string frameworkVersion = "4.6";
if (args.Length == 2)
frameworkVersion = args[1];
var jsonObject = JObject.Parse(File.ReadAllText(args[0]));
var targets = jsonObject["targets"][".NETFramework,Version=v" + frameworkVersion] as IDictionary<string, JToken>;
if(targets == null)
return;
foreach (var target in targets)
{
var nameVersion = target.Key.ToLower();
Console.WriteLine(Path.Combine(nameVersion, "content", "clojure"));
var compileMap = target.Value["compile"] as IDictionary<string, JToken>;
if (compileMap != null)
{
var compileFiles = compileMap.Keys.Where(k => "_._" != Path.GetFileName(k));
foreach (var file in compileFiles)
Console.WriteLine(Path.Combine(nameVersion, file));
}
var runtimeMap = target.Value["runtime"] as IDictionary<string, JToken>;
if (runtimeMap != null)
{
var runtimeFiles = runtimeMap.Keys.Where(k => "_._" != Path.GetFileName(k));
foreach (var file in runtimeFiles)
Console.WriteLine(Path.Combine(nameVersion, file));
}
}
}
}
}