Skip to content

Commit 975f565

Browse files
committed
Output FusionLog on FileNotFoundExceptions
1 parent 95ae3c4 commit 975f565

1 file changed

Lines changed: 94 additions & 79 deletions

File tree

app/NHtmlUnitGenerator/Program.cs

Lines changed: 94 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,94 @@
1-
#region License
2-
3-
// --------------------------------------------------
4-
// Copyright © 2003-2011 OKB. All Rights Reserved.
5-
//
6-
// This software is proprietary information of OKB.
7-
// USE IS SUBJECT TO LICENSE TERMS.
8-
// --------------------------------------------------
9-
10-
#endregion
11-
12-
using System;
13-
using System.Collections.Generic;
14-
using System.Linq;
15-
using System.Reflection;
16-
17-
using com.gargoylesoftware.htmlunit;
18-
using com.gargoylesoftware.htmlunit.html;
19-
20-
namespace NHtmlUnit.Generator
21-
{
22-
internal class Program
23-
{
24-
private static Dictionary<string, Type> CreateTypeList(
25-
IEnumerable<Assembly> assemblies, IEnumerable<Type> types)
26-
{
27-
var dict = new Dictionary<string, Type>();
28-
29-
foreach (Type t in types)
30-
{
31-
IEnumerable<Type> superTypes =
32-
assemblies.SelectMany(a => a.GetTypes()).Where(x => x.IsSubclassOf(t) && x.IsPublic);
33-
34-
foreach (Type st in superTypes.Concat(new[] { t }))
35-
{
36-
if (!dict.ContainsKey(st.Name))
37-
dict[st.Name] = st;
38-
}
39-
}
40-
41-
return dict;
42-
}
43-
44-
45-
private static void Main(string[] args)
46-
{
47-
// Console.WriteLine("App config path: " + Settings.Default);
48-
49-
Type webClientType = typeof(WebClient);
50-
var wrapperRep = new WrapperRepository(typeof(HtmlPage).Assembly);
51-
//GetJavaPropsFromType(webClientType);
52-
//GetJavaPropsFromType(typeof(HtmlPage));
53-
//GetJavaPropsFromType(typeof(HtmlInput));
54-
55-
wrapperRep.GenerateUntilDone(typeof(DomNode), typeof(WebClient), typeof(HtmlPage), typeof(CollectingAlertHandler));
56-
57-
wrapperRep.GenerateAssemblyInfo();
58-
wrapperRep.GenerateNuspec();
59-
//var classInfoList = CreateTypeList(
60-
// new[] { typeof(HtmlPage).Assembly },
61-
// new[]
62-
// {
63-
// typeof(HtmlPage),
64-
// typeof(SgmlPage)
65-
// }).Select(t => new WrapperClassInfo(t.Value, wrapperRep))
66-
// .ToArray()
67-
// .Select((ci => ci.GenerateClassCode(new StringBuilder()).ToString()));
68-
69-
//foreach (var src in classInfoList)
70-
// Console.WriteLine(src);
71-
72-
Console.WriteLine();
73-
Console.WriteLine();
74-
Console.WriteLine("Done! Press any key to exit.");
75-
76-
Console.ReadKey();
77-
}
78-
}
79-
}
1+
#region License
2+
3+
// --------------------------------------------------
4+
// Copyright © 2003-2011 OKB. All Rights Reserved.
5+
//
6+
// This software is proprietary information of OKB.
7+
// USE IS SUBJECT TO LICENSE TERMS.
8+
// --------------------------------------------------
9+
10+
#endregion
11+
12+
using System;
13+
using System.IO;
14+
using System.Collections.Generic;
15+
using System.Linq;
16+
using System.Reflection;
17+
18+
using com.gargoylesoftware.htmlunit;
19+
using com.gargoylesoftware.htmlunit.html;
20+
21+
namespace NHtmlUnit.Generator
22+
{
23+
internal class Program
24+
{
25+
private static Dictionary<string, Type> CreateTypeList(
26+
IEnumerable<Assembly> assemblies, IEnumerable<Type> types)
27+
{
28+
var dict = new Dictionary<string, Type>();
29+
30+
foreach (Type t in types)
31+
{
32+
IEnumerable<Type> superTypes =
33+
assemblies.SelectMany(a => a.GetTypes()).Where(x => x.IsSubclassOf(t) && x.IsPublic);
34+
35+
foreach (Type st in superTypes.Concat(new[] { t }))
36+
{
37+
if (!dict.ContainsKey(st.Name))
38+
dict[st.Name] = st;
39+
}
40+
}
41+
42+
return dict;
43+
}
44+
45+
private static void GenerateWrapper()
46+
{
47+
Type webClientType = typeof(WebClient);
48+
var wrapperRep = new WrapperRepository(typeof(HtmlPage).Assembly);
49+
//GetJavaPropsFromType(webClientType);
50+
//GetJavaPropsFromType(typeof(HtmlPage));
51+
//GetJavaPropsFromType(typeof(HtmlInput));
52+
53+
wrapperRep.GenerateUntilDone(typeof(DomNode), typeof(WebClient), typeof(HtmlPage), typeof(CollectingAlertHandler));
54+
55+
wrapperRep.GenerateAssemblyInfo();
56+
wrapperRep.GenerateNuspec();
57+
//var classInfoList = CreateTypeList(
58+
// new[] { typeof(HtmlPage).Assembly },
59+
// new[]
60+
// {
61+
// typeof(HtmlPage),
62+
// typeof(SgmlPage)
63+
// }).Select(t => new WrapperClassInfo(t.Value, wrapperRep))
64+
// .ToArray()
65+
// .Select((ci => ci.GenerateClassCode(new StringBuilder()).ToString()));
66+
67+
//foreach (var src in classInfoList)
68+
// Console.WriteLine(src);
69+
70+
Console.WriteLine();
71+
Console.WriteLine();
72+
Console.WriteLine("Done! Press any key to exit.");
73+
74+
Console.ReadKey();
75+
}
76+
77+
78+
private static void Main(string[] args)
79+
{
80+
// Console.WriteLine("App config path: " + Settings.Default);
81+
82+
try
83+
{
84+
GenerateWrapper();
85+
}
86+
catch (FileNotFoundException e)
87+
{
88+
Console.Error.WriteLine(e.FusionLog);
89+
Console.Error.WriteLine(e);
90+
throw;
91+
}
92+
}
93+
}
94+
}

0 commit comments

Comments
 (0)