Skip to content

Commit ae8483e

Browse files
committed
Version 0.9.0.0
1 parent aa7208a commit ae8483e

File tree

71 files changed

+15879
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+15879
-127
lines changed

.gitignore

Lines changed: 20 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,27 @@
1-
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2-
[Bb]in/
3-
[Oo]bj/
4-
5-
# mstest test results
6-
TestResults
7-
8-
## Ignore Visual Studio temporary files, build results, and
9-
## files generated by popular Visual Studio add-ons.
10-
11-
# User-specific files
121
*.suo
132
*.user
14-
*.sln.docstates
15-
16-
# Build results
17-
[Dd]ebug/
18-
[Rr]elease/
19-
x64/
20-
*_i.c
21-
*_p.c
22-
*.ilk
23-
*.meta
3+
*.FileListAbsolute.txt
4+
bin/
5+
obj/
6+
*.ncb
7+
*.nlb
8+
*.aps
9+
*.clw
10+
*.pdb
2411
*.obj
2512
*.pch
26-
*.pdb
27-
*.pgc
28-
*.pgd
29-
*.rsp
30-
*.sbr
13+
*.vspscc
14+
*_i.c
15+
*_p.c
3116
*.tlb
32-
*.tli
3317
*.tlh
34-
*.tmp
18+
*.bak
19+
*.[Cc]ache
20+
*.ilk
3521
*.log
36-
*.vspscc
37-
*.vssscc
38-
.builds
39-
40-
# Visual C++ cache files
41-
ipch/
42-
*.aps
43-
*.ncb
44-
*.opensdf
45-
*.sdf
46-
47-
# Visual Studio profiler
48-
*.psess
49-
*.vsp
50-
*.vspx
51-
52-
# Guidance Automation Toolkit
53-
*.gpState
54-
55-
# ReSharper is a .NET coding add-in
56-
_ReSharper*
57-
58-
# NCrunch
59-
*.ncrunch*
60-
.*crunch*.local.xml
61-
62-
# Installshield output folder
63-
[Ee]xpress
64-
65-
# DocProject is a documentation generator add-in
66-
DocProject/buildhelp/
67-
DocProject/Help/*.HxT
68-
DocProject/Help/*.HxC
69-
DocProject/Help/*.hhc
70-
DocProject/Help/*.hhk
71-
DocProject/Help/*.hhp
72-
DocProject/Help/Html2
73-
DocProject/Help/html
74-
75-
# Click-Once directory
76-
publish
77-
78-
# Publish Web Output
79-
*.Publish.xml
80-
81-
# NuGet Packages Directory
82-
packages
83-
84-
# Windows Azure Build Output
85-
csx
86-
*.build.csdef
87-
88-
# Windows Store app package directory
89-
AppPackages/
90-
91-
# Others
92-
[Bb]in
93-
[Oo]bj
94-
sql
95-
TestResults
96-
[Tt]est[Rr]esult*
97-
*.Cache
98-
ClientBin
99-
[Ss]tyle[Cc]op.*
100-
~$*
101-
*.dbmdl
102-
Generated_Code #added for RIA/Silverlight projects
103-
104-
# Backup & report files from converting an old project file to a newer
105-
# Visual Studio version. Backup files are not needed, because we have git ;-)
106-
_UpgradeReport_Files/
107-
Backup*/
108-
UpgradeLog*.XML
22+
*.lib
23+
*.sbr
24+
*.scc
25+
*.sig
26+
_ReSharper*/
27+
*.orig
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace JavaScriptEngineSwitcher.Core.Configuration
2+
{
3+
using System.Configuration;
4+
5+
/// <summary>
6+
/// Configuration settings of core
7+
/// </summary>
8+
public sealed class CoreConfiguration : ConfigurationSection
9+
{
10+
/// <summary>
11+
/// Gets or sets a name of default JavaScript engine
12+
/// </summary>
13+
[ConfigurationProperty("defaultEngine", DefaultValue = "")]
14+
public string DefaultEngine
15+
{
16+
get { return (string)this["defaultEngine"]; }
17+
set { this["defaultEngine"] = value; }
18+
}
19+
20+
/// <summary>
21+
/// Gets a list of registered JavaScript engines
22+
/// </summary>
23+
[ConfigurationProperty("engines", IsRequired = true)]
24+
public JsEngineRegistrationList Engines
25+
{
26+
get { return (JsEngineRegistrationList)this["engines"]; }
27+
}
28+
}
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace JavaScriptEngineSwitcher.Core.Configuration
2+
{
3+
using System.Configuration;
4+
5+
/// <summary>
6+
/// JavaScript engine registration
7+
/// </summary>
8+
public sealed class JsEngineRegistration : ConfigurationElement
9+
{
10+
/// <summary>
11+
/// Gets or sets a JavaScript engine name
12+
/// </summary>
13+
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
14+
public string Name
15+
{
16+
get { return (string)this["name"]; }
17+
set { this["name"] = value; }
18+
}
19+
20+
/// <summary>
21+
/// Gets or sets a JavaScript engine .NET-type name
22+
/// </summary>
23+
[ConfigurationProperty("type", IsRequired = true)]
24+
public string Type
25+
{
26+
get { return (string)this["type"]; }
27+
set { this["type"] = value; }
28+
}
29+
}
30+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace JavaScriptEngineSwitcher.Core.Configuration
2+
{
3+
using System.Configuration;
4+
5+
/// <summary>
6+
/// List of registered JavaScript engines
7+
/// </summary>
8+
public sealed class JsEngineRegistrationList : ConfigurationElementCollection
9+
{
10+
/// <summary>
11+
/// Creates a new JavaScript engine registration
12+
/// </summary>
13+
/// <returns>JavaScript engine registration</returns>
14+
protected override ConfigurationElement CreateNewElement()
15+
{
16+
return new JsEngineRegistration();
17+
}
18+
19+
/// <summary>
20+
/// Gets a key of the specified JavaScript engine registration
21+
/// </summary>
22+
/// <param name="element">JavaScript engine registration</param>
23+
/// <returns>Key</returns>
24+
protected override object GetElementKey(ConfigurationElement element)
25+
{
26+
return ((JsEngineRegistration)element).Name;
27+
}
28+
29+
/// <summary>
30+
/// Gets a JavaScript engine registration by JavaScript engine name
31+
/// </summary>
32+
/// <param name="name">JavaScript engine name</param>
33+
/// <returns>JavaScript engine registration</returns>
34+
public new JsEngineRegistration this[string name]
35+
{
36+
get { return (JsEngineRegistration)BaseGet(name); }
37+
}
38+
}
39+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace JavaScriptEngineSwitcher.Core.Constants
2+
{
3+
/// <summary>
4+
/// JavaScript engines names constants
5+
/// </summary>
6+
public static class EngineName
7+
{
8+
/// <summary>
9+
/// Name (key) of MSIE JavaScript engine
10+
/// </summary>
11+
public const string MsieJsEngine = "MsieJsEngine";
12+
13+
/// <summary>
14+
/// Name (key) of V8 JavaScript engine
15+
/// </summary>
16+
public const string V8JsEngine = "V8JsEngine";
17+
18+
/// <summary>
19+
/// Name (key) of Jurassic JavaScript engine
20+
/// </summary>
21+
public const string JurassicJsEngine = "JurassicJsEngine";
22+
}
23+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace JavaScriptEngineSwitcher.Core
2+
{
3+
using System;
4+
5+
/// <summary>
6+
/// The exception that is thrown when a specified value is null or empty
7+
/// </summary>
8+
public sealed class EmptyValueException : Exception
9+
{
10+
/// <summary>
11+
/// Initializes a new instance of the JavaScriptEngineSwitcher.Core.EmptyValueException class
12+
/// with a specified error message
13+
/// </summary>
14+
/// <param name="message">The message that describes the error</param>
15+
public EmptyValueException(string message)
16+
: base(message)
17+
{ }
18+
19+
/// <summary>
20+
/// Initializes a new instance of the JavaScriptEngineSwitcher.Core.EmptyValueException class
21+
/// with a specified error message and a reference to the inner exception that is the cause of this exception
22+
/// </summary>
23+
/// <param name="message">The error message that explains the reason for the exception</param>
24+
/// <param name="innerException">The exception that is the cause of the current exception</param>
25+
public EmptyValueException(string message, Exception innerException)
26+
: base(message, innerException)
27+
{ }
28+
}
29+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace JavaScriptEngineSwitcher.Core.Helpers
2+
{
3+
using System;
4+
using System.Text;
5+
6+
using Resources;
7+
using Utilities;
8+
9+
/// <summary>
10+
/// JavaScript runtime error helpers
11+
/// </summary>
12+
public static class JsRuntimeErrorHelpers
13+
{
14+
/// <summary>
15+
/// Generates a detailed error message
16+
/// </summary>
17+
/// <param name="jsRuntimeException">JavaScript runtime exception</param>
18+
/// <returns>Detailed error message</returns>
19+
public static string Format(JsRuntimeException jsRuntimeException)
20+
{
21+
var errorMessage = new StringBuilder();
22+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_Message,
23+
jsRuntimeException.Message);
24+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_EngineName,
25+
jsRuntimeException.EngineName);
26+
if (!string.IsNullOrWhiteSpace(jsRuntimeException.ErrorCode))
27+
{
28+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_ErrorCode,
29+
jsRuntimeException.ErrorCode);
30+
}
31+
if (!string.IsNullOrWhiteSpace(jsRuntimeException.Category))
32+
{
33+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_Category,
34+
jsRuntimeException.Category);
35+
}
36+
if (jsRuntimeException.LineNumber > 0)
37+
{
38+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_LineNumber,
39+
jsRuntimeException.LineNumber.ToString());
40+
}
41+
if (jsRuntimeException.ColumnNumber > 0)
42+
{
43+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_ColumnNumber,
44+
jsRuntimeException.ColumnNumber.ToString());
45+
}
46+
if (!string.IsNullOrWhiteSpace(jsRuntimeException.SourceFragment))
47+
{
48+
errorMessage.AppendFormatLine("{1}:{0}{0}{2}", Environment.NewLine,
49+
Strings.ErrorDetails_SourceFragment,
50+
jsRuntimeException.SourceFragment);
51+
}
52+
53+
return errorMessage.ToString();
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)