Skip to content

Commit 31a372f

Browse files
committed
Version 1.0.7
1 parent 9ee0ee4 commit 31a372f

File tree

10 files changed

+185
-30
lines changed

10 files changed

+185
-30
lines changed

MsieJavaScriptEngine.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.5.0")]
35-
[assembly: AssemblyFileVersion("1.0.5.0")]
34+
[assembly: AssemblyVersion("1.0.7.0")]
35+
[assembly: AssemblyFileVersion("1.0.7.0")]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace MsieJavaScriptEngine.ActiveScript
2+
{
3+
using System.Text;
4+
5+
using Resources;
6+
7+
/// <summary>
8+
/// Responsible for formatting Active Script Error Message
9+
/// </summary>
10+
public static class ActiveScriptErrorFormatter
11+
{
12+
/// <summary>
13+
/// Generates a detailed error message
14+
/// </summary>
15+
/// <param name="activeScriptException">Active script exception</param>
16+
/// <param name="filePath">File path</param>
17+
/// <returns>Detailed error message</returns>
18+
public static string Format(ActiveScriptException activeScriptException, string filePath)
19+
{
20+
var errorMessage = new StringBuilder();
21+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_Message,
22+
activeScriptException.Message);
23+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_ErrorCode,
24+
activeScriptException.ErrorCode);
25+
if (activeScriptException.ErrorWCode != 0)
26+
{
27+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_ErrorWCode,
28+
activeScriptException.ErrorWCode);
29+
}
30+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_Subcategory,
31+
activeScriptException.Subcategory);
32+
if (!string.IsNullOrWhiteSpace(activeScriptException.HelpLink))
33+
{
34+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_HelpKeyword,
35+
activeScriptException.HelpLink);
36+
}
37+
errorMessage.AppendFormatLine("{0}: {1}", Strings.ErrorDetails_File, filePath);
38+
39+
return errorMessage.ToString();
40+
}
41+
}
42+
}

MsieJavaScriptEngine/MsieJavaScriptEngine.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<Reference Include="System.Xml" />
4242
</ItemGroup>
4343
<ItemGroup>
44+
<Compile Include="ActiveScript\ActiveScriptErrorFormatter.cs" />
4445
<Compile Include="ActiveScript\ActiveScriptException.cs" />
4546
<Compile Include="ActiveScript\ActiveScriptParserWrapper.cs" />
4647
<Compile Include="ActiveScript\IActiveScript.cs" />
@@ -72,6 +73,7 @@
7273
<DependentUpon>Strings.resx</DependentUpon>
7374
</Compile>
7475
<Compile Include="MsieJsEngine.cs" />
76+
<Compile Include="StringBuilderExtensions.cs" />
7577
<Compile Include="UndefinedValueException.cs" />
7678
<Compile Include="Utils.cs" />
7779
</ItemGroup>

MsieJavaScriptEngine/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.5.0")]
35-
[assembly: AssemblyFileVersion("1.0.5.0")]
34+
[assembly: AssemblyVersion("1.0.7.0")]
35+
[assembly: AssemblyFileVersion("1.0.7.0")]

MsieJavaScriptEngine/Resources/Strings.Designer.cs

Lines changed: 52 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MsieJavaScriptEngine/Resources/Strings.resx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,27 @@
126126
<data name="Common_FileNotExist" xml:space="preserve">
127127
<value>File {0} not exist.</value>
128128
</data>
129-
<data name="Common_ValueIsEmpty" xml:space="preserve">
130-
<value>Value cannot be empty.</value>
131-
</data>
132129
<data name="Common_ValueIsNull" xml:space="preserve">
133130
<value>Value cannot be null.</value>
134131
</data>
132+
<data name="ErrorDetails_ErrorCode" xml:space="preserve">
133+
<value>Error code</value>
134+
</data>
135+
<data name="ErrorDetails_ErrorWCode" xml:space="preserve">
136+
<value>WCode</value>
137+
</data>
138+
<data name="ErrorDetails_File" xml:space="preserve">
139+
<value>File</value>
140+
</data>
141+
<data name="ErrorDetails_HelpKeyword" xml:space="preserve">
142+
<value>Help keyword</value>
143+
</data>
144+
<data name="ErrorDetails_Message" xml:space="preserve">
145+
<value>Message</value>
146+
</data>
147+
<data name="ErrorDetails_Subcategory" xml:space="preserve">
148+
<value>Subcategory</value>
149+
</data>
135150
<data name="Resources_ResourceIsNull" xml:space="preserve">
136151
<value>Resource with name '{0}' is null.</value>
137152
</data>

MsieJavaScriptEngine/Resources/Strings.ru-ru.resx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,27 @@
126126
<data name="Common_FileNotExist" xml:space="preserve">
127127
<value>Файл {0} не существует!</value>
128128
</data>
129-
<data name="Common_ValueIsEmpty" xml:space="preserve">
130-
<value>Значение не должно быть пустым!</value>
131-
</data>
132129
<data name="Common_ValueIsNull" xml:space="preserve">
133130
<value>Значение не должно быть равно null!</value>
134131
</data>
132+
<data name="ErrorDetails_ErrorCode" xml:space="preserve">
133+
<value>Код ошибки</value>
134+
</data>
135+
<data name="ErrorDetails_ErrorWCode" xml:space="preserve">
136+
<value>WCode</value>
137+
</data>
138+
<data name="ErrorDetails_File" xml:space="preserve">
139+
<value>Файл</value>
140+
</data>
141+
<data name="ErrorDetails_HelpKeyword" xml:space="preserve">
142+
<value>Ключевые слова из справки</value>
143+
</data>
144+
<data name="ErrorDetails_Message" xml:space="preserve">
145+
<value>Сообщение об ошибке</value>
146+
</data>
147+
<data name="ErrorDetails_Subcategory" xml:space="preserve">
148+
<value>Подкатегория</value>
149+
</data>
135150
<data name="Resources_ResourceIsNull" xml:space="preserve">
136151
<value>Ресурс с именем "{0}" содержит значение равное null!</value>
137152
</data>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
namespace MsieJavaScriptEngine
2+
{
3+
using System.Text;
4+
using System.Text.RegularExpressions;
5+
6+
/// <summary>
7+
/// Extensions for StringBuilder
8+
/// </summary>
9+
internal static class StringBuilderExtensions
10+
{
11+
/// <summary>
12+
/// Regular expression for format placeholder
13+
/// </summary>
14+
private static readonly Regex _formatPlaceholderRegExp =
15+
new Regex(@"\{[0-9]\}", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
16+
17+
/// <summary>
18+
/// Appends the default line terminator to the end of the current System.Text.StringBuilder object
19+
/// </summary>
20+
/// <param name="sb">Object StringBuilder</param>
21+
/// <returns>Object StringBuilder</returns>
22+
public static StringBuilder AppendFormatLine(this StringBuilder sb)
23+
{
24+
return sb.AppendLine();
25+
}
26+
27+
/// <summary>
28+
/// Appends the string returned by processing a composite format string, which
29+
/// contains zero or more format items, with default line terminator to this instance.
30+
/// Each format item is replaced by the string representation of a corresponding
31+
/// argument in a parameter array.
32+
/// </summary>
33+
/// <param name="sb">Object StringBuilder</param>
34+
/// <param name="format">A composite format string</param>
35+
/// <param name="args">An array of objects to format</param>
36+
/// <returns>Object StringBuilder</returns>
37+
public static StringBuilder AppendFormatLine(this StringBuilder sb, string format, params object[] args)
38+
{
39+
if (_formatPlaceholderRegExp.IsMatch(format))
40+
{
41+
return sb.AppendFormat(format, args).AppendLine();
42+
}
43+
44+
return sb.AppendLine(format.Replace("{{", "{").Replace("}}", "}"));
45+
}
46+
}
47+
}

NuGet/MsieJavaScriptEngine.nuspec

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>MsieJavaScriptEngine</id>
5-
<version>1.0.5</version>
5+
<version>1.0.7</version>
66
<title>MSIE JavaScript Engine for .NET</title>
77
<authors>Andrey Taritsyn</authors>
88
<owners>Andrey Taritsyn</owners>
@@ -12,8 +12,6 @@
1212
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<description>This project is a .NET-wrapper for working with the Internet Explorer's JavaScript engines (Chakra and Classic JavaScript Engine). Project was based on part of the code of the library SassAndCoffee.JavaScript (http://github.com/xpaulbettsx/SassAndCoffee).</description>
1414
<summary>This project is a .NET-wrapper for working with the Internet Explorer's JavaScript engines (Chakra and Classic JavaScript Engine).</summary>
15-
<releaseNotes>1. The JavaScript Array Polyfills from TutorialsPoint.com (http://www.tutorialspoint.com/javascript/) was replaced by the Douglas Crockford's ECMAScript 5 Polyfill (http://nuget.org/packages/ES5);
16-
2. By default using the ECMAScript 5 Polyfill is disabled.</releaseNotes>
1715
<copyright>Copyright 2012 Andrey Taritsyn - http://www.taritsyn.ru</copyright>
1816
<language>en-US</language>
1917
<tags>JavaScript ECMAScript MSIE IE Chakra</tags>

NuGet/readme.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
----------------------------------------------------------------------
4-
README file for MSIE JavaScript Engine for .NET 1.0.5
4+
README file for MSIE JavaScript Engine for .NET 1.0.7
55

66
----------------------------------------------------------------------
77

@@ -15,15 +15,6 @@
1515
JavaScript engines (Chakra and Classic JavaScript Engine).
1616
Project was based on part of the code of the library
1717
SassAndCoffee.JavaScript (http://github.com/xpaulbettsx/SassAndCoffee).
18-
19-
=============
20-
RELEASE NOTES
21-
=============
22-
1. The JavaScript Array Polyfills from TutorialsPoint.com
23-
(http://www.tutorialspoint.com/javascript/) was replaced by
24-
the Douglas Crockford's ECMAScript 5 Polyfill
25-
(http://nuget.org/packages/ES5);
26-
2. By default using the ECMAScript 5 Polyfill is disabled.
2718

2819
============
2920
PROJECT SITE

0 commit comments

Comments
 (0)