Skip to content

Commit a566a06

Browse files
committed
Was made refactoring
1 parent 7476222 commit a566a06

Some content is hidden

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

59 files changed

+1328
-643
lines changed

src/MsieJavaScriptEngine/ActiveScript/ActiveScriptException.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using System;
2-
#if !NETSTANDARD1_3
1+
#if !NETSTANDARD1_3
2+
using System;
33
using System.Runtime.Serialization;
4-
#endif
54
using System.Runtime.InteropServices.ComTypes;
65

76
namespace MsieJavaScriptEngine.ActiveScript
87
{
9-
#if !NETSTANDARD1_3
108
[Serializable]
11-
#endif
129
internal sealed class ActiveScriptException : Exception
1310
{
1411
/// <summary>
@@ -105,7 +102,6 @@ public ActiveScriptException(Exception innerException)
105102
public ActiveScriptException(string message, Exception innerException)
106103
: base(message, innerException)
107104
{ }
108-
#if !NETSTANDARD1_3
109105

110106
/// <summary>
111107
/// Initializes a new instance of the <see cref="ActiveScriptException"/> class
@@ -123,7 +119,6 @@ public ActiveScriptException(string message, Exception innerException)
123119
private ActiveScriptException(SerializationInfo info, StreamingContext context)
124120
: base(info, context)
125121
{ }
126-
#endif
127122

128123

129124
internal static ActiveScriptException Create(IActiveScriptError error)
@@ -197,4 +192,5 @@ internal static ActiveScriptException Create(IActiveScriptError error)
197192
return activeScriptException;
198193
}
199194
}
200-
}
195+
}
196+
#endif

src/MsieJavaScriptEngine/ActiveScript/ActiveScriptJsEngineBase.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23
using System.Collections.Generic;
34
using System.Globalization;
45
using System.Reflection;
@@ -53,7 +54,7 @@ internal abstract class ActiveScriptJsEngineBase : IInnerJsEngine, IActiveScript
5354
/// <summary>
5455
/// List of host items
5556
/// </summary>
56-
private Dictionary<string, object> _hostItems = new Dictionary<string, object>();
57+
private readonly Dictionary<string, object> _hostItems = new Dictionary<string, object>();
5758

5859
/// <summary>
5960
/// Host-defined document version string
@@ -110,7 +111,7 @@ protected ActiveScriptJsEngineBase(string clsid, JsEngineMode engineMode, string
110111
catch (Exception e)
111112
{
112113
throw new JsEngineLoadException(
113-
string.Format(Strings.Runtime_IeJsEngineNotLoaded,
114+
string.Format(CommonStrings.Runtime_IeJsEngineNotLoaded,
114115
_engineModeName, lowerIeVersion, e.Message), _engineModeName);
115116
}
116117

@@ -125,7 +126,7 @@ protected ActiveScriptJsEngineBase(string clsid, JsEngineMode engineMode, string
125126
if (result != (uint)ScriptHResult.Ok)
126127
{
127128
throw new JsEngineLoadException(
128-
string.Format(Strings.Runtime_ActiveScriptLanguageVersionSelectionFailed, languageVersion));
129+
string.Format(NetFrameworkStrings.Runtime_ActiveScriptLanguageVersionSelectionFailed, languageVersion));
129130
}
130131
}
131132
}
@@ -277,7 +278,7 @@ private void InitScriptDispatch()
277278

278279
if (dispatch == null)
279280
{
280-
throw new InvalidOperationException(Strings.Runtime_ActiveScriptDispatcherNotInitialized);
281+
throw new InvalidOperationException(NetFrameworkStrings.Runtime_ActiveScriptDispatcherNotInitialized);
281282
}
282283

283284
_dispatch = dispatch;
@@ -510,13 +511,13 @@ private void ExecuteResource(string resourceName, Type type)
510511
if (string.IsNullOrWhiteSpace(resourceName))
511512
{
512513
throw new ArgumentException(
513-
string.Format(Strings.Common_ArgumentIsEmpty, "resourceName"), "resourceName");
514+
string.Format(CommonStrings.Common_ArgumentIsEmpty, "resourceName"), "resourceName");
514515
}
515516

516517
if (type == null)
517518
{
518519
throw new ArgumentNullException(
519-
"type", string.Format(Strings.Common_ArgumentIsNull, "type"));
520+
"type", string.Format(CommonStrings.Common_ArgumentIsNull, "type"));
520521
}
521522

522523
string code = Utils.GetResourceAsString(resourceName, type);
@@ -557,7 +558,6 @@ private void Dispose(bool disposing)
557558
if (_hostItems != null)
558559
{
559560
_hostItems.Clear();
560-
_hostItems = null;
561561
}
562562

563563
_lastException = null;
@@ -611,7 +611,7 @@ void IActiveScriptSite.GetItemInfo(string name, ScriptInfoFlags mask, ref IntPtr
611611
if (item == null)
612612
{
613613
throw new COMException(
614-
string.Format(Strings.Runtime_ItemNotFound, name), ComErrorCode.ElementNotFound);
614+
string.Format(NetFrameworkStrings.Runtime_ItemNotFound, name), ComErrorCode.ElementNotFound);
615615
}
616616

617617
if (mask.HasFlag(ScriptInfoFlags.IUnknown))
@@ -714,7 +714,7 @@ public object CallFunction(string functionName, params object[] args)
714714
catch (MissingMemberException)
715715
{
716716
throw new JsRuntimeException(
717-
string.Format(Strings.Runtime_FunctionNotExist, functionName));
717+
string.Format(CommonStrings.Runtime_FunctionNotExist, functionName));
718718
}
719719
});
720720

@@ -756,7 +756,7 @@ public object GetVariableValue(string variableName)
756756
catch (MissingMemberException)
757757
{
758758
throw new JsRuntimeException(
759-
string.Format(Strings.Runtime_VariableNotExist, variableName));
759+
string.Format(NetFrameworkStrings.Runtime_VariableNotExist, variableName));
760760
}
761761
});
762762

@@ -811,4 +811,5 @@ public void Dispose()
811811

812812
#endregion
813813
}
814-
}
814+
}
815+
#endif

src/MsieJavaScriptEngine/ActiveScript/ActiveScriptParseWrapper.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23

34
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
45

@@ -77,7 +78,7 @@ public ActiveScriptParseWrapper(IntPtr pActiveScript, IActiveScript activeScript
7778

7879
if (_activeScriptParse64 == null && _activeScriptParse32 == null)
7980
{
80-
throw new NotSupportedException(Strings.Runtime_InvalidParserImplementationError);
81+
throw new NotSupportedException(NetFrameworkStrings.Runtime_InvalidParserImplementationError);
8182
}
8283
}
8384

@@ -306,4 +307,5 @@ public void Dispose()
306307

307308
#endregion
308309
}
309-
}
310+
}
311+
#endif

src/MsieJavaScriptEngine/ActiveScript/ChakraActiveScriptJsEngine.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace MsieJavaScriptEngine.ActiveScript
1+
#if !NETSTANDARD1_3
2+
namespace MsieJavaScriptEngine.ActiveScript
23
{
34
/// <summary>
45
/// ActiveScript version of Chakra JavaScript engine
@@ -38,4 +39,5 @@ public static bool IsSupported()
3839
return isSupported;
3940
}
4041
}
41-
}
42+
}
43+
#endif

src/MsieJavaScriptEngine/ActiveScript/ClassicActiveScriptJsEngine.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace MsieJavaScriptEngine.ActiveScript
1+
#if !NETSTANDARD1_3
2+
namespace MsieJavaScriptEngine.ActiveScript
23
{
34
/// <summary>
45
/// Classic MSIE JavaScript engine
@@ -40,4 +41,5 @@ public static bool IsSupported()
4041
return isSupported;
4142
}
4243
}
43-
}
44+
}
45+
#endif

src/MsieJavaScriptEngine/ActiveScript/IActiveScript.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23
using System.Runtime.InteropServices;
34

45
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
@@ -167,4 +168,5 @@ void InterruptScriptThread(
167168
void Clone(
168169
[Out] [MarshalAs(UnmanagedType.Interface)] out IActiveScript script);
169170
}
170-
}
171+
}
172+
#endif

src/MsieJavaScriptEngine/ActiveScript/IActiveScriptError.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Runtime.InteropServices;
1+
#if !NETSTANDARD1_3
2+
using System.Runtime.InteropServices;
23

34
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
45

@@ -43,4 +44,5 @@ void GetSourcePosition(
4344
void GetSourceLineText(
4445
[Out] [MarshalAs(UnmanagedType.BStr)] out string sourceLine);
4546
}
46-
}
47+
}
48+
#endif

src/MsieJavaScriptEngine/ActiveScript/IActiveScriptParse32.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23
using System.Runtime.InteropServices;
34

45
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
@@ -131,4 +132,5 @@ [In] [MarshalAs(UnmanagedType.LPWStr)] string delimiter,
131132
[Out] out object result,
132133
[Out] out EXCEPINFO exceptionInfo);
133134
}
134-
}
135+
}
136+
#endif

src/MsieJavaScriptEngine/ActiveScript/IActiveScriptParse64.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23
using System.Runtime.InteropServices;
34

45
using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
@@ -131,4 +132,5 @@ [In] [MarshalAs(UnmanagedType.LPWStr)] string delimiter,
131132
[Out] out object result,
132133
[Out] out EXCEPINFO exceptionInfo);
133134
}
134-
}
135+
}
136+
#endif

src/MsieJavaScriptEngine/ActiveScript/IActiveScriptParseWrapper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETSTANDARD1_3
2+
using System;
23
using System.Runtime.InteropServices;
34

45
namespace MsieJavaScriptEngine.ActiveScript
@@ -119,4 +120,5 @@ object ParseScriptText(
119120
uint startingLineNumber,
120121
ScriptTextFlags flags);
121122
}
122-
}
123+
}
124+
#endif

0 commit comments

Comments
 (0)