From fb88bb88a3636dc85c0c100e87b8f5f22f6816d8 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Mon, 24 Dec 2018 01:02:50 +0800 Subject: [PATCH 01/27] [Windows] [BREAKING!] Remove ChakraCore.NET && WPF/Xamarin support --- Windows/ChakraHosting/ChakraHost.cs | 111 +++ .../ChakraHosting.csproj} | 78 +- .../JavaScriptBackgroundWorkItemCallback.cs | 14 + .../JavaScriptBeforeCollectCallback.cs | 10 + Windows/ChakraHosting/JavaScriptContext.cs | 411 ++++++++ .../JavaScriptEngineException.cs | 39 + Windows/ChakraHosting/JavaScriptErrorCode.cs | 193 ++++ Windows/ChakraHosting/JavaScriptException.cs | 69 ++ .../ChakraHosting/JavaScriptFatalException.cs | 39 + .../JavaScriptMemoryAllocationCallback.cs | 17 + .../JavaScriptMemoryEventType.cs | 23 + .../ChakraHosting/JavaScriptNativeFunction.cs | 18 + .../JavaScriptObjectBeforeCollectCallback.cs | 14 + .../JavaScriptObjectFinalizeCallback.cs | 12 + .../JavaScriptProjectionEnqueueCallback.cs | 42 + .../JavaScriptPromiseContinuationCallback.cs | 17 + Windows/ChakraHosting/JavaScriptPropertyId.cs | 141 +++ .../ChakraHosting/JavaScriptPropertyIdType.cs | 17 + Windows/ChakraHosting/JavaScriptRuntime.cs | 225 +++++ .../JavaScriptRuntimeAttributes.cs | 58 ++ .../ChakraHosting/JavaScriptRuntimeVersion.cs | 23 + .../JavaScriptScriptException.cs | 58 ++ ...criptSerializedScriptLoadSourceCallback.cs | 13 + ...avaScriptSerializedScriptUnloadCallback.cs | 9 + .../ChakraHosting/JavaScriptSourceContext.cs | 184 ++++ .../JavaScriptThreadServiceCallback.cs | 18 + .../ChakraHosting/JavaScriptTypedArrayType.cs | 45 + .../ChakraHosting/JavaScriptUsageException.cs | 39 + Windows/ChakraHosting/JavaScriptValue.cs | 875 ++++++++++++++++++ Windows/ChakraHosting/JavaScriptValueType.cs | 73 ++ Windows/ChakraHosting/Native.cs | 460 +++++++++ .../ChakraHosting/Properties/AssemblyInfo.cs | 29 + .../Properties/ChakraHosting.rd.xml | 33 + .../Resources/Resource.designer.cs | 8 +- Windows/Sample/Shiba.UWP.Sample/App.xaml.cs | 8 +- .../Sample/Shiba.UWP.Sample/MainPage.xaml.cs | 12 +- .../Shiba.UWP.Sample/Shiba.UWP.Sample.csproj | 10 +- .../Shiba.WPF.Sample/Shiba.WPF.Sample.csproj | 4 +- .../Sample/Shiba.WPF.Sample/packages.config | 2 +- Windows/Shiba.Forms/Shiba.Forms.csproj | 20 - .../CommonProperty/CommonProperty.cs | 43 - .../CommonProperty/GridProperty.cs | 62 -- .../CommonProperty/RelativeProperty.cs | 38 - Windows/Shiba.Shared/Shiba.Shared.projitems | 35 - Windows/Shiba.Shared/Shiba.Shared.shproj | 13 - Windows/Shiba.Shared/ShibaApp.cs | 46 - .../Shiba.Shared/ViewMappers/InputMapper.cs | 37 - .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes Windows/Shiba.Test/Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes Windows/Shiba.Test/Package.appxmanifest | 46 + Windows/Shiba.Test/Properties/AssemblyInfo.cs | 18 + .../Shiba.Test/Properties/UnitTestApp.rd.xml | 29 + Windows/Shiba.Test/Shiba.Test.csproj | 186 +++- Windows/Shiba.Test/UnitTest.cs | 15 + Windows/Shiba.Test/UnitTest1.cs | 50 - Windows/Shiba.Test/UnitTestApp.xaml | 7 + Windows/Shiba.Test/UnitTestApp.xaml.cs | 102 ++ Windows/Shiba.Test/file1.xml | 7 - Windows/Shiba.UWP/Properties/Shiba.UWP.rd.xml | 33 - Windows/Shiba.WPF/Properties/AssemblyInfo.cs | 53 -- .../Properties/Resources.Designer.cs | 62 -- Windows/Shiba.WPF/Properties/Resources.resx | 117 --- .../Shiba.WPF/Properties/Settings.Designer.cs | 30 - .../Shiba.WPF/Properties/Settings.settings | 7 - Windows/Shiba.WPF/Shiba.WPF.csproj | 97 -- Windows/Shiba.WPF/app.config | 15 - Windows/Shiba.WPF/packages.config | 4 - Windows/Shiba.nuspec | 24 +- Windows/Shiba.sln | 661 ++----------- .../Shiba/CommonProperty/CommonProperty.cs | 21 + Windows/Shiba/CommonProperty/GridProperty.cs | 31 + .../{ => CommonProperty}/ICommonProperty.cs | 5 +- .../Shiba/CommonProperty/RelativeProperty.cs | 18 + Windows/Shiba/Controls/IViewRenderer.cs | 4 +- Windows/Shiba/Controls/View.cs | 233 +++-- .../ConvertExtensions.cs | 173 ++-- Windows/{Shiba.Shared => Shiba}/Converter.cs | 72 +- .../ExtensionExecutors/BindingExecutor.cs | 111 +-- .../IBindingExtensionExecutor.cs | 9 - .../IShibaExtension.cs | 5 +- Windows/{Shiba.Shared => Shiba}/Extensions.cs | 87 +- .../Internal}/Singleton.cs | 0 .../{Shiba.Shared => Shiba}/NativeRenderer.cs | 6 - Windows/Shiba/Parser/ShibaParserWrapper.cs | 50 +- .../Properties/AssemblyInfo.cs | 4 +- Windows/Shiba/Properties/Shiba.rd.xml | 34 + .../Scripting/Conversion/JTokenConversion.cs | 44 +- .../Scripting/Conversion/ObjectConversion.cs | 15 +- .../Scripting/Conversion/PromiseConversion.cs | 70 +- .../Scripting/Conversion/TypeConversion.cs | 7 +- .../Shiba/Scripting/DefaultScriptRuntime.cs | 34 +- Windows/Shiba/Scripting/IScriptRuntime.cs | 2 +- .../Scripting/JavaScriptValueExtension.cs | 9 +- Windows/Shiba/Scripting/Runtime/Http.cs | 7 +- .../Scripting/Runtime/Storage.cs | 24 +- Windows/Shiba/Shiba.cs | 21 +- Windows/Shiba/Shiba.csproj | 211 ++++- Windows/{Shiba.Shared => Shiba}/ShibaHost.cs | 93 +- .../ViewMappers/GridMapper.cs | 25 +- Windows/Shiba/ViewMappers/InputMapper.cs | 27 + .../ViewMappers/ListMapper.cs | 40 +- .../ViewMappers/StackMapper.cs | 29 +- .../ViewMappers/TextMapper.cs | 33 +- .../ViewMappers/ViewMapper.cs | 172 ++-- .../Visitors/ValueVisitor.cs | 129 +-- 110 files changed, 4746 insertions(+), 2417 deletions(-) create mode 100644 Windows/ChakraHosting/ChakraHost.cs rename Windows/{Shiba.UWP/Shiba.UWP.csproj => ChakraHosting/ChakraHosting.csproj} (65%) create mode 100644 Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptContext.cs create mode 100644 Windows/ChakraHosting/JavaScriptEngineException.cs create mode 100644 Windows/ChakraHosting/JavaScriptErrorCode.cs create mode 100644 Windows/ChakraHosting/JavaScriptException.cs create mode 100644 Windows/ChakraHosting/JavaScriptFatalException.cs create mode 100644 Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptMemoryEventType.cs create mode 100644 Windows/ChakraHosting/JavaScriptNativeFunction.cs create mode 100644 Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptPropertyId.cs create mode 100644 Windows/ChakraHosting/JavaScriptPropertyIdType.cs create mode 100644 Windows/ChakraHosting/JavaScriptRuntime.cs create mode 100644 Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs create mode 100644 Windows/ChakraHosting/JavaScriptRuntimeVersion.cs create mode 100644 Windows/ChakraHosting/JavaScriptScriptException.cs create mode 100644 Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptSourceContext.cs create mode 100644 Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs create mode 100644 Windows/ChakraHosting/JavaScriptTypedArrayType.cs create mode 100644 Windows/ChakraHosting/JavaScriptUsageException.cs create mode 100644 Windows/ChakraHosting/JavaScriptValue.cs create mode 100644 Windows/ChakraHosting/JavaScriptValueType.cs create mode 100644 Windows/ChakraHosting/Native.cs create mode 100644 Windows/ChakraHosting/Properties/AssemblyInfo.cs create mode 100644 Windows/ChakraHosting/Properties/ChakraHosting.rd.xml delete mode 100644 Windows/Shiba.Forms/Shiba.Forms.csproj delete mode 100644 Windows/Shiba.Shared/CommonProperty/CommonProperty.cs delete mode 100644 Windows/Shiba.Shared/CommonProperty/GridProperty.cs delete mode 100644 Windows/Shiba.Shared/CommonProperty/RelativeProperty.cs delete mode 100644 Windows/Shiba.Shared/Shiba.Shared.projitems delete mode 100644 Windows/Shiba.Shared/Shiba.Shared.shproj delete mode 100644 Windows/Shiba.Shared/ShibaApp.cs delete mode 100644 Windows/Shiba.Shared/ViewMappers/InputMapper.cs create mode 100644 Windows/Shiba.Test/Assets/LockScreenLogo.scale-200.png create mode 100644 Windows/Shiba.Test/Assets/SplashScreen.scale-200.png create mode 100644 Windows/Shiba.Test/Assets/Square150x150Logo.scale-200.png create mode 100644 Windows/Shiba.Test/Assets/Square44x44Logo.scale-200.png create mode 100644 Windows/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 Windows/Shiba.Test/Assets/StoreLogo.png create mode 100644 Windows/Shiba.Test/Assets/Wide310x150Logo.scale-200.png create mode 100644 Windows/Shiba.Test/Package.appxmanifest create mode 100644 Windows/Shiba.Test/Properties/AssemblyInfo.cs create mode 100644 Windows/Shiba.Test/Properties/UnitTestApp.rd.xml create mode 100644 Windows/Shiba.Test/UnitTest.cs delete mode 100644 Windows/Shiba.Test/UnitTest1.cs create mode 100644 Windows/Shiba.Test/UnitTestApp.xaml create mode 100644 Windows/Shiba.Test/UnitTestApp.xaml.cs delete mode 100644 Windows/Shiba.Test/file1.xml delete mode 100644 Windows/Shiba.UWP/Properties/Shiba.UWP.rd.xml delete mode 100644 Windows/Shiba.WPF/Properties/AssemblyInfo.cs delete mode 100644 Windows/Shiba.WPF/Properties/Resources.Designer.cs delete mode 100644 Windows/Shiba.WPF/Properties/Resources.resx delete mode 100644 Windows/Shiba.WPF/Properties/Settings.Designer.cs delete mode 100644 Windows/Shiba.WPF/Properties/Settings.settings delete mode 100644 Windows/Shiba.WPF/Shiba.WPF.csproj delete mode 100644 Windows/Shiba.WPF/app.config delete mode 100644 Windows/Shiba.WPF/packages.config create mode 100644 Windows/Shiba/CommonProperty/CommonProperty.cs create mode 100644 Windows/Shiba/CommonProperty/GridProperty.cs rename Windows/Shiba/{ => CommonProperty}/ICommonProperty.cs (70%) create mode 100644 Windows/Shiba/CommonProperty/RelativeProperty.cs rename Windows/{Shiba.Shared => Shiba}/ConvertExtensions.cs (56%) rename Windows/{Shiba.Shared => Shiba}/Converter.cs (78%) rename Windows/{Shiba.Shared => Shiba}/ExtensionExecutors/BindingExecutor.cs (55%) rename Windows/{Shiba.Shared => Shiba}/ExtensionExecutors/IBindingExtensionExecutor.cs (66%) rename Windows/Shiba/{ => ExtensionExecutors}/IShibaExtension.cs (79%) rename Windows/{Shiba.Shared => Shiba}/Extensions.cs (54%) rename Windows/{Shiba.Shared => Shiba/Internal}/Singleton.cs (100%) rename Windows/{Shiba.Shared => Shiba}/NativeRenderer.cs (85%) rename Windows/{Shiba.UWP => Shiba}/Properties/AssemblyInfo.cs (91%) create mode 100644 Windows/Shiba/Properties/Shiba.rd.xml rename Windows/{Shiba.Shared => Shiba}/Scripting/Runtime/Storage.cs (74%) rename Windows/{Shiba.Shared => Shiba}/ShibaHost.cs (57%) rename Windows/{Shiba.Shared => Shiba}/ViewMappers/GridMapper.cs (70%) create mode 100644 Windows/Shiba/ViewMappers/InputMapper.cs rename Windows/{Shiba.Shared => Shiba}/ViewMappers/ListMapper.cs (58%) rename Windows/{Shiba.Shared => Shiba}/ViewMappers/StackMapper.cs (62%) rename Windows/{Shiba.Shared => Shiba}/ViewMappers/TextMapper.cs (52%) rename Windows/{Shiba.Shared => Shiba}/ViewMappers/ViewMapper.cs (69%) rename Windows/{Shiba.Shared => Shiba}/Visitors/ValueVisitor.cs (74%) diff --git a/Windows/ChakraHosting/ChakraHost.cs b/Windows/ChakraHosting/ChakraHost.cs new file mode 100644 index 0000000..3946a15 --- /dev/null +++ b/Windows/ChakraHosting/ChakraHost.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Concurrent; +using System.Reflection.Metadata.Ecma335; +using System.Threading; +using System.Threading.Tasks; +using Windows.ApplicationModel.Appointments; + +namespace ChakraHosting +{ + public class ChakraHost : IDisposable + { + private static JavaScriptSourceContext _currentSourceContext = JavaScriptSourceContext.FromIntPtr(IntPtr.Zero); + private static JavaScriptRuntime _runtime; + + private static readonly BlockingCollection TaskQueue = + new BlockingCollection(); + + private static readonly JavaScriptPromiseContinuationCallback PromiseContinuationDelegate = + PromiseContinuationCallback; + + private readonly CancellationTokenSource _shutdownCts = new CancellationTokenSource(); + private JavaScriptContext _context; + + public JavaScriptValue GlobalObject { get; private set; } + + public void Dispose() + { + _runtime.Dispose(); + _shutdownCts.Cancel(); + } + + public ChakraHost() + { + Init(); + } + + public void Init() + { + Native.ThrowIfError(Native.JsCreateRuntime(JavaScriptRuntimeAttributes.None, null, out _runtime)); + Native.ThrowIfError(Native.JsCreateContext(_runtime, out _context)); + WithContext(() => + { + Native.ThrowIfError(Native.JsSetPromiseContinuationCallback(PromiseContinuationDelegate, IntPtr.Zero)); + StartPromiseTaskLoop(_shutdownCts.Token); + Native.ThrowIfError(Native.JsProjectWinRTNamespace("Windows")); + Native.ThrowIfError(Native.JsGetGlobalObject(out var global)); + GlobalObject = global; + }); + //Native.ThrowIfError(Native.JsStartDebugging()); + } + + public void WithContext(Action action) + { + Native.ThrowIfError(Native.JsSetCurrentContext(_context)); + action.Invoke(); + Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); + } + + public T WithContext(Func action) + { + Native.ThrowIfError(Native.JsSetCurrentContext(_context)); + var result = action.Invoke(); + Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); + return result; + } + + public JavaScriptValue RunScript(string script) + { + if (Native.JsRunScript(script, _currentSourceContext++, "", out var result) != JavaScriptErrorCode.NoError) + { + Native.ThrowIfError(Native.JsGetAndClearException(out var exception)); + Native.ThrowIfError(Native.JsGetPropertyIdFromName("message", out var messageName)); + Native.ThrowIfError(Native.JsGetProperty(exception, messageName, out var messageValue)); + return messageValue; + } + + return result; + } + + private static void PromiseContinuationCallback(JavaScriptValue task, IntPtr callbackState) + { + TaskQueue.Add(task); + //task.AddRef(); + } + + private void StartPromiseTaskLoop(CancellationToken token) + { + Task.Factory.StartNew(() => + { + while (true) + { + try + { + if (TaskQueue.Count == 0) continue; + var task = TaskQueue.Take(token); + Native.ThrowIfError(Native.JsSetCurrentContext(_context)); + task.CallFunction(GlobalObject); + task.Release(); + Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); + } + catch (OperationCanceledException e) + { + return; + } + } + } + , token + ); + } + } +} \ No newline at end of file diff --git a/Windows/Shiba.UWP/Shiba.UWP.csproj b/Windows/ChakraHosting/ChakraHosting.csproj similarity index 65% rename from Windows/Shiba.UWP/Shiba.UWP.csproj rename to Windows/ChakraHosting/ChakraHosting.csproj index 5abcf6d..b52335d 100644 --- a/Windows/Shiba.UWP/Shiba.UWP.csproj +++ b/Windows/ChakraHosting/ChakraHosting.csproj @@ -4,19 +4,18 @@ Debug AnyCPU - {0ECE2838-DE51-461F-8386-75D7DE285D53} + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0} Library Properties - Shiba.UWP - Shiba.UWP - zh-CN + ChakraHosting + ChakraHosting + en-US UAP 10.0.17763.0 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 7.2 AnyCPU @@ -44,7 +43,6 @@ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full - x86 false prompt @@ -55,7 +53,6 @@ true ;2008 pdbonly - x86 false prompt @@ -66,7 +63,6 @@ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full - ARM false prompt @@ -77,7 +73,26 @@ true ;2008 pdbonly - ARM + false + prompt + + + ARM64 + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM64 + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly false prompt @@ -88,7 +103,6 @@ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP ;2008 full - x64 false prompt @@ -99,7 +113,6 @@ true ;2008 pdbonly - x64 false prompt @@ -107,19 +120,44 @@ PackageReference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - {d0b763d5-a804-4822-be17-4cf9d0b62488} - Shiba - + + 6.2.3 + - 14.0 diff --git a/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs b/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs new file mode 100644 index 0000000..718b250 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs @@ -0,0 +1,14 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A background work item callback. + /// + /// + /// This is passed to the host's thread service (if provided) to allow the host to + /// invoke the work item callback on the background thread of its choice. + /// + /// Data argument passed to the thread service. + public delegate void JavaScriptBackgroundWorkItemCallback(IntPtr callbackData); +} diff --git a/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs b/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs new file mode 100644 index 0000000..d99a554 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs @@ -0,0 +1,10 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A callback called before collection. + /// + /// The state passed to SetBeforeCollectCallback. + public delegate void JavaScriptBeforeCollectCallback(IntPtr callbackState); +} diff --git a/Windows/ChakraHosting/JavaScriptContext.cs b/Windows/ChakraHosting/JavaScriptContext.cs new file mode 100644 index 0000000..06239ab --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptContext.cs @@ -0,0 +1,411 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A script context. + /// + /// + /// + /// Each script context contains its own global object, distinct from the global object in + /// other script contexts. + /// + /// + /// Many Chakra hosting APIs require an "active" script context, which can be set using + /// Current. Chakra hosting APIs that require a current context to be set will note + /// that explicitly in their documentation. + /// + /// + public struct JavaScriptContext + { + /// + /// The reference. + /// + private readonly IntPtr reference; + + /// + /// Initializes a new instance of the struct. + /// + /// The reference. + internal JavaScriptContext(IntPtr reference) + { + this.reference = reference; + } + + /// + /// Gets an invalid context. + /// + public static JavaScriptContext Invalid + { + get { return new JavaScriptContext(IntPtr.Zero); } + } + + /// + /// Gets or sets the current script context on the thread. + /// + public static JavaScriptContext Current + { + get + { + JavaScriptContext reference; + Native.ThrowIfError(Native.JsGetCurrentContext(out reference)); + return reference; + } + + set + { + Native.ThrowIfError(Native.JsSetCurrentContext(value)); + } + } + + /// + /// Gets a value indicating whether the runtime of the current context is in an exception state. + /// + /// + /// + /// If a call into the runtime results in an exception (either as the result of running a + /// script or due to something like a conversion failure), the runtime is placed into an + /// "exception state." All calls into any context created by the runtime (except for the + /// exception APIs) will fail with InExceptionState until the exception is + /// cleared. + /// + /// + /// If the runtime of the current context is in the exception state when a callback returns + /// into the engine, the engine will automatically rethrow the exception. + /// + /// + /// Requires an active script context. + /// + /// + public static bool HasException + { + get + { + bool hasException; + Native.ThrowIfError(Native.JsHasException(out hasException)); + return hasException; + } + } + + /// + /// Gets the runtime that the context belongs to. + /// + public JavaScriptRuntime Runtime + { + get + { + JavaScriptRuntime handle; + Native.ThrowIfError(Native.JsGetRuntime(this, out handle)); + return handle; + } + } + + /// + /// Gets a value indicating whether the context is a valid context or not. + /// + public bool IsValid + { + get { return reference != IntPtr.Zero; } + } + + /// + /// Tells the runtime to do any idle processing it need to do. + /// + /// + /// + /// If idle processing has been enabled for the current runtime, calling Idle will + /// inform the current runtime that the host is idle and that the runtime can perform + /// memory cleanup tasks. + /// + /// + /// Idle will also return the number of system ticks until there will be more idle work + /// for the runtime to do. Calling Idle before this number of ticks has passed will do + /// no work. + /// + /// + /// Requires an active script context. + /// + /// + /// + /// The next system tick when there will be more idle work to do. Returns the + /// maximum number of ticks if there no upcoming idle work to do. + /// + public static uint Idle() + { + uint ticks; + Native.ThrowIfError(Native.JsIdle(out ticks)); + return ticks; + } + + /// + /// Parses a script and returns a Function representing the script. + /// + /// + /// Requires an active script context. + /// + /// The script to parse. + /// + /// A cookie identifying the script that can be used by script contexts that have debugging enabled. + /// + /// The location the script came from. + /// A Function representing the script code. + public static JavaScriptValue ParseScript(string script, JavaScriptSourceContext sourceContext, string sourceName) + { + JavaScriptValue result; + Native.ThrowIfError(Native.JsParseScript(script, sourceContext, sourceName, out result)); + return result; + } + + /// + /// Parses a serialized script and returns a Function representing the script. + /// + /// + /// Requires an active script context. + /// + /// The script to parse. + /// The serialized script. + /// + /// A cookie identifying the script that can be used by script contexts that have debugging enabled. + /// + /// The location the script came from. + /// A Function representing the script code. + public static JavaScriptValue ParseScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceName) + { + JavaScriptValue result; + Native.ThrowIfError(Native.JsParseSerializedScript(script, buffer, sourceContext, sourceName, out result)); + return result; + } + + /// + /// Parses a script and returns a Function representing the script. + /// + /// + /// Requires an active script context. + /// + /// The script to parse. + /// A Function representing the script code. + public static JavaScriptValue ParseScript(string script) + { + return ParseScript(script, JavaScriptSourceContext.None, string.Empty); + } + + /// + /// Parses a serialized script and returns a Function representing the script. + /// + /// + /// Requires an active script context. + /// + /// The script to parse. + /// The serialized script. + /// A Function representing the script code. + public static JavaScriptValue ParseScript(string script, byte[] buffer) + { + return ParseScript(script, buffer, JavaScriptSourceContext.None, string.Empty); + } + + /// + /// Executes a script. + /// + /// + /// Requires an active script context. + /// + /// The script to run. + /// + /// A cookie identifying the script that can be used by script contexts that have debugging enabled. + /// + /// The location the script came from. + /// The result of the script, if any. + public static JavaScriptValue RunScript(string script, JavaScriptSourceContext sourceContext, string sourceName) + { + JavaScriptValue result; + Native.ThrowIfError(Native.JsRunScript(script, sourceContext, sourceName, out result)); + return result; + } + + /// + /// Runs a serialized script. + /// + /// + /// Requires an active script context. + /// + /// The source code of the serialized script. + /// The serialized script. + /// + /// A cookie identifying the script that can be used by script contexts that have debugging enabled. + /// + /// The location the script came from. + /// The result of the script, if any. + public static JavaScriptValue RunScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceName) + { + JavaScriptValue result; + Native.ThrowIfError(Native.JsRunSerializedScript(script, buffer, sourceContext, sourceName, out result)); + return result; + } + + /// + /// Executes a script. + /// + /// + /// Requires an active script context. + /// + /// The script to run. + /// The result of the script, if any. + public static JavaScriptValue RunScript(string script) + { + return RunScript(script, JavaScriptSourceContext.None, string.Empty); + } + + /// + /// Runs a serialized script. + /// + /// + /// Requires an active script context. + /// + /// The source code of the serialized script. + /// The serialized script. + /// The result of the script, if any. + public static JavaScriptValue RunScript(string script, byte[] buffer) + { + return RunScript(script, buffer, JavaScriptSourceContext.None, string.Empty); + } + + /// + /// Serializes a parsed script to a buffer than can be reused. + /// + /// + /// + /// SerializeScript parses a script and then stores the parsed form of the script in a + /// runtime-independent format. The serialized script then can be deserialized in any + /// runtime without requiring the script to be re-parsed. + /// + /// + /// Requires an active script context. + /// + /// + /// The script to serialize. + /// The buffer to put the serialized script into. Can be null. + /// + /// The size of the buffer, in bytes, required to hold the serialized script. + /// + public static ulong SerializeScript(string script, byte[] buffer) + { + var bufferSize = (ulong)buffer.Length; + Native.ThrowIfError(Native.JsSerializeScript(script, buffer, ref bufferSize)); + return bufferSize; + } + + /// + /// Returns the exception that caused the runtime of the current context to be in the + /// exception state and resets the exception state for that runtime. + /// + /// + /// + /// If the runtime of the current context is not in an exception state, this API will throw + /// JsErrorInvalidArgument. If the runtime is disabled, this will return an exception + /// indicating that the script was terminated, but it will not clear the exception (the + /// exception will be cleared if the runtime is re-enabled using + /// EnableRuntimeExecution). + /// + /// + /// Requires an active script context. + /// + /// + /// The exception for the runtime of the current context. + public static JavaScriptValue GetAndClearException() + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsGetAndClearException(out reference)); + return reference; + } + + /// + /// Sets the runtime of the current context to an exception state. + /// + /// + /// + /// If the runtime of the current context is already in an exception state, this API will + /// throw JsErrorInExceptionState. + /// + /// + /// Requires an active script context. + /// + /// + /// + /// The JavaScript exception to set for the runtime of the current context. + /// + public static void SetException(JavaScriptValue exception) + { + Native.ThrowIfError(Native.JsSetException(exception)); + } + + /// + /// Adds a reference to a script context. + /// + /// + /// Calling AddRef ensures that the context will not be freed until Release is called. + /// + /// The object's new reference count. + public uint AddRef() + { + uint count; + Native.ThrowIfError(Native.JsContextAddRef(this, out count)); + return count; + } + + /// + /// Releases a reference to a script context. + /// + /// + /// Removes a reference to a context that was created by AddRef. + /// + /// The object's new reference count. + public uint Release() + { + uint count; + Native.ThrowIfError(Native.JsContextRelease(this, out count)); + return count; + } + + /// + /// A scope automatically sets a context to current and resets the original context + /// when disposed. + /// + public struct Scope : IDisposable + { + /// + /// The previous context. + /// + private readonly JavaScriptContext previousContext; + + /// + /// Whether the structure has been disposed. + /// + private bool disposed; + + /// + /// Initializes a new instance of the struct. + /// + /// The context to create the scope for. + public Scope(JavaScriptContext context) + { + disposed = false; + previousContext = Current; + Current = context; + } + + /// + /// Disposes the scope and sets the previous context to current. + /// + public void Dispose() + { + if (disposed) + { + return; + } + + Current = previousContext; + disposed = true; + } + } + } +} diff --git a/Windows/ChakraHosting/JavaScriptEngineException.cs b/Windows/ChakraHosting/JavaScriptEngineException.cs new file mode 100644 index 0000000..211badf --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptEngineException.cs @@ -0,0 +1,39 @@ +using System; + +namespace ChakraHosting +{ + /// + /// An exception that occurred in the workings of the JavaScript engine itself. + /// + public sealed class JavaScriptEngineException : JavaScriptException + { + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + public JavaScriptEngineException(JavaScriptErrorCode code) : + this(code, "A fatal exception has occurred in a JavaScript runtime") + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The error message. + public JavaScriptEngineException(JavaScriptErrorCode code, string message) : + base(code, message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The serialization info. + /// The streaming context. + private JavaScriptEngineException(string message, Exception innerException) : + base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptErrorCode.cs b/Windows/ChakraHosting/JavaScriptErrorCode.cs new file mode 100644 index 0000000..f6e31b3 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptErrorCode.cs @@ -0,0 +1,193 @@ +namespace ChakraHosting +{ + /// + /// An error code returned from a Chakra hosting API. + /// + public enum JavaScriptErrorCode : uint + { + /// + /// Success error code. + /// + NoError = 0, + + /// + /// Category of errors that relates to incorrect usage of the API itself. + /// + CategoryUsage = 0x10000, + + /// + /// An argument to a hosting API was invalid. + /// + InvalidArgument, + + /// + /// An argument to a hosting API was null in a context where null is not allowed. + /// + NullArgument, + + /// + /// The hosting API requires that a context be current, but there is no current context. + /// + NoCurrentContext, + + /// + /// The engine is in an exception state and no APIs can be called until the exception is + /// cleared. + /// + InExceptionState, + + /// + /// A hosting API is not yet implemented. + /// + NotImplemented, + + /// + /// A hosting API was called on the wrong thread. + /// + WrongThread, + + /// + /// A runtime that is still in use cannot be disposed. + /// + RuntimeInUse, + + /// + /// A bad serialized script was used, or the serialized script was serialized by a + /// different version of the Chakra engine. + /// + BadSerializedScript, + + /// + /// The runtime is in a disabled state. + /// + InDisabledState, + + /// + /// Runtime does not support reliable script interruption. + /// + CannotDisableExecution, + + /// + /// A heap enumeration is currently underway in the script context. + /// + HeapEnumInProgress, + + /// + /// A hosting API that operates on object values was called with a non-object value. + /// + ArgumentNotObject, + + /// + /// A script context is in the middle of a profile callback. + /// + InProfileCallback, + + /// + /// A thread service callback is currently underway. + /// + InThreadServiceCallback, + + /// + /// Scripts cannot be serialized in debug contexts. + /// + CannotSerializeDebugScript, + + /// + /// The context cannot be put into a debug state because it is already in a debug state. + /// + AlreadyDebuggingContext, + + /// + /// The context cannot start profiling because it is already profiling. + /// + AlreadyProfilingContext, + + /// + /// Idle notification given when the host did not enable idle processing. + /// + IdleNotEnabled, + + /// + /// The context did not accept the enqueue callback. + /// + CannotSetProjectionEnqueueCallback, + + /// + /// Failed to start projection. + /// + CannotStartProjection, + + /// + /// The operation is not supported in an object before collect callback. + /// + InObjectBeforeCollectCallback, + + /// + /// Object cannot be unwrapped to IInspectable pointer. + /// + ObjectNotInspectable, + + /// + /// A hosting API that operates on symbol property ids but was called with a non-symbol property id. + /// The error code is returned by JsGetSymbolFromPropertyId if the function is called with non-symbol property id. + /// + PropertyNotSymbol, + + /// + /// A hosting API that operates on string property ids but was called with a non-string property id. + /// The error code is returned by existing JsGetPropertyNamefromId if the function is called with non-string property id. + /// + PropertyNotString, + + /// + /// Category of errors that relates to errors occurring within the engine itself. + /// + CategoryEngine = 0x20000, + + /// + /// The Chakra engine has run out of memory. + /// + OutOfMemory, + + /// + /// Category of errors that relates to errors in a script. + /// + CategoryScript = 0x30000, + + /// + /// A JavaScript exception occurred while running a script. + /// + ScriptException, + + /// + /// JavaScript failed to compile. + /// + ScriptCompile, + + /// + /// A script was terminated due to a request to suspend a runtime. + /// + ScriptTerminated, + + /// + /// A script was terminated because it tried to use eval or function and eval + /// was disabled. + /// + ScriptEvalDisabled, + + /// + /// Category of errors that are fatal and signify failure of the engine. + /// + CategoryFatal = 0x40000, + + /// + /// A fatal error in the engine has occurred. + /// + Fatal, + + /// + /// A hosting API was called with object created on different javascript runtime. + /// + WrongRuntime, + } +} diff --git a/Windows/ChakraHosting/JavaScriptException.cs b/Windows/ChakraHosting/JavaScriptException.cs new file mode 100644 index 0000000..a3716b5 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptException.cs @@ -0,0 +1,69 @@ +using System; + +namespace ChakraHosting +{ + /// + /// An exception returned from the Chakra engine. + /// + public class JavaScriptException : Exception + { + /// + /// The error code. + /// + private readonly JavaScriptErrorCode code; + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + public JavaScriptException(JavaScriptErrorCode code) : + this(code, "A fatal exception has occurred in a JavaScript runtime") + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The error message. + public JavaScriptException(JavaScriptErrorCode code, string message) : + base(message) + { + this.code = code; + } + + /// + /// Initializes a new instance of the class. + /// + /// The serialization info. + /// The streaming context. + protected JavaScriptException(string message, Exception innerException) : + base(message, innerException) + { + if (message != null) + { + code = (JavaScriptErrorCode) base.HResult; + } + } + + /* + /// + /// Serializes the exception information. + /// + /// The serialization information. + /// The streaming context. + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("code", (uint)code); + } + */ + /// + /// Gets the error code. + /// + public JavaScriptErrorCode ErrorCode + { + get { return code; } + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptFatalException.cs b/Windows/ChakraHosting/JavaScriptFatalException.cs new file mode 100644 index 0000000..2e7ae80 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptFatalException.cs @@ -0,0 +1,39 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A fatal exception occurred. + /// + public sealed class JavaScriptFatalException : JavaScriptException + { + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + public JavaScriptFatalException(JavaScriptErrorCode code) : + this(code, "A fatal exception has occurred in a JavaScript runtime") + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The error message. + public JavaScriptFatalException(JavaScriptErrorCode code, string message) : + base(code, message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The serialization info. + /// The streaming context. + private JavaScriptFatalException(string message, Exception innerException) : + base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs b/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs new file mode 100644 index 0000000..4fa3bd6 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs @@ -0,0 +1,17 @@ +using System; + +namespace ChakraHosting +{ + /// + /// User implemented callback routine for memory allocation events + /// + /// The state passed to SetRuntimeMemoryAllocationCallback. + /// The type of type allocation event. + /// The size of the allocation. + /// + /// For the Allocate event, returning true allows the runtime to continue with + /// allocation. Returning false indicates the allocation request is rejected. The return value + /// is ignored for other allocation events. + /// + public delegate bool JavaScriptMemoryAllocationCallback(IntPtr callbackState, JavaScriptMemoryEventType allocationEvent, UIntPtr allocationSize); +} diff --git a/Windows/ChakraHosting/JavaScriptMemoryEventType.cs b/Windows/ChakraHosting/JavaScriptMemoryEventType.cs new file mode 100644 index 0000000..f1d9d7f --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptMemoryEventType.cs @@ -0,0 +1,23 @@ +namespace ChakraHosting +{ + /// + /// Allocation callback event type. + /// + public enum JavaScriptMemoryEventType + { + /// + /// Indicates a request for memory allocation. + /// + Allocate = 0, + + /// + /// Indicates a memory freeing event. + /// + Free = 1, + + /// + /// Indicates a failed allocation event. + /// + Failure = 2 + } +} diff --git a/Windows/ChakraHosting/JavaScriptNativeFunction.cs b/Windows/ChakraHosting/JavaScriptNativeFunction.cs new file mode 100644 index 0000000..a6bfcb1 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptNativeFunction.cs @@ -0,0 +1,18 @@ +using System; +using System.Runtime.InteropServices; + +namespace ChakraHosting +{ + /// + /// A function callback. + /// + /// + /// A Function object that represents the function being invoked. + /// + /// Indicates whether this is a regular call or a 'new' call. + /// The arguments to the call. + /// The number of arguments. + /// Callback data, if any. + /// The result of the call, if any. + public delegate JavaScriptValue JavaScriptNativeFunction(JavaScriptValue callee, [MarshalAs(UnmanagedType.U1)] bool isConstructCall, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData); +} diff --git a/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs b/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs new file mode 100644 index 0000000..8d268fb --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs @@ -0,0 +1,14 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A callback called before collecting an object. + /// + /// + /// Use JsSetObjectBeforeCollectCallback to register this callback. + /// + /// The object to be collected. + /// The state passed to JsSetObjectBeforeCollectCallback. + public delegate void JavaScriptObjectBeforeCollectCallback(JavaScriptValue reference, IntPtr callbackState); +} diff --git a/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs b/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs new file mode 100644 index 0000000..7f7d608 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs @@ -0,0 +1,12 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A finalization callback. + /// + /// + /// The external data that was passed in when creating the object being finalized. + /// + public delegate void JavaScriptObjectFinalizeCallback(IntPtr data); +} diff --git a/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs b/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs new file mode 100644 index 0000000..aa03e65 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs @@ -0,0 +1,42 @@ +using System; + +namespace ChakraHosting +{ + /// + /// The context passed into application callback, JsProjectionEnqueueCallback, from Jsrt and + /// then passed back to Jsrt in the provided callback, JsProjectionCallback, by the application + /// on the correct thread. + /// + /// + /// Requires calling JsSetProjectionEnqueueCallback to receive callbacks. + /// + public struct JavaScriptProjectionCallbackContext + { + /// + /// The reference. + /// + private readonly IntPtr reference; + } + + /// + /// The Jsrt callback which should be called with the context passed to JsProjectionEnqueueCallback on + /// the correct thread. + /// + /// + /// Requires calling JsSetProjectionEnqueueCallback to receive callbacks. + /// + /// The context originally received by a call to JsProjectionEnqueueCallback. + public delegate void JavaScriptProjectionCallback(JavaScriptProjectionCallbackContext jsContext); + + /// + /// The application callback which is called by Jsrt when a projection API is completed on + /// a different thread than the original. + /// + /// + /// Requires calling JsSetProjectionEnqueueCallback to receive callbacks. + /// + /// The callback to be invoked on the original thread. + /// The applications context. + /// The Jsrt context that must be passed into jsCallback. + public delegate void JavaScriptProjectionEnqueueCallback(JavaScriptProjectionCallback jsCallback, JavaScriptProjectionCallbackContext jsContext, IntPtr callbackState); +} diff --git a/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs b/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs new file mode 100644 index 0000000..65948da --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs @@ -0,0 +1,17 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A promise continuation callback. + /// + /// + /// The host can specify a promise continuation callback in JsSetPromiseContinuationCallback. If + /// a script creates a task to be run later, then the promise continuation callback will be called with + /// the task and the task should be put in a FIFO queue, to be run when the current script is + /// done executing. + /// + /// The task, represented as a JavaScript function. + /// The data argument to be passed to the callback. + public delegate void JavaScriptPromiseContinuationCallback(JavaScriptValue task, IntPtr callbackState); +} diff --git a/Windows/ChakraHosting/JavaScriptPropertyId.cs b/Windows/ChakraHosting/JavaScriptPropertyId.cs new file mode 100644 index 0000000..f2d0aa0 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptPropertyId.cs @@ -0,0 +1,141 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A property identifier. + /// + /// + /// Property identifiers are used to refer to properties of JavaScript objects instead of using + /// strings. + /// + public struct JavaScriptPropertyId : IEquatable + { + /// + /// The id. + /// + private readonly IntPtr id; + + /// + /// Initializes a new instance of the struct. + /// + /// The ID. + internal JavaScriptPropertyId(IntPtr id) + { + this.id = id; + } + + /// + /// Gets an invalid ID. + /// + public static JavaScriptPropertyId Invalid + { + get { return new JavaScriptPropertyId(IntPtr.Zero); } + } + + /// + /// Gets the name associated with the property ID. + /// + /// + /// + /// Requires an active script context. + /// + /// + public string Name + { + get + { + string name; + Native.ThrowIfError(Native.JsGetPropertyNameFromId(this, out name)); + return name; + } + } + + /// + /// Gets the property ID associated with the name. + /// + /// + /// + /// Property IDs are specific to a context and cannot be used across contexts. + /// + /// + /// Requires an active script context. + /// + /// + /// + /// The name of the property ID to get or create. The name may consist of only digits. + /// + /// The property ID in this runtime for the given name. + public static JavaScriptPropertyId FromString(string name) + { + JavaScriptPropertyId id; + Native.ThrowIfError(Native.JsGetPropertyIdFromName(name, out id)); + return id; + } + + /// + /// The equality operator for property IDs. + /// + /// The first property ID to compare. + /// The second property ID to compare. + /// Whether the two property IDs are the same. + public static bool operator ==(JavaScriptPropertyId left, JavaScriptPropertyId right) + { + return left.Equals(right); + } + + /// + /// The inequality operator for property IDs. + /// + /// The first property ID to compare. + /// The second property ID to compare. + /// Whether the two property IDs are not the same. + public static bool operator !=(JavaScriptPropertyId left, JavaScriptPropertyId right) + { + return !left.Equals(right); + } + + /// + /// Checks for equality between property IDs. + /// + /// The other property ID to compare. + /// Whether the two property IDs are the same. + public bool Equals(JavaScriptPropertyId other) + { + return id == other.id; + } + + /// + /// Checks for equality between property IDs. + /// + /// The other property ID to compare. + /// Whether the two property IDs are the same. + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + return obj is JavaScriptPropertyId && Equals((JavaScriptPropertyId)obj); + } + + /// + /// The hash code. + /// + /// The hash code of the property ID. + public override int GetHashCode() + { + return id.ToInt32(); + } + + /// + /// Converts the property ID to a string. + /// + /// The name of the property ID. + public override string ToString() + { + return Name; + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptPropertyIdType.cs b/Windows/ChakraHosting/JavaScriptPropertyIdType.cs new file mode 100644 index 0000000..b4ec45e --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptPropertyIdType.cs @@ -0,0 +1,17 @@ +namespace ChakraHosting +{ + /// + /// Type enumeration of a JavaScript property + /// + public enum JavaScriptPropertyIdType + { + /// + /// Type enumeration of a JavaScript string property + /// + String, + /// + /// Type enumeration of a JavaScript symbol property + /// + Symbol + }; +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptRuntime.cs b/Windows/ChakraHosting/JavaScriptRuntime.cs new file mode 100644 index 0000000..1e1a0e4 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptRuntime.cs @@ -0,0 +1,225 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A Chakra runtime. + /// + /// + /// + /// Each Chakra runtime has its own independent execution engine, JIT compiler, and garbage + /// collected heap. As such, each runtime is completely isolated from other runtimes. + /// + /// + /// Runtimes can be used on any thread, but only one thread can call into a runtime at any + /// time. + /// + /// + /// NOTE: A JavaScriptRuntime, unlike other objects in the Chakra hosting API, is not + /// garbage collected since it contains the garbage collected heap itself. A runtime will + /// continue to exist until Dispose is called. + /// + /// + public struct JavaScriptRuntime : IDisposable + { + /// + /// The handle. + /// + private IntPtr handle; + + /// + /// Gets a value indicating whether the runtime is valid. + /// + public bool IsValid + { + get { return handle != IntPtr.Zero; } + } + + /// + /// Gets the current memory usage for a runtime. + /// + /// + /// Memory usage can be always be retrieved, regardless of whether or not the runtime is active + /// on another thread. + /// + public UIntPtr MemoryUsage + { + get + { + UIntPtr memoryUsage; + Native.ThrowIfError(Native.JsGetRuntimeMemoryUsage(this, out memoryUsage)); + return memoryUsage; + } + } + + /// + /// Gets or sets the current memory limit for a runtime. + /// + /// + /// The memory limit of a runtime can be always be retrieved, regardless of whether or not the + /// runtime is active on another thread. + /// + public UIntPtr MemoryLimit + { + get + { + UIntPtr memoryLimit; + Native.ThrowIfError(Native.JsGetRuntimeMemoryLimit(this, out memoryLimit)); + return memoryLimit; + } + + set + { + Native.ThrowIfError(Native.JsSetRuntimeMemoryLimit(this, value)); + } + } + + /// + /// Gets or sets a value indicating whether script execution is disabled in the runtime. + /// + public bool Disabled + { + get + { + bool isDisabled; + Native.ThrowIfError(Native.JsIsRuntimeExecutionDisabled(this, out isDisabled)); + return isDisabled; + } + + set + { + Native.ThrowIfError(value + ? Native.JsDisableRuntimeExecution(this) + : Native.JsEnableRuntimeExecution(this)); + } + } + + /// + /// Creates a new runtime. + /// + /// The attributes of the runtime to be created. + /// The version of the runtime to be created. + /// The thread service for the runtime. Can be null. + /// The runtime created. + public static JavaScriptRuntime Create(JavaScriptRuntimeAttributes attributes, JavaScriptRuntimeVersion version, JavaScriptThreadServiceCallback threadServiceCallback) + { + JavaScriptRuntime handle; + Native.ThrowIfError(Native.JsCreateRuntime(attributes, threadServiceCallback, out handle)); + return handle; + } + + /// + /// Creates a new runtime. + /// + /// The attributes of the runtime to be created. + /// The version of the runtime to be created. + /// The runtime created. + public static JavaScriptRuntime Create(JavaScriptRuntimeAttributes attributes, JavaScriptRuntimeVersion version) + { + return Create(attributes, version, null); + } + + /// + /// Creates a new runtime. + /// + /// The runtime created. + public static JavaScriptRuntime Create() + { + return Create(JavaScriptRuntimeAttributes.None, JavaScriptRuntimeVersion.Version11, null); + } + + /// + /// Disposes a runtime. + /// + /// + /// Once a runtime has been disposed, all resources owned by it are invalid and cannot be used. + /// If the runtime is active (i.e. it is set to be current on a particular thread), it cannot + /// be disposed. + /// + public void Dispose() + { + if (IsValid) + { + Native.ThrowIfError(Native.JsDisposeRuntime(this)); + } + + handle = IntPtr.Zero; + } + + /// + /// Performs a full garbage collection. + /// + public void CollectGarbage() + { + Native.ThrowIfError(Native.JsCollectGarbage(this)); + } + + /// + /// Sets a memory allocation callback for specified runtime + /// + /// + /// + /// Registering a memory allocation callback will cause the runtime to call back to the host + /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is + /// called before the runtime memory manager allocates a block of memory. The allocation will + /// be rejected if the callback returns false. The runtime memory manager will also invoke the + /// callback routine after freeing a block of memory, as well as after allocation failures. + /// + /// + /// The callback is invoked on the current runtime execution thread, therefore execution is + /// blocked until the callback completes. + /// + /// + /// The return value of the callback is not stored; previously rejected allocations will not + /// prevent the runtime from invoking the callback again later for new memory allocations. + /// + /// + /// + /// User provided state that will be passed back to the callback. + /// + /// + /// Memory allocation callback to be called for memory allocation events. + /// + public void SetMemoryAllocationCallback(IntPtr callbackState, JavaScriptMemoryAllocationCallback allocationCallback) + { + Native.ThrowIfError(Native.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback)); + } + + /// + /// Sets a callback function that is called by the runtime before garbage collection. + /// + /// + /// + /// The callback is invoked on the current runtime execution thread, therefore execution is + /// blocked until the callback completes. + /// + /// + /// The callback can be used by hosts to prepare for garbage collection. For example, by + /// releasing unnecessary references on Chakra objects. + /// + /// + /// + /// User provided state that will be passed back to the callback. + /// + /// The callback function being set. + public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback) + { + Native.ThrowIfError(Native.JsSetRuntimeBeforeCollectCallback(this, callbackState, beforeCollectCallback)); + } + + /// + /// Creates a script context for running scripts. + /// + /// + /// Each script context has its own global object that is isolated from all other script + /// contexts. + /// + /// The created script context. + public JavaScriptContext CreateContext() + { + JavaScriptContext reference; + Native.ThrowIfError(Native.JsCreateContext(this, out reference)); + return reference; + } + } +} diff --git a/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs b/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs new file mode 100644 index 0000000..4ff4d40 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs @@ -0,0 +1,58 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +namespace ChakraHosting +{ + /// + /// Attributes of a runtime. + /// + [Flags] + public enum JavaScriptRuntimeAttributes + { + /// + /// No special attributes. + /// + None = 0x00000000, + + /// + /// The runtime will not do any work (such as garbage collection) on background threads. + /// + DisableBackgroundWork = 0x00000001, + + /// + /// The runtime should support reliable script interruption. This increases the number of + /// places where the runtime will check for a script interrupt request at the cost of a + /// small amount of runtime performance. + /// + AllowScriptInterrupt = 0x00000002, + + /// + /// Host will call Idle, so enable idle processing. Otherwise, the runtime will manage + /// memory slightly more aggressively. + /// + EnableIdleProcessing = 0x00000004, + + /// + /// Runtime will not generate native code. + /// + DisableNativeCodeGeneration = 0x00000008, + + /// + /// Using Eval or Function constructor will throw an exception. + /// + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Eval is a valid function name.")] + DisableEval = 0x00000010, + + /// + /// Runtime will enable all experimental features. + /// + /// + EnableExperimentalFeatures = 0x00000020, + + /// + /// Calling JsSetException will also dispatch the exception to the script debugger + /// (if any) giving the debugger a chance to break on the exception. + /// + DispatchSetExceptionsToDebugger = 0x00000040 + } +} diff --git a/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs b/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs new file mode 100644 index 0000000..1a2cc2c --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs @@ -0,0 +1,23 @@ +namespace ChakraHosting +{ + /// + /// Version of the runtime. + /// + public enum JavaScriptRuntimeVersion + { + /// + /// Create runtime with IE10 version. + /// + Version10 = 0, + + /// + /// Create runtime with IE11 version. + /// + Version11 = 1, + + /// + /// Create runtime with highest version present on the machine at runtime. + /// + VersionEdge = -1, + } +} diff --git a/Windows/ChakraHosting/JavaScriptScriptException.cs b/Windows/ChakraHosting/JavaScriptScriptException.cs new file mode 100644 index 0000000..7e50f0d --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptScriptException.cs @@ -0,0 +1,58 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A script exception. + /// + public sealed class JavaScriptScriptException : JavaScriptException + { + /// + /// The error. + /// + private readonly JavaScriptValue error; + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The JavaScript error object. + public JavaScriptScriptException(JavaScriptErrorCode code, JavaScriptValue error) : + this(code, error, "JavaScript Exception") + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The JavaScript error object. + /// The error message. + public JavaScriptScriptException(JavaScriptErrorCode code, JavaScriptValue error, string message) : + base(code, message) + { + this.error = error; + } + + /// + /// Initializes a new instance of the class. + /// + /// The serialization info. + /// The streaming context. + private JavaScriptScriptException(string message, Exception innerException) : + base(message, innerException) + { + } + + /// + /// Gets a JavaScript object representing the script error. + /// + public JavaScriptValue Error + { + get + { + return error; + } + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs b/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs new file mode 100644 index 0000000..b46d8ac --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs @@ -0,0 +1,13 @@ +namespace ChakraHosting +{ + /// + /// Called by the runtime to load the source code of the serialized script. + /// The caller must keep the script buffer valid until the JsSerializedScriptUnloadCallback. + /// + /// The context passed to Js[Parse|Run]SerializedScriptWithCallback + /// The script returned. + /// + /// true if the operation succeeded, false otherwise. + /// + public delegate bool JavaScriptSerializedScriptLoadSourceCallback(JavaScriptSourceContext sourceContext, out string scriptBuffer); +} diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs b/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs new file mode 100644 index 0000000..647634c --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs @@ -0,0 +1,9 @@ +namespace ChakraHosting +{ + /// + /// Called by the runtime when it is finished with all resources related to the script execution. + /// The caller should free the source if loaded, the byte code, and the context at this time. + /// + /// The context passed to Js[Parse|Run]SerializedScriptWithCallback + public delegate void JavaScriptSerializedScriptUnloadCallback(JavaScriptSourceContext sourceContext); +} diff --git a/Windows/ChakraHosting/JavaScriptSourceContext.cs b/Windows/ChakraHosting/JavaScriptSourceContext.cs new file mode 100644 index 0000000..59078e0 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptSourceContext.cs @@ -0,0 +1,184 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A cookie that identifies a script for debugging purposes. + /// + public struct JavaScriptSourceContext : IEquatable + { + /// + /// The context. + /// + private readonly IntPtr context; + + /// + /// Initializes a new instance of the struct. + /// + /// The context. + private JavaScriptSourceContext(IntPtr context) + { + this.context = context; + } + + /// + /// Gets an empty source context. + /// + public static JavaScriptSourceContext None + { + get { return new JavaScriptSourceContext(new IntPtr(-1)); } + } + + /// + /// The equality operator for source contexts. + /// + /// The first source context to compare. + /// The second source context to compare. + /// Whether the two source contexts are the same. + public static bool operator ==(JavaScriptSourceContext left, JavaScriptSourceContext right) + { + return left.Equals(right); + } + + /// + /// The inequality operator for source contexts. + /// + /// The first source context to compare. + /// The second source context to compare. + /// Whether the two source contexts are not the same. + public static bool operator !=(JavaScriptSourceContext left, JavaScriptSourceContext right) + { + return !left.Equals(right); + } + + /// + /// Subtracts an offset from the value of the source context. + /// + /// The source context to subtract the offset from. + /// The offset to subtract. + /// A new source context that reflects the subtraction of the offset from the context. + public static JavaScriptSourceContext operator -(JavaScriptSourceContext context, int offset) + { + return FromIntPtr(context.context - offset); + } + + /// + /// Subtracts an offset from the value of the source context. + /// + /// The source context to subtract the offset from. + /// The offset to subtract. + /// A new source context that reflects the subtraction of the offset from the context. + public static JavaScriptSourceContext Subtract(JavaScriptSourceContext left, int right) + { + return left - right; + } + + /// + /// Decrements the value of the source context. + /// + /// The source context to decrement. + /// A new source context that reflects the decrementing of the context. + public static JavaScriptSourceContext operator --(JavaScriptSourceContext context) + { + return FromIntPtr(context.context - 1); + } + + /// + /// Decrements the value of the source context. + /// + /// The source context to decrement. + /// A new source context that reflects the decrementing of the context. + public static JavaScriptSourceContext Decrement(JavaScriptSourceContext left) + { + return --left; + } + + /// + /// Adds an offset from the value of the source context. + /// + /// The source context to add the offset to. + /// The offset to add. + /// A new source context that reflects the addition of the offset to the context. + public static JavaScriptSourceContext operator +(JavaScriptSourceContext context, int offset) + { + return FromIntPtr(context.context + offset); + } + + /// + /// Adds an offset from the value of the source context. + /// + /// The source context to add the offset to. + /// The offset to add. + /// A new source context that reflects the addition of the offset to the context. + public static JavaScriptSourceContext Add(JavaScriptSourceContext left, int right) + { + return left + right; + } + + /// + /// Increments the value of the source context. + /// + /// The source context to increment. + /// A new source context that reflects the incrementing of the context. + public static JavaScriptSourceContext operator ++(JavaScriptSourceContext context) + { + return FromIntPtr(context.context + 1); + } + + /// + /// Increments the value of the source context. + /// + /// The source context to increment. + /// A new source context that reflects the incrementing of the context. + public static JavaScriptSourceContext Increment(JavaScriptSourceContext left) + { + return ++left; + } + + /// + /// Creates a new source context. + /// + /// + /// The cookie for the source context. + /// + /// The new source context. + public static JavaScriptSourceContext FromIntPtr(IntPtr cookie) + { + return new JavaScriptSourceContext(cookie); + } + + /// + /// Checks for equality between source contexts. + /// + /// The other source context to compare. + /// Whether the two source contexts are the same. + public bool Equals(JavaScriptSourceContext other) + { + return context == other.context; + } + + /// + /// Checks for equality between source contexts. + /// + /// The other source context to compare. + /// Whether the two source contexts are the same. + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + return obj is JavaScriptSourceContext && Equals((JavaScriptSourceContext)obj); + } + + /// + /// The hash code. + /// + /// The hash code of the source context. + public override int GetHashCode() + { + return context.ToInt32(); + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs b/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs new file mode 100644 index 0000000..a88170d --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs @@ -0,0 +1,18 @@ +using System; + +namespace ChakraHosting +{ + /// + /// A thread service callback. + /// + /// + /// The host can specify a background thread service when creating a runtime. If + /// specified, then background work items will be passed to the host using this callback. The + /// host is expected to either begin executing the background work item immediately and return + /// true or return false and the runtime will handle the work item in-thread. + /// + /// The callback for the background work item. + /// The data argument to be passed to the callback. + /// Whether the thread service will execute the callback. + public delegate bool JavaScriptThreadServiceCallback(JavaScriptBackgroundWorkItemCallback callbackFunction, IntPtr callbackData); +} diff --git a/Windows/ChakraHosting/JavaScriptTypedArrayType.cs b/Windows/ChakraHosting/JavaScriptTypedArrayType.cs new file mode 100644 index 0000000..cd9b518 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptTypedArrayType.cs @@ -0,0 +1,45 @@ +namespace ChakraHosting +{ + /// + /// The type of a typed JavaScript array. + /// + public enum JavaScriptTypedArrayType + { + /// + /// An int8 array. + /// + Int8, + /// + /// An uint8 array. + /// + Uint8, + /// + /// An uint8 clamped array. + /// + Uint8Clamped, + /// + /// An int16 array. + /// + Int16, + /// + /// An uint16 array. + /// + Uint16, + /// + /// An int32 array. + /// + Int32, + /// + /// An uint32 array. + /// + Uint32, + /// + /// A float32 array. + /// + Float32, + /// + /// A float64 array. + /// + Float64 + }; +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptUsageException.cs b/Windows/ChakraHosting/JavaScriptUsageException.cs new file mode 100644 index 0000000..94d19e5 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptUsageException.cs @@ -0,0 +1,39 @@ +using System; + +namespace ChakraHosting +{ + /// + /// An API usage exception occurred. + /// + public sealed class JavaScriptUsageException : JavaScriptException + { + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + public JavaScriptUsageException(JavaScriptErrorCode code) : + this(code, "A fatal exception has occurred in a JavaScript runtime") + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The error code returned. + /// The error message. + public JavaScriptUsageException(JavaScriptErrorCode code, string message) : + base(code, message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The serialization info. + /// The streaming context. + private JavaScriptUsageException(string message, Exception innerException) : + base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptValue.cs b/Windows/ChakraHosting/JavaScriptValue.cs new file mode 100644 index 0000000..3603a04 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptValue.cs @@ -0,0 +1,875 @@ +using System; +using System.Runtime.InteropServices; + +namespace ChakraHosting +{ + /// + /// A JavaScript value. + /// + /// + /// A JavaScript value is one of the following types of values: Undefined, Null, Boolean, + /// String, Number, or Object. + /// + public struct JavaScriptValue + { + /// + /// The reference. + /// + private readonly IntPtr reference; + + /// + /// Initializes a new instance of the struct. + /// + /// The reference. + private JavaScriptValue(IntPtr reference) + { + this.reference = reference; + } + + /// + /// Gets an invalid value. + /// + public static JavaScriptValue Invalid + { + get { return new JavaScriptValue(IntPtr.Zero); } + } + + /// + /// Gets the value of undefined in the current script context. + /// + /// + /// Requires an active script context. + /// + public static JavaScriptValue Undefined + { + get + { + JavaScriptValue value; + Native.ThrowIfError(Native.JsGetUndefinedValue(out value)); + return value; + } + } + + /// + /// Gets the value of null in the current script context. + /// + /// + /// Requires an active script context. + /// + public static JavaScriptValue Null + { + get + { + JavaScriptValue value; + Native.ThrowIfError(Native.JsGetNullValue(out value)); + return value; + } + } + + /// + /// Gets the value of true in the current script context. + /// + /// + /// Requires an active script context. + /// + public static JavaScriptValue True + { + get + { + JavaScriptValue value; + Native.ThrowIfError(Native.JsGetTrueValue(out value)); + return value; + } + } + + /// + /// Gets the value of false in the current script context. + /// + /// + /// Requires an active script context. + /// + public static JavaScriptValue False + { + get + { + JavaScriptValue value; + Native.ThrowIfError(Native.JsGetFalseValue(out value)); + return value; + } + } + + /// + /// Gets the global object in the current script context. + /// + /// + /// Requires an active script context. + /// + public static JavaScriptValue GlobalObject + { + get + { + JavaScriptValue value; + Native.ThrowIfError(Native.JsGetGlobalObject(out value)); + return value; + } + } + + /// + /// Gets a value indicating whether the value is valid. + /// + public bool IsValid + { + get { return reference != IntPtr.Zero; } + } + + /// + /// Gets the JavaScript type of the value. + /// + /// + /// Requires an active script context. + /// + /// The type of the value. + public JavaScriptValueType ValueType + { + get + { + JavaScriptValueType type; + Native.ThrowIfError(Native.JsGetValueType(this, out type)); + return type; + } + } + + /// + /// Gets the length of a String value. + /// + /// + /// Requires an active script context. + /// + /// The length of the string. + public int StringLength + { + get + { + int length; + Native.ThrowIfError(Native.JsGetStringLength(this, out length)); + return length; + } + } + + /// + /// Gets or sets the prototype of an object. + /// + /// + /// Requires an active script context. + /// + public JavaScriptValue Prototype + { + get + { + JavaScriptValue prototypeReference; + Native.ThrowIfError(Native.JsGetPrototype(this, out prototypeReference)); + return prototypeReference; + } + + set + { + Native.ThrowIfError(Native.JsSetPrototype(this, value)); + } + } + + /// + /// Gets a value indicating whether an object is extensible or not. + /// + /// + /// Requires an active script context. + /// + public bool IsExtensionAllowed + { + get + { + bool allowed; + Native.ThrowIfError(Native.JsGetExtensionAllowed(this, out allowed)); + return allowed; + } + } + + /// + /// Gets a value indicating whether an object is an external object. + /// + /// + /// Requires an active script context. + /// + public bool HasExternalData + { + get + { + bool hasExternalData; + Native.ThrowIfError(Native.JsHasExternalData(this, out hasExternalData)); + return hasExternalData; + } + } + + /// + /// Gets or sets the data in an external object. + /// + /// + /// Requires an active script context. + /// + public IntPtr ExternalData + { + get + { + IntPtr data; + Native.ThrowIfError(Native.JsGetExternalData(this, out data)); + return data; + } + + set + { + Native.ThrowIfError(Native.JsSetExternalData(this, value)); + } + } + + /// + /// Creates a Boolean value from a bool value. + /// + /// + /// Requires an active script context. + /// + /// The value to be converted. + /// The converted value. + public static JavaScriptValue FromBoolean(bool value) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsBoolToBoolean(value, out reference)); + return reference; + } + + /// + /// Creates a Number value from a double value. + /// + /// + /// Requires an active script context. + /// + /// The value to be converted. + /// The new Number value. + public static JavaScriptValue FromDouble(double value) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsDoubleToNumber(value, out reference)); + return reference; + } + + /// + /// Creates a Number value from a int value. + /// + /// + /// Requires an active script context. + /// + /// The value to be converted. + /// The new Number value. + public static JavaScriptValue FromInt32(int value) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsIntToNumber(value, out reference)); + return reference; + } + + /// + /// Creates a String value from a string pointer. + /// + /// + /// Requires an active script context. + /// + /// The string to convert to a String value. + /// The new String value. + public static JavaScriptValue FromString(string value) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsPointerToString(value, new UIntPtr((uint)value.Length), out reference)); + return reference; + } + + /// + /// Creates a new Object. + /// + /// + /// Requires an active script context. + /// + /// The new Object. + public static JavaScriptValue CreateObject() + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateObject(out reference)); + return reference; + } + + /// + /// Creates a new Object that stores some external data. + /// + /// + /// Requires an active script context. + /// + /// External data that the object will represent. May be null. + /// + /// A callback for when the object is finalized. May be null. + /// + /// The new Object. + public static JavaScriptValue CreateExternalObject(IntPtr data, JavaScriptObjectFinalizeCallback finalizer) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateExternalObject(data, finalizer, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript function. + /// + /// + /// Requires an active script context. + /// + /// The method to call when the function is invoked. + /// The new function object. + public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateFunction(function, IntPtr.Zero, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript function. + /// + /// + /// Requires an active script context. + /// + /// The method to call when the function is invoked. + /// Data to be provided to all function callbacks. + /// The new function object. + public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function, IntPtr callbackData) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateFunction(function, callbackData, out reference)); + return reference; + } + + /// + /// Creates a JavaScript array object. + /// + /// + /// Requires an active script context. + /// + /// The initial length of the array. + /// The new array object. + public static JavaScriptValue CreateArray(uint length) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateArray(length, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateError(message, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript RangeError error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateRangeError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateRangeError(message, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript ReferenceError error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateReferenceError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateReferenceError(message, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript SyntaxError error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateSyntaxError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateSyntaxError(message, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript TypeError error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateTypeError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateTypeError(message, out reference)); + return reference; + } + + /// + /// Creates a new JavaScript URIError error object + /// + /// + /// Requires an active script context. + /// + /// Message for the error object. + /// The new error object. + public static JavaScriptValue CreateUriError(JavaScriptValue message) + { + JavaScriptValue reference; + Native.ThrowIfError(Native.JsCreateURIError(message, out reference)); + return reference; + } + + /// + /// Adds a reference to the object. + /// + /// + /// This only needs to be called on objects that are not going to be stored somewhere on + /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed + /// until Release is called + /// + /// The object's new reference count. + public uint AddRef() + { + uint count; + Native.ThrowIfError(Native.JsAddRef(this, out count)); + return count; + } + + /// + /// Releases a reference to the object. + /// + /// + /// Removes a reference that was created by AddRef. + /// + /// The object's new reference count. + public uint Release() + { + uint count; + Native.ThrowIfError(Native.JsRelease(this, out count)); + return count; + } + + /// + /// Retrieves the bool value of a Boolean value. + /// + /// + /// Requires an active script context. + /// + /// The converted value. + public bool ToBoolean() + { + bool value; + Native.ThrowIfError(Native.JsBooleanToBool(this, out value)); + return value; + } + + /// + /// Retrieves the double value of a Number value. + /// + /// + /// + /// This function retrieves the value of a Number value. It will fail with + /// InvalidArgument if the type of the value is not Number. + /// + /// + /// Requires an active script context. + /// + /// + /// The double value. + public double ToDouble() + { + double value; + Native.ThrowIfError(Native.JsNumberToDouble(this, out value)); + return value; + } + + /// + /// Retrieves the int value of a Number value. + /// + /// + /// + /// This function retrieves the value of a Number value. It will fail with + /// InvalidArgument if the type of the value is not Number. + /// + /// + /// Requires an active script context. + /// + /// + /// The int value. + public int ToInt32() + { + int value; + Native.ThrowIfError(Native.JsNumberToInt(this, out value)); + return value; + } + + /// + /// Retrieves the string pointer of a String value. + /// + /// + /// + /// This function retrieves the string pointer of a String value. It will fail with + /// InvalidArgument if the type of the value is not String. + /// + /// + /// Requires an active script context. + /// + /// + /// The string. + public new string ToString() + { + IntPtr buffer; + UIntPtr length; + Native.ThrowIfError(Native.JsStringToPointer(this, out buffer, out length)); + return Marshal.PtrToStringUni(buffer, (int)length); + } + + /// + /// Converts the value to Boolean using regular JavaScript semantics. + /// + /// + /// Requires an active script context. + /// + /// The converted value. + public JavaScriptValue ConvertToBoolean() + { + JavaScriptValue booleanReference; + Native.ThrowIfError(Native.JsConvertValueToBoolean(this, out booleanReference)); + return booleanReference; + } + + /// + /// Converts the value to Number using regular JavaScript semantics. + /// + /// + /// Requires an active script context. + /// + /// The converted value. + public JavaScriptValue ConvertToNumber() + { + JavaScriptValue numberReference; + Native.ThrowIfError(Native.JsConvertValueToNumber(this, out numberReference)); + return numberReference; + } + + /// + /// Converts the value to String using regular JavaScript semantics. + /// + /// + /// Requires an active script context. + /// + /// The converted value. + public JavaScriptValue ConvertToString() + { + JavaScriptValue stringReference; + Native.ThrowIfError(Native.JsConvertValueToString(this, out stringReference)); + return stringReference; + } + + /// + /// Converts the value to Object using regular JavaScript semantics. + /// + /// + /// Requires an active script context. + /// + /// The converted value. + public JavaScriptValue ConvertToObject() + { + JavaScriptValue objectReference; + Native.ThrowIfError(Native.JsConvertValueToObject(this, out objectReference)); + return objectReference; + } + + /// + /// Sets an object to not be extensible. + /// + /// + /// Requires an active script context. + /// + public void PreventExtension() + { + Native.ThrowIfError(Native.JsPreventExtension(this)); + } + + /// + /// Gets a property descriptor for an object's own property. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// The property descriptor. + public JavaScriptValue GetOwnPropertyDescriptor(JavaScriptPropertyId propertyId) + { + JavaScriptValue descriptorReference; + Native.ThrowIfError(Native.JsGetOwnPropertyDescriptor(this, propertyId, out descriptorReference)); + return descriptorReference; + } + + /// + /// Gets the list of all properties on the object. + /// + /// + /// Requires an active script context. + /// + /// An array of property names. + public JavaScriptValue GetOwnPropertyNames() + { + JavaScriptValue propertyNamesReference; + Native.ThrowIfError(Native.JsGetOwnPropertyNames(this, out propertyNamesReference)); + return propertyNamesReference; + } + + /// + /// Determines whether an object has a property. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// Whether the object (or a prototype) has the property. + public bool HasProperty(JavaScriptPropertyId propertyId) + { + bool hasProperty; + Native.ThrowIfError(Native.JsHasProperty(this, propertyId, out hasProperty)); + return hasProperty; + } + + /// + /// Gets an object's property. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// The value of the property. + public JavaScriptValue GetProperty(JavaScriptPropertyId id) + { + JavaScriptValue propertyReference; + Native.ThrowIfError(Native.JsGetProperty(this, id, out propertyReference)); + return propertyReference; + } + + /// + /// Sets an object's property. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// The new value of the property. + /// The property set should follow strict mode rules. + public void SetProperty(JavaScriptPropertyId id, JavaScriptValue value, bool useStrictRules) + { + Native.ThrowIfError(Native.JsSetProperty(this, id, value, useStrictRules)); + } + + /// + /// Deletes an object's property. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// The property set should follow strict mode rules. + /// Whether the property was deleted. + public JavaScriptValue DeleteProperty(JavaScriptPropertyId propertyId, bool useStrictRules) + { + JavaScriptValue returnReference; + Native.ThrowIfError(Native.JsDeleteProperty(this, propertyId, useStrictRules, out returnReference)); + return returnReference; + } + + /// + /// Defines a new object's own property from a property descriptor. + /// + /// + /// Requires an active script context. + /// + /// The ID of the property. + /// The property descriptor. + /// Whether the property was defined. + public bool DefineProperty(JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor) + { + bool result; + Native.ThrowIfError(Native.JsDefineProperty(this, propertyId, propertyDescriptor, out result)); + return result; + } + + /// + /// Test if an object has a value at the specified index. + /// + /// + /// Requires an active script context. + /// + /// The index to test. + /// Whether the object has an value at the specified index. + public bool HasIndexedProperty(JavaScriptValue index) + { + bool hasProperty; + Native.ThrowIfError(Native.JsHasIndexedProperty(this, index, out hasProperty)); + return hasProperty; + } + + /// + /// Retrieve the value at the specified index of an object. + /// + /// + /// Requires an active script context. + /// + /// The index to retrieve. + /// The retrieved value. + public JavaScriptValue GetIndexedProperty(JavaScriptValue index) + { + JavaScriptValue propertyReference; + Native.ThrowIfError(Native.JsGetIndexedProperty(this, index, out propertyReference)); + return propertyReference; + } + + /// + /// Set the value at the specified index of an object. + /// + /// + /// Requires an active script context. + /// + /// The index to set. + /// The value to set. + public void SetIndexedProperty(JavaScriptValue index, JavaScriptValue value) + { + Native.ThrowIfError(Native.JsSetIndexedProperty(this, index, value)); + } + + /// + /// Delete the value at the specified index of an object. + /// + /// + /// Requires an active script context. + /// + /// The index to delete. + public void DeleteIndexedProperty(JavaScriptValue index) + { + Native.ThrowIfError(Native.JsDeleteIndexedProperty(this, index)); + } + + /// + /// Compare two JavaScript values for equality. + /// + /// + /// + /// This function is equivalent to the "==" operator in JavaScript. + /// + /// + /// Requires an active script context. + /// + /// + /// The object to compare. + /// Whether the values are equal. + public bool Equals(JavaScriptValue other) + { + bool equals; + Native.ThrowIfError(Native.JsEquals(this, other, out equals)); + return equals; + } + + /// + /// Compare two JavaScript values for strict equality. + /// + /// + /// + /// This function is equivalent to the "===" operator in JavaScript. + /// + /// + /// Requires an active script context. + /// + /// + /// The object to compare. + /// Whether the values are strictly equal. + public bool StrictEquals(JavaScriptValue other) + { + bool equals; + Native.ThrowIfError(Native.JsStrictEquals(this, other, out equals)); + return equals; + } + + /// + /// Invokes a function. + /// + /// + /// Requires an active script context. + /// + /// The arguments to the call. + /// The Value returned from the function invocation, if any. + public JavaScriptValue CallFunction(params JavaScriptValue[] arguments) + { + JavaScriptValue returnReference; + + if (arguments.Length > ushort.MaxValue) + { + throw new ArgumentOutOfRangeException("arguments"); + } + + Native.ThrowIfError(Native.JsCallFunction(this, arguments, (ushort)arguments.Length, out returnReference)); + return returnReference; + } + + /// + /// Invokes a function as a constructor. + /// + /// + /// Requires an active script context. + /// + /// The arguments to the call. + /// The Value returned from the function invocation. + public JavaScriptValue ConstructObject(params JavaScriptValue[] arguments) + { + JavaScriptValue returnReference; + + if (arguments.Length > ushort.MaxValue) + { + throw new ArgumentOutOfRangeException("arguments"); + } + + Native.ThrowIfError(Native.JsConstructObject(this, arguments, (ushort)arguments.Length, out returnReference)); + return returnReference; + } + } +} diff --git a/Windows/ChakraHosting/JavaScriptValueType.cs b/Windows/ChakraHosting/JavaScriptValueType.cs new file mode 100644 index 0000000..8ae1eb8 --- /dev/null +++ b/Windows/ChakraHosting/JavaScriptValueType.cs @@ -0,0 +1,73 @@ +namespace ChakraHosting +{ + /// + /// The JavaScript type of a JavaScriptValue. + /// + public enum JavaScriptValueType + { + /// + /// The value is the undefined value. + /// + Undefined = 0, + + /// + /// The value is the null value. + /// + Null = 1, + + /// + /// The value is a JavaScript number value. + /// + Number = 2, + + /// + /// The value is a JavaScript string value. + /// + String = 3, + + /// + /// The value is a JavaScript Boolean value. + /// + Boolean = 4, + + /// + /// The value is a JavaScript object value. + /// + Object = 5, + + /// + /// The value is a JavaScript function object value. + /// + Function = 6, + + /// + /// The value is a JavaScript error object value. + /// + Error = 7, + + /// + /// The value is a JavaScript array object value. + /// + Array = 8, + + /// + /// The value is a JavaScript array object value. + /// + Symbol = 9, + + /// + /// The value is a JavaScript ArrayBuffer object value. + /// + ArrayBuffer = 10, + + /// + /// The value is a JavaScript typed array object value. + /// + TypedArray = 11, + + /// + /// The value is a JavaScript DataView object value. + /// + DataView = 12, + } +} \ No newline at end of file diff --git a/Windows/ChakraHosting/Native.cs b/Windows/ChakraHosting/Native.cs new file mode 100644 index 0000000..784f55f --- /dev/null +++ b/Windows/ChakraHosting/Native.cs @@ -0,0 +1,460 @@ +using System; +using System.Runtime.InteropServices; + +namespace ChakraHosting +{ + /// + /// Native interfaces. + /// + public static class Native + { + /// + /// Throws if a native method returns an error code. + /// + /// The error. + internal static void ThrowIfError(JavaScriptErrorCode error) + { + if (error != JavaScriptErrorCode.NoError) + { + switch (error) + { + case JavaScriptErrorCode.InvalidArgument: + throw new JavaScriptUsageException(error, "Invalid argument."); + + case JavaScriptErrorCode.NullArgument: + throw new JavaScriptUsageException(error, "Null argument."); + + case JavaScriptErrorCode.NoCurrentContext: + throw new JavaScriptUsageException(error, "No current context."); + + case JavaScriptErrorCode.InExceptionState: + throw new JavaScriptUsageException(error, "Runtime is in exception state."); + + case JavaScriptErrorCode.NotImplemented: + throw new JavaScriptUsageException(error, "Method is not implemented."); + + case JavaScriptErrorCode.WrongThread: + throw new JavaScriptUsageException(error, "Runtime is active on another thread."); + + case JavaScriptErrorCode.RuntimeInUse: + throw new JavaScriptUsageException(error, "Runtime is in use."); + + case JavaScriptErrorCode.BadSerializedScript: + throw new JavaScriptUsageException(error, "Bad serialized script."); + + case JavaScriptErrorCode.InDisabledState: + throw new JavaScriptUsageException(error, "Runtime is disabled."); + + case JavaScriptErrorCode.CannotDisableExecution: + throw new JavaScriptUsageException(error, "Cannot disable execution."); + + case JavaScriptErrorCode.AlreadyDebuggingContext: + throw new JavaScriptUsageException(error, "Context is already in debug mode."); + + case JavaScriptErrorCode.HeapEnumInProgress: + throw new JavaScriptUsageException(error, "Heap enumeration is in progress."); + + case JavaScriptErrorCode.ArgumentNotObject: + throw new JavaScriptUsageException(error, "Argument is not an object."); + + case JavaScriptErrorCode.InProfileCallback: + throw new JavaScriptUsageException(error, "In a profile callback."); + + case JavaScriptErrorCode.InThreadServiceCallback: + throw new JavaScriptUsageException(error, "In a thread service callback."); + + case JavaScriptErrorCode.CannotSerializeDebugScript: + throw new JavaScriptUsageException(error, "Cannot serialize a debug script."); + + case JavaScriptErrorCode.AlreadyProfilingContext: + throw new JavaScriptUsageException(error, "Already profiling this context."); + + case JavaScriptErrorCode.IdleNotEnabled: + throw new JavaScriptUsageException(error, "Idle is not enabled."); + + case JavaScriptErrorCode.OutOfMemory: + throw new JavaScriptEngineException(error, "Out of memory."); + + case JavaScriptErrorCode.ScriptException: + { + JavaScriptValue errorObject; + JavaScriptErrorCode innerError = JsGetAndClearException(out errorObject); + + if (innerError != JavaScriptErrorCode.NoError) + { + throw new JavaScriptFatalException(innerError); + } + + throw new JavaScriptScriptException(error, errorObject, "Script threw an exception."); + } + + case JavaScriptErrorCode.ScriptCompile: + { + JavaScriptValue errorObject; + JavaScriptErrorCode innerError = JsGetAndClearException(out errorObject); + + if (innerError != JavaScriptErrorCode.NoError) + { + throw new JavaScriptFatalException(innerError); + } + + throw new JavaScriptScriptException(error, errorObject, "Compile error."); + } + + case JavaScriptErrorCode.ScriptTerminated: + throw new JavaScriptScriptException(error, JavaScriptValue.Invalid, "Script was terminated."); + + case JavaScriptErrorCode.ScriptEvalDisabled: + throw new JavaScriptScriptException(error, JavaScriptValue.Invalid, "Eval of strings is disabled in this runtime."); + + case JavaScriptErrorCode.Fatal: + throw new JavaScriptFatalException(error); + + default: + throw new JavaScriptFatalException(error); + } + } + } + + const string DllName = "Chakra.dll"; + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateRuntime(JavaScriptRuntimeAttributes attributes, JavaScriptThreadServiceCallback threadService, out JavaScriptRuntime runtime); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCollectGarbage(JavaScriptRuntime handle); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDisposeRuntime(JavaScriptRuntime handle); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetRuntimeMemoryUsage(JavaScriptRuntime runtime, out UIntPtr memoryUsage); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetRuntimeMemoryLimit(JavaScriptRuntime runtime, out UIntPtr memoryLimit); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetRuntimeMemoryLimit(JavaScriptRuntime runtime, UIntPtr memoryLimit); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetRuntimeMemoryAllocationCallback(JavaScriptRuntime runtime, IntPtr callbackState, JavaScriptMemoryAllocationCallback allocationCallback); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetRuntimeBeforeCollectCallback(JavaScriptRuntime runtime, IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback); + + [DllImport(DllName, EntryPoint = "JsAddRef")] + internal static extern JavaScriptErrorCode JsContextAddRef(JavaScriptContext reference, out uint count); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsAddRef(JavaScriptValue reference, out uint count); + + [DllImport(DllName, EntryPoint = "JsRelease")] + internal static extern JavaScriptErrorCode JsContextRelease(JavaScriptContext reference, out uint count); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsRelease(JavaScriptValue reference, out uint count); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateContext(JavaScriptRuntime runtime, out JavaScriptContext newContext); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetCurrentContext(out JavaScriptContext currentContext); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetCurrentContext(JavaScriptContext context); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetRuntime(JavaScriptContext context, out JavaScriptRuntime runtime); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsStartDebugging(); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsIdle(out uint nextIdleTick); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsParseScript(string script, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsRunScript(string script, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsSerializeScript(string script, byte[] buffer, ref ulong bufferSize); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsParseSerializedScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsRunSerializedScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsGetPropertyIdFromName(string name, out JavaScriptPropertyId propertyId); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsGetPropertyNameFromId(JavaScriptPropertyId propertyId, out string name); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetUndefinedValue(out JavaScriptValue undefinedValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetNullValue(out JavaScriptValue nullValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetTrueValue(out JavaScriptValue trueValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetFalseValue(out JavaScriptValue falseValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsBoolToBoolean(bool value, out JavaScriptValue booleanValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsBooleanToBool(JavaScriptValue booleanValue, out bool boolValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsConvertValueToBoolean(JavaScriptValue value, out JavaScriptValue booleanValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetValueType(JavaScriptValue value, out JavaScriptValueType type); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDoubleToNumber(double doubleValue, out JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsIntToNumber(int intValue, out JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsNumberToDouble(JavaScriptValue value, out double doubleValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsConvertValueToNumber(JavaScriptValue value, out JavaScriptValue numberValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetStringLength(JavaScriptValue sringValue, out int length); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsPointerToString(string value, UIntPtr stringLength, out JavaScriptValue stringValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsStringToPointer(JavaScriptValue value, out IntPtr stringValue, out UIntPtr stringLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsConvertValueToString(JavaScriptValue value, out JavaScriptValue stringValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsVariantToValue([MarshalAs(UnmanagedType.Struct)] ref object var, out JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsValueToVariant(JavaScriptValue obj, [MarshalAs(UnmanagedType.Struct)] out object var); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetGlobalObject(out JavaScriptValue globalObject); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateObject(out JavaScriptValue obj); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateExternalObject(IntPtr data, JavaScriptObjectFinalizeCallback finalizeCallback, out JavaScriptValue obj); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsConvertValueToObject(JavaScriptValue value, out JavaScriptValue obj); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetPrototype(JavaScriptValue obj, out JavaScriptValue prototypeObject); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetPrototype(JavaScriptValue obj, JavaScriptValue prototypeObject); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetExtensionAllowed(JavaScriptValue obj, out bool value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsPreventExtension(JavaScriptValue obj); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, out JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetOwnPropertyDescriptor(JavaScriptValue obj, JavaScriptPropertyId propertyId, out JavaScriptValue propertyDescriptor); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetOwnPropertyNames(JavaScriptValue obj, out JavaScriptValue propertyNames); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, JavaScriptValue value, bool useStrictRules); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsHasProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, out bool hasProperty); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDeleteProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, bool useStrictRules, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDefineProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor, out bool result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsHasIndexedProperty(JavaScriptValue obj, JavaScriptValue index, out bool result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDeleteIndexedProperty(JavaScriptValue obj, JavaScriptValue index); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsEquals(JavaScriptValue obj1, JavaScriptValue obj2, out bool result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsStrictEquals(JavaScriptValue obj1, JavaScriptValue obj2, out bool result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsHasExternalData(JavaScriptValue obj, out bool value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetExternalData(JavaScriptValue obj, out IntPtr externalData); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetExternalData(JavaScriptValue obj, IntPtr externalData); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateArray(uint length, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCallFunction(JavaScriptValue function, JavaScriptValue[] arguments, ushort argumentCount, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsConstructObject(JavaScriptValue function, JavaScriptValue[] arguments, ushort argumentCount, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateFunction(JavaScriptNativeFunction nativeFunction, IntPtr externalData, out JavaScriptValue function); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateRangeError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateReferenceError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateSyntaxError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateTypeError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateURIError(JavaScriptValue message, out JavaScriptValue error); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsHasException(out bool hasException); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetAndClearException(out JavaScriptValue exception); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetException(JavaScriptValue exception); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsDisableRuntimeExecution(JavaScriptRuntime runtime); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsEnableRuntimeExecution(JavaScriptRuntime runtime); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsIsRuntimeExecutionDisabled(JavaScriptRuntime runtime, out bool isDisabled); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetObjectBeforeCollectCallback(JavaScriptValue reference, IntPtr callbackState, JavaScriptObjectBeforeCollectCallback beforeCollectCallback); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateNamedFunction(JavaScriptValue name, JavaScriptNativeFunction nativeFunction, IntPtr callbackState, out JavaScriptValue function); + + [DllImport(DllName, CharSet = CharSet.Unicode)] + internal static extern JavaScriptErrorCode JsProjectWinRTNamespace(string namespaceName); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsInspectableToObject([MarshalAs(UnmanagedType.IInspectable)] System.Object inspectable, out JavaScriptValue value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetProjectionEnqueueCallback(JavaScriptProjectionEnqueueCallback projectionEnqueueCallback, IntPtr context); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetPromiseContinuationCallback(JavaScriptPromiseContinuationCallback promiseContinuationCallback, IntPtr callbackState); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateArrayBuffer(uint byteLength, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateTypedArray(JavaScriptTypedArrayType arrayType, JavaScriptValue arrayBuffer, uint byteOffset, + uint elementLength, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateDataView(JavaScriptValue arrayBuffer, uint byteOffset, uint byteOffsetLength, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetArrayBufferStorage(JavaScriptValue arrayBuffer, out IntPtr buffer, out uint bufferLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetTypedArrayStorage(JavaScriptValue typedArray, out IntPtr buffer, out uint bufferLength, out JavaScriptTypedArrayType arrayType, out int elementSize); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetDataViewStorage(JavaScriptValue dataView, out IntPtr buffer, out uint bufferLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetPropertyIdType(JavaScriptPropertyId propertyId, out JavaScriptPropertyIdType propertyIdType); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateSymbol(JavaScriptValue description, out JavaScriptValue symbol); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetSymbolFromPropertyId(JavaScriptPropertyId propertyId, out JavaScriptValue symbol); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetPropertyIdFromSymbol(JavaScriptValue symbol, out JavaScriptPropertyId propertyId); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetOwnPropertySymbols(JavaScriptValue obj, out JavaScriptValue propertySymbols); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsNumberToInt(JavaScriptValue value, out int intValue); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetIndexedPropertiesToExternalData(JavaScriptValue obj, IntPtr data, JavaScriptTypedArrayType arrayType, uint elementLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetIndexedPropertiesExternalData(JavaScriptValue obj, IntPtr data, out JavaScriptTypedArrayType arrayType, out uint elementLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsHasIndexedPropertiesExternalData(JavaScriptValue obj, out bool value); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsInstanceOf(JavaScriptValue obj, JavaScriptValue constructor, out bool result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsCreateExternalArrayBuffer(IntPtr data, uint byteLength, JavaScriptObjectFinalizeCallback finalizeCallback, IntPtr callbackState, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetTypedArrayInfo(JavaScriptValue typedArray, out JavaScriptTypedArrayType arrayType, out JavaScriptValue arrayBuffer, out uint byteOffset, out uint byteLength); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetContextOfObject(JavaScriptValue obj, out JavaScriptContext context); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsGetContextData(JavaScriptContext context, out IntPtr data); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsSetContextData(JavaScriptContext context, IntPtr data); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsParseSerializedScriptWithCallback(JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, + JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + + [DllImport(DllName)] + internal static extern JavaScriptErrorCode JsRunSerializedScriptWithCallback(JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, + JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + } +} diff --git a/Windows/ChakraHosting/Properties/AssemblyInfo.cs b/Windows/ChakraHosting/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3cc0338 --- /dev/null +++ b/Windows/ChakraHosting/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ChakraHosting")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ChakraHosting")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml b/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml new file mode 100644 index 0000000..e05ff59 --- /dev/null +++ b/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs b/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs index e7d06aa..4ab3718 100644 --- a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs +++ b/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs @@ -1,11 +1,11 @@ #pragma warning disable 1591 //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 // //------------------------------------------------------------------------------ diff --git a/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs b/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs index 6b5d669..8a1b894 100644 --- a/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs +++ b/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs @@ -46,9 +46,11 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) //TODO: 从之前挂起的应用程序加载状态 } ShibaApp.Init(); - AbstractShiba.Instance.AddConverter("function awesome(value) { return value + \" is awesome!\" }"); - AbstractShiba.Instance.AddConverter("function reverse(value) { return value.split(\"\").reverse().join(\"\"); }"); - AbstractShiba.Instance.AddConverter("function helloWorld(value) { if (value === null || value === undefined) return null; return value.hello.world; }"); + ShibaApp.Instance.AddConverter("function awesome(value) { return value + \" is awesome!\" }"); + ShibaApp.Instance.AddConverter("function reverse(value) { return value.split(\"\").reverse().join(\"\"); }"); + ShibaApp.Instance.AddConverter("function helloWorld(value) { if (value === null || value === undefined) return null; return value.hello.world; }"); + var script = "const nhentai = {\r\n home: async (page) => {\r\n const link = `https://nhentai.net/api/galleries/all?page=${page}`;\r\n const result = JSON.parse(await http.get(link));\r\n return JSON.stringify(result.result)\r\n }\r\n}"; + ShibaApp.Instance.Configuration.ScriptRuntime.Execute(script); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; diff --git a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs index 6fff93d..f015d30 100644 --- a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs +++ b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Threading.Tasks; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; @@ -82,9 +83,16 @@ private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e) } } - private void ButtonBase_OnClick(object sender, RoutedEventArgs e) + private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { - Frame.Navigate(typeof(LivePage)); + + var script = $"nhentai.home(1)"; + var task = ShibaApp.Instance.Configuration.ScriptRuntime.Execute(script) as Task; + var result = await task as string; + var list = JsonConvert.DeserializeObject(result); + + + //Frame.Navigate(typeof(LivePage)); } } } \ No newline at end of file diff --git a/Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj b/Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj index e627cfb..5fe8673 100644 --- a/Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj +++ b/Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj @@ -134,15 +134,15 @@ - + - - {0ece2838-de51-461f-8386-75d7de285d53} - Shiba.UWP + + {c5d6ed6a-c8b9-4bed-a226-d1acfaa763e0} + ChakraHosting - {d0b763d5-a804-4822-be17-4cf9d0b62488} + {3ff5cc7b-a8ed-4d59-a13a-e4e42714c798} Shiba diff --git a/Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj b/Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj index 64c84df..9e3cddc 100644 --- a/Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj +++ b/Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj @@ -36,8 +36,8 @@ 4 - - ..\..\packages\Antlr4.Runtime.Standard.4.7.1.1\lib\net35\Antlr4.Runtime.Standard.dll + + ..\..\packages\Antlr4.Runtime.Standard.4.7.2\lib\net35\Antlr4.Runtime.Standard.dll diff --git a/Windows/Sample/Shiba.WPF.Sample/packages.config b/Windows/Sample/Shiba.WPF.Sample/packages.config index f4b731f..804cad7 100644 --- a/Windows/Sample/Shiba.WPF.Sample/packages.config +++ b/Windows/Sample/Shiba.WPF.Sample/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/Windows/Shiba.Forms/Shiba.Forms.csproj b/Windows/Shiba.Forms/Shiba.Forms.csproj deleted file mode 100644 index 2507a88..0000000 --- a/Windows/Shiba.Forms/Shiba.Forms.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - netstandard2.0 - - - TRACE;FORMS - latest - - - TRACE;DEBUG;FORMS - latest - - - - - - - - - \ No newline at end of file diff --git a/Windows/Shiba.Shared/CommonProperty/CommonProperty.cs b/Windows/Shiba.Shared/CommonProperty/CommonProperty.cs deleted file mode 100644 index 5bc4943..0000000 --- a/Windows/Shiba.Shared/CommonProperty/CommonProperty.cs +++ /dev/null @@ -1,43 +0,0 @@ - -#if WINDOWS_UWP -using NativeView = Windows.UI.Xaml.FrameworkElement; -using NativeBinding = Windows.UI.Xaml.Data.Binding; -using NativeProperty = Windows.UI.Xaml.DependencyProperty; -using NativeThickness = Windows.UI.Xaml.Thickness; -using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; -using NativeViewGroup = Xamarin.Forms.Layout; - -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using NativeViewGroup = System.Windows.Controls.Panel; -#endif - - -namespace Shiba.CommonProperty -{ - public abstract class AbsCommonProperty : ICommonProperty - { - public abstract string Name { get; } - public void Handle(object targetValue, object targetNativeView, object parentNativeView) - { - if (targetValue is TValue value && targetNativeView is NativeView nativeView && parentNativeView is NativeViewGroup parent) - { - SetValue(value, nativeView, parent); - } - } - - public abstract void SetValue(TValue targetValue, NativeView nativeView, NativeViewGroup parent); - } -} \ No newline at end of file diff --git a/Windows/Shiba.Shared/CommonProperty/GridProperty.cs b/Windows/Shiba.Shared/CommonProperty/GridProperty.cs deleted file mode 100644 index 2e9fc03..0000000 --- a/Windows/Shiba.Shared/CommonProperty/GridProperty.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Shiba.Controls; - -#if WINDOWS_UWP -using Windows.UI.Xaml.Controls; -using NativeView = Windows.UI.Xaml.FrameworkElement; -using NativeBinding = Windows.UI.Xaml.Data.Binding; -using NativeProperty = Windows.UI.Xaml.DependencyProperty; -using NativeThickness = Windows.UI.Xaml.Thickness; -using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; -using NativeViewGroup = Xamarin.Forms.Layout; -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using NativeViewGroup = System.Windows.Controls.Panel; -#endif - - - -namespace Shiba.CommonProperty -{ - public class GridProperty : AbsCommonProperty - { - public override string Name { get; } = "grid"; - public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) - { - var row = map.Get("row"); - var column = map.Get("column"); - var rowSpan = map.Get("rowSpan"); - var columnSpan = map.Get("columnSpan"); - if (row != default) - { - Grid.SetRow(element, row); - } - - if (column != default) - { - Grid.SetColumn(element, column); - } - - if (rowSpan != default) - { - Grid.SetRowSpan(element, rowSpan); - } - - if (columnSpan != default) - { - Grid.SetColumnSpan(element, columnSpan); - } - } - } -} \ No newline at end of file diff --git a/Windows/Shiba.Shared/CommonProperty/RelativeProperty.cs b/Windows/Shiba.Shared/CommonProperty/RelativeProperty.cs deleted file mode 100644 index 62cee45..0000000 --- a/Windows/Shiba.Shared/CommonProperty/RelativeProperty.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Shiba.Controls; - -#if WINDOWS_UWP -using Windows.UI.Xaml.Controls; -using NativeView = Windows.UI.Xaml.FrameworkElement; -using NativeBinding = Windows.UI.Xaml.Data.Binding; -using NativeProperty = Windows.UI.Xaml.DependencyProperty; -using NativeThickness = Windows.UI.Xaml.Thickness; -using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; -using NativeViewGroup = Xamarin.Forms.Layout; -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using NativeViewGroup = System.Windows.Controls.Panel; -#endif - -namespace Shiba.CommonProperty -{ - public class RelativeProperty: AbsCommonProperty - { - public override string Name { get; } = "relative"; - public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) - { - - } - } -} \ No newline at end of file diff --git a/Windows/Shiba.Shared/Shiba.Shared.projitems b/Windows/Shiba.Shared/Shiba.Shared.projitems deleted file mode 100644 index 5c5f741..0000000 --- a/Windows/Shiba.Shared/Shiba.Shared.projitems +++ /dev/null @@ -1,35 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 060ea7a7-cbb7-4534-9446-7e3634bc8605 - - - Shiba - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Windows/Shiba.Shared/Shiba.Shared.shproj b/Windows/Shiba.Shared/Shiba.Shared.shproj deleted file mode 100644 index 4068b7b..0000000 --- a/Windows/Shiba.Shared/Shiba.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 060ea7a7-cbb7-4534-9446-7e3634bc8605 - 14.0 - - - - - - - - \ No newline at end of file diff --git a/Windows/Shiba.Shared/ShibaApp.cs b/Windows/Shiba.Shared/ShibaApp.cs deleted file mode 100644 index 2b3a44b..0000000 --- a/Windows/Shiba.Shared/ShibaApp.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -#if WINDOWS_UWP -using Windows.UI.Xaml; -using Shiba.Scripting.Runtime; -#elif WPF -using System.Windows; -#elif FORMS -using Xamarin.Forms; -#endif - -#if WINDOWS_UWP -namespace Shiba.UWP -#elif WPF -namespace Shiba.WPF -#elif FORMS -namespace Shiba.Forms -#endif -{ - - public class ShibaApp : AbstractShiba - { - public static void Init(Action action = null) - { - Instance = new ShibaApp(c => - { - c.PlatformType = -#if WINDOWS_UWP - "UWP" -#elif WPF - "WPF" -#elif FORMS - "Forms" -#endif - ; -#if WINDOWS_UWP - c.ScriptRuntime.AddObject("storage", new Storage()); -#endif - action?.Invoke(c); - }); - } - - private ShibaApp(Action action = null) : base(action) - { - } - } -} diff --git a/Windows/Shiba.Shared/ViewMappers/InputMapper.cs b/Windows/Shiba.Shared/ViewMappers/InputMapper.cs deleted file mode 100644 index be59720..0000000 --- a/Windows/Shiba.Shared/ViewMappers/InputMapper.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections.Generic; -using Shiba.Controls; -using Shiba.ViewMappers; -#if WINDOWS_UWP -using Windows.UI.Xaml.Media; -using NativeView = Windows.UI.Xaml.Controls.TextBox; -#elif WPF -using System.Windows.Media; -using NativeView = System.Windows.Controls.TextBox; -#elif FORMS -using NativeView = Xamarin.Forms.Entry; -#endif - -[assembly: ExportMapper("input", typeof(InputMapper))] -namespace Shiba.ViewMappers -{ - public class InputMapper : ViewMapper - { - protected override bool HasDefaultProperty { get; } = true; - protected override PropertyMap DefaultPropertyMap { get; } = new PropertyMap("text", NativeView.TextProperty, typeof(string), isTwoWay: true); - - public override IEnumerable PropertyMaps() - { - foreach (var propertyMap in base.PropertyMaps()) - { - yield return propertyMap; - } - yield return new PropertyMap("size", NativeView.FontSizeProperty, typeof(double)); -#if FORMS - yield return new PropertyMap("color", NativeView.TextColorProperty, typeof(string), converter: ColorConverter); -#elif WINDOWS_UWP || WPF - yield return new PropertyMap("color", NativeView.ForegroundProperty, typeof(string), typeof(SolidColorBrush), converter: ColorConverter); -#endif - - } - } -} diff --git a/Windows/Shiba.Test/Assets/LockScreenLogo.scale-200.png b/Windows/Shiba.Test/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/SplashScreen.scale-200.png b/Windows/Shiba.Test/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^Lb9gny#ro$MOIxIt{+r)EA10$VR3 zanN8D{TUkl+v0CQ_>ZoHP<M-x#8@8ZiT#$Kh`(uRaX1g$Bg|qy$<#7 zSSAi{Nb8Y=lvNVeio+UGLCAtoLBfL`iOv`)yoJMDJBN>4IH@(l7YRF;61@>qq1iM9 zr@b#OC~SAxSle?5Pp8Z78{VO0YFr1x7kZU64Z23eLf2T2#6J_t;-E}DkB?NufZ0Ug zi?J&byXeaB-uTNVhuiM!UVQw}bZrJ3GtAETYp->!{q#zfN7D3AS9@Q7*V^85jGx#R z(QxYV(wW#F0XF9^^s>>H8pPlVJ>)3Oz z&_X8Sf@~?cH_O*cgi$U#`v`RRfv#y3m(ZpKk^5uLup+lVs$~}FZU$r_+}#hl%?g5m z-u-}-666ssp-xWQak~>PPy$mRc|~?pVSs1_@mBEXpPVfLF6(Ktf1S* zPPh@QZ=tFMs?LM2(5P3L2;l_6XX6s&cYsP1ip#eg0`ZEP0HGYh{UmS@o`MihLLvkU zgyAG0G`b1|qjxxh1(ODKFE%AP}Dq=3vK$P7TXP4GrM1kQ72!GUVMDl`rDC&2;TA}*nF z8$nQD&6ys_nc1*E7$*1S@R8$ymy(sQV}imGSedB@{!QR5P&N_H=-^o!?LsWs+2|mH z-e=)T^SvI)=_JIm7}j4;@*Z17=(#}m=~YF~z~CLI+vdAGlJDcdF$TM?CVI1%LhUrN zaa6DJ=Yh$)$k&Oz{-~8yw^GM^8prYxSxo zvI4k#ibryMa%%*8oI-5m61Koa_A_xg=(fwp0aBX{;X4Q;NXUhtaoJDo1>TqhWtn=_ zd5~chq#&6~c%8JZK#t_&J(9EVUU&upYeIovLt1>vaHe}UUq>#RGQj!EN#5+0@T`(@ z^g~>*c`VGRiSt;!$_4+0hk^I!@O3``5=sZ8IwlxWW7km1B&_t&E*u0_9UBa#VqwY* zz>nxv?FAsVnRaD(Bui=6i==BFUw0k4n$>`umU`F2l?7CYTD^)c2X+d9X&ddS9|gj? zM?knGkGCX&W8offw8aLC2$D{PjC3nVZwd4k?eZH8*mZ)U@3Qk8RDFOz_#WUA#vnzy zyP>KrCfKwSXea7}jgJjBc}PGY+4#6%lbZyjhy`5sZd_Vy6Wz;ixa?czkN}J9It1K6 zY!eu>|AwF^fwZlLAYyQI*lM@^>O>Iu6Vf6i>Q$?v!SeUS<{>UYMwz$*%Aq?w^`j{h z!$GZbhu=^D{&ET8;))LL%ZBDZkQqRd2;u~!d9bHGmLRhLDctNgYyjsuvoSZ#iVdoB z2!f--UUA#U;<{je#?cYt^{PIyKa%hW>}uepWMyAI{{Zo7?2>?$c9;whJae%oN|I-kpTQSx_C$Z&;f zi2i)qmEn=y4U0uvk)$m;zKfjPK@oc?I`}1Jzl$Q~aoKBd3kt7L#7gyt|A_qgz6ai< z=X%D1i!d2h?rHR^R8SUj&G||dkC?DT>{o#Yau<@uqVT{Xef&XG}5*E4aPk{}~ zplx&XhaV)&1EfI3Em;Bw#O5SV^c;{twb-1Rw)+=0!e_BLbd7tYmXCH0wrlOSS+~`7He8Iqx0{CN+DVit9;*6L~JAN zD&cyT)2?h}xnYmL?^)<7YyzZ3$FHU^Eg;DLqAV{#wv#Wj7S`Jdl1pX&{3(uZ?!uh} zDc$ZTNV*7le_W6}Hju~GMTxZQ1aWCeUc%!jv3MHAzt>Y-nQK%zfT*3ebDQA5b?iGn; zBjv3B+GhLTexd_(CzZDP4|#n5^~scvB6#Pk%Ho!kQ>yYw((Dv{6=$g3jT1!u6gORW zx5#`7Wy-ZHRa~IxGHdrp(bm%lf>2%J660nj$fCqN(epv@y!l9s7@k6EvxS{AMP>WY zX4$@F8^kayphIx-RGO$+LYl9YdoI5d|4#q9##`_F5Xnx`&GPzp2fB{-{P@ATw=X@~ z_|&^UMWAKD;jjBKTK(~o?cUFRK8EX=6>cXpfzg4ZpMB>*w_^8GSiT-Jp|xBOnzM+j z*09-@-~qJ(eqWq5@R4i^u4^{McCP(!3}C|v_WsTR*bIUxN(Nx`u##3B4{sE`Z`v8w zAwIG`?1~PkID~W{uDzmqH98Pew_1(;x2%8r^vY{)_&J2K)cN{W+h5+g)ZcjP&Ci#O zgy|8K@4kyMfwilHd&6TDlhb%++Pk!>9HRld6HT7gwyZGrxS$}CsD6`>6!!2K1@Mjf z(P0WYB7V_OFZyeWrbOFb>O54BNXf~K&?}3=^v;v_wT{DKr?jN^DtN&DXwX%u?s*c6`%8>WFz z7}YW^tp0bp^NriE)AB6M2l<7rn7fzePtR*omOevpfm9n?}2V*+0iW;S)C zhg`NAjL?D=W#k*$aR{>pGf~lD-rVtD;5jW1_*Jn1j1=es@Kcx4ySM_bwcQCT=d+DV z>Sz~L=Hj@(X%31nK$mWI@7d>}ORB`K(p=+`UD)+99YUGQc7y^bHZ1F(8|tL0 zdK*DT0kSXG_{BKTpP2*2PecdKV9;dq$^ZZDP;Nyq1kp-&GI5eAyZsK!e3V zK@rPy*{(`KIfo+lc878mDKk^V#`VT05}64kBtk%DgwLrOvLMj5-;*GNKv6c6pzMuL z6EP%ob|_0IW}lLRXCP2!9wWhEw3LA7iF#1O1mIZ@Z=6&bz41F;@S_GvYAG-#CW3z{ zP3+6vHhvP&A3$##Vo9$dT^#MoGg^|MDm=Bt1d2RRwSZ<;ZHICpLBv5Xs!D?BH^(9_ z7`H=N&^v|Z-%mP}wNzG{aiFCsRgwzwq!N6obW9+7(R; z(SZ=23`|`>qil!LMGG{_Heq!BD>(Y-zV9wD)}hz25JA37YR%39;kI4y9pgtcUass6 zP24}ZY$vvYeI`zy&)A_X#nY3017ap*0&jx|mVwyGhg3;!keU53a}Uhm3BZI$N$6Se zLWlAmy1S0xKJm4G_U@sN_Tm=`$xWJSEwKU98rZ&)1R^*$$1vA3oG#&*%SMxY_~oGP zP&PFJatFLM-Ps%84IV-+Ow)T{C7cqUAvauy4C z(FRz&?6$Rypj{xO!`y=*J5o4@U8Q-(y5(*=YoKeZ+-1YdljXxkA#B)zo=FeQH#?Le zycNUmEEHWO9a=X^pb#&cOq7-`7UA87#|S22)<7RUtZo|(zibX=w;K3qur9vy#`MNV z6UUcf9ZwEnKCCp+OoBnF@OdbvH)ANXO0o~Pi9l8=x3))}L<#vO0-~O4!~--Ket?d} zJaqsj<@CD1%S2cTW%rOP{Vto%0sGW~1RMa_j^)5nil0Yw- z0EE#bP+l4#P^%PQ+N*oxu1Zq05xZ!bXfYTg>9c{(Iw*lnjR^>kz%lAN^zFce7rppy zY8zA~3GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/Square150x150Logo.scale-200.png b/Windows/Shiba.Test/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 zuEf>ih5`wqY)~o@OeVt-wM?Q!>QzdGRj!bz6fzYrfw$hZfAKzr2-M+D+R>}~oT574c;_3zquHcElqKIsryILt3g8n3jcMb+j?i?-L3FpZJ z2WRVBRdDPc+G5aaYg#5hpE+6nQ|(VSoxT3|biF;BUq#==-27Xi=gihDPYP$7?=9cP zYKE$jeQ|3~_L0VG-(F~2ZPyD0=k{J4Q~h(t__{-mz_w8{JDY9{`1ouzz!Vr5!ECdE z6U~O1k8c}24V7~zzXWTV-Pe4)y}wQJS&q%H5`Fo_f_JvIU489aCX$;P`u#!I-=^4ijC2{&9!O&h>mi?9oYD=GC#%)6{GzN6nQYw+Fal50!#x^asjBBR50i`+mho*ttoqV)ubM2KD9S~k7+FR4>{29?6 z{!l6kDdyTN0YJ9LgkPWeXm|gyi@zM3?0@{&pXT12w|78&W-q!RRF)&iLCEZVH<|fR zN0fr2^t8H(>L?>K#>^+jWROLral(Qy-xoBq1U7A&DV||wClb)Otd9?(gZ|8znMF}D zf<1haWz^s0qgecz;RFGt0C-B4g`jNGHsFU+;{<%t65v^sjk^h$lmWn#B0#_)9ij&d z-~lc`A)YYExi^7sBuPM^Y|wA2g*5?`K?#7tzELQYNxGo$UB$4J8RJp1k(8Jj+~hMT zlN~>M@KTTh^--8y3PK_NZ@AC!{PT=CziBzGd+wTJ^@icH!Bd}%)g8V)%K?|c&WTUk zy}qv1C%(fjRoZ4ozC3{O%@5?)XzH35zHns$pgU*Q?fj4v?fp1Qbm+j;3l;9jam9Da zXVcKjPlQ73x78QPu|Ffm6x?`~e3oD=gl=4kYK?={kD5j~QCXU)`HSdduNNENzA*2$ zOm3PzF!lN5e*06-f1Uot67wY#{o-S1!KZ7E=!~7ynnk9_iJR#kFoNbAOT#^2Gd17F zMmvU6>lndZQGd|ax9kUoXXO+$N?|j@6qpsF&_j7YXvwo_C{JpmLw5&#e6k>atv%es z5)7r*Wvv_JkUpT}M!_o!nVlEk1Zbl=a*2hQ*<|%*K1Glj^FcF`6kTzGQ3lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/Square44x44Logo.scale-200.png b/Windows/Shiba.Test/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/Windows/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/StoreLogo.png b/Windows/Shiba.Test/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x literal 0 HcmV?d00001 diff --git a/Windows/Shiba.Test/Assets/Wide310x150Logo.scale-200.png b/Windows/Shiba.Test/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV8$e3?-F=L^&FrtWn~(U_Q~~^uYiyeY6-KoTnfh9AWz@ zIKje0)u!_Lw)E}G!#kEfwKVdNt(UAf9*f>tEL_(=xco-T%jTi@7YlC3hs2ik%Le0H ztj}RTeCF(5mwvi3_56>-yB?l;J>-1%!9~=fs|QcNG3J~a@JCu`4SB460s0ZO+##4fFUSGLcj_ja^fL4&BKALfb#$6$O?>P@qx2Agl^x0i&ugt zsy5Pyu=()`7HRMG3IB7F1@`_ z+-!J%#i6e^U$e#+C%Q>_qVRzWRsG^W_n+@OcX@vzI&z;mzHNb!GQ?LWA(wtpqHqTM z1OFw_{Zn?fD)p)`c`kOgv{de=v@suGRqY{N^U7gI1VF3*F=obwaXI6ob5__Yn zVTguS!%(NI09J8x#AO_aW!9W7k*UvB;IWDFC3srwftr{kHj%g)fvnAm;&h_dnl~

MY- zf+K}sCe8qU6Ujs`3ua{U0Of$R_gVQBuUA za0v=mu#vIOqiiAZOr&h*$WyOw&k-xr$;G4Ixa!#TJNr>95(h>l%)PUy4p+^SgR(uR zta%k*?ny-+nAr8spEk1fo{J4i!b^Fia`N{_F6@zidA2ZTTrjl#^5Z-2KfB@Cu}l9s z(*|Z2jc?p~vn2f)3y9i*7zJV1L{$?|&q)4oaT;uXi6>1GkRXVTOzAz(RHEmr=eFIi z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA + + + + + + + + Shiba.Test + Asahi + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Windows/Shiba.Test/Properties/AssemblyInfo.cs b/Windows/Shiba.Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..dfd0667 --- /dev/null +++ b/Windows/Shiba.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Shiba.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Shiba.Test")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyMetadata("TargetPlatform","UAP")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Windows/Shiba.Test/Properties/UnitTestApp.rd.xml b/Windows/Shiba.Test/Properties/UnitTestApp.rd.xml new file mode 100644 index 0000000..996a839 --- /dev/null +++ b/Windows/Shiba.Test/Properties/UnitTestApp.rd.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Windows/Shiba.Test/Shiba.Test.csproj b/Windows/Shiba.Test/Shiba.Test.csproj index 9147aea..009d9e5 100644 --- a/Windows/Shiba.Test/Shiba.Test.csproj +++ b/Windows/Shiba.Test/Shiba.Test.csproj @@ -1,22 +1,182 @@ - + + + - netcoreapp2.0 - false - 7.2 + Debug + x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82} + AppContainerExe + Properties + Shiba.Test + Shiba.Test + en-US + UAP + 10.0.17763.0 + 10.0.16299.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Shiba.Test_TemporaryKey.pfx + $(VisualStudioVersion) + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM64 + false + prompt + true + true + + + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM64 + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + PackageReference - - - - - + - + + + UnitTestApp.xaml + + - - Always - + + MSBuild:Compile + Designer + + + + Designer + + + + + + + + + + + + + + + + 6.2.3 + + + 1.3.2 + + + 1.3.2 + + + + + {c5d6ed6a-c8b9-4bed-a226-d1acfaa763e0} + ChakraHosting + + + {3ff5cc7b-a8ed-4d59-a13a-e4e42714c798} + Shiba + + + + 14.0 + + + \ No newline at end of file diff --git a/Windows/Shiba.Test/UnitTest.cs b/Windows/Shiba.Test/UnitTest.cs new file mode 100644 index 0000000..6c62df2 --- /dev/null +++ b/Windows/Shiba.Test/UnitTest.cs @@ -0,0 +1,15 @@ + +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Shiba.Test +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/Windows/Shiba.Test/UnitTest1.cs b/Windows/Shiba.Test/UnitTest1.cs deleted file mode 100644 index be48bb6..0000000 --- a/Windows/Shiba.Test/UnitTest1.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Jint; -using Jint.Native.Function; -using Shiba.Parser; -using Xunit; - -namespace Shiba.Test -{ - class ShibaApp : AbstractShiba - { - - - public static void Init(Action action = null) - { - Instance = new ShibaApp(c => - { - action?.Invoke(c); - }); - } - - private ShibaApp(Action action = null) : base(action) - { - } - } - - public class UnitTest1 - { - [Fact] - public void Test1() - { - ShibaApp.Init(); - var wrapper = new ShibaParserWrapper(); - -// const string input = -// "stackLayout {orientation: horizontal, padding: [8, 0], alpha: 50%, etgsa: $bind aaa, input{content: fdsafds(dsafs($bind dasfd, dfsa), dfsafs)}}"; - const string input = - "stackLayout {orientation= dsads(dsafs($bind aaa, $bind bbb), dsafs) fdsafd = [ fdsaf = 1121 fdsafd = false ] aaa -> 123 ccc -> fjsoi = cdsa jiodsa { aa = dasf }}"; - var tree = wrapper.Parse(input); -// var view = ShibaParserWrapper.BuildViewTree(tree); - - Assert.NotNull(tree); - var str = tree.ToString(); - var tree2 = wrapper.Parse(str); - Assert.Equal(tree, tree2); - } - - } -} \ No newline at end of file diff --git a/Windows/Shiba.Test/UnitTestApp.xaml b/Windows/Shiba.Test/UnitTestApp.xaml new file mode 100644 index 0000000..020d8d8 --- /dev/null +++ b/Windows/Shiba.Test/UnitTestApp.xaml @@ -0,0 +1,7 @@ + + + diff --git a/Windows/Shiba.Test/UnitTestApp.xaml.cs b/Windows/Shiba.Test/UnitTestApp.xaml.cs new file mode 100644 index 0000000..079af48 --- /dev/null +++ b/Windows/Shiba.Test/UnitTestApp.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +namespace Shiba.Test +{ + ///

+ /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); + + // Ensure the current window is active + Window.Current.Activate(); + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); + } + + /// + /// Invoked when Navigation to a certain page fails + /// + /// The Frame which failed navigation + /// Details about the navigation failure + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} diff --git a/Windows/Shiba.Test/file1.xml b/Windows/Shiba.Test/file1.xml deleted file mode 100644 index 6703ab7..0000000 --- a/Windows/Shiba.Test/file1.xml +++ /dev/null @@ -1,7 +0,0 @@ - -

- hello,
world! -

- \ No newline at end of file diff --git a/Windows/Shiba.UWP/Properties/Shiba.UWP.rd.xml b/Windows/Shiba.UWP/Properties/Shiba.UWP.rd.xml deleted file mode 100644 index 5df3c44..0000000 --- a/Windows/Shiba.UWP/Properties/Shiba.UWP.rd.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - diff --git a/Windows/Shiba.WPF/Properties/AssemblyInfo.cs b/Windows/Shiba.WPF/Properties/AssemblyInfo.cs deleted file mode 100644 index beb005b..0000000 --- a/Windows/Shiba.WPF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Shiba.WPF")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Shiba.WPF")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -//将 ComVisible 设置为 false 将使此程序集中的类型 -//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -//若要开始生成可本地化的应用程序,请设置 -//.csproj 文件中的 CultureYouAreCodingWith -//例如,如果您在源文件中使用的是美国英语, -//使用的是美国英语,请将 设置为 en-US。 然后取消 -//对以下 NeutralResourceLanguage 特性的注释。 更新 -//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //主题特定资源词典所处位置 - //(未在页面中找到资源时使用, - //或应用程序资源字典中找到时使用) - ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 - //(未在页面中找到资源时使用, - //、应用程序或任何主题专用资源字典中找到时使用) -)] - - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 -// 方法是按如下所示使用“*”: : -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Windows/Shiba.WPF/Properties/Resources.Designer.cs b/Windows/Shiba.WPF/Properties/Resources.Designer.cs deleted file mode 100644 index 1008ad7..0000000 --- a/Windows/Shiba.WPF/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本: 4.0.30319.42000 -// -// 对此文件的更改可能导致不正确的行为,如果 -// 重新生成代码,则所做更改将丢失。 -// -//------------------------------------------------------------------------------ - -namespace Shiba.WPF.Properties { - - - /// - /// 强类型资源类,用于查找本地化字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Shiba.WPF.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 覆盖当前线程的 CurrentUICulture 属性 - /// 使用此强类型的资源类的资源查找。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Windows/Shiba.WPF/Properties/Resources.resx b/Windows/Shiba.WPF/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/Windows/Shiba.WPF/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Windows/Shiba.WPF/Properties/Settings.Designer.cs b/Windows/Shiba.WPF/Properties/Settings.Designer.cs deleted file mode 100644 index da9bd38..0000000 --- a/Windows/Shiba.WPF/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Shiba.WPF.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/Windows/Shiba.WPF/Properties/Settings.settings b/Windows/Shiba.WPF/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/Windows/Shiba.WPF/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Windows/Shiba.WPF/Shiba.WPF.csproj b/Windows/Shiba.WPF/Shiba.WPF.csproj deleted file mode 100644 index 170d5a1..0000000 --- a/Windows/Shiba.WPF/Shiba.WPF.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Debug - AnyCPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12} - library - Shiba.WPF - Shiba.WPF - v4.6.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - - - true - full - false - bin\Debug\ - TRACE;DEBUG;WPF - prompt - 4 - latest - - - pdbonly - true - bin\Release\ - TRACE;WPF - prompt - 4 - latest - - - - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - 4.0 - - - ..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll - True - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - {d0b763d5-a804-4822-be17-4cf9d0b62488} - Shiba - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - \ No newline at end of file diff --git a/Windows/Shiba.WPF/app.config b/Windows/Shiba.WPF/app.config deleted file mode 100644 index de84cba..0000000 --- a/Windows/Shiba.WPF/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Windows/Shiba.WPF/packages.config b/Windows/Shiba.WPF/packages.config deleted file mode 100644 index 466ab76..0000000 --- a/Windows/Shiba.WPF/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Windows/Shiba.nuspec b/Windows/Shiba.nuspec index 188a907..40db78c 100644 --- a/Windows/Shiba.nuspec +++ b/Windows/Shiba.nuspec @@ -12,27 +12,17 @@ Shiba - - - - - - - + - - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/Windows/Shiba.sln b/Windows/Shiba.sln index a8cc089..223027e 100644 --- a/Windows/Shiba.sln +++ b/Windows/Shiba.sln @@ -3,157 +3,35 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2036 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.UWP", "Shiba.UWP\Shiba.UWP.csproj", "{0ECE2838-DE51-461F-8386-75D7DE285D53}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{67E8AAE7-C4F1-4209-9696-D78A9A5427F5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.UWP.Sample", "Sample\Shiba.UWP.Sample\Shiba.UWP.Sample.csproj", "{F44681AD-EBAB-440E-820D-F12F2F62AC7F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.WPF.Sample", "Sample\Shiba.WPF.Sample\Shiba.WPF.Sample.csproj", "{C1C53173-786D-488C-B9AD-9EFAE29D3E86}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shiba.Test", "Shiba.Test\Shiba.Test.csproj", "{EC5AC778-5330-458B-B77A-468D7745F320}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Shiba.Shared", "Shiba.Shared\Shiba.Shared.shproj", "{060EA7A7-CBB7-4534-9446-7E3634BC8605}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.WPF", "Shiba.WPF\Shiba.WPF.csproj", "{FE732DB3-D266-4336-B3A6-DC8DEBAECE12}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shiba", "Shiba\Shiba.csproj", "{D0B763D5-A804-4822-BE17-4CF9D0B62488}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba", "Shiba\Shiba.csproj", "{3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shiba.Forms", "Shiba.Forms\Shiba.Forms.csproj", "{D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChakraHosting", "ChakraHosting\ChakraHosting.csproj", "{C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Forms", "Forms", "{20BC54F0-8191-4C65-872B-6F76E1D0D8A1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.Forms.Sample.Android", "Sample\Forms\Shiba.Forms.Sample.Android\Shiba.Forms.Sample.Android.csproj", "{AA91A3E4-F372-4D16-9C43-D0389FEE8600}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.Forms.Sample.iOS", "Sample\Forms\Shiba.Forms.Sample.iOS\Shiba.Forms.Sample.iOS.csproj", "{593026C4-3B38-47D8-98BE-BFB5D0100119}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.Forms.Sample.UWP", "Sample\Forms\Shiba.Forms.Sample.UWP\Shiba.Forms.Sample.UWP.csproj", "{13E53C9A-DAE6-400A-8AAC-4983A7929476}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shiba.Forms.Sample", "Sample\Forms\Shiba.Forms.Sample\Shiba.Forms.Sample.csproj", "{1AD06004-FBE9-40BB-B74F-C52FE16AF179}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiba.Test", "Shiba.Test\Shiba.Test.csproj", "{F220CA6C-8F79-401E-8261-94839E4D1A82}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - Shiba.Shared\Shiba.Shared.projitems*{060ea7a7-cbb7-4534-9446-7e3634bc8605}*SharedItemsImports = 13 - Shiba.Shared\Shiba.Shared.projitems*{0ece2838-de51-461f-8386-75d7de285d53}*SharedItemsImports = 4 - Shiba.Shared\Shiba.Shared.projitems*{fe732db3-d266-4336-b3a6-dc8debaece12}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution - Ad-Hoc|Any CPU = Ad-Hoc|Any CPU - Ad-Hoc|ARM = Ad-Hoc|ARM - Ad-Hoc|iPhone = Ad-Hoc|iPhone - Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator - Ad-Hoc|x64 = Ad-Hoc|x64 - Ad-Hoc|x86 = Ad-Hoc|x86 - AppStore|Any CPU = AppStore|Any CPU - AppStore|ARM = AppStore|ARM - AppStore|iPhone = AppStore|iPhone - AppStore|iPhoneSimulator = AppStore|iPhoneSimulator - AppStore|x64 = AppStore|x64 - AppStore|x86 = AppStore|x86 Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM - Debug|iPhone = Debug|iPhone - Debug|iPhoneSimulator = Debug|iPhoneSimulator + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|ARM.Build.0 = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|x64.Build.0 = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Ad-Hoc|x86.Build.0 = Release|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|Any CPU.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|ARM.ActiveCfg = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|ARM.Build.0 = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|iPhone.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|x64.ActiveCfg = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|x64.Build.0 = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|x86.ActiveCfg = Release|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.AppStore|x86.Build.0 = Release|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|ARM.ActiveCfg = Debug|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|ARM.Build.0 = Debug|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|iPhone.Build.0 = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|x64.ActiveCfg = Debug|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|x64.Build.0 = Debug|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|x86.ActiveCfg = Debug|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Debug|x86.Build.0 = Debug|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|Any CPU.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|ARM.ActiveCfg = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|ARM.Build.0 = Release|ARM - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|iPhone.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|iPhone.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|x64.ActiveCfg = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|x64.Build.0 = Release|x64 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|x86.ActiveCfg = Release|x86 - {0ECE2838-DE51-461F-8386-75D7DE285D53}.Release|x86.Build.0 = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|Any CPU.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|Any CPU.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|Any CPU.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|ARM.Build.0 = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhone.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhone.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhone.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x64.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x64.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x86.Build.0 = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|Any CPU.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|Any CPU.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|Any CPU.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|ARM.ActiveCfg = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|ARM.Build.0 = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|ARM.Deploy.0 = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhone.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhone.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhone.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhoneSimulator.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhoneSimulator.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|iPhoneSimulator.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x64.ActiveCfg = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x64.Build.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x64.Deploy.0 = Release|x64 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x86.ActiveCfg = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x86.Build.0 = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.AppStore|x86.Deploy.0 = Release|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|Any CPU.ActiveCfg = Debug|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|ARM.ActiveCfg = Debug|ARM {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|ARM.Build.0 = Debug|ARM {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|ARM.Deploy.0 = Debug|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|iPhone.ActiveCfg = Debug|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 + {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|ARM64.ActiveCfg = Debug|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|x64.ActiveCfg = Debug|x64 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|x64.Build.0 = Debug|x64 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Debug|x64.Deploy.0 = Debug|x64 @@ -164,478 +42,85 @@ Global {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|ARM.ActiveCfg = Release|ARM {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|ARM.Build.0 = Release|ARM {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|ARM.Deploy.0 = Release|ARM - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|iPhone.ActiveCfg = Release|x86 - {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|iPhoneSimulator.ActiveCfg = Release|x86 + {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|ARM64.ActiveCfg = Release|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x64.ActiveCfg = Release|x64 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x64.Build.0 = Release|x64 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x64.Deploy.0 = Release|x64 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x86.ActiveCfg = Release|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x86.Build.0 = Release|x86 {F44681AD-EBAB-440E-820D-F12F2F62AC7F}.Release|x86.Deploy.0 = Release|x86 - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|Any CPU.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|ARM.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|ARM.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|iPhone.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|x64.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|x64.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|x86.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.AppStore|x86.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|ARM.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|ARM.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|iPhone.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|x64.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|x64.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|x86.ActiveCfg = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Debug|x86.Build.0 = Debug|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|Any CPU.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|ARM.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|ARM.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|iPhone.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|iPhone.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|x64.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|x64.Build.0 = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|x86.ActiveCfg = Release|Any CPU - {C1C53173-786D-488C-B9AD-9EFAE29D3E86}.Release|x86.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|Any CPU.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|ARM.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|ARM.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|iPhone.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|x64.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|x64.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|x86.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.AppStore|x86.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|ARM.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|ARM.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|iPhone.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|x64.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|x64.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|x86.ActiveCfg = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Debug|x86.Build.0 = Debug|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|Any CPU.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|ARM.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|ARM.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|iPhone.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|iPhone.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|x64.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|x64.Build.0 = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|x86.ActiveCfg = Release|Any CPU - {EC5AC778-5330-458B-B77A-468D7745F320}.Release|x86.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|Any CPU.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|ARM.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|ARM.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|iPhone.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|x64.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|x64.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|x86.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.AppStore|x86.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|ARM.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|iPhone.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|x64.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|x64.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|x86.ActiveCfg = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Debug|x86.Build.0 = Debug|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|Any CPU.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|ARM.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|ARM.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|iPhone.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|iPhone.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|x64.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|x64.Build.0 = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|x86.ActiveCfg = Release|Any CPU - {FE732DB3-D266-4336-B3A6-DC8DEBAECE12}.Release|x86.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|Any CPU.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|ARM.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|ARM.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|iPhone.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|x64.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|x64.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|x86.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.AppStore|x86.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|ARM.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|ARM.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|iPhone.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|x64.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|x64.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|x86.ActiveCfg = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Debug|x86.Build.0 = Debug|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|Any CPU.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|ARM.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|ARM.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|iPhone.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|iPhone.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|x64.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|x64.Build.0 = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|x86.ActiveCfg = Release|Any CPU - {D0B763D5-A804-4822-BE17-4CF9D0B62488}.Release|x86.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|Any CPU.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|ARM.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|ARM.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|iPhone.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|x64.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|x64.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|x86.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.AppStore|x86.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|ARM.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|ARM.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|iPhone.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|x64.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|x64.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|x86.ActiveCfg = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Debug|x86.Build.0 = Debug|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|Any CPU.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|ARM.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|ARM.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|iPhone.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|iPhone.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|x64.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|x64.Build.0 = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|x86.ActiveCfg = Release|Any CPU - {D21B4D1E-39B8-4F5C-99AE-7EAD494401BF}.Release|x86.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|Any CPU.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|ARM.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|ARM.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|ARM.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhone.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhone.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x64.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x64.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x64.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x86.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x86.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.AppStore|x86.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|ARM.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|ARM.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|ARM.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhone.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhone.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x64.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x64.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x64.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x86.ActiveCfg = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x86.Build.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Debug|x86.Deploy.0 = Debug|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|Any CPU.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|Any CPU.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|ARM.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|ARM.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|ARM.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhone.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhone.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhone.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x64.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x64.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x64.Deploy.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x86.ActiveCfg = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x86.Build.0 = Release|Any CPU - {AA91A3E4-F372-4D16-9C43-D0389FEE8600}.Release|x86.Deploy.0 = Release|Any CPU - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|iPhone.Build.0 = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|x64.ActiveCfg = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.AppStore|x86.ActiveCfg = AppStore|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|ARM.ActiveCfg = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|iPhone.ActiveCfg = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|iPhone.Build.0 = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|x64.ActiveCfg = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Debug|x86.ActiveCfg = Debug|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|Any CPU.ActiveCfg = Release|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|ARM.ActiveCfg = Release|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|iPhone.ActiveCfg = Release|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|iPhone.Build.0 = Release|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|x64.ActiveCfg = Release|iPhone - {593026C4-3B38-47D8-98BE-BFB5D0100119}.Release|x86.ActiveCfg = Release|iPhone - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|Any CPU.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|Any CPU.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|Any CPU.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|ARM.Build.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhone.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhone.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhone.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x64.ActiveCfg = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x64.Build.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x64.Deploy.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x86.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|Any CPU.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|Any CPU.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|Any CPU.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|ARM.ActiveCfg = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|ARM.Build.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|ARM.Deploy.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhone.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhone.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhone.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhoneSimulator.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhoneSimulator.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|iPhoneSimulator.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x64.ActiveCfg = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x64.Build.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x64.Deploy.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x86.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x86.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.AppStore|x86.Deploy.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|Any CPU.ActiveCfg = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|ARM.ActiveCfg = Debug|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|ARM.Build.0 = Debug|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|ARM.Deploy.0 = Debug|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|iPhone.ActiveCfg = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x64.ActiveCfg = Debug|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x64.Build.0 = Debug|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x64.Deploy.0 = Debug|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x86.ActiveCfg = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x86.Build.0 = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Debug|x86.Deploy.0 = Debug|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|Any CPU.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|ARM.ActiveCfg = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|ARM.Build.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|ARM.Deploy.0 = Release|ARM - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|iPhone.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x64.ActiveCfg = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x64.Build.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x64.Deploy.0 = Release|x64 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x86.ActiveCfg = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x86.Build.0 = Release|x86 - {13E53C9A-DAE6-400A-8AAC-4983A7929476}.Release|x86.Deploy.0 = Release|x86 - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|ARM.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|iPhone.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|x64.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|x64.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|x86.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.AppStore|x86.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|ARM.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|iPhone.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|x64.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|x64.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|x86.ActiveCfg = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Debug|x86.Build.0 = Debug|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|Any CPU.Build.0 = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|ARM.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|ARM.Build.0 = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|iPhone.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|iPhone.Build.0 = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|x64.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|x64.Build.0 = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|x86.ActiveCfg = Release|Any CPU - {1AD06004-FBE9-40BB-B74F-C52FE16AF179}.Release|x86.Build.0 = Release|Any CPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|ARM.ActiveCfg = Debug|ARM + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|ARM.Build.0 = Debug|ARM + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|ARM64.Build.0 = Debug|ARM64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|x64.ActiveCfg = Debug|x64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|x64.Build.0 = Debug|x64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|x86.ActiveCfg = Debug|x86 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Debug|x86.Build.0 = Debug|x86 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|Any CPU.Build.0 = Release|Any CPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|ARM.ActiveCfg = Release|ARM + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|ARM.Build.0 = Release|ARM + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|ARM64.ActiveCfg = Release|ARM64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|ARM64.Build.0 = Release|ARM64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|x64.ActiveCfg = Release|x64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|x64.Build.0 = Release|x64 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|x86.ActiveCfg = Release|x86 + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798}.Release|x86.Build.0 = Release|x86 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|ARM.ActiveCfg = Debug|ARM + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|ARM.Build.0 = Debug|ARM + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|ARM64.Build.0 = Debug|ARM64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|x64.ActiveCfg = Debug|x64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|x64.Build.0 = Debug|x64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|x86.ActiveCfg = Debug|x86 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Debug|x86.Build.0 = Debug|x86 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|Any CPU.Build.0 = Release|Any CPU + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|ARM.ActiveCfg = Release|ARM + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|ARM.Build.0 = Release|ARM + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|ARM64.ActiveCfg = Release|ARM64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|ARM64.Build.0 = Release|ARM64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|x64.ActiveCfg = Release|x64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|x64.Build.0 = Release|x64 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|x86.ActiveCfg = Release|x86 + {C5D6ED6A-C8B9-4BED-A226-D1ACFAA763E0}.Release|x86.Build.0 = Release|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|Any CPU.ActiveCfg = Debug|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM.ActiveCfg = Debug|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM.Build.0 = Debug|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM.Deploy.0 = Debug|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM64.Build.0 = Debug|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x64.ActiveCfg = Debug|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x64.Build.0 = Debug|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x64.Deploy.0 = Debug|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x86.ActiveCfg = Debug|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x86.Build.0 = Debug|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Debug|x86.Deploy.0 = Debug|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|Any CPU.ActiveCfg = Release|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM.ActiveCfg = Release|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM.Build.0 = Release|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM.Deploy.0 = Release|ARM + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM64.ActiveCfg = Release|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM64.Build.0 = Release|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|ARM64.Deploy.0 = Release|ARM64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x64.ActiveCfg = Release|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x64.Build.0 = Release|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x64.Deploy.0 = Release|x64 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x86.ActiveCfg = Release|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x86.Build.0 = Release|x86 + {F220CA6C-8F79-401E-8261-94839E4D1A82}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {F44681AD-EBAB-440E-820D-F12F2F62AC7F} = {67E8AAE7-C4F1-4209-9696-D78A9A5427F5} - {C1C53173-786D-488C-B9AD-9EFAE29D3E86} = {67E8AAE7-C4F1-4209-9696-D78A9A5427F5} - {20BC54F0-8191-4C65-872B-6F76E1D0D8A1} = {67E8AAE7-C4F1-4209-9696-D78A9A5427F5} - {AA91A3E4-F372-4D16-9C43-D0389FEE8600} = {20BC54F0-8191-4C65-872B-6F76E1D0D8A1} - {593026C4-3B38-47D8-98BE-BFB5D0100119} = {20BC54F0-8191-4C65-872B-6F76E1D0D8A1} - {13E53C9A-DAE6-400A-8AAC-4983A7929476} = {20BC54F0-8191-4C65-872B-6F76E1D0D8A1} - {1AD06004-FBE9-40BB-B74F-C52FE16AF179} = {20BC54F0-8191-4C65-872B-6F76E1D0D8A1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {65D40355-54BF-4351-A85C-6A8D91B4E64D} diff --git a/Windows/Shiba/CommonProperty/CommonProperty.cs b/Windows/Shiba/CommonProperty/CommonProperty.cs new file mode 100644 index 0000000..11bf1ec --- /dev/null +++ b/Windows/Shiba/CommonProperty/CommonProperty.cs @@ -0,0 +1,21 @@ +using NativeView = Windows.UI.Xaml.FrameworkElement; +using NativeBinding = Windows.UI.Xaml.Data.Binding; +using NativeProperty = Windows.UI.Xaml.DependencyProperty; +using NativeThickness = Windows.UI.Xaml.Thickness; +using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; + +namespace Shiba.CommonProperty +{ + public abstract class AbsCommonProperty : ICommonProperty + { + public abstract string Name { get; } + + public void Handle(object targetValue, object targetNativeView, object parentNativeView) + { + if (targetValue is TValue value && targetNativeView is NativeView nativeView && + parentNativeView is NativeViewGroup parent) SetValue(value, nativeView, parent); + } + + public abstract void SetValue(TValue targetValue, NativeView nativeView, NativeViewGroup parent); + } +} \ No newline at end of file diff --git a/Windows/Shiba/CommonProperty/GridProperty.cs b/Windows/Shiba/CommonProperty/GridProperty.cs new file mode 100644 index 0000000..847a781 --- /dev/null +++ b/Windows/Shiba/CommonProperty/GridProperty.cs @@ -0,0 +1,31 @@ +using Windows.UI.Xaml.Controls; +using Shiba.Controls; +using NativeView = Windows.UI.Xaml.FrameworkElement; +using NativeBinding = Windows.UI.Xaml.Data.Binding; +using NativeProperty = Windows.UI.Xaml.DependencyProperty; +using NativeThickness = Windows.UI.Xaml.Thickness; +using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; + + +namespace Shiba.CommonProperty +{ + public class GridProperty : AbsCommonProperty + { + public override string Name { get; } = "grid"; + + public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) + { + var row = map.Get("row"); + var column = map.Get("column"); + var rowSpan = map.Get("rowSpan"); + var columnSpan = map.Get("columnSpan"); + if (row != default) Grid.SetRow(element, row); + + if (column != default) Grid.SetColumn(element, column); + + if (rowSpan != default) Grid.SetRowSpan(element, rowSpan); + + if (columnSpan != default) Grid.SetColumnSpan(element, columnSpan); + } + } +} \ No newline at end of file diff --git a/Windows/Shiba/ICommonProperty.cs b/Windows/Shiba/CommonProperty/ICommonProperty.cs similarity index 70% rename from Windows/Shiba/ICommonProperty.cs rename to Windows/Shiba/CommonProperty/ICommonProperty.cs index 46cb6c7..85fb4ef 100644 --- a/Windows/Shiba/ICommonProperty.cs +++ b/Windows/Shiba/CommonProperty/ICommonProperty.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using Shiba.Controls; - -namespace Shiba +namespace Shiba.CommonProperty { public interface ICommonProperty { diff --git a/Windows/Shiba/CommonProperty/RelativeProperty.cs b/Windows/Shiba/CommonProperty/RelativeProperty.cs new file mode 100644 index 0000000..4c45692 --- /dev/null +++ b/Windows/Shiba/CommonProperty/RelativeProperty.cs @@ -0,0 +1,18 @@ +using Shiba.Controls; +using NativeView = Windows.UI.Xaml.FrameworkElement; +using NativeBinding = Windows.UI.Xaml.Data.Binding; +using NativeProperty = Windows.UI.Xaml.DependencyProperty; +using NativeThickness = Windows.UI.Xaml.Thickness; +using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; + +namespace Shiba.CommonProperty +{ + public class RelativeProperty : AbsCommonProperty + { + public override string Name { get; } = "relative"; + + public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) + { + } + } +} \ No newline at end of file diff --git a/Windows/Shiba/Controls/IViewRenderer.cs b/Windows/Shiba/Controls/IViewRenderer.cs index 29b3875..e352699 100644 --- a/Windows/Shiba/Controls/IViewRenderer.cs +++ b/Windows/Shiba/Controls/IViewRenderer.cs @@ -20,10 +20,10 @@ public interface IViewMapper { object Map(View view, IShibaContext context); } - + public interface IViewMapper : IViewMapper { - new T Map(View view, IShibaContext context); T CreateNativeView(); + new T Map(View view, IShibaContext context); } } \ No newline at end of file diff --git a/Windows/Shiba/Controls/View.cs b/Windows/Shiba/Controls/View.cs index 5ded978..289fdd7 100644 --- a/Windows/Shiba/Controls/View.cs +++ b/Windows/Shiba/Controls/View.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Linq; @@ -16,16 +15,6 @@ public Property(ShibaToken name, object value) public ShibaToken Name { get; } public object Value { get; } - public override string ToString() - { - return $"{Name} = {Value}"; - } - - private bool Equals(Property other) - { - return Equals(Name, other.Name) && Equals(Value, other.Value); - } - public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -40,6 +29,16 @@ public override int GetHashCode() return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Value != null ? Value.GetHashCode() : 0); } } + + public override string ToString() + { + return $"{Name} = {Value}"; + } + + private bool Equals(Property other) + { + return Equals(Name, other.Name) && Equals(Value, other.Value); + } } public sealed class ShibaExtension @@ -55,16 +54,6 @@ public ShibaExtension(string type, BasicValue value, string script) public BasicValue Value { get; } public string Script { get; } - public override string ToString() - { - return $"${Type} {Value}"; - } - - private bool Equals(ShibaExtension other) - { - return string.Equals(Type, other.Type) && Equals(Value, other.Value); - } - public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -79,6 +68,16 @@ public override int GetHashCode() return ((Type != null ? Type.GetHashCode() : 0) * 397) ^ (Value != null ? Value.GetHashCode() : 0); } } + + public override string ToString() + { + return $"${Type} {Value}"; + } + + private bool Equals(ShibaExtension other) + { + return string.Equals(Type, other.Type) && Equals(Value, other.Value); + } } public sealed class View @@ -94,23 +93,6 @@ public View(ShibaToken viewName, object defaultValue = null) public List Children { get; } = new List(); public List Properties { get; } = new List(); public View Parent { get; internal set; } - - - public override string ToString() - { - if (DefaultValue != null) - { - return $"{ViewName} -> {DefaultValue}"; - } - - return - $"{ViewName} {{ {string.Join(" ", Properties.Select(it => it.ToString()))} {string.Join(" ", Children.Select(it => it.ToString()))} }}"; - } - - private bool Equals(View other) - { - return Equals(ViewName, other.ViewName) && Equals(DefaultValue, other.DefaultValue) && Children.SequenceEqual(other.Children) && Properties.SequenceEqual(other.Properties); - } public override bool Equals(object obj) { @@ -123,33 +105,48 @@ public override int GetHashCode() { unchecked { - var hashCode = (ViewName != null ? ViewName.GetHashCode() : 0); + var hashCode = ViewName != null ? ViewName.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (DefaultValue != null ? DefaultValue.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Children != null ? Children.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Properties != null ? Properties.GetHashCode() : 0); return hashCode; } } - } - public sealed class ShibaArray : List - { + public override string ToString() { - return $"[{string.Join(",", this.Select(it => it.ToString()))}]"; + if (DefaultValue != null) return $"{ViewName} -> {DefaultValue}"; + + return + $"{ViewName} {{ {string.Join(" ", Properties.Select(it => it.ToString()))} {string.Join(" ", Children.Select(it => it.ToString()))} }}"; } - private bool Equals(ShibaArray other) + private bool Equals(View other) { - return this.SequenceEqual(other); + return Equals(ViewName, other.ViewName) && Equals(DefaultValue, other.DefaultValue) && + Children.SequenceEqual(other.Children) && Properties.SequenceEqual(other.Properties); } + } + public sealed class ShibaArray : List + { public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj is ShibaArray array && Equals(array); } + + public override string ToString() + { + return $"[{string.Join(",", this.Select(it => it.ToString()))}]"; + } + + private bool Equals(ShibaArray other) + { + return this.SequenceEqual(other); + } } public enum ShibaValueType @@ -158,9 +155,9 @@ public enum ShibaValueType Token, Number, Null, - Boolean, + Boolean } - + public sealed class BasicValue { public BasicValue(ShibaValueType typeCode, object value) @@ -171,6 +168,22 @@ public BasicValue(ShibaValueType typeCode, object value) public ShibaValueType TypeCode { get; } public object Value { get; } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj is BasicValue value && Equals(value); + } + + public override int GetHashCode() + { + unchecked + { + return ((int) TypeCode * 397) ^ (Value != null ? Value.GetHashCode() : 0); + } + } + public override string ToString() { switch (TypeCode) @@ -181,7 +194,7 @@ public override string ToString() case ShibaValueType.Number: return $"{Value}"; case ShibaValueType.Null: - return $"null"; + return "null"; case ShibaValueType.Boolean: return $"{Value.ToString().ToLower()}"; default: @@ -193,26 +206,24 @@ private bool Equals(BasicValue other) { return TypeCode == other.TypeCode && Equals(Value, other.Value); } + } + + public sealed class ShibaMap + { + public List Properties { get; } = new List(); public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - return obj is BasicValue value && Equals(value); + return obj is ShibaMap o && Equals(o); } public override int GetHashCode() { - unchecked - { - return ((int) TypeCode * 397) ^ (Value != null ? Value.GetHashCode() : 0); - } + return Properties != null ? Properties.GetHashCode() : 0; } - } - - public sealed class ShibaMap - { - public List Properties { get; } = new List(); + public override string ToString() { return $"[ {string.Join(" ", Properties.Select(it => it.ToString()))} ]"; @@ -223,31 +234,46 @@ private bool Equals(ShibaMap other) return Properties.SequenceEqual(other.Properties); } - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - return obj is ShibaMap o && Equals(o); - } - - public override int GetHashCode() - { - return Properties != null ? Properties.GetHashCode() : 0; - } - //public object this[string name] //{ // get // { // var value = Properties.FirstOrDefault(it => it.Name.IsCurrentPlatform(name))?.Value; - + // } //} - } - + public sealed class ShibaToken { + public ShibaToken(string value) : this(string.Empty, value) + { + } + + public ShibaToken(string prefix, string value) + { + Value = value; + Prefix = prefix; + } + + public string Prefix { get; } + public string Value { get; } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj is ShibaToken token && Equals(token); + } + + public override int GetHashCode() + { + unchecked + { + return ((Prefix != null ? Prefix.GetHashCode() : 0) * 397) ^ (Value != null ? Value.GetHashCode() : 0); + } + } + public bool IsCurrentPlatform(string value) { if (ReferenceEquals(value, null)) return false; @@ -256,14 +282,14 @@ public bool IsCurrentPlatform(string value) public bool IsCurrentPlatform() { - return Prefix == AbstractShiba.Instance.Configuration.PlatformType || string.IsNullOrEmpty(Prefix); + return Prefix == ShibaApp.Instance.Configuration.PlatformType || string.IsNullOrEmpty(Prefix); } - + // public static bool operator ==(string value, ShibaToken token) // { // if (ReferenceEquals(value, null)) return false; // if (ReferenceEquals(token, null)) return false; -// return (token.Prefix == AbstractShiba.Instance.Configuration.PlatformType || string.IsNullOrEmpty(token.Prefix)) && string.Equals(value, token.Value); +// return (token.Prefix == ShibaApp.Instance.Configuration.PlatformType || string.IsNullOrEmpty(token.Prefix)) && string.Equals(value, token.Value); // } // // public static bool operator !=(string name, ShibaToken token) @@ -284,21 +310,6 @@ public bool IsCurrentPlatform() return !(c1 == c2); } - - public ShibaToken(string value) : this(prefix: string.Empty, value: value) - { - - } - - public ShibaToken(string prefix, string value) - { - Value = value; - Prefix = prefix; - } - - public string Prefix { get; } - public string Value { get; } - public override string ToString() { return string.IsNullOrEmpty(Prefix) ? Value : $"{Prefix}:{Value}"; @@ -308,21 +319,6 @@ private bool Equals(ShibaToken other) { return string.Equals(Prefix, other.Prefix) && string.Equals(Value, other.Value); } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - return obj is ShibaToken token && Equals(token); - } - - public override int GetHashCode() - { - unchecked - { - return ((Prefix != null ? Prefix.GetHashCode() : 0) * 397) ^ (Value != null ? Value.GetHashCode() : 0); - } - } } @@ -336,16 +332,6 @@ public ShibaFunction(string name) public string Name { get; } public List Parameters { get; } = new List(); - public override string ToString() - { - return $"{Name}({string.Join(",", Parameters.Select(it => it.ToString()))})"; - } - - private bool Equals(ShibaFunction other) - { - return string.Equals(Name, other.Name) && Parameters.SequenceEqual(other.Parameters); - } - public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -357,10 +343,19 @@ public override int GetHashCode() { unchecked { - return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Parameters != null ? Parameters.GetHashCode() : 0); + return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ + (Parameters != null ? Parameters.GetHashCode() : 0); } } - } - + public override string ToString() + { + return $"{Name}({string.Join(",", Parameters.Select(it => it.ToString()))})"; + } + + private bool Equals(ShibaFunction other) + { + return string.Equals(Name, other.Name) && Parameters.SequenceEqual(other.Parameters); + } + } } \ No newline at end of file diff --git a/Windows/Shiba.Shared/ConvertExtensions.cs b/Windows/Shiba/ConvertExtensions.cs similarity index 56% rename from Windows/Shiba.Shared/ConvertExtensions.cs rename to Windows/Shiba/ConvertExtensions.cs index d690fe5..8457286 100644 --- a/Windows/Shiba.Shared/ConvertExtensions.cs +++ b/Windows/Shiba/ConvertExtensions.cs @@ -1,147 +1,78 @@ using System; using System.Linq; using System.Reflection; -#if WINDOWS_UWP using Windows.UI; using NativeThickness = Windows.UI.Xaml.Thickness; -#elif WPF -using System.Windows; -using System.Windows.Media; -using NativeThickness = System.Windows.Thickness; -using System.Drawing; -#elif FORMS -using Xamarin.Forms; -using NativeThickness = Xamarin.Forms.Thickness; -#endif namespace Shiba { internal static class ConvertExtensions { - - public static bool TryChangeType(this object value, Type type, out object result) - { - if (value == null) - { - result = null; - return false; - } - - if (type == null) - { - result = value; - return false; - } - - if (value.GetType() == type) - { - result = value; - return true; - } - - if (value.CanChangeType(type)) - { - result = Convert.ChangeType(value, type); - return true; - } - - result = value; - return false; - - } - public static bool CanChangeType(this object value, Type conversionType) { - if (conversionType == null) - { - return false; - } + if (conversionType == null) return false; - if (value == null) - { - return false; - } + if (value == null) return false; return value is IConvertible; } - + public static Color ToNativeColor(this string colorString) { - if (string.IsNullOrEmpty(colorString)) - { - throw new ArgumentException(nameof(colorString)); - } + if (string.IsNullOrEmpty(colorString)) throw new ArgumentException(nameof(colorString)); if (colorString[0] == '#') - { switch (colorString.Length) { case 9: { var cuint = Convert.ToUInt32(colorString.Substring(1), 16); - var a = (byte)(cuint >> 24); - var r = (byte)((cuint >> 16) & 0xff); - var g = (byte)((cuint >> 8) & 0xff); - var b = (byte)(cuint & 0xff); -#if FORMS - return Color.FromRgba(r, g, b, a); -#else + var a = (byte) (cuint >> 24); + var r = (byte) ((cuint >> 16) & 0xff); + var g = (byte) ((cuint >> 8) & 0xff); + var b = (byte) (cuint & 0xff); return Color.FromArgb(a, r, g, b); -#endif } case 7: { var cuint = Convert.ToUInt32(colorString.Substring(1), 16); - var r = (byte)((cuint >> 16) & 0xff); - var g = (byte)((cuint >> 8) & 0xff); - var b = (byte)(cuint & 0xff); -#if FORMS - return Color.FromRgb(r, g, b); -#else + var r = (byte) ((cuint >> 16) & 0xff); + var g = (byte) ((cuint >> 8) & 0xff); + var b = (byte) (cuint & 0xff); return Color.FromArgb(255, r, g, b); -#endif } case 5: { var cuint = Convert.ToUInt16(colorString.Substring(1), 16); - var a = (byte)(cuint >> 12); - var r = (byte)((cuint >> 8) & 0xf); - var g = (byte)((cuint >> 4) & 0xf); - var b = (byte)(cuint & 0xf); - a = (byte)(a << 4 | a); - r = (byte)(r << 4 | r); - g = (byte)(g << 4 | g); - b = (byte)(b << 4 | b); -#if FORMS - return Color.FromRgba(r, g, b, a); -#else + var a = (byte) (cuint >> 12); + var r = (byte) ((cuint >> 8) & 0xf); + var g = (byte) ((cuint >> 4) & 0xf); + var b = (byte) (cuint & 0xf); + a = (byte) ((a << 4) | a); + r = (byte) ((r << 4) | r); + g = (byte) ((g << 4) | g); + b = (byte) ((b << 4) | b); return Color.FromArgb(a, r, g, b); -#endif } case 4: { var cuint = Convert.ToUInt16(colorString.Substring(1), 16); - var r = (byte)((cuint >> 8) & 0xf); - var g = (byte)((cuint >> 4) & 0xf); - var b = (byte)(cuint & 0xf); - r = (byte)(r << 4 | r); - g = (byte)(g << 4 | g); - b = (byte)(b << 4 | b); -#if FORMS - return Color.FromRgb(r, g, b); -#else + var r = (byte) ((cuint >> 8) & 0xf); + var g = (byte) ((cuint >> 4) & 0xf); + var b = (byte) (cuint & 0xf); + r = (byte) ((r << 4) | r); + g = (byte) ((g << 4) | g); + b = (byte) ((b << 4) | b); return Color.FromArgb(255, r, g, b); -#endif } default: throw new FormatException( $"The {colorString} string passed in the colorString argument is not a recognized Color format."); } - } if (colorString.Length > 3 && colorString[0] == 's' && colorString[1] == 'c' && colorString[2] == '#') { @@ -155,45 +86,59 @@ public static Color ToNativeColor(this string colorString) var scR = double.Parse(values[1]); var scG = double.Parse(values[2]); var scB = double.Parse(values[3]); -#if FORMS - return Color.FromRgba((byte)(scR * 255), (byte)(scG * 255), (byte)(scB * 255), (byte)(scA * 255)); -#else - return Color.FromArgb((byte)(scA * 255), (byte)(scR * 255), (byte)(scG * 255), (byte)(scB * 255)); -#endif + return Color.FromArgb((byte) (scA * 255), (byte) (scR * 255), (byte) (scG * 255), + (byte) (scB * 255)); } case 3: { var scR = double.Parse(values[0].Substring(3)); var scG = double.Parse(values[1]); var scB = double.Parse(values[2]); -#if FORMS - return Color.FromRgb((byte)(scR * 255), (byte)(scG * 255), (byte)(scB * 255)); -#else - return Color.FromArgb(255, (byte)(scR * 255), (byte)(scG * 255), (byte)(scB * 255)); -#endif + return Color.FromArgb(255, (byte) (scR * 255), (byte) (scG * 255), (byte) (scB * 255)); } default: throw new FormatException( $"The {colorString} string passed in the colorString argument is not a recognized Color format (sc#[scA,]scR,scG,scB)."); } - } -#if FORMS - var prop = typeof(Color).GetTypeInfo().DeclaredProperties.FirstOrDefault(it => - string.Equals(it.Name, colorString, StringComparison.OrdinalIgnoreCase)); -#else var prop = typeof(Colors).GetTypeInfo().DeclaredProperties.FirstOrDefault(it => string.Equals(it.Name, colorString, StringComparison.OrdinalIgnoreCase)); -#endif - if (prop != null) - { - return (Color)prop.GetValue(null); - } + if (prop != null) return (Color) prop.GetValue(null); throw new FormatException( $"The {colorString} string passed in the colorString argument is not a recognized Color."); } + + public static bool TryChangeType(this object value, Type type, out object result) + { + if (value == null) + { + result = null; + return false; + } + + if (type == null) + { + result = value; + return false; + } + + if (value.GetType() == type) + { + result = value; + return true; + } + + if (value.CanChangeType(type)) + { + result = Convert.ChangeType(value, type); + return true; + } + + result = value; + return false; + } } } \ No newline at end of file diff --git a/Windows/Shiba.Shared/Converter.cs b/Windows/Shiba/Converter.cs similarity index 78% rename from Windows/Shiba.Shared/Converter.cs rename to Windows/Shiba/Converter.cs index 2248af0..938d2fe 100644 --- a/Windows/Shiba.Shared/Converter.cs +++ b/Windows/Shiba/Converter.cs @@ -1,19 +1,10 @@ using System; using System.Diagnostics; using System.Linq; -using Shiba.Controls; -using Shiba.Internal; -#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Data; -#elif WPF -using System.Windows; -using System.Windows.Data; -using System.Globalization; -#elif FORMS -using Xamarin.Forms; -using System.Globalization; -#endif +using Shiba.Controls; +using Shiba.Internal; namespace Shiba { @@ -21,10 +12,16 @@ internal class ShibaFunctionExecutor { public object Execute(ShibaFunction function, object dataContext) { - return AbstractShiba.Instance.Configuration.ScriptRuntime.Execute(function.Name, - function.Parameters.Select(it => GetParameterValue(it, dataContext)).ToArray()); + return ShibaApp.Instance.Configuration.ScriptRuntime.Execute(function.Name, + function.Parameters.Select(it => GetParameterValue(it, dataContext)).ToArray()); + } + + protected virtual object GetValueFromDataContext(ShibaExtension extension, object dataContext) + { + return ShibaApp.Instance.Configuration.ExtensionExecutors + .FirstOrDefault(it => it.Name == extension.Type)?.ProvideValue(null, extension); } - + private object GetParameterValue(object it, object dataContext) { switch (it) @@ -37,12 +34,6 @@ private object GetParameterValue(object it, object dataContext) return it; } } - - protected virtual object GetValueFromDataContext(ShibaExtension extension, object dataContext) - { - return AbstractShiba.Instance.Configuration.ExtensionExecutors - .FirstOrDefault(it => it.Name == extension.Type)?.ProvideValue(null, extension); - } } internal class SingleBindingShibaFunctionExecutor : ShibaFunctionExecutor @@ -52,14 +43,16 @@ protected override object GetValueFromDataContext(ShibaExtension binding, object return dataContext; } } - + internal class SingleBindingFunctionConverter : FunctionConverter { protected override ShibaFunctionExecutor Executor => Singleton.Instance; } internal class FunctionConverter : ShibaConverter - { + { + protected virtual ShibaFunctionExecutor Executor => Singleton.Instance; + protected override object Convert(object value, Type targetType, object parameter) { switch (parameter) @@ -69,13 +62,8 @@ protected override object Convert(object value, Type targetType, object paramete case ShibaConverterParameter converterParameter: if (converterParameter.InnerConverter != null) { -#if WINDOWS_UWP var innerResult = converterParameter.InnerConverter.Convert(value, targetType, converterParameter.InnerParameter, string.Empty); -#elif WPF || FORMS - var innerResult = converterParameter.InnerConverter.Convert(value, targetType, - converterParameter.InnerParameter, CultureInfo.CurrentCulture); -#endif return Executor.Execute(converterParameter.Function, innerResult); } else @@ -87,16 +75,14 @@ protected override object Convert(object value, Type targetType, object paramete } } - protected virtual ShibaFunctionExecutor Executor => Singleton.Instance; - protected override object ConvertBack(object value, Type targetType, object parameter) { throw new NotImplementedException(); } } - - + + internal sealed class RawDataConverter : ShibaConverter { protected override object Convert(object value, Type targetType, object parameter) @@ -116,24 +102,15 @@ internal static class ConverterExtensions { public static object CheckIfIsBoolean(this object value, Type targetType) { -#if !FORMS if (targetType == typeof(Visibility) && value is bool boolValue) - { return boolValue ? Visibility.Visible : Visibility.Collapsed; - } -#endif return value; } public static object CheckIfIsVisibility(this object value, Type targetType) { -#if !FORMS - if (targetType == typeof(bool) && value is Visibility visibility) - { - return visibility == Visibility.Visible; - } -#endif + if (targetType == typeof(bool) && value is Visibility visibility) return visibility == Visibility.Visible; return value; } @@ -148,7 +125,6 @@ internal class ShibaConverterParameter internal abstract class ShibaConverter : IValueConverter { -#if WINDOWS_UWP public object Convert(object value, Type targetType, object parameter, string language) { return Convert(value, targetType, parameter).CheckIfIsBoolean(targetType); @@ -159,18 +135,6 @@ public object ConvertBack(object value, Type targetType, object parameter, strin return ConvertBack(value, targetType, parameter).CheckIfIsVisibility(targetType); } -#elif WPF || FORMS - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return Convert(value, targetType, parameter); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return ConvertBack(value, targetType, parameter); - } -#endif - protected abstract object Convert(object value, Type targetType, object parameter); protected abstract object ConvertBack(object value, Type targetType, object parameter); diff --git a/Windows/Shiba.Shared/ExtensionExecutors/BindingExecutor.cs b/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs similarity index 55% rename from Windows/Shiba.Shared/ExtensionExecutors/BindingExecutor.cs rename to Windows/Shiba/ExtensionExecutors/BindingExecutor.cs index 5d3b0cb..b557c5c 100644 --- a/Windows/Shiba.Shared/ExtensionExecutors/BindingExecutor.cs +++ b/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs @@ -1,39 +1,15 @@ using System; -using System.Collections.Generic; using System.Linq; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; using Newtonsoft.Json.Linq; using Shiba.Controls; using Shiba.Internal; -using Shiba.Visitors; using ShibaView = Shiba.Controls.View; -#if WINDOWS_UWP -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; using NativeView = Windows.UI.Xaml.FrameworkElement; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeProperty = Windows.UI.Xaml.DependencyProperty; using NativeThickness = Windows.UI.Xaml.Thickness; -using Windows.UI.Xaml.Data; - -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.VisualElement; -using XFView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; - -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using System.Windows.Data; -#endif namespace Shiba.ExtensionExecutors @@ -50,12 +26,10 @@ public object ProvideValue(IShibaContext context, ShibaExtension value) public virtual NativeBinding ProvideNativeBinding(IShibaContext context, ShibaExtension value) { var dataContextPath = -#if FORMS - "BindingContext"; -#elif WINDOWS_UWP || WPF "DataContext"; -#endif - var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token ? value.Value.Value as string : null; + var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token + ? value.Value.Value as string + : null; var path = string.IsNullOrEmpty(targetPath) ? dataContextPath : $"{dataContextPath}.{targetPath}"; @@ -63,12 +37,8 @@ public virtual NativeBinding ProvideNativeBinding(IShibaContext context, ShibaEx return new NativeBinding { Source = context.ShibaHost, -#if FORMS - Path = path, -#elif WINDOWS_UWP || WPF Path = new PropertyPath(path), - UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, -#endif + UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; } } @@ -77,89 +47,62 @@ public class JsonExecutor : BindingExecutor { public override string Name { get; } = "json"; - public override Binding ProvideNativeBinding(IShibaContext context, ShibaExtension value) + public override NativeBinding ProvideNativeBinding(IShibaContext context, ShibaExtension value) { var dataContextPath = -#if FORMS - "BindingContext"; -#elif WINDOWS_UWP || WPF "DataContext"; -#endif - var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token ? value.Value.Value as string : null; + var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token + ? value.Value.Value as string + : null; var path = dataContextPath; - + return new NativeBinding { Converter = Singleton.Instance, ConverterParameter = targetPath, Source = context.ShibaHost, -#if FORMS - Path = path, -#elif WINDOWS_UWP || WPF Path = new PropertyPath(path), - UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, -#endif + UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; } } - class JsonConverter : ShibaConverter + internal class JsonConverter : ShibaConverter { protected override object Convert(object value, Type targetType, object parameter) { - if (!(value is JToken token)) - { - return null; - } + if (!(value is JToken token)) return null; var targetPath = parameter + ""; - - if (string.IsNullOrEmpty(targetPath)) - { - return ParseValue(token, targetType); - } + + if (string.IsNullOrEmpty(targetPath)) return ParseValue(token, targetType); token = targetPath.Split('.').Aggregate(token, (current, path) => current?[path]); return ParseValue(token, targetType); } + protected override object ConvertBack(object value, Type targetType, object parameter) + { + throw new NotImplementedException(); + } + private object ParseValue(JToken token, Type targetType) { - if (token == null) - { - return null; - } + if (token == null) return null; if (!token.HasValues) { - if (token is JValue value) - { - return value.Value; - } + if (token is JValue value) return value.Value; return token; } - if (targetType == typeof(string)) - { - return token.Value(); - } - if (targetType == typeof(int)) - { - return token.Value(); - } + if (targetType == typeof(string)) return token.Value(); - if (targetType == typeof(double)) - { - return token.Value(); - } + if (targetType == typeof(int)) return token.Value(); - return token.Value(); - } + if (targetType == typeof(double)) return token.Value(); - protected override object ConvertBack(object value, Type targetType, object parameter) - { - throw new NotImplementedException(); + return token.Value(); } } - } \ No newline at end of file diff --git a/Windows/Shiba.Shared/ExtensionExecutors/IBindingExtensionExecutor.cs b/Windows/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs similarity index 66% rename from Windows/Shiba.Shared/ExtensionExecutors/IBindingExtensionExecutor.cs rename to Windows/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs index db9ebbf..b6099ae 100644 --- a/Windows/Shiba.Shared/ExtensionExecutors/IBindingExtensionExecutor.cs +++ b/Windows/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs @@ -1,14 +1,6 @@ using Shiba.Controls; - -#if WINDOWS_UWP using NativeBinding = Windows.UI.Xaml.Data.Binding; -#elif FORMS -using NativeBinding = Xamarin.Forms.Binding; - -#elif WPF -using NativeBinding = System.Windows.Data.Binding; -#endif namespace Shiba.ExtensionExecutors { @@ -16,5 +8,4 @@ public interface IBindingExtensionExecutor : IExtensionExecutor { NativeBinding ProvideNativeBinding(IShibaContext context, ShibaExtension value); } - } \ No newline at end of file diff --git a/Windows/Shiba/IShibaExtension.cs b/Windows/Shiba/ExtensionExecutors/IShibaExtension.cs similarity index 79% rename from Windows/Shiba/IShibaExtension.cs rename to Windows/Shiba/ExtensionExecutors/IShibaExtension.cs index d24c185..2c821e8 100644 --- a/Windows/Shiba/IShibaExtension.cs +++ b/Windows/Shiba/ExtensionExecutors/IShibaExtension.cs @@ -1,8 +1,6 @@ -using System; -using System.Threading.Tasks; using Shiba.Controls; -namespace Shiba +namespace Shiba.ExtensionExecutors { public interface IExtensionExecutor { @@ -12,6 +10,5 @@ public interface IExtensionExecutor public interface IMutableExtensionExecutor : IExtensionExecutor { - } } \ No newline at end of file diff --git a/Windows/Shiba.Shared/Extensions.cs b/Windows/Shiba/Extensions.cs similarity index 54% rename from Windows/Shiba.Shared/Extensions.cs rename to Windows/Shiba/Extensions.cs index 6a312e1..472941f 100644 --- a/Windows/Shiba.Shared/Extensions.cs +++ b/Windows/Shiba/Extensions.cs @@ -1,32 +1,15 @@ using System; using System.Linq; using System.Reflection; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Markup; using Shiba.Controls; using Shiba.Visitors; using ShibaView = Shiba.Controls.View; -#if WINDOWS_UWP -using Windows.UI.Xaml; -using Windows.UI.Xaml.Markup; using NativeView = Windows.UI.Xaml.FrameworkElement; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeProperty = Windows.UI.Xaml.DependencyProperty; using NativeThickness = Windows.UI.Xaml.Thickness; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.VisualElement; -using XFView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -#endif namespace Shiba { @@ -34,37 +17,32 @@ public static class ViewExtension { public static DataTemplate ToDataTemplate(this ShibaView view) { -#if WINDOWS_UWP - var layoutString = view.ToString(); var templateString = $""; var template = XamlReader.Load(templateString) as DataTemplate; -#elif WPF - var factory = new FrameworkElementFactory(typeof(ShibaHost)); - factory.SetValue(ShibaHost.ShibaLayoutProperty, view); - var template = new DataTemplate - { - DataType = typeof(ShibaHost), - VisualTree = factory - }; -#elif FORMS - var template = new DataTemplate(() => new ViewCell - { - View = new ShibaHost - { - ShibaLayout = view - } - }); -#endif + return template; } } - + public static class ShibaMapExtension { - + public static T Get(this ShibaMap map, string name) + { + var value = map.Properties.FirstOrDefault(it => it.Name.IsCurrentPlatform(name))?.Value; + if (value == null) return default; + + var result = ShibaValueVisitor.GetValue(value, null); + if (result is T targetResult) return targetResult; + + if (typeof(IConvertible).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) + return (T) Convert.ChangeType(result, typeof(T)); + + return default; + } + public static NativeThickness ToNativeThickness(this ShibaMap shibaObject) { var left = shibaObject?.Get("left") ?? default; @@ -75,35 +53,10 @@ public static NativeThickness ToNativeThickness(this ShibaMap shibaObject) var horizon = shibaObject?.Get("horizon") ?? default; if (vertical != default || horizon != default) - { - return new NativeThickness(left: horizon, top: vertical, right: horizon, bottom: vertical); - } - - - return new NativeThickness(left: left, top: top, right: right, bottom: bottom); - } - - public static T Get(this ShibaMap map, string name) - { - var value = map.Properties.FirstOrDefault(it => it.Name.IsCurrentPlatform(name))?.Value; - if (value == null) - { - return default; - } + return new NativeThickness(horizon, vertical, horizon, vertical); - var result = ShibaValueVisitor.GetValue(value, null); - if (result is T targetResult) - { - return targetResult; - } - if (typeof(IConvertible).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) - { - return (T)Convert.ChangeType(result, typeof(T)); - } - - return default; + return new NativeThickness(left, top, right, bottom); } } - } \ No newline at end of file diff --git a/Windows/Shiba.Shared/Singleton.cs b/Windows/Shiba/Internal/Singleton.cs similarity index 100% rename from Windows/Shiba.Shared/Singleton.cs rename to Windows/Shiba/Internal/Singleton.cs diff --git a/Windows/Shiba.Shared/NativeRenderer.cs b/Windows/Shiba/NativeRenderer.cs similarity index 85% rename from Windows/Shiba.Shared/NativeRenderer.cs rename to Windows/Shiba/NativeRenderer.cs index 91b508c..1df662f 100644 --- a/Windows/Shiba.Shared/NativeRenderer.cs +++ b/Windows/Shiba/NativeRenderer.cs @@ -2,13 +2,7 @@ using Shiba.Internal; using Shiba.Parser; using Shiba.Visitors; -#if WINDOWS_UWP using NativeView = Windows.UI.Xaml.UIElement; -#elif WPF -using NativeView = System.Windows.UIElement; -#elif FORMS -using NativeView = Xamarin.Forms.View; -#endif namespace Shiba { diff --git a/Windows/Shiba/Parser/ShibaParserWrapper.cs b/Windows/Shiba/Parser/ShibaParserWrapper.cs index da32738..17132ab 100644 --- a/Windows/Shiba/Parser/ShibaParserWrapper.cs +++ b/Windows/Shiba/Parser/ShibaParserWrapper.cs @@ -33,33 +33,28 @@ static ShibaVisitor() public abstract Type HandleType { get; } public abstract object Visit(IParseTree tree); - protected static T GetValue(IParseTree tree) - { - var value = GetValue(tree); - if (value is T result) return result; - - return default; - } - protected internal static object GetValue(IParseTree tree) { - if (tree == null) - { - return null; - } + if (tree == null) return null; var visitor = Visitors.FirstOrDefault(it => it.HandleType == tree.GetType()); if (visitor == null) { if (tree is ParserRuleContext parserRuleContext) - { return GetValue(parserRuleContext.children.FirstOrDefault(it => it is ParserRuleContext)); - } return null; } return visitor.Visit(tree); } + + protected static T GetValue(IParseTree tree) + { + var value = GetValue(tree); + if (value is T result) return result; + + return default; + } } @@ -82,15 +77,16 @@ protected override View Parse(ShibaParser.ViewContext tree) { var viewName = GetValue(tree.identifier()); var view = new View(viewName, GetValue(tree.value())); - + if (tree.property() != null) view.Properties.AddRange(tree.property().Select(GetValue)); - if (tree.view() != null) view.Children.AddRange(tree.view().Select(it => - { - var child = GetValue(it); - child.Parent = view; - return child; - })); + if (tree.view() != null) + view.Children.AddRange(tree.view().Select(it => + { + var child = GetValue(it); + child.Parent = view; + return child; + })); return view; } @@ -217,6 +213,12 @@ protected override ShibaArray Parse(ShibaParser.ArrayContext tree) public class ShibaParserWrapper { + public object Parse(string input) + { + var tree = ParseGrammarTree(input); + return ShibaVisitor.GetValue(tree); + } + private IParseTree ParseGrammarTree(string input) { var stream = CharStreams.fromstring(input); @@ -226,11 +228,5 @@ private IParseTree ParseGrammarTree(string input) return parser.view(); } - - public object Parse(string input) - { - var tree = ParseGrammarTree(input); - return ShibaVisitor.GetValue(tree); - } } } \ No newline at end of file diff --git a/Windows/Shiba.UWP/Properties/AssemblyInfo.cs b/Windows/Shiba/Properties/AssemblyInfo.cs similarity index 91% rename from Windows/Shiba.UWP/Properties/AssemblyInfo.cs rename to Windows/Shiba/Properties/AssemblyInfo.cs index f8344c1..f52076c 100644 --- a/Windows/Shiba.UWP/Properties/AssemblyInfo.cs +++ b/Windows/Shiba/Properties/AssemblyInfo.cs @@ -4,11 +4,11 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Shiba.UWP")] +[assembly: AssemblyTitle("Shiba")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Shiba.UWP")] +[assembly: AssemblyProduct("Shiba")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Windows/Shiba/Properties/Shiba.rd.xml b/Windows/Shiba/Properties/Shiba.rd.xml new file mode 100644 index 0000000..3f40482 --- /dev/null +++ b/Windows/Shiba/Properties/Shiba.rd.xml @@ -0,0 +1,34 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Windows/Shiba/Scripting/Conversion/JTokenConversion.cs b/Windows/Shiba/Scripting/Conversion/JTokenConversion.cs index b7bd1bd..d5f24a1 100644 --- a/Windows/Shiba/Scripting/Conversion/JTokenConversion.cs +++ b/Windows/Shiba/Scripting/Conversion/JTokenConversion.cs @@ -1,5 +1,5 @@ using System; -using ChakraCore.NET.API; +using ChakraHosting; using Newtonsoft.Json.Linq; namespace Shiba.Scripting.Conversion @@ -10,10 +10,7 @@ public JTokenConversion() { ToJsValue = value => { - if (value is JToken token) - { - return JsonToJsValue.Convert(token); - } + if (value is JToken token) return JsonToJsValue.Convert(token); return JavaScriptValue.Undefined; }; @@ -25,11 +22,13 @@ public JTokenConversion() public Func ToJsValue { get; } public Func FromJsValue { get; } + public bool CanConvert(JavaScriptValue value) { return false; } } + internal sealed class JsValueToJson { private static readonly JToken TrueValue = new JValue(true); @@ -40,7 +39,9 @@ internal sealed class JsValueToJson private static readonly JsValueToJson Instance = new JsValueToJson(); - private JsValueToJson() { } + private JsValueToJson() + { + } public static JToken Convert(JavaScriptValue value) { @@ -77,7 +78,7 @@ private JToken VisitArray(JavaScriptValue value) { var array = new JArray(); var propertyId = JavaScriptPropertyId.FromString("length"); - var length = (int)value.GetProperty(propertyId).ToDouble(); + var length = (int) value.GetProperty(propertyId).ToDouble(); for (var i = 0; i < length; ++i) { var index = JavaScriptValue.FromInt32(i); @@ -97,9 +98,9 @@ private JToken VisitError(JavaScriptValue value) { return new JObject { - { "message", Visit(value.GetProperty(JavaScriptPropertyId.FromString("message"))) }, - { "description", Visit(value.GetProperty(JavaScriptPropertyId.FromString("description"))) }, - { "stack", Visit(value.GetProperty(JavaScriptPropertyId.FromString("stack"))) }, + {"message", Visit(value.GetProperty(JavaScriptPropertyId.FromString("message")))}, + {"description", Visit(value.GetProperty(JavaScriptPropertyId.FromString("description")))}, + {"stack", Visit(value.GetProperty(JavaScriptPropertyId.FromString("stack")))} }; } @@ -113,7 +114,7 @@ private JToken VisitNumber(JavaScriptValue value) var number = value.ToDouble(); return number % 1 == 0 - ? new JValue((long)number) + ? new JValue((long) number) : new JValue(number); } @@ -147,7 +148,9 @@ internal sealed class JsonToJsValue private static readonly JsonToJsValue Instance = new JsonToJsValue(); - private JsonToJsValue() { } + private JsonToJsValue() + { + } public static JavaScriptValue Convert(JToken token) { @@ -162,19 +165,19 @@ private JavaScriptValue Visit(JToken token) switch (token.Type) { case JTokenType.Array: - return VisitArray((JArray)token); + return VisitArray((JArray) token); case JTokenType.Boolean: - return VisitBoolean((JValue)token); + return VisitBoolean((JValue) token); case JTokenType.Float: - return VisitFloat((JValue)token); + return VisitFloat((JValue) token); case JTokenType.Integer: - return VisitInteger((JValue)token); + return VisitInteger((JValue) token); case JTokenType.Null: return VisitNull(token); case JTokenType.Object: - return VisitObject((JObject)token); + return VisitObject((JObject) token); case JTokenType.String: - return VisitString((JValue)token); + return VisitString((JValue) token); case JTokenType.Undefined: return VisitUndefined(token); case JTokenType.Constructor: @@ -195,7 +198,7 @@ private JavaScriptValue Visit(JToken token) private JavaScriptValue VisitArray(JArray token) { var n = token.Count; - var array = JavaScriptValue.CreateArray((uint)n); + var array = JavaScriptValue.CreateArray((uint) n); for (var i = 0; i < n; ++i) { var element = Visit(token[i]); @@ -248,5 +251,4 @@ private JavaScriptValue VisitUndefined(JToken token) return JavaScriptValue.Undefined; } } - -} +} \ No newline at end of file diff --git a/Windows/Shiba/Scripting/Conversion/ObjectConversion.cs b/Windows/Shiba/Scripting/Conversion/ObjectConversion.cs index 92ca327..c8437f9 100644 --- a/Windows/Shiba/Scripting/Conversion/ObjectConversion.cs +++ b/Windows/Shiba/Scripting/Conversion/ObjectConversion.cs @@ -1,6 +1,6 @@ using System; using System.Collections; -using ChakraCore.NET.API; +using ChakraHosting; using Newtonsoft.Json.Linq; namespace Shiba.Scripting.Conversion @@ -11,26 +11,21 @@ public ObjectConversion() { ToJsValue = value => { - if (value is IEnumerable list) - { - return JsonToJsValue.Convert(JArray.FromObject(list)); - } + if (value is IEnumerable list) return JsonToJsValue.Convert(JArray.FromObject(list)); return JsonToJsValue.Convert(JObject.FromObject(value)); }; - FromJsValue = value => - { - throw new NotImplementedException(); - }; + FromJsValue = value => { throw new NotImplementedException(); }; } public Type ObjectType { get; } = typeof(object); public Func ToJsValue { get; } public Func FromJsValue { get; } + public bool CanConvert(JavaScriptValue value) { return false; } } -} +} \ No newline at end of file diff --git a/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs b/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs index e74dfd7..d9b9a45 100644 --- a/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs +++ b/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs @@ -1,10 +1,8 @@ using System; -using System.ComponentModel; using System.Linq; using System.Threading; using System.Threading.Tasks; -using ChakraCore.NET; -using ChakraCore.NET.API; +using ChakraHosting; namespace Shiba.Scripting.Conversion { @@ -14,15 +12,16 @@ public PromiseConversion() { ToJsValue = value => { - if (!(value is Task task)) - { - return JavaScriptValue.Undefined; - } - if (!(AbstractShiba.Instance.Configuration.ScriptRuntime is DefaultScriptRuntime runtime)) - { + if (!(value is Task task)) return JavaScriptValue.Undefined; + if (!(ShibaApp.Instance.Configuration.ScriptRuntime is DefaultScriptRuntime runtime)) return JavaScriptValue.Undefined; - } - JavaScriptValue.CreatePromise(out var result, out var resolve, out var reject); + + var promiseObj = runtime.ChakraHost.RunScript( + "(()=>{let promise = {}; promise.promise=new Promise((resolve,reject)=>{promise.resolve=resolve; promise.reject=reject}); return promise;})();" + ); + var resolve = promiseObj.GetProperty(JavaScriptPropertyId.FromString("resolve")); + var reject = promiseObj.GetProperty(JavaScriptPropertyId.FromString("reject")); + var result = promiseObj.GetProperty(JavaScriptPropertyId.FromString("promise")); Task.Factory.StartNew(async () => { try @@ -31,17 +30,19 @@ public PromiseConversion() { dynamic dtask = task; var taskResult = await dtask as object; - runtime.Context?.ServiceNode.WithContext(() => resolve.CallFunction(result, taskResult.ToJavaScriptValue())); + runtime.ChakraHost.WithContext(() => + resolve.CallFunction(result, taskResult.ToJavaScriptValue())); } else //Task { await task; - runtime.Context?.ServiceNode.WithContext(() => resolve.CallFunction(result, JavaScriptValue.Invalid)); + runtime.ChakraHost.WithContext(() => resolve.CallFunction(result, JavaScriptValue.Invalid)); } } catch (Exception ex) { - runtime.Context?.ServiceNode.WithContext(() => reject.CallFunction(result, JavaScriptValue.FromString(ex.Message))); + runtime.ChakraHost.WithContext(() => + reject.CallFunction(result, JavaScriptValue.FromString(ex.Message))); } }); @@ -52,7 +53,6 @@ public PromiseConversion() { return Task.Factory.FromAsync((callback, state) => { - var result = new AsyncResult(); JavaScriptValue FulfilledCallback(JavaScriptValue callee, bool call, JavaScriptValue[] arguments, @@ -81,10 +81,7 @@ JavaScriptValue RejectCallback(JavaScriptValue callee, bool call, JavaScriptValu }, result => { var asyncResult = result as AsyncResult ?? throw new ArgumentException("Result is of wrong type."); - if (asyncResult.HasError) - { - throw new Exception(asyncResult.Error.ToString()); - } + if (asyncResult.HasError) throw new Exception(asyncResult.Error.ToString()); return asyncResult.Result; }, null); }; @@ -93,56 +90,51 @@ JavaScriptValue RejectCallback(JavaScriptValue callee, bool call, JavaScriptValu public Type ObjectType { get; } = typeof(Task); public Func ToJsValue { get; } public Func FromJsValue { get; } + public bool CanConvert(JavaScriptValue value) { - if (!value.HasProperty(JavaScriptPropertyId.FromString("constructor"))) - { - return false; - } + if (!value.HasProperty(JavaScriptPropertyId.FromString("constructor"))) return false; var constructor = value.GetProperty(JavaScriptPropertyId.FromString("constructor")); - if (!constructor.HasProperty(JavaScriptPropertyId.FromString("name"))) - { - return false; - } + if (!constructor.HasProperty(JavaScriptPropertyId.FromString("name"))) return false; var name = constructor.GetProperty(JavaScriptPropertyId.FromString("name")); return name.ValueType == JavaScriptValueType.String && name.ToString() == "Promise"; } } - + public class AsyncResult : IAsyncResult { private readonly ManualResetEvent _mre = new ManualResetEvent(false); + public string Error { get; private set; } + public bool HasError { get; private set; } + public object Result { get; private set; } + public WaitHandle AsyncWaitHandle => _mre; - public bool CompletedSynchronously { get; private set; } = false; + public bool CompletedSynchronously { get; } = false; public bool IsCompleted { get; private set; } public object AsyncState => throw new NotImplementedException(); - public string Error { get; private set; } - public bool HasError { get; private set; } = false; - - private void Release() - { - IsCompleted = true; - _mre.Set(); - } - public void SetError(string error) { Error = error; HasError = true; Release(); } - public object Result { get; private set; } public void SetResult(object value) { Result = value; Release(); } + + private void Release() + { + IsCompleted = true; + _mre.Set(); + } } } \ No newline at end of file diff --git a/Windows/Shiba/Scripting/Conversion/TypeConversion.cs b/Windows/Shiba/Scripting/Conversion/TypeConversion.cs index ceb3d26..4f73d28 100644 --- a/Windows/Shiba/Scripting/Conversion/TypeConversion.cs +++ b/Windows/Shiba/Scripting/Conversion/TypeConversion.cs @@ -1,6 +1,5 @@ using System; -using System.Threading.Tasks; -using ChakraCore.NET.API; +using ChakraHosting; namespace Shiba.Scripting.Conversion { @@ -14,7 +13,8 @@ public interface ITypeConversion public class TypeConversion : ITypeConversion { - public TypeConversion(Type objectType, Func toJsValue, Func fromJsValue) + public TypeConversion(Type objectType, Func toJsValue, + Func fromJsValue) { ObjectType = objectType; ToJsValue = toJsValue; @@ -24,6 +24,7 @@ public TypeConversion(Type objectType, Func toJsValue, public Type ObjectType { get; } public Func ToJsValue { get; } public Func FromJsValue { get; } + public bool CanConvert(JavaScriptValue value) { return false; diff --git a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs index 8105da9..7186921 100644 --- a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs +++ b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs @@ -1,8 +1,7 @@ using System; using System.Linq; using System.Reflection; -using ChakraCore.NET; -using ChakraCore.NET.API; +using ChakraHosting; using Shiba.Scripting.Conversion; using Shiba.Scripting.Runtime; @@ -12,27 +11,27 @@ public class DefaultScriptRuntime : IScriptRuntime, IDisposable { private JavaScriptValue[] _prefix; - public DefaultScriptRuntime(ChakraContext context = null) + public DefaultScriptRuntime() { - Context = context ?? ChakraRuntime.Create().CreateContext(false); - Context.ServiceNode.WithContext(() => { _prefix = new[] {JavaScriptValue.FromBoolean(false)}; }); + ChakraHost = new ChakraHost(); + ChakraHost.WithContext(() => { _prefix = new[] {JavaScriptValue.FromBoolean(false)}; }); InitConversion(); InitRuntimeObject(); } - public ChakraContext Context { get; private set; } + public ChakraHost ChakraHost { get; private set; } public void Dispose() { - Context?.Dispose(); - Context = null; + ChakraHost?.Dispose(); + ChakraHost = null; } public object Execute(string functionName, params object[] parameters) { - return Context.ServiceNode.WithContext(() => + return ChakraHost.WithContext(() => { - var func = Context.GlobalObject.ReferenceValue.GetProperty( + var func = ChakraHost.GlobalObject.GetProperty( JavaScriptPropertyId.FromString(functionName)); switch (func.ValueType) @@ -53,20 +52,19 @@ public object Execute(string functionName, params object[] parameters) public object Execute(string script) { - return Context.ServiceNode.WithContext(() => + return ChakraHost.WithContext(() => { - var debugService = Context.ServiceNode.GetService(); - var result = JavaScriptContext.RunScript(script, debugService.GetScriptContext("Script", script)); + var result = ChakraHost.RunScript(script); return result.ToNative(); }); } public void AddObject(string name, object value) { - if (value == null || string.IsNullOrEmpty(name)) throw new ArgumentException(); - - Context.ServiceNode.WithContext(() => + ChakraHost.WithContext(() => { + if (value == null || string.IsNullOrEmpty(name)) throw new ArgumentException(); + var objPropertyId = JavaScriptPropertyId.FromString(name); switch (value) { @@ -77,7 +75,7 @@ public void AddObject(string name, object value) case float _: case double _: case null: - Context.GlobalObject.ReferenceValue.SetProperty(objPropertyId, value.ToJavaScriptValue(), + ChakraHost.GlobalObject.SetProperty(objPropertyId, value.ToJavaScriptValue(), true); break; default: @@ -130,7 +128,7 @@ JavaScriptValue Function(JavaScriptValue callee, bool call, obj.SetProperty(propertyId, property.GetValue(value).ToJavaScriptValue(), false); break; } - Context.GlobalObject.ReferenceValue.SetProperty(objPropertyId, obj, true); + ChakraHost.GlobalObject.SetProperty(objPropertyId, obj, true); break; } }); diff --git a/Windows/Shiba/Scripting/IScriptRuntime.cs b/Windows/Shiba/Scripting/IScriptRuntime.cs index e2511ce..4576039 100644 --- a/Windows/Shiba/Scripting/IScriptRuntime.cs +++ b/Windows/Shiba/Scripting/IScriptRuntime.cs @@ -2,8 +2,8 @@ namespace Shiba.Scripting { public interface IScriptRuntime { + void AddObject(string name, object value); object Execute(string functionName, params object[] parameters); object Execute(string script); - void AddObject(string name, object value); } } \ No newline at end of file diff --git a/Windows/Shiba/Scripting/JavaScriptValueExtension.cs b/Windows/Shiba/Scripting/JavaScriptValueExtension.cs index e2d3df0..55574dd 100644 --- a/Windows/Shiba/Scripting/JavaScriptValueExtension.cs +++ b/Windows/Shiba/Scripting/JavaScriptValueExtension.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using ChakraCore.NET.API; +using ChakraHosting; using Shiba.Scripting.Conversion; namespace Shiba.Scripting @@ -9,7 +9,7 @@ namespace Shiba.Scripting internal static class JavaScriptValueExtension { internal static readonly List Conversions = new List(); - + public static JavaScriptValue ToJavaScriptValue(this object it) { switch (it) @@ -56,10 +56,7 @@ public static object ToNative(this JavaScriptValue value) case JavaScriptValueType.Number: { var target = value.ToDouble(); - if (Math.Abs(target % 1) <= double.Epsilon * 100) - { - return Convert.ToInt32(target); - } + if (Math.Abs(target % 1) <= double.Epsilon * 100) return Convert.ToInt32(target); return target; } diff --git a/Windows/Shiba/Scripting/Runtime/Http.cs b/Windows/Shiba/Scripting/Runtime/Http.cs index c6b939e..103b319 100644 --- a/Windows/Shiba/Scripting/Runtime/Http.cs +++ b/Windows/Shiba/Scripting/Runtime/Http.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Text; +using System.Net.Http; using System.Threading.Tasks; namespace Shiba.Scripting.Runtime @@ -17,4 +14,4 @@ public async Task Get(string url) } } } -} +} \ No newline at end of file diff --git a/Windows/Shiba.Shared/Scripting/Runtime/Storage.cs b/Windows/Shiba/Scripting/Runtime/Storage.cs similarity index 74% rename from Windows/Shiba.Shared/Scripting/Runtime/Storage.cs rename to Windows/Shiba/Scripting/Runtime/Storage.cs index 2c5055d..da9cee5 100644 --- a/Windows/Shiba.Shared/Scripting/Runtime/Storage.cs +++ b/Windows/Shiba/Scripting/Runtime/Storage.cs @@ -1,31 +1,23 @@ #if WINDOWS_UWP -using System; -using System.Collections.Generic; -using System.Text; using Windows.Storage; namespace Shiba.Scripting.Runtime { public class Storage { - [JsExport(Name = "save")] - public void Save(string key, object value) - { - ApplicationData.Current.LocalSettings.Values.Add(key, value); - } - [JsExport(Name = "load")] public object Load(string key, object defaultValue) { if (ApplicationData.Current.LocalSettings.Values.TryGetValue(key, out var obj)) - { return obj; - } - else - { - return defaultValue; - } + return defaultValue; + } + + [JsExport(Name = "save")] + public void Save(string key, object value) + { + ApplicationData.Current.LocalSettings.Values.Add(key, value); } } } -#endif +#endif \ No newline at end of file diff --git a/Windows/Shiba/Shiba.cs b/Windows/Shiba/Shiba.cs index 9fb8bef..8e4a772 100644 --- a/Windows/Shiba/Shiba.cs +++ b/Windows/Shiba/Shiba.cs @@ -1,16 +1,17 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using ChakraCore.NET.API; +using Shiba.CommonProperty; using Shiba.Controls; +using Shiba.ExtensionExecutors; using Shiba.Scripting; +using Shiba.Scripting.Runtime; namespace Shiba { - public abstract class AbstractShiba + public class ShibaApp { - protected AbstractShiba(Action action) + private ShibaApp(Action action) { action?.Invoke(Configuration); ViewMapping.Init(); @@ -20,12 +21,22 @@ protected AbstractShiba(Action action) public ShibaConfiguration Configuration { get; } = new ShibaConfiguration(); - public static AbstractShiba Instance { get; protected set; } + public static ShibaApp Instance { get; protected set; } public void AddConverter(string converter) { Configuration.ScriptRuntime.Execute(converter); } + + public static void Init(Action action = null) + { + Instance = new ShibaApp(c => + { + c.PlatformType = "UWP"; + c.ScriptRuntime.AddObject("storage", new Storage()); + action?.Invoke(c); + }); + } } public class ShibaConfiguration diff --git a/Windows/Shiba/Shiba.csproj b/Windows/Shiba/Shiba.csproj index a60b23e..b422baa 100644 --- a/Windows/Shiba/Shiba.csproj +++ b/Windows/Shiba/Shiba.csproj @@ -1,12 +1,209 @@ - + + + - netstandard2.0 - 7.2 + Debug + AnyCPU + {3FF5CC7B-A8ED-4D59-A13A-E4E42714C798} + Library + Properties + Shiba + Shiba + en-US + UAP + 10.0.17763.0 + 10.0.16299.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + latest + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + latest + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + latest + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + latest + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + latest + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + latest + + + ARM64 + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + latest + + + ARM64 + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + latest + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + latest + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + latest + + + PackageReference - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.7.2 + + + 6.2.3 + + + 12.0.1 + + + + + + + + + + + {c5d6ed6a-c8b9-4bed-a226-d1acfaa763e0} + ChakraHosting + + + + 14.0 + + + \ No newline at end of file diff --git a/Windows/Shiba.Shared/ShibaHost.cs b/Windows/Shiba/ShibaHost.cs similarity index 57% rename from Windows/Shiba.Shared/ShibaHost.cs rename to Windows/Shiba/ShibaHost.cs index e04b214..8b7efd7 100644 --- a/Windows/Shiba.Shared/ShibaHost.cs +++ b/Windows/Shiba/ShibaHost.cs @@ -1,66 +1,21 @@ -using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Markup; using Shiba.Controls; -#if WINDOWS_UWP -using Windows.UI.Xaml; using NativeParent = Windows.UI.Xaml.Controls.ContentControl; -using Windows.UI.Xaml.Markup; -#elif WPF -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using NativeParent = System.Windows.Controls.ContentControl; -#elif FORMS -using Xamarin.Forms; -using NativeParent = Xamarin.Forms.ContentView; -using View = Shiba.Controls.View; -#endif namespace Shiba { -#if WINDOWS_UWP [ContentProperty(Name = nameof(Layout))] -#elif WPF || FORMS - [ContentProperty(nameof(Layout))] -#endif public class ShibaHost : NativeParent, IShibaHost { -#if FORMS - public object DataContext => BindingContext; - - public static readonly BindableProperty ShibaLayoutProperty = BindableProperty.Create( - nameof(ShibaLayout), typeof(View), typeof(ShibaHost), propertyChanged: OnShibaLayoutChanged); - - private static void OnShibaLayoutChanged(BindableObject bindable, object oldValue, object newValue) - { - (bindable as ShibaHost)?.OnShibaLayoutChanged(newValue as View); - } - - public static readonly BindableProperty LayoutProperty = BindableProperty.Create( - nameof(Layout), typeof(string), typeof(ShibaHost), propertyChanged: OnLayoutChanged); - - private static void OnLayoutChanged(BindableObject bindable, object oldvalue, object newvalue) - { - (bindable as ShibaHost)?.OnLayoutChanged(newvalue as string); - } -#else public static readonly DependencyProperty ShibaLayoutProperty = DependencyProperty.Register( - nameof(ShibaLayout), typeof(View), typeof(ShibaHost), new PropertyMetadata(default(View), OnShibaLayoutChanged)); + nameof(ShibaLayout), typeof(View), typeof(ShibaHost), + new PropertyMetadata(default(View), OnShibaLayoutChanged)); public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register( nameof(Layout), typeof(string), typeof(ShibaHost), new PropertyMetadata(default(string), OnLayoutChanged)); - private static void OnShibaLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - (d as ShibaHost)?.OnShibaLayoutChanged(e.NewValue as View); - } - - private static void OnLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - (d as ShibaHost)?.OnLayoutChanged(e.NewValue as string); - } -#endif - public ShibaHost() { Context = new ShibaContext @@ -69,8 +24,6 @@ public ShibaHost() }; } - public IShibaContext Context { get; } - public string Layout { get => (string) GetValue(LayoutProperty); @@ -83,28 +36,38 @@ public View ShibaLayout set => SetValue(ShibaLayoutProperty, value); } - private void OnShibaLayoutChanged(View value) + public IShibaContext Context { get; } + + public void ReLayout() { - if (value == null) - { - Content = null; - return; - } - Content = NativeRenderer.Render(value, Context); + OnLayoutChanged(Layout); + } + + private static void OnLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + (d as ShibaHost)?.OnLayoutChanged(e.NewValue as string); } private void OnLayoutChanged(string value) { - if (string.IsNullOrEmpty(value)) - { - return; - } + if (string.IsNullOrEmpty(value)) return; ShibaLayout = NativeRenderer.Parse(value); } - - public void ReLayout() + + private static void OnShibaLayoutChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - OnLayoutChanged(Layout); + (d as ShibaHost)?.OnShibaLayoutChanged(e.NewValue as View); + } + + private void OnShibaLayoutChanged(View value) + { + if (value == null) + { + Content = null; + return; + } + + Content = NativeRenderer.Render(value, Context); } } } \ No newline at end of file diff --git a/Windows/Shiba.Shared/ViewMappers/GridMapper.cs b/Windows/Shiba/ViewMappers/GridMapper.cs similarity index 70% rename from Windows/Shiba.Shared/ViewMappers/GridMapper.cs rename to Windows/Shiba/ViewMappers/GridMapper.cs index 002274d..b1d9be1 100644 --- a/Windows/Shiba.Shared/ViewMappers/GridMapper.cs +++ b/Windows/Shiba/ViewMappers/GridMapper.cs @@ -1,20 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using Windows.UI.Xaml.Controls; using Shiba.Controls; using Shiba.ViewMappers; -#if WINDOWS_UWP -using Windows.UI.Xaml.Controls; using NativeView = Windows.UI.Xaml.Controls.Grid; -#elif WPF -using System.Windows.Controls; -using NativeView = System.Windows.Controls.Grid; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.Grid; -#endif [assembly: ExportMapper("grid", typeof(GridMapper))] + namespace Shiba.ViewMappers { public class GridMapper : ViewMapper @@ -26,32 +19,24 @@ public override IEnumerable PropertyMaps() private IEnumerable GetPropertyMaps() { -#if WINDOWS_UWP - yield return new PropertyMap("columnSpacing", Grid.ColumnSpacingProperty, typeof(double)); - yield return new PropertyMap("rowSpacing", Grid.RowSpacingProperty, typeof(double)); -#elif WPF - yield return new PropertyMap("showGridLines", Grid.ShowGridLinesProperty, typeof(bool)); -#endif + yield return new PropertyMap("columnSpacing", NativeView.ColumnSpacingProperty, typeof(double)); + yield return new PropertyMap("rowSpacing", NativeView.RowSpacingProperty, typeof(double)); yield return new ManuallyValueMap("row", typeof(int), (element, o) => { if (o is int value && element is NativeView target) - { Enumerable.Range(0, Convert.ToInt32(value)) .Select(it => new RowDefinition()) .ToList() .ForEach(it => target.RowDefinitions.Add(it)); - } }); yield return new ManuallyValueMap("column", typeof(int), (element, o) => { if (o is int value && element is NativeView target) - { Enumerable.Range(0, Convert.ToInt32(value)) .Select(it => new ColumnDefinition()) .ToList() .ForEach(it => target.ColumnDefinitions.Add(it)); - } }); } } -} +} \ No newline at end of file diff --git a/Windows/Shiba/ViewMappers/InputMapper.cs b/Windows/Shiba/ViewMappers/InputMapper.cs new file mode 100644 index 0000000..389dc4f --- /dev/null +++ b/Windows/Shiba/ViewMappers/InputMapper.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media; +using Shiba.Controls; +using Shiba.ViewMappers; +using NativeView = Windows.UI.Xaml.Controls.TextBox; + +[assembly: ExportMapper("input", typeof(InputMapper))] + +namespace Shiba.ViewMappers +{ + public class InputMapper : ViewMapper + { + protected override bool HasDefaultProperty { get; } = true; + + protected override PropertyMap DefaultPropertyMap { get; } = + new PropertyMap("text", NativeView.TextProperty, typeof(string), isTwoWay: true); + + public override IEnumerable PropertyMaps() + { + foreach (var propertyMap in base.PropertyMaps()) yield return propertyMap; + yield return new PropertyMap("size", Control.FontSizeProperty, typeof(double)); + yield return new PropertyMap("color", Control.ForegroundProperty, typeof(string), typeof(SolidColorBrush), + ColorConverter); + } + } +} \ No newline at end of file diff --git a/Windows/Shiba.Shared/ViewMappers/ListMapper.cs b/Windows/Shiba/ViewMappers/ListMapper.cs similarity index 58% rename from Windows/Shiba.Shared/ViewMappers/ListMapper.cs rename to Windows/Shiba/ViewMappers/ListMapper.cs index 3c8a4fb..2d18084 100644 --- a/Windows/Shiba.Shared/ViewMappers/ListMapper.cs +++ b/Windows/Shiba/ViewMappers/ListMapper.cs @@ -1,42 +1,18 @@ -using System; +using System.Collections; using System.Collections.Generic; using System.Linq; +using Windows.UI.Xaml.Controls; using Shiba.Controls; using Shiba.ViewMappers; -using View = Shiba.Controls.View; -using System.Collections; -#if WINDOWS_UWP -using Windows.UI.Xaml.Markup; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeView = Windows.UI.Xaml.Controls.ListView; -#elif WPF -using System.Windows; -using NativeBinding = System.Windows.Data.Binding; -using NativeView = System.Windows.Controls.ListView; -#elif FORMS -using Xamarin.Forms; -using NativeBinding = Xamarin.Forms.Binding; -using NativeView = Xamarin.Forms.ListView; -#endif [assembly: ExportMapper("list", typeof(ListMapper))] + namespace Shiba.ViewMappers { public class ListMapper : ViewMapper { - -#if FORMS - public override NativeView CreateNativeView() - { - return new NativeView - { - HasUnevenRows = true - }; - } -#endif - public override IEnumerable PropertyMaps() { return base.PropertyMaps().Concat(GetProperties()); @@ -49,7 +25,7 @@ private IEnumerable GetProperties() if (element is NativeView nativeView && value is View itemLayout) { var template = itemLayout.ToDataTemplate(); - nativeView.SetValue(NativeView.ItemTemplateProperty, template); + nativeView.SetValue(ItemsControl.ItemTemplateProperty, template); } }); yield return new ManuallyValueMap("items", typeof(IEnumerable), (element, value) => @@ -57,16 +33,12 @@ private IEnumerable GetProperties() if (element is NativeView nativeView) { if (value is NativeBinding binding) - { - nativeView.SetBinding(NativeView.ItemsSourceProperty, binding); - } + nativeView.SetBinding(ItemsControl.ItemsSourceProperty, binding); else - { - nativeView.SetBinding(NativeView.ItemsSourceProperty, new NativeBinding + nativeView.SetBinding(ItemsControl.ItemsSourceProperty, new NativeBinding { Source = value }); - } } }); } diff --git a/Windows/Shiba.Shared/ViewMappers/StackMapper.cs b/Windows/Shiba/ViewMappers/StackMapper.cs similarity index 62% rename from Windows/Shiba.Shared/ViewMappers/StackMapper.cs rename to Windows/Shiba/ViewMappers/StackMapper.cs index b55c327..313a527 100644 --- a/Windows/Shiba.Shared/ViewMappers/StackMapper.cs +++ b/Windows/Shiba/ViewMappers/StackMapper.cs @@ -1,25 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; +using Windows.UI.Xaml.Controls; using Shiba.Controls; using Shiba.ViewMappers; -#if WINDOWS_UWP using NativeView = Windows.UI.Xaml.Controls.StackPanel; -using Windows.UI.Xaml.Controls; -#elif WPF -using System.Windows.Controls; -using NativeView = System.Windows.Controls.StackPanel; -#elif FORMS -using NativeView = Xamarin.Forms.StackLayout; -using Orientation = Xamarin.Forms.StackOrientation; -#endif [assembly: ExportMapper("stack", typeof(StackMapper))] + namespace Shiba.ViewMappers { public class StackMapper : ViewMapper { - public override IEnumerable PropertyMaps() { return base.PropertyMaps().Concat(GetProperties()); @@ -27,22 +19,17 @@ public override IEnumerable PropertyMaps() private IEnumerable GetProperties() { - yield return new PropertyMap("orientation", NativeView.OrientationProperty, typeof(string), OrientationConverter); + yield return new PropertyMap("orientation", NativeView.OrientationProperty, typeof(string), + OrientationConverter); } private object OrientationConverter(object arg) { - if (!(arg is string value)) - { - throw new ArgumentException(); - } - - if (Enum.TryParse(value, true, out Orientation result)) - { - return result; - } + if (!(arg is string value)) throw new ArgumentException(); + + if (Enum.TryParse(value, true, out Orientation result)) return result; throw new ArgumentOutOfRangeException(); } } -} +} \ No newline at end of file diff --git a/Windows/Shiba.Shared/ViewMappers/TextMapper.cs b/Windows/Shiba/ViewMappers/TextMapper.cs similarity index 52% rename from Windows/Shiba.Shared/ViewMappers/TextMapper.cs rename to Windows/Shiba/ViewMappers/TextMapper.cs index 93ccf35..733eb09 100644 --- a/Windows/Shiba.Shared/ViewMappers/TextMapper.cs +++ b/Windows/Shiba/ViewMappers/TextMapper.cs @@ -1,37 +1,26 @@ using System.Collections.Generic; +using Windows.UI.Xaml.Media; using Shiba.Controls; using Shiba.ViewMappers; -#if WINDOWS_UWP -using Windows.UI.Xaml.Media; using NativeView = Windows.UI.Xaml.Controls.TextBlock; -#elif WPF -using System.Windows.Media; -using NativeView = System.Windows.Controls.TextBlock; -#elif FORMS -using NativeView = Xamarin.Forms.Label; -#endif [assembly: ExportMapper("text", typeof(TextMapper))] + namespace Shiba.ViewMappers { public class TextMapper : ViewMapper { + protected override bool HasDefaultProperty { get; } = true; + + protected override PropertyMap DefaultPropertyMap { get; } = + new PropertyMap("text", NativeView.TextProperty, typeof(string)); + public override IEnumerable PropertyMaps() { - foreach (var propertyMap in base.PropertyMaps()) - { - yield return propertyMap; - } + foreach (var propertyMap in base.PropertyMaps()) yield return propertyMap; yield return new PropertyMap("size", NativeView.FontSizeProperty, typeof(double)); -#if FORMS - yield return new PropertyMap("color", NativeView.TextColorProperty, typeof(string), converter: ColorConverter); -#elif WINDOWS_UWP || WPF - yield return new PropertyMap("color", NativeView.ForegroundProperty, typeof(string), typeof(SolidColorBrush), converter: ColorConverter); -#endif + yield return new PropertyMap("color", NativeView.ForegroundProperty, typeof(string), + typeof(SolidColorBrush), ColorConverter); } - - protected override bool HasDefaultProperty { get; } = true; - - protected override PropertyMap DefaultPropertyMap { get; } = new PropertyMap("text", NativeView.TextProperty, typeof(string)); } -} +} \ No newline at end of file diff --git a/Windows/Shiba.Shared/ViewMappers/ViewMapper.cs b/Windows/Shiba/ViewMappers/ViewMapper.cs similarity index 69% rename from Windows/Shiba.Shared/ViewMappers/ViewMapper.cs rename to Windows/Shiba/ViewMappers/ViewMapper.cs index 4c1a2c8..8209c9b 100644 --- a/Windows/Shiba.Shared/ViewMappers/ViewMapper.cs +++ b/Windows/Shiba/ViewMappers/ViewMapper.cs @@ -1,40 +1,20 @@ using System; using System.Collections.Generic; using System.Linq; -using Shiba.Controls; -using Shiba.Visitors; -using ShibaView = Shiba.Controls.View; -#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; +using Shiba.Controls; +using Shiba.Visitors; +using ShibaView = Shiba.Controls.View; using NativeView = Windows.UI.Xaml.FrameworkElement; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeProperty = Windows.UI.Xaml.DependencyProperty; using NativeThickness = Windows.UI.Xaml.Thickness; -using Windows.UI.Xaml.Data; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.VisualElement; -using XFView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; - -#elif WPF -using System.Windows; -using System.Windows.Controls; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using System.Windows.Data; -#endif namespace Shiba.ViewMappers { - public interface IValueMap { string Name { get; } @@ -51,26 +31,29 @@ public ManuallyValueMap(string name, Type valueType, Action Action = action; } + public Action Action { get; protected set; } + public string Name { get; } public Type ValueType { get; } + public virtual void SetValue(NativeView view, object value) { value.TryChangeType(ValueType, out value); Action?.Invoke(view, value); } - - public Action Action { get; protected set; } } public sealed class PropertyMap : ManuallyValueMap { - public PropertyMap(string name, NativeProperty dependencyProperty, Type valueType, Type propertyType, Func converter = null, bool isTwoWay = false) : + public PropertyMap(string name, NativeProperty dependencyProperty, Type valueType, Type propertyType, + Func converter = null, bool isTwoWay = false) : this(name, dependencyProperty, valueType, converter, isTwoWay) { PropertyType = propertyType; } - public PropertyMap(string name, NativeProperty dependencyProperty, Type valueType, Func converter = null, bool isTwoWay = false) : base(name, valueType, null) + public PropertyMap(string name, NativeProperty dependencyProperty, Type valueType, + Func converter = null, bool isTwoWay = false) : base(name, valueType, null) { DependencyProperty = dependencyProperty; Converter = converter; @@ -79,6 +62,11 @@ public PropertyMap(string name, NativeProperty dependencyProperty, Type valueTyp Action = SetValue; } + public NativeProperty DependencyProperty { get; } + public Type PropertyType { get; } + public Func Converter { get; } + public bool IsTwoWay { get; } + public override void SetValue(NativeView view, object value) { switch (value) @@ -93,18 +81,10 @@ public override void SetValue(NativeView view, object value) default: value.TryChangeType(ValueType, out value); value = Converter == null ? value : Converter.Invoke(value); - if (value.GetType() == PropertyType) - { - view.SetValue(DependencyProperty, value); - } + if (value.GetType() == PropertyType) view.SetValue(DependencyProperty, value); break; } } - - public NativeProperty DependencyProperty { get; } - public Type PropertyType { get; } - public Func Converter { get; } - public bool IsTwoWay { get; } } public class ViewMapper : IViewMapper @@ -112,23 +92,49 @@ public class ViewMapper : IViewMapper { private List _propertyCache; - protected virtual IEnumerable ExtendPropertyMap() + protected virtual bool HasDefaultProperty { get; } = false; + + protected virtual PropertyMap DefaultPropertyMap { get; } + + object IViewMapper.Map(ShibaView view, IShibaContext context) { - return null; + return Map(view, context); + } + + public TNativeView Map(ShibaView view, IShibaContext context) + { + var target = CreateNativeView(); + + if (_propertyCache == null) _propertyCache = PropertyMaps().ToList(); + + if (view.DefaultValue != null && DefaultPropertyMap != null && HasDefaultProperty) + SetValue(context, view.DefaultValue, DefaultPropertyMap, target); + + foreach (var property in view.Properties) + { + if (!string.IsNullOrEmpty(property.Name.Prefix) && + property.Name.Prefix != ShibaApp.Instance.Configuration.PlatformType) + continue; + + var cache = _propertyCache.FirstOrDefault(it => it.Name == property.Name.Value); + if (cache != null) SetValue(context, property.Value, cache, target); + } + + return target; + } + + public virtual TNativeView CreateNativeView() + { + return new TNativeView(); } public virtual IEnumerable PropertyMaps() { yield return new PropertyMap("enable", -#if WINDOWS_UWP || WPF Control.IsEnabledProperty, -#elif FORMS - NativeView.IsEnabledProperty, -#endif typeof(bool)); yield return new PropertyMap("width", NativeView.WidthProperty, typeof(double)); yield return new PropertyMap("height", NativeView.HeightProperty, typeof(double)); -#if WINDOWS_UWP || WPF yield return new PropertyMap("maxHeight", NativeView.MaxHeightProperty, typeof(double)); yield return new PropertyMap("minHeight", NativeView.MinHeightProperty, typeof(double)); yield return new PropertyMap("maxWidth", NativeView.MaxWidthProperty, typeof(double)); @@ -142,91 +148,33 @@ public virtual IEnumerable PropertyMaps() value => ((ShibaMap) value).ToNativeThickness()); yield return new PropertyMap("margin", NativeView.MarginProperty, typeof(ShibaMap), typeof(NativeThickness), value => ((ShibaMap) value).ToNativeThickness()); -#elif FORMS - yield return new PropertyMap("padding", Layout.PaddingProperty, typeof(ShibaMap), typeof(NativeThickness), - value => ((ShibaMap) value).ToNativeThickness()); - yield return new PropertyMap("margin", XFView.MarginProperty, typeof(ShibaMap), typeof(NativeThickness), - value => ((ShibaMap) value).ToNativeThickness()); - yield return new PropertyMap("background", NativeView.BackgroundColorProperty, typeof(string), - ColorConverter); -#endif - yield return new PropertyMap("alpha", NativeView.OpacityProperty, typeof(double)); + yield return new PropertyMap("alpha", UIElement.OpacityProperty, typeof(double)); yield return new PropertyMap("style", NativeView.StyleProperty, typeof(string), typeof(Style)); - if (DefaultPropertyMap != null) - { - yield return DefaultPropertyMap; - } + if (DefaultPropertyMap != null) yield return DefaultPropertyMap; var exprop = ExtendPropertyMap(); if (exprop != null) - { - foreach (var item in exprop) yield return item; - } + foreach (var item in exprop) + yield return item; } protected object ColorConverter(object arg) { - if (!(arg is string value)) - { - throw new ArgumentException("background value should be string"); - } + if (!(arg is string value)) throw new ArgumentException("background value should be string"); -#if WINDOWS_UWP || WPF return new SolidColorBrush(value.ToNativeColor()); -#elif FORMS - return value.ToNativeColor(); -#endif - } - - protected virtual bool HasDefaultProperty { get; } = false; - - protected virtual PropertyMap DefaultPropertyMap { get; } - - object IViewMapper.Map(ShibaView view, IShibaContext context) - { - return Map(view, context); } - public TNativeView Map(ShibaView view, IShibaContext context) + protected virtual IEnumerable ExtendPropertyMap() { - var target = CreateNativeView(); - - if (_propertyCache == null) - { - _propertyCache = PropertyMaps().ToList(); - } - - if (view.DefaultValue != null && DefaultPropertyMap != null && HasDefaultProperty) - { - SetValue(context, view.DefaultValue, DefaultPropertyMap, target); - } - - foreach (var property in view.Properties) - { - if (!string.IsNullOrEmpty(property.Name.Prefix) && - property.Name.Prefix != AbstractShiba.Instance.Configuration.PlatformType) - { - continue; - } - - var cache = _propertyCache.FirstOrDefault(it => it.Name == property.Name.Value); - if (cache != null) - { - SetValue(context, property.Value, cache, target); - } - } - - return target; + return null; } private void SetValue(IShibaContext context, object value, IValueMap valueMap, TNativeView target) { - var targetValue = valueMap.ValueType == value?.GetType() ? value : ShibaValueVisitor.GetValue(value, context); + var targetValue = valueMap.ValueType == value?.GetType() + ? value + : ShibaValueVisitor.GetValue(value, context); valueMap.SetValue(target, targetValue); } - - public virtual TNativeView CreateNativeView() - { - return new TNativeView(); - } } } \ No newline at end of file diff --git a/Windows/Shiba.Shared/Visitors/ValueVisitor.cs b/Windows/Shiba/Visitors/ValueVisitor.cs similarity index 74% rename from Windows/Shiba.Shared/Visitors/ValueVisitor.cs rename to Windows/Shiba/Visitors/ValueVisitor.cs index 0fc2f08..53aeed9 100644 --- a/Windows/Shiba.Shared/Visitors/ValueVisitor.cs +++ b/Windows/Shiba/Visitors/ValueVisitor.cs @@ -6,36 +6,14 @@ using System.Security.Cryptography; using System.Text; using Shiba.Controls; +using Shiba.ExtensionExecutors; using Shiba.Internal; using ShibaView = Shiba.Controls.View; -using View = Shiba.Controls.View; -#if WINDOWS_UWP -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; using NativeView = Windows.UI.Xaml.FrameworkElement; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeProperty = Windows.UI.Xaml.DependencyProperty; using NativeThickness = Windows.UI.Xaml.Thickness; using NativeViewGroup = Windows.UI.Xaml.Controls.Panel; -#elif FORMS -using Xamarin.Forms; -using NativeView = Xamarin.Forms.View; -using NativeBinding = Xamarin.Forms.Binding; -using NativeProperty = Xamarin.Forms.BindableProperty; -using NativeThickness = Xamarin.Forms.Thickness; -using NativeViewGroup = Xamarin.Forms.Layout; - -#elif WPF -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using NativeView = System.Windows.FrameworkElement; -using NativeBinding = System.Windows.Data.Binding; -using NativeProperty = System.Windows.DependencyProperty; -using NativeThickness = System.Windows.Thickness; -using System.Windows.Media; -using NativeViewGroup = System.Windows.Controls.Panel; -#endif namespace Shiba.Visitors { @@ -66,17 +44,11 @@ static ShibaValueVisitor() protected internal static object GetValue(object item, IShibaContext context) { - if (item == null) - { - return null; - } + if (item == null) return null; var visitor = Visitors.FirstOrDefault(it => it.HandleType == item.GetType()); - if (visitor == null) - { - return item; - } + if (visitor == null) return item; return visitor.Visit(item, context); } @@ -104,18 +76,12 @@ internal sealed class ViewVisitor : GenericVisitor protected override NativeView Parse(View view, IShibaContext context) { var attribute = - AbstractShiba.Instance.ViewMapping.Mappers.LastOrDefault(it => + ShibaApp.Instance.ViewMapping.Mappers.LastOrDefault(it => view.ViewName.IsCurrentPlatform(it.ViewName)); - if (attribute == null) - { - return null; - } + if (attribute == null) return null; var renderer = Renderer.GetOrAdd(attribute.ViewName, type => CreateRenderer(attribute)); - if (context == null) - { - throw new ArgumentNullException($"{nameof(context)} can not be null"); - } + if (context == null) throw new ArgumentNullException($"{nameof(context)} can not be null"); var target = renderer.Map(view, context) as NativeView; if (view.Children.Any() && target is NativeViewGroup panel) @@ -127,19 +93,16 @@ protected override NativeView Parse(View view, IShibaContext context) panel.Children.Add(child); var commonprop = it.Properties.Where(prop => prop.Name.IsCurrentPlatform() && - AbstractShiba.Instance.Configuration.CommonProperties.Any(cp => cp.Name == prop.Name.Value)) + ShibaApp.Instance.Configuration.CommonProperties.Any(cp => cp.Name == prop.Name.Value)) .ToList(); - if (commonprop.Any()) - { - commonprops.Add((it, child, commonprop)); - } + if (commonprop.Any()) commonprops.Add((it, child, commonprop)); }); commonprops.ForEach(it => { it.properties.ForEach(prop => { - AbstractShiba.Instance.Configuration.CommonProperties + ShibaApp.Instance.Configuration.CommonProperties .Where(cp => cp.Name == prop.Name.Value).ToList() .ForEach(cp => cp.Handle(prop.Value, it.native, target)); }); @@ -159,66 +122,56 @@ internal sealed class ShibaExtensionVisitor : GenericVisitor ScriptsCache { get; } = new ConcurrentDictionary(); - private string Hash(string input) - { - var hash = (new SHA1Managed()).ComputeHash(Encoding.UTF8.GetBytes(input)); - return string.Join("", hash.Select(b => b.ToString("x2")).ToArray()); - } - protected override object Parse(ShibaExtension item, IShibaContext context) { var executor = - AbstractShiba.Instance.Configuration.ExtensionExecutors.FirstOrDefault(it => it.Name == item.Type); + ShibaApp.Instance.Configuration.ExtensionExecutors.FirstOrDefault(it => it.Name == item.Type); if (executor != null) { var value = executor.ProvideValue(context, item); - if (string.IsNullOrEmpty(item.Script)) - { - return value; - } + if (string.IsNullOrEmpty(item.Script)) return value; var funcName = ScriptsCache.GetOrAdd(item.Script, script => { var hash = $"_{Hash(script)}"; //TODO: function parameter name - AbstractShiba.Instance.AddConverter($"function {hash}(it){{ {script.TrimStart('$').TrimStart('{').TrimEnd('}')} }}"); + ShibaApp.Instance.AddConverter( + $"function {hash}(it){{ {script.TrimStart('$').TrimStart('{').TrimEnd('}')} }}"); return hash; }); var func = new ShibaFunction(funcName) {Parameters = {item}}; if (value is NativeBinding binding) { - if (binding.Converter != null) - { binding.ConverterParameter = new ShibaConverterParameter { InnerConverter = binding.Converter, InnerParameter = binding.ConverterParameter, Function = func }; - } else - { binding.ConverterParameter = func; - } binding.Converter = Singleton.Instance; return binding; } - else + + return new NativeBinding { - return new NativeBinding - { - ConverterParameter = - Singleton.Instance.Execute(func, item), - Converter = Singleton.Instance - }; - } - + ConverterParameter = + Singleton.Instance.Execute(func, item), + Converter = Singleton.Instance + }; } throw new NotImplementedException(); } + + private string Hash(string input) + { + var hash = new SHA1Managed().ComputeHash(Encoding.UTF8.GetBytes(input)); + return string.Join("", hash.Select(b => b.ToString("x2")).ToArray()); + } } internal sealed class ShibaFunctionVisitor : GenericVisitor @@ -228,13 +181,11 @@ protected override NativeBinding Parse(ShibaFunction item, IShibaContext context var function = ParseFunction(item, context); var extensions = GetExtensions(function)?.ToList(); if (extensions == null || !extensions.Any()) - { return new NativeBinding { ConverterParameter = Singleton.Instance.Execute(function, null), Converter = Singleton.Instance }; - } if (extensions.Count == 1) { @@ -246,33 +197,29 @@ protected override NativeBinding Parse(ShibaFunction item, IShibaContext context { case NativeBinding binding: if (binding.Converter != null) - { binding.ConverterParameter = new ShibaConverterParameter { InnerConverter = binding.Converter, InnerParameter = binding.ConverterParameter, Function = function }; - } else - { binding.ConverterParameter = function; - } binding.Converter = Singleton.Instance; return binding; default: return new NativeBinding { - ConverterParameter = Singleton.Instance.Execute(function, extensionValue), + ConverterParameter = + Singleton.Instance.Execute(function, + extensionValue), Converter = Singleton.Instance }; } } if (extensions.Count > 1) - { - throw new ArgumentOutOfRangeException($"Currently only support single ShibaExtension"); - } + throw new ArgumentOutOfRangeException("Currently only support single ShibaExtension"); throw new ArgumentOutOfRangeException($"Can not handle function call ${item}"); } @@ -280,27 +227,19 @@ protected override NativeBinding Parse(ShibaFunction item, IShibaContext context private IEnumerable GetExtensions(ShibaFunction function) { foreach (var item in function.Parameters) - { switch (item) { case ShibaExtension extension: { - var executor = AbstractShiba.Instance.Configuration.ExtensionExecutors + var executor = ShibaApp.Instance.Configuration.ExtensionExecutors .FirstOrDefault(it => it.Name == extension.Type); - if (!(executor is IMutableExtensionExecutor)) - { - yield return extension; - } + if (!(executor is IMutableExtensionExecutor)) yield return extension; } break; case ShibaFunction shibaFunction: - foreach (var extension in GetExtensions(shibaFunction)) - { - yield return extension; - } + foreach (var extension in GetExtensions(shibaFunction)) yield return extension; break; } - } } private ShibaFunction ParseFunction(ShibaFunction item, IShibaContext context) @@ -314,12 +253,10 @@ private ShibaFunction ParseFunction(ShibaFunction item, IShibaContext context) item.Parameters[i] = ParseFunction(function, context); break; case ShibaExtension extension: - var executor = AbstractShiba.Instance.Configuration.ExtensionExecutors + var executor = ShibaApp.Instance.Configuration.ExtensionExecutors .FirstOrDefault(it => it.Name == extension.Type); if (executor is IMutableExtensionExecutor) - { item.Parameters[i] = executor.ProvideValue(context, extension); - } break; default: item.Parameters[i] = GetValue(parameter, context); From dd6fdd09399b0e3a54d6678a67f6dafb634b7a9a Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 18 Jan 2019 14:07:23 +0800 Subject: [PATCH 02/27] [Android] Update packages --- Android/app/build.gradle | 10 +++++----- Android/build.gradle | 2 +- Android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- Android/shiba/build.gradle | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Android/app/build.gradle b/Android/app/build.gradle index 97d5804..4c3bca0 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -28,15 +28,15 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.7' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8' implementation "com.squareup.okhttp3:okhttp:+" testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation project(':shiba') implementation 'androidx.recyclerview:recyclerview:1.0.0' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1' - releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' + releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' } diff --git a/Android/build.gradle b/Android/build.gradle index b64b88e..5ecbd7f 100644 --- a/Android/build.gradle +++ b/Android/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' diff --git a/Android/gradle/wrapper/gradle-wrapper.properties b/Android/gradle/wrapper/gradle-wrapper.properties index 558bf27..8f42876 100644 --- a/Android/gradle/wrapper/gradle-wrapper.properties +++ b/Android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 25 15:57:23 CST 2018 +#Fri Jan 18 13:59:42 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/Android/shiba/build.gradle b/Android/shiba/build.gradle index f26fb90..539fc16 100644 --- a/Android/shiba/build.gradle +++ b/Android/shiba/build.gradle @@ -44,7 +44,7 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.+' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' - implementation 'org.antlr:antlr4:4.7.1' + implementation 'org.antlr:antlr4:4.7.+' implementation 'com.github.LiquidPlayer:LiquidCore:0.5.+' From 3892937377408efffa91aa5361b959b7a2c70b71 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 18 Jan 2019 14:11:59 +0800 Subject: [PATCH 03/27] [Windows] Bug fix for script runtime --- .../Scripting/Conversion/PromiseConversion.cs | 14 +- .../Shiba/Scripting/DefaultScriptRuntime.cs | 188 +++++++++--------- 2 files changed, 106 insertions(+), 96 deletions(-) diff --git a/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs b/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs index d9b9a45..e6541fd 100644 --- a/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs +++ b/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs @@ -30,19 +30,23 @@ public PromiseConversion() { dynamic dtask = task; var taskResult = await dtask as object; - runtime.ChakraHost.WithContext(() => - resolve.CallFunction(result, taskResult.ToJavaScriptValue())); + runtime.ChakraHost.EnterContext(); + resolve.CallFunction(result, taskResult.ToJavaScriptValue()); + runtime.ChakraHost.LeaveContext(); } else //Task { await task; - runtime.ChakraHost.WithContext(() => resolve.CallFunction(result, JavaScriptValue.Invalid)); + runtime.ChakraHost.EnterContext(); + resolve.CallFunction(result, JavaScriptValue.Invalid); + runtime.ChakraHost.LeaveContext(); } } catch (Exception ex) { - runtime.ChakraHost.WithContext(() => - reject.CallFunction(result, JavaScriptValue.FromString(ex.Message))); + runtime.ChakraHost.EnterContext(); + reject.CallFunction(result, JavaScriptValue.FromString(ex.Message)); + runtime.ChakraHost.LeaveContext(); } }); diff --git a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs index 7186921..2e23f67 100644 --- a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs +++ b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using ChakraHosting; @@ -9,14 +10,16 @@ namespace Shiba.Scripting { public class DefaultScriptRuntime : IScriptRuntime, IDisposable { - private JavaScriptValue[] _prefix; - + private readonly JavaScriptValue[] _prefix; + private readonly List _functions = new List(); public DefaultScriptRuntime() { ChakraHost = new ChakraHost(); - ChakraHost.WithContext(() => { _prefix = new[] {JavaScriptValue.FromBoolean(false)}; }); + ChakraHost.EnterContext(); + _prefix = new[] { JavaScriptValue.FromBoolean(false) }; InitConversion(); InitRuntimeObject(); + ChakraHost.LeaveContext(); } public ChakraHost ChakraHost { get; private set; } @@ -29,109 +32,112 @@ public void Dispose() public object Execute(string functionName, params object[] parameters) { - return ChakraHost.WithContext(() => + ChakraHost.EnterContext(); + var func = ChakraHost.GlobalObject.GetProperty( + JavaScriptPropertyId.FromString(functionName)); + object result = null; + switch (func.ValueType) { - var func = ChakraHost.GlobalObject.GetProperty( - JavaScriptPropertyId.FromString(functionName)); - - switch (func.ValueType) + case JavaScriptValueType.Function: { - case JavaScriptValueType.Function: - { - var param = _prefix.Concat(parameters.Select(it => it.ToJavaScriptValue())).ToArray(); + var param = _prefix.Concat(parameters.Select(it => it.ToJavaScriptValue())).ToArray(); - var result = func.CallFunction(param); + result = func.CallFunction(param).ToNative(); - return result.ToNative(); - } - default: - return null; } - }); + break; + default: + break; + } + ChakraHost.LeaveContext(); + return result; } public object Execute(string script) { - return ChakraHost.WithContext(() => - { - var result = ChakraHost.RunScript(script); - return result.ToNative(); - }); + ChakraHost.EnterContext(); + var result = ChakraHost.RunScript(script).ToNative(); + ChakraHost.LeaveContext(); + return result; } - + public void AddObject(string name, object value) { - ChakraHost.WithContext(() => - { - if (value == null || string.IsNullOrEmpty(name)) throw new ArgumentException(); + if (value == null || string.IsNullOrEmpty(name)) throw new ArgumentException(); - var objPropertyId = JavaScriptPropertyId.FromString(name); - switch (value) - { - case string _: - case bool _: - case int _: - case decimal _: - case float _: - case double _: - case null: - ChakraHost.GlobalObject.SetProperty(objPropertyId, value.ToJavaScriptValue(), - true); - break; - default: - var obj = JavaScriptValue.CreateObject(); - var type = value.GetType().GetTypeInfo(); - var members = type.GetMembers() - .Where(it => it.GetCustomAttribute() != null); - - foreach (var item in members) - switch (item) - { - case MethodInfo method: - var functionId = - JavaScriptPropertyId.FromString(method.GetCustomAttribute() - .Name); - var parameter = method.GetParameters(); - - JavaScriptValue Function(JavaScriptValue callee, bool call, - JavaScriptValue[] arguments, - ushort count, IntPtr data) + ChakraHost.EnterContext(); + var objPropertyId = JavaScriptPropertyId.FromString(name); + switch (value) + { + case string _: + case bool _: + case int _: + case decimal _: + case float _: + case double _: + case null: + ChakraHost.GlobalObject.SetProperty(objPropertyId, value.ToJavaScriptValue(), + true); + break; + default: + var obj = JavaScriptValue.CreateObject(); + var type = value.GetType().GetTypeInfo(); + var members = type.GetMembers() + .Where(it => it.GetCustomAttribute() != null); + + foreach (var item in members) + switch (item) + { + case MethodInfo method: + var functionId = + JavaScriptPropertyId.FromString(method.GetCustomAttribute() + .Name); + var parameter = method.GetParameters(); + + JavaScriptValue Function(JavaScriptValue callee, bool call, + JavaScriptValue[] arguments, + ushort count, IntPtr data) + { + object[] param; + var args = arguments.Skip(1).ToArray(); + if (!args.Any() && parameter.Length > 0) { - object[] param; - var args = arguments.Skip(1).ToArray(); - if (count >= parameter.Length) - param = Enumerable.Range(0, parameter.Length) - .Select(index => args[index].ToNative()).ToArray(); - else - param = args.Select(it => it.ToNative()).Concat(Enumerable - .Range(count + 1, parameter.Length - count) - .Select( - index => - { - var paramType = parameter[index].ParameterType; - return paramType.IsValueType - ? Activator.CreateInstance(paramType) - : null; - })).ToArray(); - - var result = method.Invoke(value, param); - return result.ToJavaScriptValue(); + return JavaScriptValue.Invalid; } - - var function = JavaScriptValue.CreateFunction(Function, IntPtr.Zero); - obj.SetProperty(functionId, function, true); - break; - case PropertyInfo property: - var propertyId = - JavaScriptPropertyId.FromString(property.GetCustomAttribute() - .Name); - obj.SetProperty(propertyId, property.GetValue(value).ToJavaScriptValue(), false); - break; - } - ChakraHost.GlobalObject.SetProperty(objPropertyId, obj, true); - break; - } - }); + if (count >= parameter.Length) + param = Enumerable.Range(0, parameter.Length) + .Select(index => args.ElementAtOrDefault(index).ToNative()).ToArray(); + else + param = args.Select(it => it.ToNative()).Concat(Enumerable + .Range(count + 1, parameter.Length - count) + .Select( + index => + { + var paramType = parameter[index].ParameterType; + return paramType.IsValueType + ? Activator.CreateInstance(paramType) + : null; + })).ToArray(); + + var result = method.Invoke(value, param); + return result.ToJavaScriptValue(); + } + _functions.Add(Function); + var function = JavaScriptValue.CreateFunction(Function, IntPtr.Zero); + obj.SetProperty(functionId, function, true); + break; + case PropertyInfo property: + var propertyId = + JavaScriptPropertyId.FromString(property.GetCustomAttribute() + .Name); + + obj.SetProperty(propertyId, property.GetValue(value).ToJavaScriptValue(), false); + break; + } + ChakraHost.GlobalObject.SetProperty(objPropertyId, obj, true); + break; + } + ChakraHost.LeaveContext(); } public void AddConversion(ITypeConversion conversion) From 501a5ff73e480080ca199e702337aaa6e172173b Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 18 Jan 2019 14:12:19 +0800 Subject: [PATCH 04/27] [Windows] Clean up ChakraHosting --- Windows/ChakraHosting/ChakraHost.cs | 68 +++-- .../JavaScriptBackgroundWorkItemCallback.cs | 4 +- .../JavaScriptBeforeCollectCallback.cs | 2 +- Windows/ChakraHosting/JavaScriptContext.cs | 142 +++++----- .../JavaScriptEngineException.cs | 6 +- Windows/ChakraHosting/JavaScriptErrorCode.cs | 47 ++-- Windows/ChakraHosting/JavaScriptException.cs | 18 +- .../ChakraHosting/JavaScriptFatalException.cs | 6 +- .../JavaScriptMemoryAllocationCallback.cs | 7 +- .../JavaScriptMemoryEventType.cs | 2 +- .../ChakraHosting/JavaScriptNativeFunction.cs | 6 +- .../JavaScriptObjectBeforeCollectCallback.cs | 2 +- .../JavaScriptObjectFinalizeCallback.cs | 2 +- .../JavaScriptProjectionEnqueueCallback.cs | 7 +- .../JavaScriptPromiseContinuationCallback.cs | 2 +- Windows/ChakraHosting/JavaScriptPropertyId.cs | 30 +- .../ChakraHosting/JavaScriptPropertyIdType.cs | 3 +- Windows/ChakraHosting/JavaScriptRuntime.cs | 97 +++---- .../JavaScriptRuntimeAttributes.cs | 6 +- .../ChakraHosting/JavaScriptRuntimeVersion.cs | 4 +- .../JavaScriptScriptException.cs | 16 +- ...criptSerializedScriptLoadSourceCallback.cs | 5 +- ...avaScriptSerializedScriptUnloadCallback.cs | 2 +- .../ChakraHosting/JavaScriptSourceContext.cs | 18 +- .../JavaScriptThreadServiceCallback.cs | 7 +- .../ChakraHosting/JavaScriptTypedArrayType.cs | 10 +- .../ChakraHosting/JavaScriptUsageException.cs | 6 +- Windows/ChakraHosting/JavaScriptValue.cs | 219 +++++---------- Windows/ChakraHosting/JavaScriptValueType.cs | 2 +- Windows/ChakraHosting/Native.cs | 259 +++++++++++------- .../ChakraHosting/Properties/AssemblyInfo.cs | 1 - .../Properties/ChakraHosting.rd.xml | 7 +- 32 files changed, 483 insertions(+), 530 deletions(-) diff --git a/Windows/ChakraHosting/ChakraHost.cs b/Windows/ChakraHosting/ChakraHost.cs index 3946a15..2035b01 100644 --- a/Windows/ChakraHosting/ChakraHost.cs +++ b/Windows/ChakraHosting/ChakraHost.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Concurrent; -using System.Reflection.Metadata.Ecma335; using System.Threading; using System.Threading.Tasks; -using Windows.ApplicationModel.Appointments; namespace ChakraHosting { @@ -21,6 +19,11 @@ public class ChakraHost : IDisposable private readonly CancellationTokenSource _shutdownCts = new CancellationTokenSource(); private JavaScriptContext _context; + public ChakraHost() + { + Init(); + } + public JavaScriptValue GlobalObject { get; private set; } public void Dispose() @@ -29,58 +32,55 @@ public void Dispose() _shutdownCts.Cancel(); } - public ChakraHost() - { - Init(); - } - public void Init() { Native.ThrowIfError(Native.JsCreateRuntime(JavaScriptRuntimeAttributes.None, null, out _runtime)); Native.ThrowIfError(Native.JsCreateContext(_runtime, out _context)); - WithContext(() => - { - Native.ThrowIfError(Native.JsSetPromiseContinuationCallback(PromiseContinuationDelegate, IntPtr.Zero)); - StartPromiseTaskLoop(_shutdownCts.Token); - Native.ThrowIfError(Native.JsProjectWinRTNamespace("Windows")); - Native.ThrowIfError(Native.JsGetGlobalObject(out var global)); - GlobalObject = global; - }); + EnterContext(); + Native.ThrowIfError(Native.JsSetPromiseContinuationCallback(PromiseContinuationDelegate, IntPtr.Zero)); + StartPromiseTaskLoop(_shutdownCts.Token); + //Native.ThrowIfError(Native.JsProjectWinRTNamespace("Windows")); + Native.ThrowIfError(Native.JsGetGlobalObject(out var global)); + GlobalObject = global; //Native.ThrowIfError(Native.JsStartDebugging()); + LeaveContext(); } - public void WithContext(Action action) + public void EnterContext() { Native.ThrowIfError(Native.JsSetCurrentContext(_context)); - action.Invoke(); - Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); } - public T WithContext(Func action) + public void LeaveContext() { - Native.ThrowIfError(Native.JsSetCurrentContext(_context)); - var result = action.Invoke(); Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); - return result; } + //public void WithContext(Action action) + //{ + // EnterContext(); + // action.Invoke(); + // LeaveContext(); + //} + + //public T WithContext(Func action) + //{ + // EnterContext(); + // var result = action.Invoke(); + // LeaveContext(); + // return result; + //} + public JavaScriptValue RunScript(string script) { - if (Native.JsRunScript(script, _currentSourceContext++, "", out var result) != JavaScriptErrorCode.NoError) - { - Native.ThrowIfError(Native.JsGetAndClearException(out var exception)); - Native.ThrowIfError(Native.JsGetPropertyIdFromName("message", out var messageName)); - Native.ThrowIfError(Native.JsGetProperty(exception, messageName, out var messageValue)); - return messageValue; - } - + Native.ThrowIfError(Native.JsRunScript(script, _currentSourceContext++, "", out var result)); return result; } private static void PromiseContinuationCallback(JavaScriptValue task, IntPtr callbackState) { TaskQueue.Add(task); - //task.AddRef(); + task.AddRef(); } private void StartPromiseTaskLoop(CancellationToken token) @@ -88,21 +88,19 @@ private void StartPromiseTaskLoop(CancellationToken token) Task.Factory.StartNew(() => { while (true) - { try { if (TaskQueue.Count == 0) continue; var task = TaskQueue.Take(token); - Native.ThrowIfError(Native.JsSetCurrentContext(_context)); + EnterContext(); task.CallFunction(GlobalObject); task.Release(); - Native.ThrowIfError(Native.JsSetCurrentContext(JavaScriptContext.Invalid)); + LeaveContext(); } catch (OperationCanceledException e) { return; } - } } , token ); diff --git a/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs b/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs index 718b250..42e6b6b 100644 --- a/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs +++ b/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs @@ -6,9 +6,9 @@ namespace ChakraHosting /// A background work item callback. /// /// - /// This is passed to the host's thread service (if provided) to allow the host to + /// This is passed to the host's thread service (if provided) to allow the host to /// invoke the work item callback on the background thread of its choice. /// /// Data argument passed to the thread service. public delegate void JavaScriptBackgroundWorkItemCallback(IntPtr callbackData); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs b/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs index d99a554..8b8045a 100644 --- a/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs +++ b/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs @@ -7,4 +7,4 @@ namespace ChakraHosting /// /// The state passed to SetBeforeCollectCallback. public delegate void JavaScriptBeforeCollectCallback(IntPtr callbackState); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptContext.cs b/Windows/ChakraHosting/JavaScriptContext.cs index 06239ab..636d6ea 100644 --- a/Windows/ChakraHosting/JavaScriptContext.cs +++ b/Windows/ChakraHosting/JavaScriptContext.cs @@ -7,13 +7,13 @@ namespace ChakraHosting /// /// /// - /// Each script context contains its own global object, distinct from the global object in - /// other script contexts. + /// Each script context contains its own global object, distinct from the global object in + /// other script contexts. /// /// - /// Many Chakra hosting APIs require an "active" script context, which can be set using - /// Current. Chakra hosting APIs that require a current context to be set will note - /// that explicitly in their documentation. + /// Many Chakra hosting APIs require an "active" script context, which can be set using + /// Current. Chakra hosting APIs that require a current context to be set will note + /// that explicitly in their documentation. /// /// public struct JavaScriptContext @@ -24,7 +24,7 @@ public struct JavaScriptContext private readonly IntPtr reference; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The reference. internal JavaScriptContext(IntPtr reference) @@ -35,10 +35,7 @@ internal JavaScriptContext(IntPtr reference) /// /// Gets an invalid context. /// - public static JavaScriptContext Invalid - { - get { return new JavaScriptContext(IntPtr.Zero); } - } + public static JavaScriptContext Invalid => new JavaScriptContext(IntPtr.Zero); /// /// Gets or sets the current script context on the thread. @@ -47,15 +44,11 @@ public static JavaScriptContext Current { get { - JavaScriptContext reference; - Native.ThrowIfError(Native.JsGetCurrentContext(out reference)); + Native.ThrowIfError(Native.JsGetCurrentContext(out var reference)); return reference; } - set - { - Native.ThrowIfError(Native.JsSetCurrentContext(value)); - } + set => Native.ThrowIfError(Native.JsSetCurrentContext(value)); } /// @@ -63,26 +56,25 @@ public static JavaScriptContext Current /// /// /// - /// If a call into the runtime results in an exception (either as the result of running a - /// script or due to something like a conversion failure), the runtime is placed into an - /// "exception state." All calls into any context created by the runtime (except for the - /// exception APIs) will fail with InExceptionState until the exception is - /// cleared. + /// If a call into the runtime results in an exception (either as the result of running a + /// script or due to something like a conversion failure), the runtime is placed into an + /// "exception state." All calls into any context created by the runtime (except for the + /// exception APIs) will fail with InExceptionState until the exception is + /// cleared. /// /// - /// If the runtime of the current context is in the exception state when a callback returns - /// into the engine, the engine will automatically rethrow the exception. + /// If the runtime of the current context is in the exception state when a callback returns + /// into the engine, the engine will automatically rethrow the exception. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// public static bool HasException { get { - bool hasException; - Native.ThrowIfError(Native.JsHasException(out hasException)); + Native.ThrowIfError(Native.JsHasException(out var hasException)); return hasException; } } @@ -94,8 +86,7 @@ public JavaScriptRuntime Runtime { get { - JavaScriptRuntime handle; - Native.ThrowIfError(Native.JsGetRuntime(this, out handle)); + Native.ThrowIfError(Native.JsGetRuntime(this, out var handle)); return handle; } } @@ -103,37 +94,33 @@ public JavaScriptRuntime Runtime /// /// Gets a value indicating whether the context is a valid context or not. /// - public bool IsValid - { - get { return reference != IntPtr.Zero; } - } + public bool IsValid => reference != IntPtr.Zero; /// /// Tells the runtime to do any idle processing it need to do. /// /// /// - /// If idle processing has been enabled for the current runtime, calling Idle will - /// inform the current runtime that the host is idle and that the runtime can perform - /// memory cleanup tasks. + /// If idle processing has been enabled for the current runtime, calling Idle will + /// inform the current runtime that the host is idle and that the runtime can perform + /// memory cleanup tasks. /// /// - /// Idle will also return the number of system ticks until there will be more idle work - /// for the runtime to do. Calling Idle before this number of ticks has passed will do - /// no work. + /// Idle will also return the number of system ticks until there will be more idle work + /// for the runtime to do. Calling Idle before this number of ticks has passed will do + /// no work. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// - /// The next system tick when there will be more idle work to do. Returns the + /// The next system tick when there will be more idle work to do. Returns the /// maximum number of ticks if there no upcoming idle work to do. /// public static uint Idle() { - uint ticks; - Native.ThrowIfError(Native.JsIdle(out ticks)); + Native.ThrowIfError(Native.JsIdle(out var ticks)); return ticks; } @@ -149,10 +136,10 @@ public static uint Idle() /// /// The location the script came from. /// A Function representing the script code. - public static JavaScriptValue ParseScript(string script, JavaScriptSourceContext sourceContext, string sourceName) + public static JavaScriptValue ParseScript(string script, JavaScriptSourceContext sourceContext, + string sourceName) { - JavaScriptValue result; - Native.ThrowIfError(Native.JsParseScript(script, sourceContext, sourceName, out result)); + Native.ThrowIfError(Native.JsParseScript(script, sourceContext, sourceName, out var result)); return result; } @@ -169,10 +156,11 @@ public static JavaScriptValue ParseScript(string script, JavaScriptSourceContext /// /// The location the script came from. /// A Function representing the script code. - public static JavaScriptValue ParseScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceName) + public static JavaScriptValue ParseScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, + string sourceName) { - JavaScriptValue result; - Native.ThrowIfError(Native.JsParseSerializedScript(script, buffer, sourceContext, sourceName, out result)); + Native.ThrowIfError(Native.JsParseSerializedScript(script, buffer, sourceContext, sourceName, + out var result)); return result; } @@ -217,8 +205,7 @@ public static JavaScriptValue ParseScript(string script, byte[] buffer) /// The result of the script, if any. public static JavaScriptValue RunScript(string script, JavaScriptSourceContext sourceContext, string sourceName) { - JavaScriptValue result; - Native.ThrowIfError(Native.JsRunScript(script, sourceContext, sourceName, out result)); + Native.ThrowIfError(Native.JsRunScript(script, sourceContext, sourceName, out var result)); return result; } @@ -235,10 +222,11 @@ public static JavaScriptValue RunScript(string script, JavaScriptSourceContext s /// /// The location the script came from. /// The result of the script, if any. - public static JavaScriptValue RunScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceName) + public static JavaScriptValue RunScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, + string sourceName) { - JavaScriptValue result; - Native.ThrowIfError(Native.JsRunSerializedScript(script, buffer, sourceContext, sourceName, out result)); + Native.ThrowIfError(Native.JsRunSerializedScript(script, buffer, sourceContext, sourceName, + out var result)); return result; } @@ -274,12 +262,12 @@ public static JavaScriptValue RunScript(string script, byte[] buffer) /// /// /// - /// SerializeScript parses a script and then stores the parsed form of the script in a - /// runtime-independent format. The serialized script then can be deserialized in any - /// runtime without requiring the script to be re-parsed. + /// SerializeScript parses a script and then stores the parsed form of the script in a + /// runtime-independent format. The serialized script then can be deserialized in any + /// runtime without requiring the script to be re-parsed. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The script to serialize. @@ -289,32 +277,31 @@ public static JavaScriptValue RunScript(string script, byte[] buffer) /// public static ulong SerializeScript(string script, byte[] buffer) { - var bufferSize = (ulong)buffer.Length; + var bufferSize = (ulong) buffer.Length; Native.ThrowIfError(Native.JsSerializeScript(script, buffer, ref bufferSize)); return bufferSize; } /// - /// Returns the exception that caused the runtime of the current context to be in the + /// Returns the exception that caused the runtime of the current context to be in the /// exception state and resets the exception state for that runtime. /// /// /// - /// If the runtime of the current context is not in an exception state, this API will throw - /// JsErrorInvalidArgument. If the runtime is disabled, this will return an exception - /// indicating that the script was terminated, but it will not clear the exception (the - /// exception will be cleared if the runtime is re-enabled using - /// EnableRuntimeExecution). + /// If the runtime of the current context is not in an exception state, this API will throw + /// JsErrorInvalidArgument. If the runtime is disabled, this will return an exception + /// indicating that the script was terminated, but it will not clear the exception (the + /// exception will be cleared if the runtime is re-enabled using + /// EnableRuntimeExecution). /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The exception for the runtime of the current context. public static JavaScriptValue GetAndClearException() { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsGetAndClearException(out reference)); + Native.ThrowIfError(Native.JsGetAndClearException(out var reference)); return reference; } @@ -323,11 +310,11 @@ public static JavaScriptValue GetAndClearException() /// /// /// - /// If the runtime of the current context is already in an exception state, this API will - /// throw JsErrorInExceptionState. + /// If the runtime of the current context is already in an exception state, this API will + /// throw JsErrorInExceptionState. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// @@ -347,8 +334,7 @@ public static void SetException(JavaScriptValue exception) /// The object's new reference count. public uint AddRef() { - uint count; - Native.ThrowIfError(Native.JsContextAddRef(this, out count)); + Native.ThrowIfError(Native.JsContextAddRef(this, out var count)); return count; } @@ -361,8 +347,7 @@ public uint AddRef() /// The object's new reference count. public uint Release() { - uint count; - Native.ThrowIfError(Native.JsContextRelease(this, out count)); + Native.ThrowIfError(Native.JsContextRelease(this, out var count)); return count; } @@ -383,7 +368,7 @@ public struct Scope : IDisposable private bool disposed; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The context to create the scope for. public Scope(JavaScriptContext context) @@ -398,14 +383,11 @@ public Scope(JavaScriptContext context) /// public void Dispose() { - if (disposed) - { - return; - } + if (disposed) return; Current = previousContext; disposed = true; } } } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptEngineException.cs b/Windows/ChakraHosting/JavaScriptEngineException.cs index 211badf..0fd3af7 100644 --- a/Windows/ChakraHosting/JavaScriptEngineException.cs +++ b/Windows/ChakraHosting/JavaScriptEngineException.cs @@ -8,7 +8,7 @@ namespace ChakraHosting public sealed class JavaScriptEngineException : JavaScriptException { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. public JavaScriptEngineException(JavaScriptErrorCode code) : @@ -17,7 +17,7 @@ public JavaScriptEngineException(JavaScriptErrorCode code) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The error message. @@ -27,7 +27,7 @@ public JavaScriptEngineException(JavaScriptErrorCode code, string message) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serialization info. /// The streaming context. diff --git a/Windows/ChakraHosting/JavaScriptErrorCode.cs b/Windows/ChakraHosting/JavaScriptErrorCode.cs index f6e31b3..b4a8cb1 100644 --- a/Windows/ChakraHosting/JavaScriptErrorCode.cs +++ b/Windows/ChakraHosting/JavaScriptErrorCode.cs @@ -14,7 +14,7 @@ public enum JavaScriptErrorCode : uint /// Category of errors that relates to incorrect usage of the API itself. /// CategoryUsage = 0x10000, - + /// /// An argument to a hosting API was invalid. /// @@ -24,99 +24,99 @@ public enum JavaScriptErrorCode : uint /// An argument to a hosting API was null in a context where null is not allowed. /// NullArgument, - + /// /// The hosting API requires that a context be current, but there is no current context. /// NoCurrentContext, - + /// /// The engine is in an exception state and no APIs can be called until the exception is /// cleared. /// InExceptionState, - + /// /// A hosting API is not yet implemented. /// NotImplemented, - + /// /// A hosting API was called on the wrong thread. /// WrongThread, - + /// /// A runtime that is still in use cannot be disposed. /// RuntimeInUse, - + /// /// A bad serialized script was used, or the serialized script was serialized by a /// different version of the Chakra engine. /// BadSerializedScript, - + /// /// The runtime is in a disabled state. /// InDisabledState, - + /// /// Runtime does not support reliable script interruption. /// CannotDisableExecution, - + /// /// A heap enumeration is currently underway in the script context. /// HeapEnumInProgress, - + /// /// A hosting API that operates on object values was called with a non-object value. /// ArgumentNotObject, - + /// /// A script context is in the middle of a profile callback. /// InProfileCallback, - + /// /// A thread service callback is currently underway. /// InThreadServiceCallback, - + /// /// Scripts cannot be serialized in debug contexts. /// CannotSerializeDebugScript, - + /// /// The context cannot be put into a debug state because it is already in a debug state. /// AlreadyDebuggingContext, - + /// /// The context cannot start profiling because it is already profiling. /// AlreadyProfilingContext, - + /// /// Idle notification given when the host did not enable idle processing. /// IdleNotEnabled, - + /// /// The context did not accept the enqueue callback. /// CannotSetProjectionEnqueueCallback, - + /// /// Failed to start projection. /// CannotStartProjection, - + /// /// The operation is not supported in an object before collect callback. /// @@ -135,7 +135,8 @@ public enum JavaScriptErrorCode : uint /// /// A hosting API that operates on string property ids but was called with a non-string property id. - /// The error code is returned by existing JsGetPropertyNamefromId if the function is called with non-string property id. + /// The error code is returned by existing JsGetPropertyNamefromId if the function is called with non-string property + /// id. /// PropertyNotString, @@ -188,6 +189,6 @@ public enum JavaScriptErrorCode : uint /// /// A hosting API was called with object created on different javascript runtime. /// - WrongRuntime, + WrongRuntime } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptException.cs b/Windows/ChakraHosting/JavaScriptException.cs index a3716b5..b1433f3 100644 --- a/Windows/ChakraHosting/JavaScriptException.cs +++ b/Windows/ChakraHosting/JavaScriptException.cs @@ -8,12 +8,12 @@ namespace ChakraHosting public class JavaScriptException : Exception { /// - /// The error code. + /// The error code. /// private readonly JavaScriptErrorCode code; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. public JavaScriptException(JavaScriptErrorCode code) : @@ -22,7 +22,7 @@ public JavaScriptException(JavaScriptErrorCode code) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The error message. @@ -33,17 +33,14 @@ public JavaScriptException(JavaScriptErrorCode code, string message) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serialization info. /// The streaming context. protected JavaScriptException(string message, Exception innerException) : base(message, innerException) { - if (message != null) - { - code = (JavaScriptErrorCode) base.HResult; - } + if (message != null) code = (JavaScriptErrorCode) HResult; } /* @@ -61,9 +58,6 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont /// /// Gets the error code. /// - public JavaScriptErrorCode ErrorCode - { - get { return code; } - } + public JavaScriptErrorCode ErrorCode => code; } } \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptFatalException.cs b/Windows/ChakraHosting/JavaScriptFatalException.cs index 2e7ae80..1f48339 100644 --- a/Windows/ChakraHosting/JavaScriptFatalException.cs +++ b/Windows/ChakraHosting/JavaScriptFatalException.cs @@ -8,7 +8,7 @@ namespace ChakraHosting public sealed class JavaScriptFatalException : JavaScriptException { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. public JavaScriptFatalException(JavaScriptErrorCode code) : @@ -17,7 +17,7 @@ public JavaScriptFatalException(JavaScriptErrorCode code) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The error message. @@ -27,7 +27,7 @@ public JavaScriptFatalException(JavaScriptErrorCode code, string message) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serialization info. /// The streaming context. diff --git a/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs b/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs index 4fa3bd6..92de0da 100644 --- a/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs +++ b/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs @@ -9,9 +9,10 @@ namespace ChakraHosting /// The type of type allocation event. /// The size of the allocation. /// - /// For the Allocate event, returning true allows the runtime to continue with + /// For the Allocate event, returning true allows the runtime to continue with /// allocation. Returning false indicates the allocation request is rejected. The return value /// is ignored for other allocation events. /// - public delegate bool JavaScriptMemoryAllocationCallback(IntPtr callbackState, JavaScriptMemoryEventType allocationEvent, UIntPtr allocationSize); -} + public delegate bool JavaScriptMemoryAllocationCallback(IntPtr callbackState, + JavaScriptMemoryEventType allocationEvent, UIntPtr allocationSize); +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptMemoryEventType.cs b/Windows/ChakraHosting/JavaScriptMemoryEventType.cs index f1d9d7f..6be01a4 100644 --- a/Windows/ChakraHosting/JavaScriptMemoryEventType.cs +++ b/Windows/ChakraHosting/JavaScriptMemoryEventType.cs @@ -20,4 +20,4 @@ public enum JavaScriptMemoryEventType /// Failure = 2 } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptNativeFunction.cs b/Windows/ChakraHosting/JavaScriptNativeFunction.cs index a6bfcb1..98fb9e1 100644 --- a/Windows/ChakraHosting/JavaScriptNativeFunction.cs +++ b/Windows/ChakraHosting/JavaScriptNativeFunction.cs @@ -14,5 +14,7 @@ namespace ChakraHosting /// The number of arguments. /// Callback data, if any. /// The result of the call, if any. - public delegate JavaScriptValue JavaScriptNativeFunction(JavaScriptValue callee, [MarshalAs(UnmanagedType.U1)] bool isConstructCall, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData); -} + public delegate JavaScriptValue JavaScriptNativeFunction(JavaScriptValue callee, + [MarshalAs(UnmanagedType.U1)] bool isConstructCall, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] + JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData); +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs b/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs index 8d268fb..5ae5c95 100644 --- a/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs +++ b/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs @@ -11,4 +11,4 @@ namespace ChakraHosting /// The object to be collected. /// The state passed to JsSetObjectBeforeCollectCallback. public delegate void JavaScriptObjectBeforeCollectCallback(JavaScriptValue reference, IntPtr callbackState); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs b/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs index 7f7d608..2b22605 100644 --- a/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs +++ b/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs @@ -9,4 +9,4 @@ namespace ChakraHosting /// The external data that was passed in when creating the object being finalized. /// public delegate void JavaScriptObjectFinalizeCallback(IntPtr data); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs b/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs index aa03e65..c8c0cdf 100644 --- a/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs +++ b/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs @@ -13,7 +13,7 @@ namespace ChakraHosting public struct JavaScriptProjectionCallbackContext { /// - /// The reference. + /// The reference. /// private readonly IntPtr reference; } @@ -38,5 +38,6 @@ public struct JavaScriptProjectionCallbackContext /// The callback to be invoked on the original thread. /// The applications context. /// The Jsrt context that must be passed into jsCallback. - public delegate void JavaScriptProjectionEnqueueCallback(JavaScriptProjectionCallback jsCallback, JavaScriptProjectionCallbackContext jsContext, IntPtr callbackState); -} + public delegate void JavaScriptProjectionEnqueueCallback(JavaScriptProjectionCallback jsCallback, + JavaScriptProjectionCallbackContext jsContext, IntPtr callbackState); +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs b/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs index 65948da..878fc1e 100644 --- a/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs +++ b/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs @@ -14,4 +14,4 @@ namespace ChakraHosting /// The task, represented as a JavaScript function. /// The data argument to be passed to the callback. public delegate void JavaScriptPromiseContinuationCallback(JavaScriptValue task, IntPtr callbackState); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptPropertyId.cs b/Windows/ChakraHosting/JavaScriptPropertyId.cs index f2d0aa0..773cb4b 100644 --- a/Windows/ChakraHosting/JavaScriptPropertyId.cs +++ b/Windows/ChakraHosting/JavaScriptPropertyId.cs @@ -12,12 +12,12 @@ namespace ChakraHosting public struct JavaScriptPropertyId : IEquatable { /// - /// The id. + /// The id. /// private readonly IntPtr id; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The ID. internal JavaScriptPropertyId(IntPtr id) @@ -28,38 +28,34 @@ internal JavaScriptPropertyId(IntPtr id) /// /// Gets an invalid ID. /// - public static JavaScriptPropertyId Invalid - { - get { return new JavaScriptPropertyId(IntPtr.Zero); } - } + public static JavaScriptPropertyId Invalid => new JavaScriptPropertyId(IntPtr.Zero); /// /// Gets the name associated with the property ID. /// /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// public string Name { get { - string name; - Native.ThrowIfError(Native.JsGetPropertyNameFromId(this, out name)); + Native.ThrowIfError(Native.JsGetPropertyNameFromId(this, out var name)); return name; } } /// - /// Gets the property ID associated with the name. + /// Gets the property ID associated with the name. /// /// /// - /// Property IDs are specific to a context and cannot be used across contexts. + /// Property IDs are specific to a context and cannot be used across contexts. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// @@ -68,8 +64,7 @@ public string Name /// The property ID in this runtime for the given name. public static JavaScriptPropertyId FromString(string name) { - JavaScriptPropertyId id; - Native.ThrowIfError(Native.JsGetPropertyIdFromName(name, out id)); + Native.ThrowIfError(Native.JsGetPropertyIdFromName(name, out var id)); return id; } @@ -112,12 +107,9 @@ public bool Equals(JavaScriptPropertyId other) /// Whether the two property IDs are the same. public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) - { - return false; - } + if (ReferenceEquals(null, obj)) return false; - return obj is JavaScriptPropertyId && Equals((JavaScriptPropertyId)obj); + return obj is JavaScriptPropertyId && Equals((JavaScriptPropertyId) obj); } /// diff --git a/Windows/ChakraHosting/JavaScriptPropertyIdType.cs b/Windows/ChakraHosting/JavaScriptPropertyIdType.cs index b4ec45e..ba37997 100644 --- a/Windows/ChakraHosting/JavaScriptPropertyIdType.cs +++ b/Windows/ChakraHosting/JavaScriptPropertyIdType.cs @@ -9,9 +9,10 @@ public enum JavaScriptPropertyIdType /// Type enumeration of a JavaScript string property /// String, + /// /// Type enumeration of a JavaScript symbol property /// Symbol - }; + } } \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptRuntime.cs b/Windows/ChakraHosting/JavaScriptRuntime.cs index 1e1a0e4..c29a3d6 100644 --- a/Windows/ChakraHosting/JavaScriptRuntime.cs +++ b/Windows/ChakraHosting/JavaScriptRuntime.cs @@ -7,33 +7,30 @@ namespace ChakraHosting /// /// /// - /// Each Chakra runtime has its own independent execution engine, JIT compiler, and garbage - /// collected heap. As such, each runtime is completely isolated from other runtimes. + /// Each Chakra runtime has its own independent execution engine, JIT compiler, and garbage + /// collected heap. As such, each runtime is completely isolated from other runtimes. /// /// - /// Runtimes can be used on any thread, but only one thread can call into a runtime at any - /// time. + /// Runtimes can be used on any thread, but only one thread can call into a runtime at any + /// time. /// /// - /// NOTE: A JavaScriptRuntime, unlike other objects in the Chakra hosting API, is not - /// garbage collected since it contains the garbage collected heap itself. A runtime will - /// continue to exist until Dispose is called. + /// NOTE: A JavaScriptRuntime, unlike other objects in the Chakra hosting API, is not + /// garbage collected since it contains the garbage collected heap itself. A runtime will + /// continue to exist until Dispose is called. /// /// public struct JavaScriptRuntime : IDisposable { /// - /// The handle. + /// The handle. /// private IntPtr handle; /// /// Gets a value indicating whether the runtime is valid. /// - public bool IsValid - { - get { return handle != IntPtr.Zero; } - } + public bool IsValid => handle != IntPtr.Zero; /// /// Gets the current memory usage for a runtime. @@ -46,8 +43,7 @@ public UIntPtr MemoryUsage { get { - UIntPtr memoryUsage; - Native.ThrowIfError(Native.JsGetRuntimeMemoryUsage(this, out memoryUsage)); + Native.ThrowIfError(Native.JsGetRuntimeMemoryUsage(this, out var memoryUsage)); return memoryUsage; } } @@ -56,22 +52,18 @@ public UIntPtr MemoryUsage /// Gets or sets the current memory limit for a runtime. /// /// - /// The memory limit of a runtime can be always be retrieved, regardless of whether or not the + /// The memory limit of a runtime can be always be retrieved, regardless of whether or not the /// runtime is active on another thread. /// public UIntPtr MemoryLimit { get { - UIntPtr memoryLimit; - Native.ThrowIfError(Native.JsGetRuntimeMemoryLimit(this, out memoryLimit)); + Native.ThrowIfError(Native.JsGetRuntimeMemoryLimit(this, out var memoryLimit)); return memoryLimit; } - set - { - Native.ThrowIfError(Native.JsSetRuntimeMemoryLimit(this, value)); - } + set => Native.ThrowIfError(Native.JsSetRuntimeMemoryLimit(this, value)); } /// @@ -81,17 +73,14 @@ public bool Disabled { get { - bool isDisabled; - Native.ThrowIfError(Native.JsIsRuntimeExecutionDisabled(this, out isDisabled)); + Native.ThrowIfError(Native.JsIsRuntimeExecutionDisabled(this, out var isDisabled)); return isDisabled; } - set - { + set => Native.ThrowIfError(value - ? Native.JsDisableRuntimeExecution(this) - : Native.JsEnableRuntimeExecution(this)); - } + ? Native.JsDisableRuntimeExecution(this) + : Native.JsEnableRuntimeExecution(this)); } /// @@ -101,10 +90,10 @@ public bool Disabled /// The version of the runtime to be created. /// The thread service for the runtime. Can be null. /// The runtime created. - public static JavaScriptRuntime Create(JavaScriptRuntimeAttributes attributes, JavaScriptRuntimeVersion version, JavaScriptThreadServiceCallback threadServiceCallback) + public static JavaScriptRuntime Create(JavaScriptRuntimeAttributes attributes, JavaScriptRuntimeVersion version, + JavaScriptThreadServiceCallback threadServiceCallback) { - JavaScriptRuntime handle; - Native.ThrowIfError(Native.JsCreateRuntime(attributes, threadServiceCallback, out handle)); + Native.ThrowIfError(Native.JsCreateRuntime(attributes, threadServiceCallback, out var handle)); return handle; } @@ -133,15 +122,12 @@ public static JavaScriptRuntime Create() /// /// /// Once a runtime has been disposed, all resources owned by it are invalid and cannot be used. - /// If the runtime is active (i.e. it is set to be current on a particular thread), it cannot + /// If the runtime is active (i.e. it is set to be current on a particular thread), it cannot /// be disposed. /// public void Dispose() { - if (IsValid) - { - Native.ThrowIfError(Native.JsDisposeRuntime(this)); - } + if (IsValid) Native.ThrowIfError(Native.JsDisposeRuntime(this)); handle = IntPtr.Zero; } @@ -159,19 +145,19 @@ public void CollectGarbage() /// /// /// - /// Registering a memory allocation callback will cause the runtime to call back to the host - /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is - /// called before the runtime memory manager allocates a block of memory. The allocation will - /// be rejected if the callback returns false. The runtime memory manager will also invoke the - /// callback routine after freeing a block of memory, as well as after allocation failures. + /// Registering a memory allocation callback will cause the runtime to call back to the host + /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is + /// called before the runtime memory manager allocates a block of memory. The allocation will + /// be rejected if the callback returns false. The runtime memory manager will also invoke the + /// callback routine after freeing a block of memory, as well as after allocation failures. /// /// - /// The callback is invoked on the current runtime execution thread, therefore execution is - /// blocked until the callback completes. + /// The callback is invoked on the current runtime execution thread, therefore execution is + /// blocked until the callback completes. /// /// - /// The return value of the callback is not stored; previously rejected allocations will not - /// prevent the runtime from invoking the callback again later for new memory allocations. + /// The return value of the callback is not stored; previously rejected allocations will not + /// prevent the runtime from invoking the callback again later for new memory allocations. /// /// /// @@ -180,7 +166,8 @@ public void CollectGarbage() /// /// Memory allocation callback to be called for memory allocation events. /// - public void SetMemoryAllocationCallback(IntPtr callbackState, JavaScriptMemoryAllocationCallback allocationCallback) + public void SetMemoryAllocationCallback(IntPtr callbackState, + JavaScriptMemoryAllocationCallback allocationCallback) { Native.ThrowIfError(Native.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback)); } @@ -190,19 +177,20 @@ public void SetMemoryAllocationCallback(IntPtr callbackState, JavaScriptMemoryAl /// /// /// - /// The callback is invoked on the current runtime execution thread, therefore execution is - /// blocked until the callback completes. + /// The callback is invoked on the current runtime execution thread, therefore execution is + /// blocked until the callback completes. /// /// - /// The callback can be used by hosts to prepare for garbage collection. For example, by - /// releasing unnecessary references on Chakra objects. + /// The callback can be used by hosts to prepare for garbage collection. For example, by + /// releasing unnecessary references on Chakra objects. /// /// /// /// User provided state that will be passed back to the callback. /// /// The callback function being set. - public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback) + public void SetBeforeCollectCallback(IntPtr callbackState, + JavaScriptBeforeCollectCallback beforeCollectCallback) { Native.ThrowIfError(Native.JsSetRuntimeBeforeCollectCallback(this, callbackState, beforeCollectCallback)); } @@ -211,15 +199,14 @@ public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeColle /// Creates a script context for running scripts. /// /// - /// Each script context has its own global object that is isolated from all other script + /// Each script context has its own global object that is isolated from all other script /// contexts. /// /// The created script context. public JavaScriptContext CreateContext() { - JavaScriptContext reference; - Native.ThrowIfError(Native.JsCreateContext(this, out reference)); + Native.ThrowIfError(Native.JsCreateContext(this, out var reference)); return reference; } } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs b/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs index 4ff4d40..33562e7 100644 --- a/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs +++ b/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs @@ -40,13 +40,13 @@ public enum JavaScriptRuntimeAttributes /// /// Using Eval or Function constructor will throw an exception. /// - [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Eval is a valid function name.")] + [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", + Justification = "Eval is a valid function name.")] DisableEval = 0x00000010, /// /// Runtime will enable all experimental features. /// - /// EnableExperimentalFeatures = 0x00000020, /// @@ -55,4 +55,4 @@ public enum JavaScriptRuntimeAttributes /// DispatchSetExceptionsToDebugger = 0x00000040 } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs b/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs index 1a2cc2c..34ee758 100644 --- a/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs +++ b/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs @@ -18,6 +18,6 @@ public enum JavaScriptRuntimeVersion /// /// Create runtime with highest version present on the machine at runtime. /// - VersionEdge = -1, + VersionEdge = -1 } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptScriptException.cs b/Windows/ChakraHosting/JavaScriptScriptException.cs index 7e50f0d..72d21a1 100644 --- a/Windows/ChakraHosting/JavaScriptScriptException.cs +++ b/Windows/ChakraHosting/JavaScriptScriptException.cs @@ -8,12 +8,12 @@ namespace ChakraHosting public sealed class JavaScriptScriptException : JavaScriptException { /// - /// The error. + /// The error. /// private readonly JavaScriptValue error; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The JavaScript error object. @@ -23,7 +23,7 @@ public JavaScriptScriptException(JavaScriptErrorCode code, JavaScriptValue error } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The JavaScript error object. @@ -35,7 +35,7 @@ public JavaScriptScriptException(JavaScriptErrorCode code, JavaScriptValue error } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serialization info. /// The streaming context. @@ -47,12 +47,6 @@ private JavaScriptScriptException(string message, Exception innerException) : /// /// Gets a JavaScript object representing the script error. /// - public JavaScriptValue Error - { - get - { - return error; - } - } + public JavaScriptValue Error => error; } } \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs b/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs index b46d8ac..c009bc5 100644 --- a/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs +++ b/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs @@ -9,5 +9,6 @@ /// /// true if the operation succeeded, false otherwise. /// - public delegate bool JavaScriptSerializedScriptLoadSourceCallback(JavaScriptSourceContext sourceContext, out string scriptBuffer); -} + public delegate bool JavaScriptSerializedScriptLoadSourceCallback(JavaScriptSourceContext sourceContext, + out string scriptBuffer); +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs b/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs index 647634c..9aa45ea 100644 --- a/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs +++ b/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs @@ -6,4 +6,4 @@ /// /// The context passed to Js[Parse|Run]SerializedScriptWithCallback public delegate void JavaScriptSerializedScriptUnloadCallback(JavaScriptSourceContext sourceContext); -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptSourceContext.cs b/Windows/ChakraHosting/JavaScriptSourceContext.cs index 59078e0..ba06d52 100644 --- a/Windows/ChakraHosting/JavaScriptSourceContext.cs +++ b/Windows/ChakraHosting/JavaScriptSourceContext.cs @@ -8,12 +8,12 @@ namespace ChakraHosting public struct JavaScriptSourceContext : IEquatable { /// - /// The context. + /// The context. /// private readonly IntPtr context; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The context. private JavaScriptSourceContext(IntPtr context) @@ -24,10 +24,7 @@ private JavaScriptSourceContext(IntPtr context) /// /// Gets an empty source context. /// - public static JavaScriptSourceContext None - { - get { return new JavaScriptSourceContext(new IntPtr(-1)); } - } + public static JavaScriptSourceContext None => new JavaScriptSourceContext(new IntPtr(-1)); /// /// The equality operator for source contexts. @@ -136,7 +133,7 @@ public static JavaScriptSourceContext Increment(JavaScriptSourceContext left) } /// - /// Creates a new source context. + /// Creates a new source context. /// /// /// The cookie for the source context. @@ -164,12 +161,9 @@ public bool Equals(JavaScriptSourceContext other) /// Whether the two source contexts are the same. public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) - { - return false; - } + if (ReferenceEquals(null, obj)) return false; - return obj is JavaScriptSourceContext && Equals((JavaScriptSourceContext)obj); + return obj is JavaScriptSourceContext && Equals((JavaScriptSourceContext) obj); } /// diff --git a/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs b/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs index a88170d..6dce621 100644 --- a/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs +++ b/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs @@ -6,7 +6,7 @@ namespace ChakraHosting /// A thread service callback. /// /// - /// The host can specify a background thread service when creating a runtime. If + /// The host can specify a background thread service when creating a runtime. If /// specified, then background work items will be passed to the host using this callback. The /// host is expected to either begin executing the background work item immediately and return /// true or return false and the runtime will handle the work item in-thread. @@ -14,5 +14,6 @@ namespace ChakraHosting /// The callback for the background work item. /// The data argument to be passed to the callback. /// Whether the thread service will execute the callback. - public delegate bool JavaScriptThreadServiceCallback(JavaScriptBackgroundWorkItemCallback callbackFunction, IntPtr callbackData); -} + public delegate bool JavaScriptThreadServiceCallback(JavaScriptBackgroundWorkItemCallback callbackFunction, + IntPtr callbackData); +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptTypedArrayType.cs b/Windows/ChakraHosting/JavaScriptTypedArrayType.cs index cd9b518..51db9ec 100644 --- a/Windows/ChakraHosting/JavaScriptTypedArrayType.cs +++ b/Windows/ChakraHosting/JavaScriptTypedArrayType.cs @@ -9,37 +9,45 @@ public enum JavaScriptTypedArrayType /// An int8 array. /// Int8, + /// /// An uint8 array. /// Uint8, + /// /// An uint8 clamped array. /// Uint8Clamped, + /// /// An int16 array. /// Int16, + /// /// An uint16 array. /// Uint16, + /// /// An int32 array. /// Int32, + /// /// An uint32 array. /// Uint32, + /// /// A float32 array. /// Float32, + /// /// A float64 array. /// Float64 - }; + } } \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptUsageException.cs b/Windows/ChakraHosting/JavaScriptUsageException.cs index 94d19e5..6b07240 100644 --- a/Windows/ChakraHosting/JavaScriptUsageException.cs +++ b/Windows/ChakraHosting/JavaScriptUsageException.cs @@ -8,7 +8,7 @@ namespace ChakraHosting public sealed class JavaScriptUsageException : JavaScriptException { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. public JavaScriptUsageException(JavaScriptErrorCode code) : @@ -17,7 +17,7 @@ public JavaScriptUsageException(JavaScriptErrorCode code) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error code returned. /// The error message. @@ -27,7 +27,7 @@ public JavaScriptUsageException(JavaScriptErrorCode code, string message) : } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serialization info. /// The streaming context. diff --git a/Windows/ChakraHosting/JavaScriptValue.cs b/Windows/ChakraHosting/JavaScriptValue.cs index 3603a04..907670e 100644 --- a/Windows/ChakraHosting/JavaScriptValue.cs +++ b/Windows/ChakraHosting/JavaScriptValue.cs @@ -7,18 +7,18 @@ namespace ChakraHosting /// A JavaScript value. /// /// - /// A JavaScript value is one of the following types of values: Undefined, Null, Boolean, + /// A JavaScript value is one of the following types of values: Undefined, Null, Boolean, /// String, Number, or Object. /// public struct JavaScriptValue { /// - /// The reference. + /// The reference. /// private readonly IntPtr reference; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The reference. private JavaScriptValue(IntPtr reference) @@ -29,10 +29,7 @@ private JavaScriptValue(IntPtr reference) /// /// Gets an invalid value. /// - public static JavaScriptValue Invalid - { - get { return new JavaScriptValue(IntPtr.Zero); } - } + public static JavaScriptValue Invalid => new JavaScriptValue(IntPtr.Zero); /// /// Gets the value of undefined in the current script context. @@ -44,8 +41,7 @@ public static JavaScriptValue Undefined { get { - JavaScriptValue value; - Native.ThrowIfError(Native.JsGetUndefinedValue(out value)); + Native.ThrowIfError(Native.JsGetUndefinedValue(out var value)); return value; } } @@ -60,8 +56,7 @@ public static JavaScriptValue Null { get { - JavaScriptValue value; - Native.ThrowIfError(Native.JsGetNullValue(out value)); + Native.ThrowIfError(Native.JsGetNullValue(out var value)); return value; } } @@ -76,8 +71,7 @@ public static JavaScriptValue True { get { - JavaScriptValue value; - Native.ThrowIfError(Native.JsGetTrueValue(out value)); + Native.ThrowIfError(Native.JsGetTrueValue(out var value)); return value; } } @@ -92,8 +86,7 @@ public static JavaScriptValue False { get { - JavaScriptValue value; - Native.ThrowIfError(Native.JsGetFalseValue(out value)); + Native.ThrowIfError(Native.JsGetFalseValue(out var value)); return value; } } @@ -108,8 +101,7 @@ public static JavaScriptValue GlobalObject { get { - JavaScriptValue value; - Native.ThrowIfError(Native.JsGetGlobalObject(out value)); + Native.ThrowIfError(Native.JsGetGlobalObject(out var value)); return value; } } @@ -117,10 +109,7 @@ public static JavaScriptValue GlobalObject /// /// Gets a value indicating whether the value is valid. /// - public bool IsValid - { - get { return reference != IntPtr.Zero; } - } + public bool IsValid => reference != IntPtr.Zero; /// /// Gets the JavaScript type of the value. @@ -133,8 +122,7 @@ public JavaScriptValueType ValueType { get { - JavaScriptValueType type; - Native.ThrowIfError(Native.JsGetValueType(this, out type)); + Native.ThrowIfError(Native.JsGetValueType(this, out var type)); return type; } } @@ -150,8 +138,7 @@ public int StringLength { get { - int length; - Native.ThrowIfError(Native.JsGetStringLength(this, out length)); + Native.ThrowIfError(Native.JsGetStringLength(this, out var length)); return length; } } @@ -166,15 +153,11 @@ public JavaScriptValue Prototype { get { - JavaScriptValue prototypeReference; - Native.ThrowIfError(Native.JsGetPrototype(this, out prototypeReference)); + Native.ThrowIfError(Native.JsGetPrototype(this, out var prototypeReference)); return prototypeReference; } - set - { - Native.ThrowIfError(Native.JsSetPrototype(this, value)); - } + set => Native.ThrowIfError(Native.JsSetPrototype(this, value)); } /// @@ -187,8 +170,7 @@ public bool IsExtensionAllowed { get { - bool allowed; - Native.ThrowIfError(Native.JsGetExtensionAllowed(this, out allowed)); + Native.ThrowIfError(Native.JsGetExtensionAllowed(this, out var allowed)); return allowed; } } @@ -203,8 +185,7 @@ public bool HasExternalData { get { - bool hasExternalData; - Native.ThrowIfError(Native.JsHasExternalData(this, out hasExternalData)); + Native.ThrowIfError(Native.JsHasExternalData(this, out var hasExternalData)); return hasExternalData; } } @@ -219,15 +200,11 @@ public IntPtr ExternalData { get { - IntPtr data; - Native.ThrowIfError(Native.JsGetExternalData(this, out data)); + Native.ThrowIfError(Native.JsGetExternalData(this, out var data)); return data; } - set - { - Native.ThrowIfError(Native.JsSetExternalData(this, value)); - } + set => Native.ThrowIfError(Native.JsSetExternalData(this, value)); } /// @@ -240,8 +217,7 @@ public IntPtr ExternalData /// The converted value. public static JavaScriptValue FromBoolean(bool value) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsBoolToBoolean(value, out reference)); + Native.ThrowIfError(Native.JsBoolToBoolean(value, out var reference)); return reference; } @@ -255,8 +231,7 @@ public static JavaScriptValue FromBoolean(bool value) /// The new Number value. public static JavaScriptValue FromDouble(double value) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsDoubleToNumber(value, out reference)); + Native.ThrowIfError(Native.JsDoubleToNumber(value, out var reference)); return reference; } @@ -270,8 +245,7 @@ public static JavaScriptValue FromDouble(double value) /// The new Number value. public static JavaScriptValue FromInt32(int value) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsIntToNumber(value, out reference)); + Native.ThrowIfError(Native.JsIntToNumber(value, out var reference)); return reference; } @@ -285,8 +259,7 @@ public static JavaScriptValue FromInt32(int value) /// The new String value. public static JavaScriptValue FromString(string value) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsPointerToString(value, new UIntPtr((uint)value.Length), out reference)); + Native.ThrowIfError(Native.JsPointerToString(value, new UIntPtr((uint) value.Length), out var reference)); return reference; } @@ -299,8 +272,7 @@ public static JavaScriptValue FromString(string value) /// The new Object. public static JavaScriptValue CreateObject() { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateObject(out reference)); + Native.ThrowIfError(Native.JsCreateObject(out var reference)); return reference; } @@ -317,8 +289,7 @@ public static JavaScriptValue CreateObject() /// The new Object. public static JavaScriptValue CreateExternalObject(IntPtr data, JavaScriptObjectFinalizeCallback finalizer) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateExternalObject(data, finalizer, out reference)); + Native.ThrowIfError(Native.JsCreateExternalObject(data, finalizer, out var reference)); return reference; } @@ -332,8 +303,7 @@ public static JavaScriptValue CreateExternalObject(IntPtr data, JavaScriptObject /// The new function object. public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateFunction(function, IntPtr.Zero, out reference)); + Native.ThrowIfError(Native.JsCreateFunction(function, IntPtr.Zero, out var reference)); return reference; } @@ -348,8 +318,7 @@ public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function) /// The new function object. public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function, IntPtr callbackData) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateFunction(function, callbackData, out reference)); + Native.ThrowIfError(Native.JsCreateFunction(function, callbackData, out var reference)); return reference; } @@ -363,8 +332,7 @@ public static JavaScriptValue CreateFunction(JavaScriptNativeFunction function, /// The new array object. public static JavaScriptValue CreateArray(uint length) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateArray(length, out reference)); + Native.ThrowIfError(Native.JsCreateArray(length, out var reference)); return reference; } @@ -378,8 +346,7 @@ public static JavaScriptValue CreateArray(uint length) /// The new error object. public static JavaScriptValue CreateError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateError(message, out reference)); + Native.ThrowIfError(Native.JsCreateError(message, out var reference)); return reference; } @@ -393,8 +360,7 @@ public static JavaScriptValue CreateError(JavaScriptValue message) /// The new error object. public static JavaScriptValue CreateRangeError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateRangeError(message, out reference)); + Native.ThrowIfError(Native.JsCreateRangeError(message, out var reference)); return reference; } @@ -408,8 +374,7 @@ public static JavaScriptValue CreateRangeError(JavaScriptValue message) /// The new error object. public static JavaScriptValue CreateReferenceError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateReferenceError(message, out reference)); + Native.ThrowIfError(Native.JsCreateReferenceError(message, out var reference)); return reference; } @@ -423,8 +388,7 @@ public static JavaScriptValue CreateReferenceError(JavaScriptValue message) /// The new error object. public static JavaScriptValue CreateSyntaxError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateSyntaxError(message, out reference)); + Native.ThrowIfError(Native.JsCreateSyntaxError(message, out var reference)); return reference; } @@ -438,8 +402,7 @@ public static JavaScriptValue CreateSyntaxError(JavaScriptValue message) /// The new error object. public static JavaScriptValue CreateTypeError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateTypeError(message, out reference)); + Native.ThrowIfError(Native.JsCreateTypeError(message, out var reference)); return reference; } @@ -453,8 +416,7 @@ public static JavaScriptValue CreateTypeError(JavaScriptValue message) /// The new error object. public static JavaScriptValue CreateUriError(JavaScriptValue message) { - JavaScriptValue reference; - Native.ThrowIfError(Native.JsCreateURIError(message, out reference)); + Native.ThrowIfError(Native.JsCreateURIError(message, out var reference)); return reference; } @@ -462,15 +424,14 @@ public static JavaScriptValue CreateUriError(JavaScriptValue message) /// Adds a reference to the object. /// /// - /// This only needs to be called on objects that are not going to be stored somewhere on - /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed + /// This only needs to be called on objects that are not going to be stored somewhere on + /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed /// until Release is called /// /// The object's new reference count. public uint AddRef() { - uint count; - Native.ThrowIfError(Native.JsAddRef(this, out count)); + Native.ThrowIfError(Native.JsAddRef(this, out var count)); return count; } @@ -483,8 +444,7 @@ public uint AddRef() /// The object's new reference count. public uint Release() { - uint count; - Native.ThrowIfError(Native.JsRelease(this, out count)); + Native.ThrowIfError(Native.JsRelease(this, out var count)); return count; } @@ -497,8 +457,7 @@ public uint Release() /// The converted value. public bool ToBoolean() { - bool value; - Native.ThrowIfError(Native.JsBooleanToBool(this, out value)); + Native.ThrowIfError(Native.JsBooleanToBool(this, out var value)); return value; } @@ -507,18 +466,17 @@ public bool ToBoolean() /// /// /// - /// This function retrieves the value of a Number value. It will fail with - /// InvalidArgument if the type of the value is not Number. + /// This function retrieves the value of a Number value. It will fail with + /// InvalidArgument if the type of the value is not Number. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The double value. public double ToDouble() { - double value; - Native.ThrowIfError(Native.JsNumberToDouble(this, out value)); + Native.ThrowIfError(Native.JsNumberToDouble(this, out var value)); return value; } @@ -527,18 +485,17 @@ public double ToDouble() /// /// /// - /// This function retrieves the value of a Number value. It will fail with - /// InvalidArgument if the type of the value is not Number. + /// This function retrieves the value of a Number value. It will fail with + /// InvalidArgument if the type of the value is not Number. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The int value. public int ToInt32() { - int value; - Native.ThrowIfError(Native.JsNumberToInt(this, out value)); + Native.ThrowIfError(Native.JsNumberToInt(this, out var value)); return value; } @@ -547,20 +504,18 @@ public int ToInt32() /// /// /// - /// This function retrieves the string pointer of a String value. It will fail with - /// InvalidArgument if the type of the value is not String. + /// This function retrieves the string pointer of a String value. It will fail with + /// InvalidArgument if the type of the value is not String. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The string. public new string ToString() { - IntPtr buffer; - UIntPtr length; - Native.ThrowIfError(Native.JsStringToPointer(this, out buffer, out length)); - return Marshal.PtrToStringUni(buffer, (int)length); + Native.ThrowIfError(Native.JsStringToPointer(this, out var buffer, out var length)); + return Marshal.PtrToStringUni(buffer, (int) length); } /// @@ -572,8 +527,7 @@ public int ToInt32() /// The converted value. public JavaScriptValue ConvertToBoolean() { - JavaScriptValue booleanReference; - Native.ThrowIfError(Native.JsConvertValueToBoolean(this, out booleanReference)); + Native.ThrowIfError(Native.JsConvertValueToBoolean(this, out var booleanReference)); return booleanReference; } @@ -586,8 +540,7 @@ public JavaScriptValue ConvertToBoolean() /// The converted value. public JavaScriptValue ConvertToNumber() { - JavaScriptValue numberReference; - Native.ThrowIfError(Native.JsConvertValueToNumber(this, out numberReference)); + Native.ThrowIfError(Native.JsConvertValueToNumber(this, out var numberReference)); return numberReference; } @@ -600,8 +553,7 @@ public JavaScriptValue ConvertToNumber() /// The converted value. public JavaScriptValue ConvertToString() { - JavaScriptValue stringReference; - Native.ThrowIfError(Native.JsConvertValueToString(this, out stringReference)); + Native.ThrowIfError(Native.JsConvertValueToString(this, out var stringReference)); return stringReference; } @@ -614,8 +566,7 @@ public JavaScriptValue ConvertToString() /// The converted value. public JavaScriptValue ConvertToObject() { - JavaScriptValue objectReference; - Native.ThrowIfError(Native.JsConvertValueToObject(this, out objectReference)); + Native.ThrowIfError(Native.JsConvertValueToObject(this, out var objectReference)); return objectReference; } @@ -640,8 +591,7 @@ public void PreventExtension() /// The property descriptor. public JavaScriptValue GetOwnPropertyDescriptor(JavaScriptPropertyId propertyId) { - JavaScriptValue descriptorReference; - Native.ThrowIfError(Native.JsGetOwnPropertyDescriptor(this, propertyId, out descriptorReference)); + Native.ThrowIfError(Native.JsGetOwnPropertyDescriptor(this, propertyId, out var descriptorReference)); return descriptorReference; } @@ -654,8 +604,7 @@ public JavaScriptValue GetOwnPropertyDescriptor(JavaScriptPropertyId propertyId) /// An array of property names. public JavaScriptValue GetOwnPropertyNames() { - JavaScriptValue propertyNamesReference; - Native.ThrowIfError(Native.JsGetOwnPropertyNames(this, out propertyNamesReference)); + Native.ThrowIfError(Native.JsGetOwnPropertyNames(this, out var propertyNamesReference)); return propertyNamesReference; } @@ -669,8 +618,7 @@ public JavaScriptValue GetOwnPropertyNames() /// Whether the object (or a prototype) has the property. public bool HasProperty(JavaScriptPropertyId propertyId) { - bool hasProperty; - Native.ThrowIfError(Native.JsHasProperty(this, propertyId, out hasProperty)); + Native.ThrowIfError(Native.JsHasProperty(this, propertyId, out var hasProperty)); return hasProperty; } @@ -684,8 +632,7 @@ public bool HasProperty(JavaScriptPropertyId propertyId) /// The value of the property. public JavaScriptValue GetProperty(JavaScriptPropertyId id) { - JavaScriptValue propertyReference; - Native.ThrowIfError(Native.JsGetProperty(this, id, out propertyReference)); + Native.ThrowIfError(Native.JsGetProperty(this, id, out var propertyReference)); return propertyReference; } @@ -714,8 +661,7 @@ public void SetProperty(JavaScriptPropertyId id, JavaScriptValue value, bool use /// Whether the property was deleted. public JavaScriptValue DeleteProperty(JavaScriptPropertyId propertyId, bool useStrictRules) { - JavaScriptValue returnReference; - Native.ThrowIfError(Native.JsDeleteProperty(this, propertyId, useStrictRules, out returnReference)); + Native.ThrowIfError(Native.JsDeleteProperty(this, propertyId, useStrictRules, out var returnReference)); return returnReference; } @@ -730,8 +676,7 @@ public JavaScriptValue DeleteProperty(JavaScriptPropertyId propertyId, bool useS /// Whether the property was defined. public bool DefineProperty(JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor) { - bool result; - Native.ThrowIfError(Native.JsDefineProperty(this, propertyId, propertyDescriptor, out result)); + Native.ThrowIfError(Native.JsDefineProperty(this, propertyId, propertyDescriptor, out var result)); return result; } @@ -745,8 +690,7 @@ public bool DefineProperty(JavaScriptPropertyId propertyId, JavaScriptValue prop /// Whether the object has an value at the specified index. public bool HasIndexedProperty(JavaScriptValue index) { - bool hasProperty; - Native.ThrowIfError(Native.JsHasIndexedProperty(this, index, out hasProperty)); + Native.ThrowIfError(Native.JsHasIndexedProperty(this, index, out var hasProperty)); return hasProperty; } @@ -760,8 +704,7 @@ public bool HasIndexedProperty(JavaScriptValue index) /// The retrieved value. public JavaScriptValue GetIndexedProperty(JavaScriptValue index) { - JavaScriptValue propertyReference; - Native.ThrowIfError(Native.JsGetIndexedProperty(this, index, out propertyReference)); + Native.ThrowIfError(Native.JsGetIndexedProperty(this, index, out var propertyReference)); return propertyReference; } @@ -795,18 +738,17 @@ public void DeleteIndexedProperty(JavaScriptValue index) /// /// /// - /// This function is equivalent to the "==" operator in JavaScript. + /// This function is equivalent to the "==" operator in JavaScript. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The object to compare. /// Whether the values are equal. public bool Equals(JavaScriptValue other) { - bool equals; - Native.ThrowIfError(Native.JsEquals(this, other, out equals)); + Native.ThrowIfError(Native.JsEquals(this, other, out var equals)); return equals; } @@ -815,18 +757,17 @@ public bool Equals(JavaScriptValue other) /// /// /// - /// This function is equivalent to the "===" operator in JavaScript. + /// This function is equivalent to the "===" operator in JavaScript. /// /// - /// Requires an active script context. + /// Requires an active script context. /// /// /// The object to compare. /// Whether the values are strictly equal. public bool StrictEquals(JavaScriptValue other) { - bool equals; - Native.ThrowIfError(Native.JsStrictEquals(this, other, out equals)); + Native.ThrowIfError(Native.JsStrictEquals(this, other, out var equals)); return equals; } @@ -840,14 +781,10 @@ public bool StrictEquals(JavaScriptValue other) /// The Value returned from the function invocation, if any. public JavaScriptValue CallFunction(params JavaScriptValue[] arguments) { - JavaScriptValue returnReference; + if (arguments.Length > ushort.MaxValue) throw new ArgumentOutOfRangeException("arguments"); - if (arguments.Length > ushort.MaxValue) - { - throw new ArgumentOutOfRangeException("arguments"); - } - - Native.ThrowIfError(Native.JsCallFunction(this, arguments, (ushort)arguments.Length, out returnReference)); + Native.ThrowIfError(Native.JsCallFunction(this, arguments, (ushort) arguments.Length, + out var returnReference)); return returnReference; } @@ -861,15 +798,11 @@ public JavaScriptValue CallFunction(params JavaScriptValue[] arguments) /// The Value returned from the function invocation. public JavaScriptValue ConstructObject(params JavaScriptValue[] arguments) { - JavaScriptValue returnReference; - - if (arguments.Length > ushort.MaxValue) - { - throw new ArgumentOutOfRangeException("arguments"); - } + if (arguments.Length > ushort.MaxValue) throw new ArgumentOutOfRangeException("arguments"); - Native.ThrowIfError(Native.JsConstructObject(this, arguments, (ushort)arguments.Length, out returnReference)); + Native.ThrowIfError(Native.JsConstructObject(this, arguments, (ushort) arguments.Length, + out var returnReference)); return returnReference; } } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/JavaScriptValueType.cs b/Windows/ChakraHosting/JavaScriptValueType.cs index 8ae1eb8..4b93457 100644 --- a/Windows/ChakraHosting/JavaScriptValueType.cs +++ b/Windows/ChakraHosting/JavaScriptValueType.cs @@ -68,6 +68,6 @@ public enum JavaScriptValueType /// /// The value is a JavaScript DataView object value. /// - DataView = 12, + DataView = 12 } } \ No newline at end of file diff --git a/Windows/ChakraHosting/Native.cs b/Windows/ChakraHosting/Native.cs index 784f55f..54b1458 100644 --- a/Windows/ChakraHosting/Native.cs +++ b/Windows/ChakraHosting/Native.cs @@ -8,14 +8,15 @@ namespace ChakraHosting /// public static class Native { + private const string DllName = "Chakra.dll"; + /// - /// Throws if a native method returns an error code. + /// Throws if a native method returns an error code. /// /// The error. internal static void ThrowIfError(JavaScriptErrorCode error) { if (error != JavaScriptErrorCode.NoError) - { switch (error) { case JavaScriptErrorCode.InvalidArgument: @@ -76,36 +77,29 @@ internal static void ThrowIfError(JavaScriptErrorCode error) throw new JavaScriptEngineException(error, "Out of memory."); case JavaScriptErrorCode.ScriptException: - { - JavaScriptValue errorObject; - JavaScriptErrorCode innerError = JsGetAndClearException(out errorObject); + { + var innerError = JsGetAndClearException(out var errorObject); - if (innerError != JavaScriptErrorCode.NoError) - { - throw new JavaScriptFatalException(innerError); - } + if (innerError != JavaScriptErrorCode.NoError) throw new JavaScriptFatalException(innerError); - throw new JavaScriptScriptException(error, errorObject, "Script threw an exception."); - } + throw new JavaScriptScriptException(error, errorObject, "Script threw an exception."); + } case JavaScriptErrorCode.ScriptCompile: - { - JavaScriptValue errorObject; - JavaScriptErrorCode innerError = JsGetAndClearException(out errorObject); + { + var innerError = JsGetAndClearException(out var errorObject); - if (innerError != JavaScriptErrorCode.NoError) - { - throw new JavaScriptFatalException(innerError); - } + if (innerError != JavaScriptErrorCode.NoError) throw new JavaScriptFatalException(innerError); - throw new JavaScriptScriptException(error, errorObject, "Compile error."); - } + throw new JavaScriptScriptException(error, errorObject, "Compile error."); + } case JavaScriptErrorCode.ScriptTerminated: throw new JavaScriptScriptException(error, JavaScriptValue.Invalid, "Script was terminated."); case JavaScriptErrorCode.ScriptEvalDisabled: - throw new JavaScriptScriptException(error, JavaScriptValue.Invalid, "Eval of strings is disabled in this runtime."); + throw new JavaScriptScriptException(error, JavaScriptValue.Invalid, + "Eval of strings is disabled in this runtime."); case JavaScriptErrorCode.Fatal: throw new JavaScriptFatalException(error); @@ -113,13 +107,11 @@ internal static void ThrowIfError(JavaScriptErrorCode error) default: throw new JavaScriptFatalException(error); } - } } - const string DllName = "Chakra.dll"; - [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateRuntime(JavaScriptRuntimeAttributes attributes, JavaScriptThreadServiceCallback threadService, out JavaScriptRuntime runtime); + internal static extern JavaScriptErrorCode JsCreateRuntime(JavaScriptRuntimeAttributes attributes, + JavaScriptThreadServiceCallback threadService, out JavaScriptRuntime runtime); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsCollectGarbage(JavaScriptRuntime handle); @@ -128,19 +120,24 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsDisposeRuntime(JavaScriptRuntime handle); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetRuntimeMemoryUsage(JavaScriptRuntime runtime, out UIntPtr memoryUsage); + internal static extern JavaScriptErrorCode JsGetRuntimeMemoryUsage(JavaScriptRuntime runtime, + out UIntPtr memoryUsage); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetRuntimeMemoryLimit(JavaScriptRuntime runtime, out UIntPtr memoryLimit); + internal static extern JavaScriptErrorCode JsGetRuntimeMemoryLimit(JavaScriptRuntime runtime, + out UIntPtr memoryLimit); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetRuntimeMemoryLimit(JavaScriptRuntime runtime, UIntPtr memoryLimit); + internal static extern JavaScriptErrorCode JsSetRuntimeMemoryLimit(JavaScriptRuntime runtime, + UIntPtr memoryLimit); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetRuntimeMemoryAllocationCallback(JavaScriptRuntime runtime, IntPtr callbackState, JavaScriptMemoryAllocationCallback allocationCallback); + internal static extern JavaScriptErrorCode JsSetRuntimeMemoryAllocationCallback(JavaScriptRuntime runtime, + IntPtr callbackState, JavaScriptMemoryAllocationCallback allocationCallback); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetRuntimeBeforeCollectCallback(JavaScriptRuntime runtime, IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback); + internal static extern JavaScriptErrorCode JsSetRuntimeBeforeCollectCallback(JavaScriptRuntime runtime, + IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback); [DllImport(DllName, EntryPoint = "JsAddRef")] internal static extern JavaScriptErrorCode JsContextAddRef(JavaScriptContext reference, out uint count); @@ -155,7 +152,8 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsRelease(JavaScriptValue reference, out uint count); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateContext(JavaScriptRuntime runtime, out JavaScriptContext newContext); + internal static extern JavaScriptErrorCode JsCreateContext(JavaScriptRuntime runtime, + out JavaScriptContext newContext); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetCurrentContext(out JavaScriptContext currentContext); @@ -164,8 +162,9 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsSetCurrentContext(JavaScriptContext context); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetRuntime(JavaScriptContext context, out JavaScriptRuntime runtime); - + internal static extern JavaScriptErrorCode JsGetRuntime(JavaScriptContext context, + out JavaScriptRuntime runtime); + [DllImport(DllName)] internal static extern JavaScriptErrorCode JsStartDebugging(); @@ -173,25 +172,32 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsIdle(out uint nextIdleTick); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsParseScript(string script, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsParseScript(string script, JavaScriptSourceContext sourceContext, + string sourceUrl, out JavaScriptValue result); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsRunScript(string script, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsRunScript(string script, JavaScriptSourceContext sourceContext, + string sourceUrl, out JavaScriptValue result); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsSerializeScript(string script, byte[] buffer, ref ulong bufferSize); + internal static extern JavaScriptErrorCode + JsSerializeScript(string script, byte[] buffer, ref ulong bufferSize); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsParseSerializedScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsParseSerializedScript(string script, byte[] buffer, + JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsRunSerializedScript(string script, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsRunSerializedScript(string script, byte[] buffer, + JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsGetPropertyIdFromName(string name, out JavaScriptPropertyId propertyId); + internal static extern JavaScriptErrorCode JsGetPropertyIdFromName(string name, + out JavaScriptPropertyId propertyId); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsGetPropertyNameFromId(JavaScriptPropertyId propertyId, out string name); + internal static extern JavaScriptErrorCode JsGetPropertyNameFromId(JavaScriptPropertyId propertyId, + out string name); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetUndefinedValue(out JavaScriptValue undefinedValue); @@ -212,7 +218,8 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsBooleanToBool(JavaScriptValue booleanValue, out bool boolValue); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsConvertValueToBoolean(JavaScriptValue value, out JavaScriptValue booleanValue); + internal static extern JavaScriptErrorCode JsConvertValueToBoolean(JavaScriptValue value, + out JavaScriptValue booleanValue); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetValueType(JavaScriptValue value, out JavaScriptValueType type); @@ -227,25 +234,31 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsNumberToDouble(JavaScriptValue value, out double doubleValue); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsConvertValueToNumber(JavaScriptValue value, out JavaScriptValue numberValue); + internal static extern JavaScriptErrorCode JsConvertValueToNumber(JavaScriptValue value, + out JavaScriptValue numberValue); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetStringLength(JavaScriptValue sringValue, out int length); [DllImport(DllName, CharSet = CharSet.Unicode)] - internal static extern JavaScriptErrorCode JsPointerToString(string value, UIntPtr stringLength, out JavaScriptValue stringValue); + internal static extern JavaScriptErrorCode JsPointerToString(string value, UIntPtr stringLength, + out JavaScriptValue stringValue); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsStringToPointer(JavaScriptValue value, out IntPtr stringValue, out UIntPtr stringLength); + internal static extern JavaScriptErrorCode JsStringToPointer(JavaScriptValue value, out IntPtr stringValue, + out UIntPtr stringLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsConvertValueToString(JavaScriptValue value, out JavaScriptValue stringValue); + internal static extern JavaScriptErrorCode JsConvertValueToString(JavaScriptValue value, + out JavaScriptValue stringValue); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsVariantToValue([MarshalAs(UnmanagedType.Struct)] ref object var, out JavaScriptValue value); + internal static extern JavaScriptErrorCode JsVariantToValue([MarshalAs(UnmanagedType.Struct)] ref object var, + out JavaScriptValue value); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsValueToVariant(JavaScriptValue obj, [MarshalAs(UnmanagedType.Struct)] out object var); + internal static extern JavaScriptErrorCode JsValueToVariant(JavaScriptValue obj, + [MarshalAs(UnmanagedType.Struct)] out object var); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetGlobalObject(out JavaScriptValue globalObject); @@ -254,13 +267,16 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsCreateObject(out JavaScriptValue obj); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateExternalObject(IntPtr data, JavaScriptObjectFinalizeCallback finalizeCallback, out JavaScriptValue obj); + internal static extern JavaScriptErrorCode JsCreateExternalObject(IntPtr data, + JavaScriptObjectFinalizeCallback finalizeCallback, out JavaScriptValue obj); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsConvertValueToObject(JavaScriptValue value, out JavaScriptValue obj); + internal static extern JavaScriptErrorCode JsConvertValueToObject(JavaScriptValue value, + out JavaScriptValue obj); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetPrototype(JavaScriptValue obj, out JavaScriptValue prototypeObject); + internal static extern JavaScriptErrorCode JsGetPrototype(JavaScriptValue obj, + out JavaScriptValue prototypeObject); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsSetPrototype(JavaScriptValue obj, JavaScriptValue prototypeObject); @@ -272,43 +288,55 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsPreventExtension(JavaScriptValue obj); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, out JavaScriptValue value); + internal static extern JavaScriptErrorCode JsGetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, + out JavaScriptValue value); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetOwnPropertyDescriptor(JavaScriptValue obj, JavaScriptPropertyId propertyId, out JavaScriptValue propertyDescriptor); + internal static extern JavaScriptErrorCode JsGetOwnPropertyDescriptor(JavaScriptValue obj, + JavaScriptPropertyId propertyId, out JavaScriptValue propertyDescriptor); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetOwnPropertyNames(JavaScriptValue obj, out JavaScriptValue propertyNames); + internal static extern JavaScriptErrorCode JsGetOwnPropertyNames(JavaScriptValue obj, + out JavaScriptValue propertyNames); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, JavaScriptValue value, bool useStrictRules); + internal static extern JavaScriptErrorCode JsSetProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, + JavaScriptValue value, bool useStrictRules); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsHasProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, out bool hasProperty); + internal static extern JavaScriptErrorCode JsHasProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, + out bool hasProperty); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsDeleteProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, bool useStrictRules, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsDeleteProperty(JavaScriptValue obj, + JavaScriptPropertyId propertyId, bool useStrictRules, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsDefineProperty(JavaScriptValue obj, JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor, out bool result); + internal static extern JavaScriptErrorCode JsDefineProperty(JavaScriptValue obj, + JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor, out bool result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsHasIndexedProperty(JavaScriptValue obj, JavaScriptValue index, out bool result); + internal static extern JavaScriptErrorCode JsHasIndexedProperty(JavaScriptValue obj, JavaScriptValue index, + out bool result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsGetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, + out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, JavaScriptValue value); + internal static extern JavaScriptErrorCode JsSetIndexedProperty(JavaScriptValue obj, JavaScriptValue index, + JavaScriptValue value); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsDeleteIndexedProperty(JavaScriptValue obj, JavaScriptValue index); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsEquals(JavaScriptValue obj1, JavaScriptValue obj2, out bool result); + internal static extern JavaScriptErrorCode + JsEquals(JavaScriptValue obj1, JavaScriptValue obj2, out bool result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsStrictEquals(JavaScriptValue obj1, JavaScriptValue obj2, out bool result); + internal static extern JavaScriptErrorCode JsStrictEquals(JavaScriptValue obj1, JavaScriptValue obj2, + out bool result); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsHasExternalData(JavaScriptValue obj, out bool value); @@ -323,28 +351,35 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsCreateArray(uint length, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCallFunction(JavaScriptValue function, JavaScriptValue[] arguments, ushort argumentCount, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsCallFunction(JavaScriptValue function, JavaScriptValue[] arguments, + ushort argumentCount, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsConstructObject(JavaScriptValue function, JavaScriptValue[] arguments, ushort argumentCount, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsConstructObject(JavaScriptValue function, + JavaScriptValue[] arguments, ushort argumentCount, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateFunction(JavaScriptNativeFunction nativeFunction, IntPtr externalData, out JavaScriptValue function); + internal static extern JavaScriptErrorCode JsCreateFunction(JavaScriptNativeFunction nativeFunction, + IntPtr externalData, out JavaScriptValue function); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsCreateError(JavaScriptValue message, out JavaScriptValue error); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateRangeError(JavaScriptValue message, out JavaScriptValue error); + internal static extern JavaScriptErrorCode JsCreateRangeError(JavaScriptValue message, + out JavaScriptValue error); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateReferenceError(JavaScriptValue message, out JavaScriptValue error); + internal static extern JavaScriptErrorCode JsCreateReferenceError(JavaScriptValue message, + out JavaScriptValue error); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateSyntaxError(JavaScriptValue message, out JavaScriptValue error); + internal static extern JavaScriptErrorCode JsCreateSyntaxError(JavaScriptValue message, + out JavaScriptValue error); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateTypeError(JavaScriptValue message, out JavaScriptValue error); + internal static extern JavaScriptErrorCode + JsCreateTypeError(JavaScriptValue message, out JavaScriptValue error); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsCreateURIError(JavaScriptValue message, out JavaScriptValue error); @@ -365,83 +400,107 @@ internal static void ThrowIfError(JavaScriptErrorCode error) internal static extern JavaScriptErrorCode JsEnableRuntimeExecution(JavaScriptRuntime runtime); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsIsRuntimeExecutionDisabled(JavaScriptRuntime runtime, out bool isDisabled); + internal static extern JavaScriptErrorCode JsIsRuntimeExecutionDisabled(JavaScriptRuntime runtime, + out bool isDisabled); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetObjectBeforeCollectCallback(JavaScriptValue reference, IntPtr callbackState, JavaScriptObjectBeforeCollectCallback beforeCollectCallback); + internal static extern JavaScriptErrorCode JsSetObjectBeforeCollectCallback(JavaScriptValue reference, + IntPtr callbackState, JavaScriptObjectBeforeCollectCallback beforeCollectCallback); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateNamedFunction(JavaScriptValue name, JavaScriptNativeFunction nativeFunction, IntPtr callbackState, out JavaScriptValue function); + internal static extern JavaScriptErrorCode JsCreateNamedFunction(JavaScriptValue name, + JavaScriptNativeFunction nativeFunction, IntPtr callbackState, out JavaScriptValue function); [DllImport(DllName, CharSet = CharSet.Unicode)] internal static extern JavaScriptErrorCode JsProjectWinRTNamespace(string namespaceName); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsInspectableToObject([MarshalAs(UnmanagedType.IInspectable)] System.Object inspectable, out JavaScriptValue value); - + internal static extern JavaScriptErrorCode JsInspectableToObject([MarshalAs(UnmanagedType.IInspectable)] + object inspectable, out JavaScriptValue value); + [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetProjectionEnqueueCallback(JavaScriptProjectionEnqueueCallback projectionEnqueueCallback, IntPtr context); + internal static extern JavaScriptErrorCode JsSetProjectionEnqueueCallback( + JavaScriptProjectionEnqueueCallback projectionEnqueueCallback, IntPtr context); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetPromiseContinuationCallback(JavaScriptPromiseContinuationCallback promiseContinuationCallback, IntPtr callbackState); + internal static extern JavaScriptErrorCode JsSetPromiseContinuationCallback( + JavaScriptPromiseContinuationCallback promiseContinuationCallback, IntPtr callbackState); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsCreateArrayBuffer(uint byteLength, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateTypedArray(JavaScriptTypedArrayType arrayType, JavaScriptValue arrayBuffer, uint byteOffset, + internal static extern JavaScriptErrorCode JsCreateTypedArray(JavaScriptTypedArrayType arrayType, + JavaScriptValue arrayBuffer, uint byteOffset, uint elementLength, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateDataView(JavaScriptValue arrayBuffer, uint byteOffset, uint byteOffsetLength, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsCreateDataView(JavaScriptValue arrayBuffer, uint byteOffset, + uint byteOffsetLength, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetArrayBufferStorage(JavaScriptValue arrayBuffer, out IntPtr buffer, out uint bufferLength); + internal static extern JavaScriptErrorCode JsGetArrayBufferStorage(JavaScriptValue arrayBuffer, + out IntPtr buffer, out uint bufferLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetTypedArrayStorage(JavaScriptValue typedArray, out IntPtr buffer, out uint bufferLength, out JavaScriptTypedArrayType arrayType, out int elementSize); + internal static extern JavaScriptErrorCode JsGetTypedArrayStorage(JavaScriptValue typedArray, out IntPtr buffer, + out uint bufferLength, out JavaScriptTypedArrayType arrayType, out int elementSize); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetDataViewStorage(JavaScriptValue dataView, out IntPtr buffer, out uint bufferLength); + internal static extern JavaScriptErrorCode JsGetDataViewStorage(JavaScriptValue dataView, out IntPtr buffer, + out uint bufferLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetPropertyIdType(JavaScriptPropertyId propertyId, out JavaScriptPropertyIdType propertyIdType); + internal static extern JavaScriptErrorCode JsGetPropertyIdType(JavaScriptPropertyId propertyId, + out JavaScriptPropertyIdType propertyIdType); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateSymbol(JavaScriptValue description, out JavaScriptValue symbol); + internal static extern JavaScriptErrorCode JsCreateSymbol(JavaScriptValue description, + out JavaScriptValue symbol); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetSymbolFromPropertyId(JavaScriptPropertyId propertyId, out JavaScriptValue symbol); + internal static extern JavaScriptErrorCode JsGetSymbolFromPropertyId(JavaScriptPropertyId propertyId, + out JavaScriptValue symbol); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetPropertyIdFromSymbol(JavaScriptValue symbol, out JavaScriptPropertyId propertyId); + internal static extern JavaScriptErrorCode JsGetPropertyIdFromSymbol(JavaScriptValue symbol, + out JavaScriptPropertyId propertyId); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetOwnPropertySymbols(JavaScriptValue obj, out JavaScriptValue propertySymbols); + internal static extern JavaScriptErrorCode JsGetOwnPropertySymbols(JavaScriptValue obj, + out JavaScriptValue propertySymbols); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsNumberToInt(JavaScriptValue value, out int intValue); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsSetIndexedPropertiesToExternalData(JavaScriptValue obj, IntPtr data, JavaScriptTypedArrayType arrayType, uint elementLength); + internal static extern JavaScriptErrorCode JsSetIndexedPropertiesToExternalData(JavaScriptValue obj, + IntPtr data, JavaScriptTypedArrayType arrayType, uint elementLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetIndexedPropertiesExternalData(JavaScriptValue obj, IntPtr data, out JavaScriptTypedArrayType arrayType, out uint elementLength); + internal static extern JavaScriptErrorCode JsGetIndexedPropertiesExternalData(JavaScriptValue obj, IntPtr data, + out JavaScriptTypedArrayType arrayType, out uint elementLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsHasIndexedPropertiesExternalData(JavaScriptValue obj, out bool value); + internal static extern JavaScriptErrorCode JsHasIndexedPropertiesExternalData(JavaScriptValue obj, + out bool value); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsInstanceOf(JavaScriptValue obj, JavaScriptValue constructor, out bool result); + internal static extern JavaScriptErrorCode JsInstanceOf(JavaScriptValue obj, JavaScriptValue constructor, + out bool result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsCreateExternalArrayBuffer(IntPtr data, uint byteLength, JavaScriptObjectFinalizeCallback finalizeCallback, IntPtr callbackState, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsCreateExternalArrayBuffer(IntPtr data, uint byteLength, + JavaScriptObjectFinalizeCallback finalizeCallback, IntPtr callbackState, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetTypedArrayInfo(JavaScriptValue typedArray, out JavaScriptTypedArrayType arrayType, out JavaScriptValue arrayBuffer, out uint byteOffset, out uint byteLength); + internal static extern JavaScriptErrorCode JsGetTypedArrayInfo(JavaScriptValue typedArray, + out JavaScriptTypedArrayType arrayType, out JavaScriptValue arrayBuffer, out uint byteOffset, + out uint byteLength); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsGetContextOfObject(JavaScriptValue obj, out JavaScriptContext context); + internal static extern JavaScriptErrorCode JsGetContextOfObject(JavaScriptValue obj, + out JavaScriptContext context); [DllImport(DllName)] internal static extern JavaScriptErrorCode JsGetContextData(JavaScriptContext context, out IntPtr data); @@ -450,11 +509,15 @@ internal static extern JavaScriptErrorCode JsCreateTypedArray(JavaScriptTypedArr internal static extern JavaScriptErrorCode JsSetContextData(JavaScriptContext context, IntPtr data); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsParseSerializedScriptWithCallback(JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, - JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsParseSerializedScriptWithCallback( + JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, + JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, + JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); [DllImport(DllName)] - internal static extern JavaScriptErrorCode JsRunSerializedScriptWithCallback(JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, - JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); + internal static extern JavaScriptErrorCode JsRunSerializedScriptWithCallback( + JavaScriptSerializedScriptLoadSourceCallback scriptLoadCallback, + JavaScriptSerializedScriptUnloadCallback scriptUnloadCallback, byte[] buffer, + JavaScriptSourceContext sourceContext, string sourceUrl, out JavaScriptValue result); } -} +} \ No newline at end of file diff --git a/Windows/ChakraHosting/Properties/AssemblyInfo.cs b/Windows/ChakraHosting/Properties/AssemblyInfo.cs index 3cc0338..6a35623 100644 --- a/Windows/ChakraHosting/Properties/AssemblyInfo.cs +++ b/Windows/ChakraHosting/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml b/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml index e05ff59..0f8d517 100644 --- a/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml +++ b/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml @@ -1,4 +1,5 @@ - + + + - + \ No newline at end of file From d8f1a545c4bec3a1fc4aced4c050df4db3d0983f Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 25 Jan 2019 19:57:39 +0800 Subject: [PATCH 05/27] [Android] add text size --- .../java/moe/tlaster/shiba/mapper/TextMapper.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Android/shiba/src/main/java/moe/tlaster/shiba/mapper/TextMapper.kt b/Android/shiba/src/main/java/moe/tlaster/shiba/mapper/TextMapper.kt index e1cdbdc..fd0804d 100644 --- a/Android/shiba/src/main/java/moe/tlaster/shiba/mapper/TextMapper.kt +++ b/Android/shiba/src/main/java/moe/tlaster/shiba/mapper/TextMapper.kt @@ -1,8 +1,12 @@ package moe.tlaster.shiba.mapper +import android.content.Context import android.graphics.Color import android.widget.TextView import moe.tlaster.shiba.IShibaContext +import android.util.TypedValue + + class TextMapper : ViewMapper() { override var hasDefaultProperty = true @@ -18,6 +22,15 @@ class TextMapper : ViewMapper() { view.setTextColor(Color.parseColor(it)) } })) + add(PropertyMap("size", { view, it -> + if (view is TextView && it is Number) { + view.textSize = spToPx(it.toFloat(), view.context).toFloat() + } + })) } } -} \ No newline at end of file +} + +fun spToPx(sp: Float, context: Context): Int { + return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, context.resources.displayMetrics).toInt() +} From 1e8dcfca9ca7b72463652c33424d92bc818fccb4 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Tue, 29 Jan 2019 16:51:32 +0800 Subject: [PATCH 06/27] clean up --- .../moe/tlaster/shibasample/LiveActivity.kt | 44 +------------------ .../scripting/conversion/PromiseConversion.kt | 3 +- Windows/ChakraHosting/ChakraHost.cs | 2 +- Windows/Sample/Shiba.UWP.Sample/App.xaml.cs | 3 -- .../Sample/Shiba.UWP.Sample/MainPage.xaml.cs | 9 +--- Windows/Shiba.Test/Shiba.Test.csproj | 4 +- .../Shiba/Scripting/DefaultScriptRuntime.cs | 4 +- 7 files changed, 7 insertions(+), 62 deletions(-) diff --git a/Android/app/src/main/java/moe/tlaster/shibasample/LiveActivity.kt b/Android/app/src/main/java/moe/tlaster/shibasample/LiveActivity.kt index 4398cc1..142de73 100644 --- a/Android/app/src/main/java/moe/tlaster/shibasample/LiveActivity.kt +++ b/Android/app/src/main/java/moe/tlaster/shibasample/LiveActivity.kt @@ -92,48 +92,6 @@ class Streaming(private val dataCallback: (JsonNode) -> Unit, private val layout var host = "http://10.0.2.2:5000/streaming" -// fun fetch(): ServerSentEvent? { -// val request = Request.Builder().url(host).build() -// val okSse = OkSse() -// return okSse.newServerSentEvent(request, object : ServerSentEvent.Listener { -// override fun onOpen(sse: ServerSentEvent?, response: Response?) { -// } -// -// override fun onRetryTime(sse: ServerSentEvent?, milliseconds: Long): Boolean { -// return true -// } -// -// override fun onComment(sse: ServerSentEvent?, comment: String?) { -// } -// -// override fun onRetryError(sse: ServerSentEvent?, throwable: Throwable?, response: Response?): Boolean { -// return true -// } -// -// override fun onPreRetry(sse: ServerSentEvent?, originalRequest: Request?): Request { -// return originalRequest ?: throw Error() -// } -// -// override fun onMessage(sse: ServerSentEvent?, id: String?, event: String?, message: String?) { -// when (event) { -// "data_changed" -> { -// dataCallback.invoke(ObjectMapper().readTree(message?.trim('"'))) -// } -// "layout_changed" -> { -// if (message != null) { -// layoutCallback.invoke(message.trim('"')) -// } -// } -// } -// } -// -// override fun onClosed(sse: ServerSentEvent?) { -// } -// -// }) -// } - - fun fetch(): Shutdownable { val response = client.get(host) if (response.isSuccessful) { @@ -177,7 +135,7 @@ class Streaming(private val dataCallback: (JsonNode) -> Unit, private val layout // ) // handler.onStatus(status) // } - } catch (e: java.io.InterruptedIOException) { + } catch (e: Throwable) { break } } diff --git a/Android/shiba/src/main/java/moe/tlaster/shiba/scripting/conversion/PromiseConversion.kt b/Android/shiba/src/main/java/moe/tlaster/shiba/scripting/conversion/PromiseConversion.kt index 2a9dfb6..d60b2d4 100644 --- a/Android/shiba/src/main/java/moe/tlaster/shiba/scripting/conversion/PromiseConversion.kt +++ b/Android/shiba/src/main/java/moe/tlaster/shiba/scripting/conversion/PromiseConversion.kt @@ -22,7 +22,7 @@ class PromiseConversion(override val objectType: Class<*> = Deferred::class.java return null } val obj = value.toObject() - val deferred = GlobalScope.async { + return GlobalScope.async { suspendCoroutine { cont -> obj.property("then").toFunction().call(obj, object : JSFunction(obj.context, "then") { @@ -38,7 +38,6 @@ class PromiseConversion(override val objectType: Class<*> = Deferred::class.java } } - return deferred } override fun toJSValue(context: JSContext, value: Any): JSValue { diff --git a/Windows/ChakraHosting/ChakraHost.cs b/Windows/ChakraHosting/ChakraHost.cs index 2035b01..f63e153 100644 --- a/Windows/ChakraHosting/ChakraHost.cs +++ b/Windows/ChakraHosting/ChakraHost.cs @@ -34,7 +34,7 @@ public void Dispose() public void Init() { - Native.ThrowIfError(Native.JsCreateRuntime(JavaScriptRuntimeAttributes.None, null, out _runtime)); + Native.ThrowIfError(Native.JsCreateRuntime(JavaScriptRuntimeAttributes.EnableExperimentalFeatures, null, out _runtime)); Native.ThrowIfError(Native.JsCreateContext(_runtime, out _context)); EnterContext(); Native.ThrowIfError(Native.JsSetPromiseContinuationCallback(PromiseContinuationDelegate, IntPtr.Zero)); diff --git a/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs b/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs index 8a1b894..3e347f9 100644 --- a/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs +++ b/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs @@ -49,9 +49,6 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) ShibaApp.Instance.AddConverter("function awesome(value) { return value + \" is awesome!\" }"); ShibaApp.Instance.AddConverter("function reverse(value) { return value.split(\"\").reverse().join(\"\"); }"); ShibaApp.Instance.AddConverter("function helloWorld(value) { if (value === null || value === undefined) return null; return value.hello.world; }"); - var script = "const nhentai = {\r\n home: async (page) => {\r\n const link = `https://nhentai.net/api/galleries/all?page=${page}`;\r\n const result = JSON.parse(await http.get(link));\r\n return JSON.stringify(result.result)\r\n }\r\n}"; - ShibaApp.Instance.Configuration.ScriptRuntime.Execute(script); - SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; diff --git a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs index f015d30..7334f34 100644 --- a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs +++ b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs @@ -85,14 +85,7 @@ private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e) private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { - - var script = $"nhentai.home(1)"; - var task = ShibaApp.Instance.Configuration.ScriptRuntime.Execute(script) as Task; - var result = await task as string; - var list = JsonConvert.DeserializeObject(result); - - - //Frame.Navigate(typeof(LivePage)); + Frame.Navigate(typeof(LivePage)); } } } \ No newline at end of file diff --git a/Windows/Shiba.Test/Shiba.Test.csproj b/Windows/Shiba.Test/Shiba.Test.csproj index 009d9e5..21eb7ef 100644 --- a/Windows/Shiba.Test/Shiba.Test.csproj +++ b/Windows/Shiba.Test/Shiba.Test.csproj @@ -152,10 +152,10 @@ 6.2.3 - 1.3.2 + 1.4.0 - 1.3.2 + 1.4.0 diff --git a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs index 2e23f67..3a543f0 100644 --- a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs +++ b/Windows/Shiba/Scripting/DefaultScriptRuntime.cs @@ -41,9 +41,7 @@ public object Execute(string functionName, params object[] parameters) case JavaScriptValueType.Function: { var param = _prefix.Concat(parameters.Select(it => it.ToJavaScriptValue())).ToArray(); - result = func.CallFunction(param).ToNative(); - } break; default: @@ -73,7 +71,7 @@ public void AddObject(string name, object value) case bool _: case int _: case decimal _: - case float _: + case float _: case double _: case null: ChakraHost.GlobalObject.SetProperty(objPropertyId, value.ToJavaScriptValue(), From 4624a3178072714dba3916e49a6a87d69006e701 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Fri, 1 Feb 2019 16:18:54 +0800 Subject: [PATCH 07/27] Update playground to typescript && replace koa with express --- Playground/server/index.mjs | 78 ---- Playground/server/index.ts | 42 ++ Playground/server/package-lock.json | 620 ++++++++++++++++++---------- Playground/server/package.json | 12 +- Playground/server/tsconfig.json | 60 +++ Playground/server/tslint.json | 9 + 6 files changed, 527 insertions(+), 294 deletions(-) delete mode 100644 Playground/server/index.mjs create mode 100644 Playground/server/index.ts create mode 100644 Playground/server/tsconfig.json create mode 100644 Playground/server/tslint.json diff --git a/Playground/server/index.mjs b/Playground/server/index.mjs deleted file mode 100644 index 3dc2355..0000000 --- a/Playground/server/index.mjs +++ /dev/null @@ -1,78 +0,0 @@ -import Koa from 'koa'; -import { readFile, watchFile } from 'fs'; -import Router from 'koa-router'; -import { promisify } from 'util'; -import EventEmitter from 'events' -import { PassThrough } from 'stream'; - -const layoutPath = './layout.sb'; -const dataPath = './data.json'; -const readFileAsync = promisify(readFile) -const Stream = new EventEmitter(); - -watchFile(layoutPath, async (curr, prev) => { - const content = await readFileAsync(layoutPath, "utf8"); - Stream.emit("layout_changed", "layout_changed", content); -}); - -watchFile(dataPath, async (curr, prev) => { - const content = await readFileAsync(dataPath, "utf8"); - Stream.emit("data_changed", "data_changed", content); -}) - - -const app = new Koa(); -var router = new Router(); - - -//logger -app.use(async (ctx, next) => { - await next(); - console.log(`${ctx.method} ${ctx.url}`); - console.log(ctx.body); -}); - -router.get('/streaming', async (ctx, next) => { - const stream = new PassThrough(); - - ctx.set('Content-Type', 'text/event-stream'); - ctx.set('Cache-Control', 'no-cache'); - ctx.set('Connection', 'keep-alive'); - ctx.status = 200; - - Stream.on("layout_changed", function (event, data) { - console.log("layout_changed"); - console.log(event); - console.log(data); - stream.write("event: " + String(event) + "\n" + "data: " + data.replace(/\r?\n|\r/g,"") + "\n\n"); - }); - - Stream.on("data_changed", function (event, data) { - console.log("data_changed"); - console.log(event); - console.log(data); - stream.write("event: " + String(event) + "\n" + "data: " + data.replace(/\r?\n|\r/g,"") + "\n\n"); - }); - - ctx.type = 'text/event-stream'; - ctx.body = stream; - - Stream.emit("data_changed", "data_changed", await readFileAsync(dataPath, "utf8")); - Stream.emit("layout_changed", "layout_changed", await readFileAsync(layoutPath, "utf8")); - -}) - -router.get('/layout', async (ctx, next) => { - ctx.body = await readFileAsync('./layout.sb', "utf8"); -}); - -router.get('/json', async (ctx, next) => { - const content = JSON.parse(await readFileAsync(dataPath, "utf8")); - ctx.body = content; -}) - - -app.use(router.routes()) -app.use(router.allowedMethods()); - -app.listen(5000); diff --git a/Playground/server/index.ts b/Playground/server/index.ts new file mode 100644 index 0000000..fa7b50d --- /dev/null +++ b/Playground/server/index.ts @@ -0,0 +1,42 @@ +import EventEmitter from "events"; +import express from "express"; +import { readFile, watchFile } from "fs"; +import { promisify } from "util"; + +const layoutPath = "./layout.sb"; +const dataPath = "./data.json"; +const readFileAsync = promisify(readFile); +const Stream = new EventEmitter(); + +watchFile(layoutPath, async (curr, prev) => { + const content = await readFileAsync(layoutPath, "utf8"); + Stream.emit("layout_changed", "layout_changed", content); +}); + +watchFile(dataPath, async (curr, prev) => { + const content = await readFileAsync(dataPath, "utf8"); + Stream.emit("data_changed", "data_changed", content); +}); + +const app = express(); + +app.get("/streaming", async (req, res) => { + res.writeHead(200, { + "Cache-Control": "no-cache", + "Connection": "keep-alive", + "Content-Type": "text/event-stream", + }); + + Stream.on("layout_changed", (event, data) => { + res.write("event: " + String(event) + "\n" + "data: " + data.replace(/\r?\n|\r/g, "") + "\n\n"); + }); + + Stream.on("data_changed", (event, data) => { + res.write("event: " + String(event) + "\n" + "data: " + data.replace(/\r?\n|\r/g, "") + "\n\n"); + }); + + Stream.emit("data_changed", "data_changed", await readFileAsync(dataPath, "utf8")); + Stream.emit("layout_changed", "layout_changed", await readFileAsync(layoutPath, "utf8")); +}); + +app.listen(5000); diff --git a/Playground/server/package-lock.json b/Playground/server/package-lock.json index 5fdd073..d1202c5 100644 --- a/Playground/server/package-lock.json +++ b/Playground/server/package-lock.json @@ -4,6 +4,74 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/body-parser": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz", + "integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.32", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz", + "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.16.1", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.16.1.tgz", + "integrity": "sha512-V0clmJow23WeyblmACoxbHBu2JKlE5TiIme6Lem14FnPW9gsttyHtk6wq7njcdIWH1njAaFgR8gW09lgY98gQg==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.16.1", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.1.tgz", + "integrity": "sha512-QgbIMRU1EVRry5cIu1ORCQP4flSYqLM1lS5LYyGWfKnFT3E58f0gKto7BR13clBFVrVZ0G0rbLZ1hUpSkgQQOA==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/range-parser": "*" + } + }, + "@types/mime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz", + "integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA==", + "dev": true + }, + "@types/node": { + "version": "10.12.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.21.tgz", + "integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==", + "dev": true + }, + "@types/range-parser": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", + "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==", + "dev": true + }, + "@types/serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==", + "dev": true, + "requires": { + "@types/express-serve-static-core": "*", + "@types/mime": "*" + } + }, "abbrev": { "version": "1.1.1", "resolved": "http://registry.npm.taobao.org/abbrev/download/abbrev-1.1.1.tgz", @@ -12,7 +80,7 @@ }, "accepts": { "version": "1.3.5", - "resolved": "http://registry.npm.taobao.org/accepts/download/accepts-1.3.5.tgz", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "requires": { "mime-types": "~2.1.18", @@ -43,11 +111,6 @@ "color-convert": "^1.9.0" } }, - "any-promise": { - "version": "1.3.0", - "resolved": "http://registry.npm.taobao.org/any-promise/download/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, "anymatch": { "version": "2.0.0", "resolved": "http://registry.npm.taobao.org/anymatch/download/anymatch-2.0.0.tgz", @@ -58,6 +121,12 @@ "normalize-path": "^2.1.1" } }, + "arg": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.0.tgz", + "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==", + "dev": true + }, "arr-diff": { "version": "4.0.0", "resolved": "http://registry.npm.taobao.org/arr-diff/download/arr-diff-4.0.0.tgz", @@ -76,6 +145,11 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, "array-unique": { "version": "0.3.2", "resolved": "http://registry.npm.taobao.org/array-unique/download/array-unique-0.3.2.tgz", @@ -167,6 +241,33 @@ "integrity": "sha1-wteA9T1Fu6gxeokC1M7q86Y4WxQ=", "dev": true }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "boxen": { "version": "1.3.0", "resolved": "http://registry.npm.taobao.org/boxen/download/boxen-1.3.0.tgz", @@ -221,6 +322,17 @@ } } }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, "cache-base": { "version": "1.0.1", "resolved": "http://registry.npm.taobao.org/cache-base/download/cache-base-1.0.1.tgz", @@ -238,15 +350,6 @@ "unset-value": "^1.0.0" } }, - "cache-content-type": { - "version": "1.0.1", - "resolved": "http://registry.npm.taobao.org/cache-content-type/download/cache-content-type-1.0.1.tgz", - "integrity": "sha1-A1zeKwjuISn0qDFeqPAKANuhRTw=", - "requires": { - "mime-types": "^2.1.18", - "ylru": "^1.2.0" - } - }, "camelcase": { "version": "4.1.0", "resolved": "http://registry.npm.taobao.org/camelcase/download/camelcase-4.1.0.tgz", @@ -326,11 +429,6 @@ "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", "dev": true }, - "co": { - "version": "4.6.0", - "resolved": "http://registry.npm.taobao.org/co/download/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, "collection-visit": { "version": "1.0.0", "resolved": "http://registry.npm.taobao.org/collection-visit/download/collection-visit-1.0.0.tgz", @@ -384,22 +482,23 @@ }, "content-disposition": { "version": "0.5.2", - "resolved": "http://registry.npm.taobao.org/content-disposition/download/content-disposition-0.5.2.tgz", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, "content-type": { "version": "1.0.4", - "resolved": "http://registry.npm.taobao.org/content-type/download/content-type-1.0.4.tgz", - "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=" + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, - "cookies": { - "version": "0.7.3", - "resolved": "http://registry.npm.taobao.org/cookies/download/cookies-0.7.3.tgz", - "integrity": "sha1-eRLOIfvy6MLacM8cPzUa7PWdrfo=", - "requires": { - "depd": "~1.1.2", - "keygrip": "~1.0.3" - } + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, "copy-descriptor": { "version": "0.1.1", @@ -443,6 +542,7 @@ "version": "3.1.0", "resolved": "http://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz", "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "dev": true, "requires": { "ms": "2.0.0" } @@ -453,11 +553,6 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, - "deep-equal": { - "version": "1.0.1", - "resolved": "http://registry.npm.taobao.org/deep-equal/download/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" - }, "deep-extend": { "version": "0.6.0", "resolved": "http://registry.npm.taobao.org/deep-extend/download/deep-extend-0.6.0.tgz", @@ -505,21 +600,22 @@ } } }, - "delegates": { - "version": "1.0.0", - "resolved": "http://registry.npm.taobao.org/delegates/download/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, "depd": { "version": "1.1.2", - "resolved": "http://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, "destroy": { "version": "1.0.4", - "resolved": "http://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, "dot-prop": { "version": "4.2.0", "resolved": "http://registry.npm.taobao.org/dot-prop/download/dot-prop-4.2.0.tgz", @@ -537,17 +633,17 @@ }, "ee-first": { "version": "1.1.1", - "resolved": "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, - "error-inject": { - "version": "1.0.0", - "resolved": "http://registry.npm.taobao.org/error-inject/download/error-inject-1.0.0.tgz", - "integrity": "sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc=" + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, "escape-html": { "version": "1.0.3", - "resolved": "http://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, "escape-string-regexp": { @@ -556,6 +652,11 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, "execa": { "version": "0.7.0", "resolved": "http://registry.npm.taobao.org/execa/download/execa-0.7.0.tgz", @@ -615,6 +716,53 @@ } } }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "extend-shallow": { "version": "3.0.2", "resolved": "http://registry.npm.taobao.org/extend-shallow/download/extend-shallow-3.0.2.tgz", @@ -724,12 +872,41 @@ } } }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "for-in": { "version": "1.0.2", "resolved": "http://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, "fragment-cache": { "version": "0.2.1", "resolved": "http://registry.npm.taobao.org/fragment-cache/download/fragment-cache-0.2.1.tgz", @@ -741,14 +918,9 @@ }, "fresh": { "version": "0.5.2", - "resolved": "http://registry.npm.taobao.org/fresh/download/fresh-0.5.2.tgz", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" }, - "fs": { - "version": "0.0.1-security", - "resolved": "http://registry.npm.taobao.org/fs/download/fs-0.0.1-security.tgz", - "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" - }, "fsevents": { "version": "1.2.4", "resolved": "http://registry.npm.taobao.org/fsevents/download/fsevents-1.2.4.tgz", @@ -1383,25 +1555,23 @@ } } }, - "http-assert": { - "version": "1.4.0", - "resolved": "http://registry.npm.taobao.org/http-assert/download/http-assert-1.4.0.tgz", - "integrity": "sha1-DlULT8pq3xIbvu2DJIwX5i9ZOpo=", - "requires": { - "deep-equal": "~1.0.1", - "http-errors": "~1.7.1" - } - }, "http-errors": { - "version": "1.7.1", - "resolved": "http://registry.npm.taobao.org/http-errors/download/http-errors-1.7.1.tgz", - "integrity": "sha1-ak/+XTUYjhw5+HJTRpBYWFLh8Cc=", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { "depd": "~1.1.2", "inherits": "2.0.3", "setprototypeof": "1.1.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "statuses": ">= 1.4.0 < 2" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-by-default": { @@ -1433,6 +1603,11 @@ "integrity": "sha1-7uJfVtscnsYIXgwid4CD9Zar+Sc=", "dev": true }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "http://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz", @@ -1534,11 +1709,6 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, - "is-generator-function": { - "version": "1.0.7", - "resolved": "http://registry.npm.taobao.org/is-generator-function/download/is-generator-function-1.0.7.tgz", - "integrity": "sha1-0hMuUpuwAAp/gHlNS99c1eWBNSI=" - }, "is-glob": { "version": "4.0.0", "resolved": "http://registry.npm.taobao.org/is-glob/download/is-glob-4.0.0.tgz", @@ -1632,11 +1802,6 @@ "integrity": "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0=", "dev": true }, - "isarray": { - "version": "0.0.1", - "resolved": "http://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, "isexe": { "version": "2.0.0", "resolved": "http://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz", @@ -1649,100 +1814,12 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, - "keygrip": { - "version": "1.0.3", - "resolved": "http://registry.npm.taobao.org/keygrip/download/keygrip-1.0.3.tgz", - "integrity": "sha1-OZ1wnwrtK6sKBZ4M3TpQI6BT4dw=" - }, "kind-of": { "version": "6.0.2", "resolved": "http://registry.npm.taobao.org/kind-of/download/kind-of-6.0.2.tgz", "integrity": "sha1-ARRrNqYhjmTljzqNZt5df8b20FE=", "dev": true }, - "koa": { - "version": "2.6.2", - "resolved": "http://registry.npm.taobao.org/koa/download/koa-2.6.2.tgz", - "integrity": "sha1-V7pNBJsKmcrg1ZTmFE4pMZSafOE=", - "requires": { - "accepts": "^1.3.5", - "cache-content-type": "^1.0.0", - "content-disposition": "~0.5.2", - "content-type": "^1.0.4", - "cookies": "~0.7.1", - "debug": "~3.1.0", - "delegates": "^1.0.0", - "depd": "^1.1.2", - "destroy": "^1.0.4", - "error-inject": "^1.0.0", - "escape-html": "^1.0.3", - "fresh": "~0.5.2", - "http-assert": "^1.3.0", - "http-errors": "^1.6.3", - "is-generator-function": "^1.0.7", - "koa-compose": "^4.1.0", - "koa-convert": "^1.2.0", - "koa-is-json": "^1.0.0", - "on-finished": "^2.3.0", - "only": "~0.0.2", - "parseurl": "^1.3.2", - "statuses": "^1.5.0", - "type-is": "^1.6.16", - "vary": "^1.1.2" - } - }, - "koa-compose": { - "version": "4.1.0", - "resolved": "http://registry.npm.taobao.org/koa-compose/download/koa-compose-4.1.0.tgz", - "integrity": "sha1-UHMGuTcZAdtBEhyBLpI9DWfT6Hc=" - }, - "koa-convert": { - "version": "1.2.0", - "resolved": "http://registry.npm.taobao.org/koa-convert/download/koa-convert-1.2.0.tgz", - "integrity": "sha1-2kCHXfSd4FOQmNFwC1CCDOvNIdA=", - "requires": { - "co": "^4.6.0", - "koa-compose": "^3.0.0" - }, - "dependencies": { - "koa-compose": { - "version": "3.2.1", - "resolved": "http://registry.npm.taobao.org/koa-compose/download/koa-compose-3.2.1.tgz", - "integrity": "sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=", - "requires": { - "any-promise": "^1.1.0" - } - } - } - }, - "koa-is-json": { - "version": "1.0.0", - "resolved": "http://registry.npm.taobao.org/koa-is-json/download/koa-is-json-1.0.0.tgz", - "integrity": "sha1-JzwH7c3Ljfaiwat9We52SRRR7BQ=" - }, - "koa-router": { - "version": "7.4.0", - "resolved": "http://registry.npm.taobao.org/koa-router/download/koa-router-7.4.0.tgz", - "integrity": "sha1-ruH3rcAtXLMdfWdGXJ6syCXoxeA=", - "requires": { - "debug": "^3.1.0", - "http-errors": "^1.3.1", - "koa-compose": "^3.0.0", - "methods": "^1.0.1", - "path-to-regexp": "^1.1.1", - "urijs": "^1.19.0" - }, - "dependencies": { - "koa-compose": { - "version": "3.2.1", - "resolved": "http://registry.npm.taobao.org/koa-compose/download/koa-compose-3.2.1.tgz", - "integrity": "sha1-qFzLQLfZhtjlo0Wzoazo6rz1Tec=", - "requires": { - "any-promise": "^1.1.0" - } - } - } - }, "latest-version": { "version": "3.1.0", "resolved": "http://registry.npm.taobao.org/latest-version/download/latest-version-3.1.0.tgz", @@ -1783,6 +1860,12 @@ "pify": "^3.0.0" } }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, "map-cache": { "version": "0.2.2", "resolved": "http://registry.npm.taobao.org/map-cache/download/map-cache-0.2.2.tgz", @@ -1800,12 +1883,17 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, "methods": { "version": "1.1.2", - "resolved": "http://registry.npm.taobao.org/methods/download/methods-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" }, "micromatch": { @@ -1829,15 +1917,20 @@ "to-regex": "^3.0.2" } }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, "mime-db": { "version": "1.37.0", - "resolved": "http://registry.npm.taobao.org/mime-db/download/mime-db-1.37.0.tgz", - "integrity": "sha1-C2oM5v2+lXbiXx8tL96IMNwK0Ng=" + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" }, "mime-types": { "version": "2.1.21", - "resolved": "http://registry.npm.taobao.org/mime-types/download/mime-types-2.1.21.tgz", - "integrity": "sha1-KJlaoey3cHQv5q5+WPkYHHRLP5Y=", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "requires": { "mime-db": "~1.37.0" } @@ -1911,7 +2004,7 @@ }, "negotiator": { "version": "0.6.1", - "resolved": "http://registry.npm.taobao.org/negotiator/download/negotiator-0.6.1.tgz", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" }, "nodemon": { @@ -2010,17 +2103,12 @@ }, "on-finished": { "version": "2.3.0", - "resolved": "http://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", "requires": { "ee-first": "1.1.1" } }, - "only": { - "version": "0.0.2", - "resolved": "http://registry.npm.taobao.org/only/download/only-0.0.2.tgz", - "integrity": "sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=" - }, "p-finally": { "version": "1.0.0", "resolved": "http://registry.npm.taobao.org/p-finally/download/p-finally-1.0.0.tgz", @@ -2041,7 +2129,7 @@ }, "parseurl": { "version": "1.3.2", - "resolved": "http://registry.npm.taobao.org/parseurl/download/parseurl-1.3.2.tgz", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" }, "pascalcase": { @@ -2075,12 +2163,9 @@ "dev": true }, "path-to-regexp": { - "version": "1.7.0", - "resolved": "http://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "requires": { - "isarray": "0.0.1" - } + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "pify": { "version": "3.0.0", @@ -2106,6 +2191,15 @@ "integrity": "sha1-o31zL0JxtKsa0HDTVQjoKQeI/6o=", "dev": true }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "http://registry.npm.taobao.org/pseudomap/download/pseudomap-1.0.2.tgz", @@ -2118,6 +2212,27 @@ "integrity": "sha1-REi760sq8f7SQq/I3HQWpvUElRo=", "dev": true }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, "rc": { "version": "1.2.8", "resolved": "http://registry.npm.taobao.org/rc/download/rc-1.2.8.tgz", @@ -2226,8 +2341,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", - "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", - "dev": true + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=" }, "safe-regex": { "version": "1.1.0", @@ -2238,6 +2352,11 @@ "ret": "~0.1.10" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "semver": { "version": "5.6.0", "resolved": "http://registry.npm.taobao.org/semver/download/semver-5.6.0.tgz", @@ -2253,6 +2372,47 @@ "semver": "^5.0.3" } }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, "set-value": { "version": "2.0.0", "resolved": "http://registry.npm.taobao.org/set-value/download/set-value-2.0.0.tgz", @@ -2278,8 +2438,8 @@ }, "setprototypeof": { "version": "1.1.0", - "resolved": "http://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.0.tgz", - "integrity": "sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY=" + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" }, "shebang-command": { "version": "1.2.0", @@ -2437,6 +2597,24 @@ "urix": "^0.1.0" } }, + "source-map-support": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", + "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "source-map-url": { "version": "0.4.0", "resolved": "http://registry.npm.taobao.org/source-map-url/download/source-map-url-0.4.0.tgz", @@ -2474,9 +2652,9 @@ } }, "statuses": { - "version": "1.5.0", - "resolved": "http://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" }, "string-width": { "version": "2.1.1", @@ -2584,11 +2762,6 @@ "repeat-string": "^1.6.1" } }, - "toidentifier": { - "version": "1.0.0", - "resolved": "http://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz", - "integrity": "sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM=" - }, "touch": { "version": "3.1.0", "resolved": "http://registry.npm.taobao.org/touch/download/touch-3.1.0.tgz", @@ -2598,15 +2771,34 @@ "nopt": "~1.0.10" } }, + "ts-node": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.0.2.tgz", + "integrity": "sha512-MosTrinKmaAcWgO8tqMjMJB22h+sp3Rd1i4fdoWY4mhBDekOwIAKI/bzmRi7IcbCmjquccYg2gcF6NBkLgr0Tw==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^3.0.0" + } + }, "type-is": { "version": "1.6.16", - "resolved": "http://registry.npm.taobao.org/type-is/download/type-is-1.6.16.tgz", - "integrity": "sha1-+JzjQVQcZysl7nrjxz3uOyvlAZQ=", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "requires": { "media-typer": "0.3.0", "mime-types": "~2.1.18" } }, + "typescript": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.1.tgz", + "integrity": "sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==", + "dev": true + }, "undefsafe": { "version": "2.0.2", "resolved": "http://registry.npm.taobao.org/undefsafe/download/undefsafe-2.0.2.tgz", @@ -2671,6 +2863,11 @@ "crypto-random-string": "^1.0.0" } }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, "unset-value": { "version": "1.0.0", "resolved": "http://registry.npm.taobao.org/unset-value/download/unset-value-1.0.0.tgz", @@ -2747,11 +2944,6 @@ "xdg-basedir": "^3.0.0" } }, - "urijs": { - "version": "1.19.1", - "resolved": "http://registry.npm.taobao.org/urijs/download/urijs-1.19.1.tgz", - "integrity": "sha1-Ww/1MMDL3oOG9jQiNbpcpumV0lo=" - }, "urix": { "version": "0.1.0", "resolved": "http://registry.npm.taobao.org/urix/download/urix-0.1.0.tgz", @@ -2779,9 +2971,14 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, "vary": { "version": "1.1.2", - "resolved": "http://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, "which": { @@ -2825,10 +3022,11 @@ "integrity": "sha1-tLBJ4xS+VF486AIjbWzSLNkcPek=", "dev": true }, - "ylru": { - "version": "1.2.1", - "resolved": "http://registry.npm.taobao.org/ylru/download/ylru-1.2.1.tgz", - "integrity": "sha1-9Xa2M0FUeYnB3nuiiHYJI7J/6E8=" + "yn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.0.0.tgz", + "integrity": "sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q==", + "dev": true } } } diff --git a/Playground/server/package.json b/Playground/server/package.json index f68e035..7df94d5 100644 --- a/Playground/server/package.json +++ b/Playground/server/package.json @@ -5,16 +5,18 @@ "main": "index.mjs", "scripts": { "test": "jest", - "start": "node --experimental-modules index.mjs" + "start": "ts-node index.ts" }, "author": "", "license": "MIT", "dependencies": { - "fs": "0.0.1-security", - "koa": "^2.6.2", - "koa-router": "^7.4.0" + "express": "^4.16.4" }, "devDependencies": { - "nodemon": "^1.18.6" + "@types/express": "^4.16.1", + "@types/node": "^10.12.21", + "nodemon": "^1.18.6", + "ts-node": "^8.0.2", + "typescript": "^3.3.1" } } diff --git a/Playground/server/tsconfig.json b/Playground/server/tsconfig.json new file mode 100644 index 0000000..b292f1b --- /dev/null +++ b/Playground/server/tsconfig.json @@ -0,0 +1,60 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "lib": ["es2015"], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } +} \ No newline at end of file diff --git a/Playground/server/tslint.json b/Playground/server/tslint.json new file mode 100644 index 0000000..32fa6e5 --- /dev/null +++ b/Playground/server/tslint.json @@ -0,0 +1,9 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": {}, + "rulesDirectory": [] +} \ No newline at end of file From 42069a89d4f42c788276c71d6127e9d3d775c959 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Tue, 12 Feb 2019 11:36:17 +0800 Subject: [PATCH 08/27] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 225ebec..bd4feb1 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ # Status | Platform | Build Status | Download | |:---:|:---:|:---:| -| .Net |[![Build status](https://ci.appveyor.com/api/projects/status/2qp96xf35naduen7?svg=true)](https://ci.appveyor.com/project/Tlaster/shiba) | [![NuGet version](https://badge.fury.io/nu/Shiba.svg)](https://badge.fury.io/nu/Shiba)| -| Android |[![Build Status](https://travis-ci.com/Tlaster/Shiba.svg?branch=master)](https://travis-ci.com/Tlaster/Shiba)|[![Download](https://api.bintray.com/packages/tlaster/Shiba/Shiba/images/download.svg)](https://bintray.com/tlaster/Shiba/Shiba/_latestVersion) | +| .Net |[![Build status](https://ci.appveyor.com/api/projects/status/b0tdrkd15y8ufaq1/branch/master?svg=true)](https://ci.appveyor.com/project/ShibaJS/shiba/branch/master) | [![NuGet version](https://badge.fury.io/nu/Shiba.svg)](https://badge.fury.io/nu/Shiba)| +| Android |[![Build Status](https://travis-ci.com/ShibaJS/Shiba.svg?branch=master)](https://travis-ci.com/ShibaJS/Shiba)|[![Download](https://api.bintray.com/packages/tlaster/Shiba/Shiba/images/download.svg)](https://bintray.com/tlaster/Shiba/Shiba/_latestVersion) | **Shiba is still in development and is not production-ready** From 447c7620383b9f089e5ec84203394dbcf11a9543 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Tue, 12 Feb 2019 12:11:01 +0800 Subject: [PATCH 09/27] [Android] update package --- Android/app/build.gradle | 8 ++++++-- Android/build.gradle | 4 ++-- Android/shiba/build.gradle | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Android/app/build.gradle b/Android/app/build.gradle index 4c3bca0..997b171 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -9,7 +9,7 @@ android { compileSdkVersion 28 defaultConfig { applicationId "moe.tlaster.shibasample" - minSdkVersion 21 + minSdkVersion 24 targetSdkVersion 28 versionCode 1 versionName "1.0" @@ -21,6 +21,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } } dependencies { @@ -30,7 +34,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8' - implementation "com.squareup.okhttp3:okhttp:+" + implementation "com.squareup.okhttp3:okhttp:3.13.1" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' diff --git a/Android/build.gradle b/Android/build.gradle index 5ecbd7f..ac507df 100644 --- a/Android/build.gradle +++ b/Android/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.11' + ext.kotlin_version = '1.3.21' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' diff --git a/Android/shiba/build.gradle b/Android/shiba/build.gradle index 539fc16..746debe 100644 --- a/Android/shiba/build.gradle +++ b/Android/shiba/build.gradle @@ -46,7 +46,7 @@ dependencies { implementation 'org.antlr:antlr4:4.7.+' - implementation 'com.github.LiquidPlayer:LiquidCore:0.5.+' + implementation 'com.github.LiquidPlayer:LiquidCore:0.6.+' implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.+' From 578113d4490d76020079e67ccec669b7054fef04 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Wed, 13 Feb 2019 19:03:10 +0800 Subject: [PATCH 10/27] [WIP] Remove antlr --- Android/shiba/build.gradle | 2 - .../Shiba/CommonProperty/CommonProperty.cs | 7 +- Windows/Shiba/CommonProperty/GridProperty.cs | 2 +- .../Shiba/CommonProperty/ICommonProperty.cs | 4 +- .../Shiba/CommonProperty/RelativeProperty.cs | 2 +- Windows/Shiba/Controls/View.cs | 217 ++--- .../ExtensionExecutors/BindingExecutor.cs | 8 +- Windows/Shiba/Extensions.cs | 8 +- Windows/Shiba/Parser/Shiba.interp | 66 -- Windows/Shiba/Parser/Shiba.tokens | 35 - Windows/Shiba/Parser/ShibaBaseListener.cs | 160 ---- Windows/Shiba/Parser/ShibaLexer.cs | 320 ------- Windows/Shiba/Parser/ShibaLexer.interp | 88 -- Windows/Shiba/Parser/ShibaLexer.tokens | 35 - Windows/Shiba/Parser/ShibaListener.cs | 125 --- Windows/Shiba/Parser/ShibaParser.cs | 855 ------------------ Windows/Shiba/Parser/ShibaParserWrapper.cs | 260 +++--- Windows/Shiba/Shiba.csproj | 13 - Windows/Shiba/ViewMappers/ViewMapper.cs | 3 +- Windows/Shiba/Visitors/ValueVisitor.cs | 38 +- 20 files changed, 272 insertions(+), 1976 deletions(-) delete mode 100644 Windows/Shiba/Parser/Shiba.interp delete mode 100644 Windows/Shiba/Parser/Shiba.tokens delete mode 100644 Windows/Shiba/Parser/ShibaBaseListener.cs delete mode 100644 Windows/Shiba/Parser/ShibaLexer.cs delete mode 100644 Windows/Shiba/Parser/ShibaLexer.interp delete mode 100644 Windows/Shiba/Parser/ShibaLexer.tokens delete mode 100644 Windows/Shiba/Parser/ShibaListener.cs delete mode 100644 Windows/Shiba/Parser/ShibaParser.cs diff --git a/Android/shiba/build.gradle b/Android/shiba/build.gradle index 746debe..113c4c8 100644 --- a/Android/shiba/build.gradle +++ b/Android/shiba/build.gradle @@ -44,8 +44,6 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.+' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' - implementation 'org.antlr:antlr4:4.7.+' - implementation 'com.github.LiquidPlayer:LiquidCore:0.6.+' implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.+' diff --git a/Windows/Shiba/CommonProperty/CommonProperty.cs b/Windows/Shiba/CommonProperty/CommonProperty.cs index 11bf1ec..54038b8 100644 --- a/Windows/Shiba/CommonProperty/CommonProperty.cs +++ b/Windows/Shiba/CommonProperty/CommonProperty.cs @@ -1,3 +1,4 @@ +using Shiba.Controls; using NativeView = Windows.UI.Xaml.FrameworkElement; using NativeBinding = Windows.UI.Xaml.Data.Binding; using NativeProperty = Windows.UI.Xaml.DependencyProperty; @@ -10,12 +11,12 @@ public abstract class AbsCommonProperty : ICommonProperty { public abstract string Name { get; } - public void Handle(object targetValue, object targetNativeView, object parentNativeView) + public void Handle(object targetValue, View targetShibaView, object targetNativeView, object parentNativeView) { if (targetValue is TValue value && targetNativeView is NativeView nativeView && - parentNativeView is NativeViewGroup parent) SetValue(value, nativeView, parent); + parentNativeView is NativeViewGroup parent) SetValue(value, targetShibaView, nativeView, parent); } - public abstract void SetValue(TValue targetValue, NativeView nativeView, NativeViewGroup parent); + public abstract void SetValue(TValue targetValue, View targetShibaView, NativeView nativeView, NativeViewGroup parent); } } \ No newline at end of file diff --git a/Windows/Shiba/CommonProperty/GridProperty.cs b/Windows/Shiba/CommonProperty/GridProperty.cs index 847a781..1f28390 100644 --- a/Windows/Shiba/CommonProperty/GridProperty.cs +++ b/Windows/Shiba/CommonProperty/GridProperty.cs @@ -13,7 +13,7 @@ public class GridProperty : AbsCommonProperty { public override string Name { get; } = "grid"; - public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) + public override void SetValue(ShibaMap map, View targetShibaView, NativeView element, NativeViewGroup parent) { var row = map.Get("row"); var column = map.Get("column"); diff --git a/Windows/Shiba/CommonProperty/ICommonProperty.cs b/Windows/Shiba/CommonProperty/ICommonProperty.cs index 85fb4ef..8264031 100644 --- a/Windows/Shiba/CommonProperty/ICommonProperty.cs +++ b/Windows/Shiba/CommonProperty/ICommonProperty.cs @@ -1,8 +1,10 @@ +using Shiba.Controls; + namespace Shiba.CommonProperty { public interface ICommonProperty { string Name { get; } - void Handle(object targetValue, object targetNativeView, object parentNativeView); + void Handle(object targetValue, View targetShibaView, object targetNativeView, object parentNativeView); } } \ No newline at end of file diff --git a/Windows/Shiba/CommonProperty/RelativeProperty.cs b/Windows/Shiba/CommonProperty/RelativeProperty.cs index 4c45692..f98f9bd 100644 --- a/Windows/Shiba/CommonProperty/RelativeProperty.cs +++ b/Windows/Shiba/CommonProperty/RelativeProperty.cs @@ -11,7 +11,7 @@ public class RelativeProperty : AbsCommonProperty { public override string Name { get; } = "relative"; - public override void SetValue(ShibaMap map, NativeView element, NativeViewGroup parent) + public override void SetValue(ShibaMap map, View targetShibaView, NativeView element, NativeViewGroup parent) { } } diff --git a/Windows/Shiba/Controls/View.cs b/Windows/Shiba/Controls/View.cs index 289fdd7..d945b36 100644 --- a/Windows/Shiba/Controls/View.cs +++ b/Windows/Shiba/Controls/View.cs @@ -1,6 +1,9 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; +using System.Collections.ObjectModel; using System.Linq; +using Shiba.Visitors; namespace Shiba.Controls { @@ -30,11 +33,6 @@ public override int GetHashCode() } } - public override string ToString() - { - return $"{Name} = {Value}"; - } - private bool Equals(Property other) { return Equals(Name, other.Name) && Equals(Value, other.Value); @@ -43,7 +41,7 @@ private bool Equals(Property other) public sealed class ShibaExtension { - public ShibaExtension(string type, BasicValue value, string script) + public ShibaExtension(string type, string value, string script) { Type = type; Value = value; @@ -51,7 +49,7 @@ public ShibaExtension(string type, BasicValue value, string script) } public string Type { get; } - public BasicValue Value { get; } + public string Value { get; } public string Script { get; } public override bool Equals(object obj) @@ -69,11 +67,6 @@ public override int GetHashCode() } } - public override string ToString() - { - return $"${Type} {Value}"; - } - private bool Equals(ShibaExtension other) { return string.Equals(Type, other.Type) && Equals(Value, other.Value); @@ -82,18 +75,26 @@ private bool Equals(ShibaExtension other) public sealed class View { - public View(ShibaToken viewName, object defaultValue = null) + public View(ShibaToken viewName, string rawString, object defaultValue = null) { + RawString = rawString; ViewName = viewName; DefaultValue = defaultValue; } + public string RawString { get; } + public ShibaToken ViewName { get; } public object DefaultValue { get; } public List Children { get; } = new List(); public List Properties { get; } = new List(); public View Parent { get; internal set; } + public object GetProperty(string name) + { + return ShibaValueVisitor.GetValue(Properties.FirstOrDefault(it => it.Name.IsCurrentPlatformAndCheckValue(name)).Value, null); + } + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -116,10 +117,7 @@ public override int GetHashCode() public override string ToString() { - if (DefaultValue != null) return $"{ViewName} -> {DefaultValue}"; - - return - $"{ViewName} {{ {string.Join(" ", Properties.Select(it => it.ToString()))} {string.Join(" ", Children.Select(it => it.ToString()))} }}"; + return RawString; } private bool Equals(View other) @@ -129,88 +127,93 @@ private bool Equals(View other) } } - public sealed class ShibaArray : List - { - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - return obj is ShibaArray array && Equals(array); - } - - public override string ToString() - { - return $"[{string.Join(",", this.Select(it => it.ToString()))}]"; - } - - private bool Equals(ShibaArray other) - { - return this.SequenceEqual(other); - } - } - - public enum ShibaValueType - { - String, - Token, - Number, - Null, - Boolean - } + //public sealed class ShibaArray : List + //{ + // public override bool Equals(object obj) + // { + // if (ReferenceEquals(null, obj)) return false; + // if (ReferenceEquals(this, obj)) return true; + // return obj is ShibaArray array && Equals(array); + // } + + // public override string ToString() + // { + // return $"[{string.Join(",", this.Select(it => it.ToString()))}]"; + // } + + // private bool Equals(ShibaArray other) + // { + // return this.SequenceEqual(other); + // } + //} + + //public enum ShibaValueType + //{ + // String, + // Token, + // Number, + // Null, + // Boolean + //} + + //public sealed class BasicValue + //{ + // public BasicValue(ShibaValueType typeCode, object value) + // { + // TypeCode = typeCode; + // Value = value; + // } + + // public ShibaValueType TypeCode { get; } + // public object Value { get; } + + // public override bool Equals(object obj) + // { + // if (ReferenceEquals(null, obj)) return false; + // if (ReferenceEquals(this, obj)) return true; + // return obj is BasicValue value && Equals(value); + // } + + // public override int GetHashCode() + // { + // unchecked + // { + // return ((int) TypeCode * 397) ^ (Value != null ? Value.GetHashCode() : 0); + // } + // } + + // public override string ToString() + // { + // switch (TypeCode) + // { + // case ShibaValueType.String: + // return $"\"{Value}\""; + // case ShibaValueType.Token: + // case ShibaValueType.Number: + // return $"{Value}"; + // case ShibaValueType.Null: + // return "null"; + // case ShibaValueType.Boolean: + // return $"{Value.ToString().ToLower()}"; + // default: + // throw new ArgumentOutOfRangeException(); + // } + // } + + // private bool Equals(BasicValue other) + // { + // return TypeCode == other.TypeCode && Equals(Value, other.Value); + // } + //} - public sealed class BasicValue + public sealed class ShibaMap { - public BasicValue(ShibaValueType typeCode, object value) + public ShibaMap(IDictionary properties) { - TypeCode = typeCode; - Value = value; + Properties = new ReadOnlyDictionary(properties); } - public ShibaValueType TypeCode { get; } - public object Value { get; } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - return obj is BasicValue value && Equals(value); - } - - public override int GetHashCode() - { - unchecked - { - return ((int) TypeCode * 397) ^ (Value != null ? Value.GetHashCode() : 0); - } - } - - public override string ToString() - { - switch (TypeCode) - { - case ShibaValueType.String: - return $"\"{Value}\""; - case ShibaValueType.Token: - case ShibaValueType.Number: - return $"{Value}"; - case ShibaValueType.Null: - return "null"; - case ShibaValueType.Boolean: - return $"{Value.ToString().ToLower()}"; - default: - throw new ArgumentOutOfRangeException(); - } - } - - private bool Equals(BasicValue other) - { - return TypeCode == other.TypeCode && Equals(Value, other.Value); - } - } - - public sealed class ShibaMap - { - public List Properties { get; } = new List(); + public ReadOnlyDictionary Properties { get; } public override bool Equals(object obj) { @@ -224,24 +227,10 @@ public override int GetHashCode() return Properties != null ? Properties.GetHashCode() : 0; } - public override string ToString() - { - return $"[ {string.Join(" ", Properties.Select(it => it.ToString()))} ]"; - } - private bool Equals(ShibaMap other) { return Properties.SequenceEqual(other.Properties); } - - //public object this[string name] - //{ - // get - // { - // var value = Properties.FirstOrDefault(it => it.Name.IsCurrentPlatform(name))?.Value; - - // } - //} } public sealed class ShibaToken @@ -274,7 +263,7 @@ public override int GetHashCode() } } - public bool IsCurrentPlatform(string value) + public bool IsCurrentPlatformAndCheckValue(string value) { if (ReferenceEquals(value, null)) return false; return IsCurrentPlatform() && string.Equals(value, Value); @@ -310,11 +299,6 @@ public bool IsCurrentPlatform() return !(c1 == c2); } - public override string ToString() - { - return string.IsNullOrEmpty(Prefix) ? Value : $"{Prefix}:{Value}"; - } - private bool Equals(ShibaToken other) { return string.Equals(Prefix, other.Prefix) && string.Equals(Value, other.Value); @@ -348,11 +332,6 @@ public override int GetHashCode() } } - public override string ToString() - { - return $"{Name}({string.Join(",", Parameters.Select(it => it.ToString()))})"; - } - private bool Equals(ShibaFunction other) { return string.Equals(Name, other.Name) && Parameters.SequenceEqual(other.Parameters); diff --git a/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs b/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs index b557c5c..45fbff5 100644 --- a/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs +++ b/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs @@ -27,9 +27,7 @@ public virtual NativeBinding ProvideNativeBinding(IShibaContext context, ShibaEx { var dataContextPath = "DataContext"; - var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token - ? value.Value.Value as string - : null; + var targetPath = value.Value; var path = string.IsNullOrEmpty(targetPath) ? dataContextPath : $"{dataContextPath}.{targetPath}"; @@ -51,9 +49,7 @@ public override NativeBinding ProvideNativeBinding(IShibaContext context, ShibaE { var dataContextPath = "DataContext"; - var targetPath = value.Value != null && value.Value.TypeCode == ShibaValueType.Token - ? value.Value.Value as string - : null; + var targetPath = value.Value; var path = dataContextPath; return new NativeBinding diff --git a/Windows/Shiba/Extensions.cs b/Windows/Shiba/Extensions.cs index 472941f..c9f6f5d 100644 --- a/Windows/Shiba/Extensions.cs +++ b/Windows/Shiba/Extensions.cs @@ -31,14 +31,16 @@ public static class ShibaMapExtension { public static T Get(this ShibaMap map, string name) { - var value = map.Properties.FirstOrDefault(it => it.Name.IsCurrentPlatform(name))?.Value; + var value = map.Properties.FirstOrDefault(it => it.Key == name).Value; if (value == null) return default; var result = ShibaValueVisitor.GetValue(value, null); if (result is T targetResult) return targetResult; - if (typeof(IConvertible).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) - return (T) Convert.ChangeType(result, typeof(T)); + if (result.TryChangeType(typeof(T), out var castResult)) + { + return (T) castResult; + } return default; } diff --git a/Windows/Shiba/Parser/Shiba.interp b/Windows/Shiba/Parser/Shiba.interp deleted file mode 100644 index 691f94e..0000000 --- a/Windows/Shiba/Parser/Shiba.interp +++ /dev/null @@ -1,66 +0,0 @@ -token literal names: -null -'$' -null -'null' -null -null -null -null -'->' -',' -':' -'=' -'(' -')' -'[' -']' -'{' -'}' -null -null -null -null -null -null - -token symbolic names: -null -null -Script -Null -String -Boolean -Identifier -Number -Arrow -Comma -Colon -Assign -LeftParen -RightParen -LeftBracket -RightBracket -LeftBrace -RightBrace -Hws -Vws -DocComment -BlockComment -LineComment -LineCommentExt - -rule names: -view -property -value -map -basicValue -functionCall -shibaExtension -array -identifier - - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 25, 108, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 25, 10, 2, 3, 2, 5, 2, 28, 10, 2, 7, 2, 30, 10, 2, 12, 2, 14, 2, 33, 11, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 39, 10, 2, 5, 2, 41, 10, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 53, 10, 4, 3, 5, 3, 5, 3, 5, 5, 5, 58, 10, 5, 7, 5, 60, 10, 5, 12, 5, 14, 5, 63, 11, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 73, 10, 7, 7, 7, 75, 10, 7, 12, 7, 14, 7, 78, 11, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 5, 8, 85, 10, 8, 3, 8, 5, 8, 88, 10, 8, 3, 9, 3, 9, 3, 9, 5, 9, 93, 10, 9, 7, 9, 95, 10, 9, 12, 9, 14, 9, 98, 11, 9, 3, 9, 3, 9, 3, 10, 3, 10, 5, 10, 104, 10, 10, 3, 10, 3, 10, 3, 10, 2, 2, 11, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 3, 3, 2, 5, 9, 2, 118, 2, 20, 3, 2, 2, 2, 4, 42, 3, 2, 2, 2, 6, 52, 3, 2, 2, 2, 8, 54, 3, 2, 2, 2, 10, 66, 3, 2, 2, 2, 12, 68, 3, 2, 2, 2, 14, 81, 3, 2, 2, 2, 16, 89, 3, 2, 2, 2, 18, 103, 3, 2, 2, 2, 20, 40, 5, 18, 10, 2, 21, 31, 7, 18, 2, 2, 22, 25, 5, 4, 3, 2, 23, 25, 5, 2, 2, 2, 24, 22, 3, 2, 2, 2, 24, 23, 3, 2, 2, 2, 25, 27, 3, 2, 2, 2, 26, 28, 7, 11, 2, 2, 27, 26, 3, 2, 2, 2, 27, 28, 3, 2, 2, 2, 28, 30, 3, 2, 2, 2, 29, 24, 3, 2, 2, 2, 30, 33, 3, 2, 2, 2, 31, 29, 3, 2, 2, 2, 31, 32, 3, 2, 2, 2, 32, 34, 3, 2, 2, 2, 33, 31, 3, 2, 2, 2, 34, 41, 7, 19, 2, 2, 35, 38, 7, 10, 2, 2, 36, 39, 5, 6, 4, 2, 37, 39, 5, 4, 3, 2, 38, 36, 3, 2, 2, 2, 38, 37, 3, 2, 2, 2, 39, 41, 3, 2, 2, 2, 40, 21, 3, 2, 2, 2, 40, 35, 3, 2, 2, 2, 40, 41, 3, 2, 2, 2, 41, 3, 3, 2, 2, 2, 42, 43, 5, 18, 10, 2, 43, 44, 7, 13, 2, 2, 44, 45, 5, 6, 4, 2, 45, 5, 3, 2, 2, 2, 46, 53, 5, 10, 6, 2, 47, 53, 5, 16, 9, 2, 48, 53, 5, 8, 5, 2, 49, 53, 5, 12, 7, 2, 50, 53, 5, 14, 8, 2, 51, 53, 5, 2, 2, 2, 52, 46, 3, 2, 2, 2, 52, 47, 3, 2, 2, 2, 52, 48, 3, 2, 2, 2, 52, 49, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 52, 51, 3, 2, 2, 2, 53, 7, 3, 2, 2, 2, 54, 61, 7, 16, 2, 2, 55, 57, 5, 4, 3, 2, 56, 58, 7, 11, 2, 2, 57, 56, 3, 2, 2, 2, 57, 58, 3, 2, 2, 2, 58, 60, 3, 2, 2, 2, 59, 55, 3, 2, 2, 2, 60, 63, 3, 2, 2, 2, 61, 59, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 62, 64, 3, 2, 2, 2, 63, 61, 3, 2, 2, 2, 64, 65, 7, 17, 2, 2, 65, 9, 3, 2, 2, 2, 66, 67, 9, 2, 2, 2, 67, 11, 3, 2, 2, 2, 68, 69, 7, 8, 2, 2, 69, 76, 7, 14, 2, 2, 70, 72, 5, 6, 4, 2, 71, 73, 7, 11, 2, 2, 72, 71, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 75, 3, 2, 2, 2, 74, 70, 3, 2, 2, 2, 75, 78, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 79, 3, 2, 2, 2, 78, 76, 3, 2, 2, 2, 79, 80, 7, 15, 2, 2, 80, 13, 3, 2, 2, 2, 81, 82, 7, 3, 2, 2, 82, 84, 7, 8, 2, 2, 83, 85, 5, 10, 6, 2, 84, 83, 3, 2, 2, 2, 84, 85, 3, 2, 2, 2, 85, 87, 3, 2, 2, 2, 86, 88, 7, 4, 2, 2, 87, 86, 3, 2, 2, 2, 87, 88, 3, 2, 2, 2, 88, 15, 3, 2, 2, 2, 89, 96, 7, 16, 2, 2, 90, 92, 5, 6, 4, 2, 91, 93, 7, 11, 2, 2, 92, 91, 3, 2, 2, 2, 92, 93, 3, 2, 2, 2, 93, 95, 3, 2, 2, 2, 94, 90, 3, 2, 2, 2, 95, 98, 3, 2, 2, 2, 96, 94, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 99, 3, 2, 2, 2, 98, 96, 3, 2, 2, 2, 99, 100, 7, 17, 2, 2, 100, 17, 3, 2, 2, 2, 101, 102, 7, 8, 2, 2, 102, 104, 7, 12, 2, 2, 103, 101, 3, 2, 2, 2, 103, 104, 3, 2, 2, 2, 104, 105, 3, 2, 2, 2, 105, 106, 7, 8, 2, 2, 106, 19, 3, 2, 2, 2, 17, 24, 27, 31, 38, 40, 52, 57, 61, 72, 76, 84, 87, 92, 96, 103] \ No newline at end of file diff --git a/Windows/Shiba/Parser/Shiba.tokens b/Windows/Shiba/Parser/Shiba.tokens deleted file mode 100644 index d08ccdc..0000000 --- a/Windows/Shiba/Parser/Shiba.tokens +++ /dev/null @@ -1,35 +0,0 @@ -T__0=1 -Script=2 -Null=3 -String=4 -Boolean=5 -Identifier=6 -Number=7 -Arrow=8 -Comma=9 -Colon=10 -Assign=11 -LeftParen=12 -RightParen=13 -LeftBracket=14 -RightBracket=15 -LeftBrace=16 -RightBrace=17 -Hws=18 -Vws=19 -DocComment=20 -BlockComment=21 -LineComment=22 -LineCommentExt=23 -'$'=1 -'null'=3 -'->'=8 -','=9 -':'=10 -'='=11 -'('=12 -')'=13 -'['=14 -']'=15 -'{'=16 -'}'=17 diff --git a/Windows/Shiba/Parser/ShibaBaseListener.cs b/Windows/Shiba/Parser/ShibaBaseListener.cs deleted file mode 100644 index 879ceaa..0000000 --- a/Windows/Shiba/Parser/ShibaBaseListener.cs +++ /dev/null @@ -1,160 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.7.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from Shiba.g4 by ANTLR 4.7.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace Shiba.Parser { - -using Antlr4.Runtime.Misc; -using IErrorNode = Antlr4.Runtime.Tree.IErrorNode; -using ITerminalNode = Antlr4.Runtime.Tree.ITerminalNode; -using IToken = Antlr4.Runtime.IToken; -using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; - -/// -/// This class provides an empty implementation of , -/// which can be extended to create a listener which only needs to handle a subset -/// of the available methods. -/// -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7.1")] -[System.CLSCompliant(false)] -public partial class ShibaBaseListener : IShibaListener { - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterView([NotNull] ShibaParser.ViewContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitView([NotNull] ShibaParser.ViewContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterProperty([NotNull] ShibaParser.PropertyContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitProperty([NotNull] ShibaParser.PropertyContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterValue([NotNull] ShibaParser.ValueContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitValue([NotNull] ShibaParser.ValueContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterMap([NotNull] ShibaParser.MapContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitMap([NotNull] ShibaParser.MapContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterBasicValue([NotNull] ShibaParser.BasicValueContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitBasicValue([NotNull] ShibaParser.BasicValueContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterFunctionCall([NotNull] ShibaParser.FunctionCallContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitFunctionCall([NotNull] ShibaParser.FunctionCallContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterShibaExtension([NotNull] ShibaParser.ShibaExtensionContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitShibaExtension([NotNull] ShibaParser.ShibaExtensionContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterArray([NotNull] ShibaParser.ArrayContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitArray([NotNull] ShibaParser.ArrayContext context) { } - /// - /// Enter a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void EnterIdentifier([NotNull] ShibaParser.IdentifierContext context) { } - /// - /// Exit a parse tree produced by . - /// The default implementation does nothing. - /// - /// The parse tree. - public virtual void ExitIdentifier([NotNull] ShibaParser.IdentifierContext context) { } - - /// - /// The default implementation does nothing. - public virtual void EnterEveryRule([NotNull] ParserRuleContext context) { } - /// - /// The default implementation does nothing. - public virtual void ExitEveryRule([NotNull] ParserRuleContext context) { } - /// - /// The default implementation does nothing. - public virtual void VisitTerminal([NotNull] ITerminalNode node) { } - /// - /// The default implementation does nothing. - public virtual void VisitErrorNode([NotNull] IErrorNode node) { } -} -} // namespace Shiba.Parser diff --git a/Windows/Shiba/Parser/ShibaLexer.cs b/Windows/Shiba/Parser/ShibaLexer.cs deleted file mode 100644 index ecc3a6d..0000000 --- a/Windows/Shiba/Parser/ShibaLexer.cs +++ /dev/null @@ -1,320 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.7.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from Shiba.g4 by ANTLR 4.7.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace Shiba.Parser { -using System; -using System.IO; -using System.Text; -using Antlr4.Runtime; -using Antlr4.Runtime.Atn; -using Antlr4.Runtime.Misc; -using DFA = Antlr4.Runtime.Dfa.DFA; - -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7.1")] -[System.CLSCompliant(false)] -public partial class ShibaLexer : Lexer { - protected static DFA[] decisionToDFA; - protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); - public const int - T__0=1, Script=2, Null=3, String=4, Boolean=5, Identifier=6, Number=7, - Arrow=8, Comma=9, Colon=10, Assign=11, LeftParen=12, RightParen=13, LeftBracket=14, - RightBracket=15, LeftBrace=16, RightBrace=17, Hws=18, Vws=19, DocComment=20, - BlockComment=21, LineComment=22, LineCommentExt=23; - public static string[] channelNames = { - "DEFAULT_TOKEN_CHANNEL", "HIDDEN" - }; - - public static string[] modeNames = { - "DEFAULT_MODE" - }; - - public static readonly string[] ruleNames = { - "T__0", "Script", "Null", "String", "Boolean", "Identifier", "Number", - "Arrow", "Comma", "Colon", "Assign", "LeftParen", "RightParen", "LeftBracket", - "RightBracket", "LeftBrace", "RightBrace", "INT", "EXP", "Hws", "Vws", - "DocComment", "BlockComment", "LineComment", "LineCommentExt" - }; - - - public ShibaLexer(ICharStream input) - : this(input, Console.Out, Console.Error) { } - - public ShibaLexer(ICharStream input, TextWriter output, TextWriter errorOutput) - : base(input, output, errorOutput) - { - Interpreter = new LexerATNSimulator(this, _ATN, decisionToDFA, sharedContextCache); - } - - private static readonly string[] _LiteralNames = { - null, "'$'", null, "'null'", null, null, null, null, "'->'", "','", "':'", - "'='", "'('", "')'", "'['", "']'", "'{'", "'}'" - }; - private static readonly string[] _SymbolicNames = { - null, null, "Script", "Null", "String", "Boolean", "Identifier", "Number", - "Arrow", "Comma", "Colon", "Assign", "LeftParen", "RightParen", "LeftBracket", - "RightBracket", "LeftBrace", "RightBrace", "Hws", "Vws", "DocComment", - "BlockComment", "LineComment", "LineCommentExt" - }; - public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); - - [NotNull] - public override IVocabulary Vocabulary - { - get - { - return DefaultVocabulary; - } - } - - public override string GrammarFileName { get { return "Shiba.g4"; } } - - public override string[] RuleNames { get { return ruleNames; } } - - public override string[] ChannelNames { get { return channelNames; } } - - public override string[] ModeNames { get { return modeNames; } } - - public override string SerializedAtn { get { return new string(_serializedATN); } } - - static ShibaLexer() { - decisionToDFA = new DFA[_ATN.NumberOfDecisions]; - for (int i = 0; i < _ATN.NumberOfDecisions; i++) { - decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i); - } - } - private static char[] _serializedATN = { - '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x2', '\x19', '\xEE', '\b', '\x1', '\x4', '\x2', '\t', '\x2', - '\x4', '\x3', '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', - '\x5', '\x4', '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', - '\t', '\b', '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x4', '\v', - '\t', '\v', '\x4', '\f', '\t', '\f', '\x4', '\r', '\t', '\r', '\x4', '\xE', - '\t', '\xE', '\x4', '\xF', '\t', '\xF', '\x4', '\x10', '\t', '\x10', '\x4', - '\x11', '\t', '\x11', '\x4', '\x12', '\t', '\x12', '\x4', '\x13', '\t', - '\x13', '\x4', '\x14', '\t', '\x14', '\x4', '\x15', '\t', '\x15', '\x4', - '\x16', '\t', '\x16', '\x4', '\x17', '\t', '\x17', '\x4', '\x18', '\t', - '\x18', '\x4', '\x19', '\t', '\x19', '\x4', '\x1A', '\t', '\x1A', '\x3', - '\x2', '\x3', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', - '\x3', '\a', '\x3', '<', '\n', '\x3', '\f', '\x3', '\xE', '\x3', '?', - '\v', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', '\x3', - '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\a', '\x5', - 'J', '\n', '\x5', '\f', '\x5', '\xE', '\x5', 'M', '\v', '\x5', '\x3', - '\x5', '\x3', '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', - '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', '\x6', '\x3', - '\x6', '\x5', '\x6', 'Z', '\n', '\x6', '\x3', '\a', '\x6', '\a', ']', - '\n', '\a', '\r', '\a', '\xE', '\a', '^', '\x3', '\a', '\a', '\a', '\x62', - '\n', '\a', '\f', '\a', '\xE', '\a', '\x65', '\v', '\a', '\x3', '\b', - '\x5', '\b', 'h', '\n', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x6', - '\b', 'm', '\n', '\b', '\r', '\b', '\xE', '\b', 'n', '\x5', '\b', 'q', - '\n', '\b', '\x3', '\b', '\x5', '\b', 't', '\n', '\b', '\x3', '\t', '\x3', - '\t', '\x3', '\t', '\x3', '\n', '\x3', '\n', '\x3', '\v', '\x3', '\v', - '\x3', '\f', '\x3', '\f', '\x3', '\r', '\x3', '\r', '\x3', '\xE', '\x3', - '\xE', '\x3', '\xF', '\x3', '\xF', '\x3', '\x10', '\x3', '\x10', '\x3', - '\x11', '\x3', '\x11', '\x3', '\x12', '\x3', '\x12', '\x3', '\x13', '\x3', - '\x13', '\x3', '\x13', '\a', '\x13', '\x8E', '\n', '\x13', '\f', '\x13', - '\xE', '\x13', '\x91', '\v', '\x13', '\x5', '\x13', '\x93', '\n', '\x13', - '\x3', '\x14', '\x3', '\x14', '\x5', '\x14', '\x97', '\n', '\x14', '\x3', - '\x14', '\x3', '\x14', '\x3', '\x15', '\x3', '\x15', '\x3', '\x15', '\x3', - '\x15', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', '\x16', '\x3', - '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\a', - '\x17', '\xA8', '\n', '\x17', '\f', '\x17', '\xE', '\x17', '\xAB', '\v', - '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x17', '\x5', '\x17', '\xB0', - '\n', '\x17', '\x3', '\x17', '\x3', '\x17', '\x3', '\x18', '\x3', '\x18', - '\x3', '\x18', '\x3', '\x18', '\a', '\x18', '\xB8', '\n', '\x18', '\f', - '\x18', '\xE', '\x18', '\xBB', '\v', '\x18', '\x3', '\x18', '\x3', '\x18', - '\x3', '\x18', '\x5', '\x18', '\xC0', '\n', '\x18', '\x3', '\x18', '\x3', - '\x18', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x19', '\a', - '\x19', '\xC8', '\n', '\x19', '\f', '\x19', '\xE', '\x19', '\xCB', '\v', - '\x19', '\x3', '\x19', '\x3', '\x19', '\x3', '\x1A', '\x3', '\x1A', '\x3', - '\x1A', '\x3', '\x1A', '\a', '\x1A', '\xD3', '\n', '\x1A', '\f', '\x1A', - '\xE', '\x1A', '\xD6', '\v', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\a', - '\x1A', '\xDA', '\n', '\x1A', '\f', '\x1A', '\xE', '\x1A', '\xDD', '\v', - '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\a', - '\x1A', '\xE3', '\n', '\x1A', '\f', '\x1A', '\xE', '\x1A', '\xE6', '\v', - '\x1A', '\a', '\x1A', '\xE8', '\n', '\x1A', '\f', '\x1A', '\xE', '\x1A', - '\xEB', '\v', '\x1A', '\x3', '\x1A', '\x3', '\x1A', '\x5', '=', '\xA9', - '\xB9', '\x2', '\x1B', '\x3', '\x3', '\x5', '\x4', '\a', '\x5', '\t', - '\x6', '\v', '\a', '\r', '\b', '\xF', '\t', '\x11', '\n', '\x13', '\v', - '\x15', '\f', '\x17', '\r', '\x19', '\xE', '\x1B', '\xF', '\x1D', '\x10', - '\x1F', '\x11', '!', '\x12', '#', '\x13', '%', '\x2', '\'', '\x2', ')', - '\x14', '+', '\x15', '-', '\x16', '/', '\x17', '\x31', '\x18', '\x33', - '\x19', '\x3', '\x2', '\r', '\x3', '\x2', '$', '$', '\x5', '\x2', '\x43', - '\\', '\x61', '\x61', '\x63', '|', '\a', '\x2', '\x30', '\x30', '\x32', - ';', '\x43', '\\', '\x61', '\x61', '\x63', '|', '\x3', '\x2', '\x32', - ';', '\x3', '\x2', '\x33', ';', '\x4', '\x2', 'G', 'G', 'g', 'g', '\x4', - '\x2', '-', '-', '/', '/', '\x4', '\x2', '\v', '\v', '\"', '\"', '\x4', - '\x2', '\f', '\f', '\xE', '\xF', '\x4', '\x2', '\f', '\f', '\xF', '\xF', - '\x3', '\x2', '\f', '\f', '\x2', '\x100', '\x2', '\x3', '\x3', '\x2', - '\x2', '\x2', '\x2', '\x5', '\x3', '\x2', '\x2', '\x2', '\x2', '\a', '\x3', - '\x2', '\x2', '\x2', '\x2', '\t', '\x3', '\x2', '\x2', '\x2', '\x2', '\v', - '\x3', '\x2', '\x2', '\x2', '\x2', '\r', '\x3', '\x2', '\x2', '\x2', '\x2', - '\xF', '\x3', '\x2', '\x2', '\x2', '\x2', '\x11', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x13', '\x3', '\x2', '\x2', '\x2', '\x2', '\x15', '\x3', - '\x2', '\x2', '\x2', '\x2', '\x17', '\x3', '\x2', '\x2', '\x2', '\x2', - '\x19', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1B', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x2', '\x1F', '\x3', - '\x2', '\x2', '\x2', '\x2', '!', '\x3', '\x2', '\x2', '\x2', '\x2', '#', - '\x3', '\x2', '\x2', '\x2', '\x2', ')', '\x3', '\x2', '\x2', '\x2', '\x2', - '+', '\x3', '\x2', '\x2', '\x2', '\x2', '-', '\x3', '\x2', '\x2', '\x2', - '\x2', '/', '\x3', '\x2', '\x2', '\x2', '\x2', '\x31', '\x3', '\x2', '\x2', - '\x2', '\x2', '\x33', '\x3', '\x2', '\x2', '\x2', '\x3', '\x35', '\x3', - '\x2', '\x2', '\x2', '\x5', '\x37', '\x3', '\x2', '\x2', '\x2', '\a', - '\x42', '\x3', '\x2', '\x2', '\x2', '\t', 'G', '\x3', '\x2', '\x2', '\x2', - '\v', 'Y', '\x3', '\x2', '\x2', '\x2', '\r', '\\', '\x3', '\x2', '\x2', - '\x2', '\xF', 'g', '\x3', '\x2', '\x2', '\x2', '\x11', 'u', '\x3', '\x2', - '\x2', '\x2', '\x13', 'x', '\x3', '\x2', '\x2', '\x2', '\x15', 'z', '\x3', - '\x2', '\x2', '\x2', '\x17', '|', '\x3', '\x2', '\x2', '\x2', '\x19', - '~', '\x3', '\x2', '\x2', '\x2', '\x1B', '\x80', '\x3', '\x2', '\x2', - '\x2', '\x1D', '\x82', '\x3', '\x2', '\x2', '\x2', '\x1F', '\x84', '\x3', - '\x2', '\x2', '\x2', '!', '\x86', '\x3', '\x2', '\x2', '\x2', '#', '\x88', - '\x3', '\x2', '\x2', '\x2', '%', '\x92', '\x3', '\x2', '\x2', '\x2', '\'', - '\x94', '\x3', '\x2', '\x2', '\x2', ')', '\x9A', '\x3', '\x2', '\x2', - '\x2', '+', '\x9E', '\x3', '\x2', '\x2', '\x2', '-', '\xA2', '\x3', '\x2', - '\x2', '\x2', '/', '\xB3', '\x3', '\x2', '\x2', '\x2', '\x31', '\xC3', - '\x3', '\x2', '\x2', '\x2', '\x33', '\xCE', '\x3', '\x2', '\x2', '\x2', - '\x35', '\x36', '\a', '&', '\x2', '\x2', '\x36', '\x4', '\x3', '\x2', - '\x2', '\x2', '\x37', '\x38', '\a', '&', '\x2', '\x2', '\x38', '\x39', - '\a', '}', '\x2', '\x2', '\x39', '=', '\x3', '\x2', '\x2', '\x2', ':', - '<', '\v', '\x2', '\x2', '\x2', ';', ':', '\x3', '\x2', '\x2', '\x2', - '<', '?', '\x3', '\x2', '\x2', '\x2', '=', '>', '\x3', '\x2', '\x2', '\x2', - '=', ';', '\x3', '\x2', '\x2', '\x2', '>', '@', '\x3', '\x2', '\x2', '\x2', - '?', '=', '\x3', '\x2', '\x2', '\x2', '@', '\x41', '\a', '\x7F', '\x2', - '\x2', '\x41', '\x6', '\x3', '\x2', '\x2', '\x2', '\x42', '\x43', '\a', - 'p', '\x2', '\x2', '\x43', '\x44', '\a', 'w', '\x2', '\x2', '\x44', '\x45', - '\a', 'n', '\x2', '\x2', '\x45', '\x46', '\a', 'n', '\x2', '\x2', '\x46', - '\b', '\x3', '\x2', '\x2', '\x2', 'G', 'K', '\a', '$', '\x2', '\x2', 'H', - 'J', '\n', '\x2', '\x2', '\x2', 'I', 'H', '\x3', '\x2', '\x2', '\x2', - 'J', 'M', '\x3', '\x2', '\x2', '\x2', 'K', 'I', '\x3', '\x2', '\x2', '\x2', - 'K', 'L', '\x3', '\x2', '\x2', '\x2', 'L', 'N', '\x3', '\x2', '\x2', '\x2', - 'M', 'K', '\x3', '\x2', '\x2', '\x2', 'N', 'O', '\a', '$', '\x2', '\x2', - 'O', '\n', '\x3', '\x2', '\x2', '\x2', 'P', 'Q', '\a', 'v', '\x2', '\x2', - 'Q', 'R', '\a', 't', '\x2', '\x2', 'R', 'S', '\a', 'w', '\x2', '\x2', - 'S', 'Z', '\a', 'g', '\x2', '\x2', 'T', 'U', '\a', 'h', '\x2', '\x2', - 'U', 'V', '\a', '\x63', '\x2', '\x2', 'V', 'W', '\a', 'n', '\x2', '\x2', - 'W', 'X', '\a', 'u', '\x2', '\x2', 'X', 'Z', '\a', 'g', '\x2', '\x2', - 'Y', 'P', '\x3', '\x2', '\x2', '\x2', 'Y', 'T', '\x3', '\x2', '\x2', '\x2', - 'Z', '\f', '\x3', '\x2', '\x2', '\x2', '[', ']', '\t', '\x3', '\x2', '\x2', - '\\', '[', '\x3', '\x2', '\x2', '\x2', ']', '^', '\x3', '\x2', '\x2', - '\x2', '^', '\\', '\x3', '\x2', '\x2', '\x2', '^', '_', '\x3', '\x2', - '\x2', '\x2', '_', '\x63', '\x3', '\x2', '\x2', '\x2', '`', '\x62', '\t', - '\x4', '\x2', '\x2', '\x61', '`', '\x3', '\x2', '\x2', '\x2', '\x62', - '\x65', '\x3', '\x2', '\x2', '\x2', '\x63', '\x61', '\x3', '\x2', '\x2', - '\x2', '\x63', '\x64', '\x3', '\x2', '\x2', '\x2', '\x64', '\xE', '\x3', - '\x2', '\x2', '\x2', '\x65', '\x63', '\x3', '\x2', '\x2', '\x2', '\x66', - 'h', '\a', '/', '\x2', '\x2', 'g', '\x66', '\x3', '\x2', '\x2', '\x2', - 'g', 'h', '\x3', '\x2', '\x2', '\x2', 'h', 'i', '\x3', '\x2', '\x2', '\x2', - 'i', 'p', '\x5', '%', '\x13', '\x2', 'j', 'l', '\a', '\x30', '\x2', '\x2', - 'k', 'm', '\t', '\x5', '\x2', '\x2', 'l', 'k', '\x3', '\x2', '\x2', '\x2', - 'm', 'n', '\x3', '\x2', '\x2', '\x2', 'n', 'l', '\x3', '\x2', '\x2', '\x2', - 'n', 'o', '\x3', '\x2', '\x2', '\x2', 'o', 'q', '\x3', '\x2', '\x2', '\x2', - 'p', 'j', '\x3', '\x2', '\x2', '\x2', 'p', 'q', '\x3', '\x2', '\x2', '\x2', - 'q', 's', '\x3', '\x2', '\x2', '\x2', 'r', 't', '\x5', '\'', '\x14', '\x2', - 's', 'r', '\x3', '\x2', '\x2', '\x2', 's', 't', '\x3', '\x2', '\x2', '\x2', - 't', '\x10', '\x3', '\x2', '\x2', '\x2', 'u', 'v', '\a', '/', '\x2', '\x2', - 'v', 'w', '\a', '@', '\x2', '\x2', 'w', '\x12', '\x3', '\x2', '\x2', '\x2', - 'x', 'y', '\a', '.', '\x2', '\x2', 'y', '\x14', '\x3', '\x2', '\x2', '\x2', - 'z', '{', '\a', '<', '\x2', '\x2', '{', '\x16', '\x3', '\x2', '\x2', '\x2', - '|', '}', '\a', '?', '\x2', '\x2', '}', '\x18', '\x3', '\x2', '\x2', '\x2', - '~', '\x7F', '\a', '*', '\x2', '\x2', '\x7F', '\x1A', '\x3', '\x2', '\x2', - '\x2', '\x80', '\x81', '\a', '+', '\x2', '\x2', '\x81', '\x1C', '\x3', - '\x2', '\x2', '\x2', '\x82', '\x83', '\a', ']', '\x2', '\x2', '\x83', - '\x1E', '\x3', '\x2', '\x2', '\x2', '\x84', '\x85', '\a', '_', '\x2', - '\x2', '\x85', ' ', '\x3', '\x2', '\x2', '\x2', '\x86', '\x87', '\a', - '}', '\x2', '\x2', '\x87', '\"', '\x3', '\x2', '\x2', '\x2', '\x88', '\x89', - '\a', '\x7F', '\x2', '\x2', '\x89', '$', '\x3', '\x2', '\x2', '\x2', '\x8A', - '\x93', '\a', '\x32', '\x2', '\x2', '\x8B', '\x8F', '\t', '\x6', '\x2', - '\x2', '\x8C', '\x8E', '\t', '\x5', '\x2', '\x2', '\x8D', '\x8C', '\x3', - '\x2', '\x2', '\x2', '\x8E', '\x91', '\x3', '\x2', '\x2', '\x2', '\x8F', - '\x8D', '\x3', '\x2', '\x2', '\x2', '\x8F', '\x90', '\x3', '\x2', '\x2', - '\x2', '\x90', '\x93', '\x3', '\x2', '\x2', '\x2', '\x91', '\x8F', '\x3', - '\x2', '\x2', '\x2', '\x92', '\x8A', '\x3', '\x2', '\x2', '\x2', '\x92', - '\x8B', '\x3', '\x2', '\x2', '\x2', '\x93', '&', '\x3', '\x2', '\x2', - '\x2', '\x94', '\x96', '\t', '\a', '\x2', '\x2', '\x95', '\x97', '\t', - '\b', '\x2', '\x2', '\x96', '\x95', '\x3', '\x2', '\x2', '\x2', '\x96', - '\x97', '\x3', '\x2', '\x2', '\x2', '\x97', '\x98', '\x3', '\x2', '\x2', - '\x2', '\x98', '\x99', '\x5', '%', '\x13', '\x2', '\x99', '(', '\x3', - '\x2', '\x2', '\x2', '\x9A', '\x9B', '\t', '\t', '\x2', '\x2', '\x9B', - '\x9C', '\x3', '\x2', '\x2', '\x2', '\x9C', '\x9D', '\b', '\x15', '\x2', - '\x2', '\x9D', '*', '\x3', '\x2', '\x2', '\x2', '\x9E', '\x9F', '\t', - '\n', '\x2', '\x2', '\x9F', '\xA0', '\x3', '\x2', '\x2', '\x2', '\xA0', - '\xA1', '\b', '\x16', '\x2', '\x2', '\xA1', ',', '\x3', '\x2', '\x2', - '\x2', '\xA2', '\xA3', '\a', '\x31', '\x2', '\x2', '\xA3', '\xA4', '\a', - ',', '\x2', '\x2', '\xA4', '\xA5', '\a', ',', '\x2', '\x2', '\xA5', '\xA9', - '\x3', '\x2', '\x2', '\x2', '\xA6', '\xA8', '\v', '\x2', '\x2', '\x2', - '\xA7', '\xA6', '\x3', '\x2', '\x2', '\x2', '\xA8', '\xAB', '\x3', '\x2', - '\x2', '\x2', '\xA9', '\xAA', '\x3', '\x2', '\x2', '\x2', '\xA9', '\xA7', - '\x3', '\x2', '\x2', '\x2', '\xAA', '\xAF', '\x3', '\x2', '\x2', '\x2', - '\xAB', '\xA9', '\x3', '\x2', '\x2', '\x2', '\xAC', '\xAD', '\a', ',', - '\x2', '\x2', '\xAD', '\xB0', '\a', '\x31', '\x2', '\x2', '\xAE', '\xB0', - '\a', '\x2', '\x2', '\x3', '\xAF', '\xAC', '\x3', '\x2', '\x2', '\x2', - '\xAF', '\xAE', '\x3', '\x2', '\x2', '\x2', '\xB0', '\xB1', '\x3', '\x2', - '\x2', '\x2', '\xB1', '\xB2', '\b', '\x17', '\x2', '\x2', '\xB2', '.', - '\x3', '\x2', '\x2', '\x2', '\xB3', '\xB4', '\a', '\x31', '\x2', '\x2', - '\xB4', '\xB5', '\a', ',', '\x2', '\x2', '\xB5', '\xB9', '\x3', '\x2', - '\x2', '\x2', '\xB6', '\xB8', '\v', '\x2', '\x2', '\x2', '\xB7', '\xB6', - '\x3', '\x2', '\x2', '\x2', '\xB8', '\xBB', '\x3', '\x2', '\x2', '\x2', - '\xB9', '\xBA', '\x3', '\x2', '\x2', '\x2', '\xB9', '\xB7', '\x3', '\x2', - '\x2', '\x2', '\xBA', '\xBF', '\x3', '\x2', '\x2', '\x2', '\xBB', '\xB9', - '\x3', '\x2', '\x2', '\x2', '\xBC', '\xBD', '\a', ',', '\x2', '\x2', '\xBD', - '\xC0', '\a', '\x31', '\x2', '\x2', '\xBE', '\xC0', '\a', '\x2', '\x2', - '\x3', '\xBF', '\xBC', '\x3', '\x2', '\x2', '\x2', '\xBF', '\xBE', '\x3', - '\x2', '\x2', '\x2', '\xC0', '\xC1', '\x3', '\x2', '\x2', '\x2', '\xC1', - '\xC2', '\b', '\x18', '\x2', '\x2', '\xC2', '\x30', '\x3', '\x2', '\x2', - '\x2', '\xC3', '\xC4', '\a', '\x31', '\x2', '\x2', '\xC4', '\xC5', '\a', - '\x31', '\x2', '\x2', '\xC5', '\xC9', '\x3', '\x2', '\x2', '\x2', '\xC6', - '\xC8', '\n', '\v', '\x2', '\x2', '\xC7', '\xC6', '\x3', '\x2', '\x2', - '\x2', '\xC8', '\xCB', '\x3', '\x2', '\x2', '\x2', '\xC9', '\xC7', '\x3', - '\x2', '\x2', '\x2', '\xC9', '\xCA', '\x3', '\x2', '\x2', '\x2', '\xCA', - '\xCC', '\x3', '\x2', '\x2', '\x2', '\xCB', '\xC9', '\x3', '\x2', '\x2', - '\x2', '\xCC', '\xCD', '\b', '\x19', '\x2', '\x2', '\xCD', '\x32', '\x3', - '\x2', '\x2', '\x2', '\xCE', '\xCF', '\a', '\x31', '\x2', '\x2', '\xCF', - '\xD0', '\a', '\x31', '\x2', '\x2', '\xD0', '\xD4', '\x3', '\x2', '\x2', - '\x2', '\xD1', '\xD3', '\n', '\f', '\x2', '\x2', '\xD2', '\xD1', '\x3', - '\x2', '\x2', '\x2', '\xD3', '\xD6', '\x3', '\x2', '\x2', '\x2', '\xD4', - '\xD2', '\x3', '\x2', '\x2', '\x2', '\xD4', '\xD5', '\x3', '\x2', '\x2', - '\x2', '\xD5', '\xE9', '\x3', '\x2', '\x2', '\x2', '\xD6', '\xD4', '\x3', - '\x2', '\x2', '\x2', '\xD7', '\xDB', '\a', '\f', '\x2', '\x2', '\xD8', - '\xDA', '\x5', ')', '\x15', '\x2', '\xD9', '\xD8', '\x3', '\x2', '\x2', - '\x2', '\xDA', '\xDD', '\x3', '\x2', '\x2', '\x2', '\xDB', '\xD9', '\x3', - '\x2', '\x2', '\x2', '\xDB', '\xDC', '\x3', '\x2', '\x2', '\x2', '\xDC', - '\xDE', '\x3', '\x2', '\x2', '\x2', '\xDD', '\xDB', '\x3', '\x2', '\x2', - '\x2', '\xDE', '\xDF', '\a', '\x31', '\x2', '\x2', '\xDF', '\xE0', '\a', - '\x31', '\x2', '\x2', '\xE0', '\xE4', '\x3', '\x2', '\x2', '\x2', '\xE1', - '\xE3', '\n', '\f', '\x2', '\x2', '\xE2', '\xE1', '\x3', '\x2', '\x2', - '\x2', '\xE3', '\xE6', '\x3', '\x2', '\x2', '\x2', '\xE4', '\xE2', '\x3', - '\x2', '\x2', '\x2', '\xE4', '\xE5', '\x3', '\x2', '\x2', '\x2', '\xE5', - '\xE8', '\x3', '\x2', '\x2', '\x2', '\xE6', '\xE4', '\x3', '\x2', '\x2', - '\x2', '\xE7', '\xD7', '\x3', '\x2', '\x2', '\x2', '\xE8', '\xEB', '\x3', - '\x2', '\x2', '\x2', '\xE9', '\xE7', '\x3', '\x2', '\x2', '\x2', '\xE9', - '\xEA', '\x3', '\x2', '\x2', '\x2', '\xEA', '\xEC', '\x3', '\x2', '\x2', - '\x2', '\xEB', '\xE9', '\x3', '\x2', '\x2', '\x2', '\xEC', '\xED', '\b', - '\x1A', '\x2', '\x2', '\xED', '\x34', '\x3', '\x2', '\x2', '\x2', '\x1A', - '\x2', '=', 'K', 'Y', '\\', '^', '\x61', '\x63', 'g', 'n', 'p', 's', '\x8F', - '\x92', '\x96', '\xA9', '\xAF', '\xB9', '\xBF', '\xC9', '\xD4', '\xDB', - '\xE4', '\xE9', '\x3', '\b', '\x2', '\x2', - }; - - public static readonly ATN _ATN = - new ATNDeserializer().Deserialize(_serializedATN); - - -} -} // namespace Shiba.Parser diff --git a/Windows/Shiba/Parser/ShibaLexer.interp b/Windows/Shiba/Parser/ShibaLexer.interp deleted file mode 100644 index 43131a9..0000000 --- a/Windows/Shiba/Parser/ShibaLexer.interp +++ /dev/null @@ -1,88 +0,0 @@ -token literal names: -null -'$' -null -'null' -null -null -null -null -'->' -',' -':' -'=' -'(' -')' -'[' -']' -'{' -'}' -null -null -null -null -null -null - -token symbolic names: -null -null -Script -Null -String -Boolean -Identifier -Number -Arrow -Comma -Colon -Assign -LeftParen -RightParen -LeftBracket -RightBracket -LeftBrace -RightBrace -Hws -Vws -DocComment -BlockComment -LineComment -LineCommentExt - -rule names: -T__0 -Script -Null -String -Boolean -Identifier -Number -Arrow -Comma -Colon -Assign -LeftParen -RightParen -LeftBracket -RightBracket -LeftBrace -RightBrace -INT -EXP -Hws -Vws -DocComment -BlockComment -LineComment -LineCommentExt - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 25, 238, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 60, 10, 3, 12, 3, 14, 3, 63, 11, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 7, 5, 74, 10, 5, 12, 5, 14, 5, 77, 11, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 90, 10, 6, 3, 7, 6, 7, 93, 10, 7, 13, 7, 14, 7, 94, 3, 7, 7, 7, 98, 10, 7, 12, 7, 14, 7, 101, 11, 7, 3, 8, 5, 8, 104, 10, 8, 3, 8, 3, 8, 3, 8, 6, 8, 109, 10, 8, 13, 8, 14, 8, 110, 5, 8, 113, 10, 8, 3, 8, 5, 8, 116, 10, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 7, 19, 142, 10, 19, 12, 19, 14, 19, 145, 11, 19, 5, 19, 147, 10, 19, 3, 20, 3, 20, 5, 20, 151, 10, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 168, 10, 23, 12, 23, 14, 23, 171, 11, 23, 3, 23, 3, 23, 3, 23, 5, 23, 176, 10, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 7, 24, 184, 10, 24, 12, 24, 14, 24, 187, 11, 24, 3, 24, 3, 24, 3, 24, 5, 24, 192, 10, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 7, 25, 200, 10, 25, 12, 25, 14, 25, 203, 11, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 7, 26, 211, 10, 26, 12, 26, 14, 26, 214, 11, 26, 3, 26, 3, 26, 7, 26, 218, 10, 26, 12, 26, 14, 26, 221, 11, 26, 3, 26, 3, 26, 3, 26, 3, 26, 7, 26, 227, 10, 26, 12, 26, 14, 26, 230, 11, 26, 7, 26, 232, 10, 26, 12, 26, 14, 26, 235, 11, 26, 3, 26, 3, 26, 5, 61, 169, 185, 2, 27, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 2, 39, 2, 41, 20, 43, 21, 45, 22, 47, 23, 49, 24, 51, 25, 3, 2, 13, 3, 2, 36, 36, 5, 2, 67, 92, 97, 97, 99, 124, 7, 2, 48, 48, 50, 59, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59, 3, 2, 51, 59, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 4, 2, 11, 11, 34, 34, 4, 2, 12, 12, 14, 15, 4, 2, 12, 12, 15, 15, 3, 2, 12, 12, 2, 256, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 3, 53, 3, 2, 2, 2, 5, 55, 3, 2, 2, 2, 7, 66, 3, 2, 2, 2, 9, 71, 3, 2, 2, 2, 11, 89, 3, 2, 2, 2, 13, 92, 3, 2, 2, 2, 15, 103, 3, 2, 2, 2, 17, 117, 3, 2, 2, 2, 19, 120, 3, 2, 2, 2, 21, 122, 3, 2, 2, 2, 23, 124, 3, 2, 2, 2, 25, 126, 3, 2, 2, 2, 27, 128, 3, 2, 2, 2, 29, 130, 3, 2, 2, 2, 31, 132, 3, 2, 2, 2, 33, 134, 3, 2, 2, 2, 35, 136, 3, 2, 2, 2, 37, 146, 3, 2, 2, 2, 39, 148, 3, 2, 2, 2, 41, 154, 3, 2, 2, 2, 43, 158, 3, 2, 2, 2, 45, 162, 3, 2, 2, 2, 47, 179, 3, 2, 2, 2, 49, 195, 3, 2, 2, 2, 51, 206, 3, 2, 2, 2, 53, 54, 7, 38, 2, 2, 54, 4, 3, 2, 2, 2, 55, 56, 7, 38, 2, 2, 56, 57, 7, 125, 2, 2, 57, 61, 3, 2, 2, 2, 58, 60, 11, 2, 2, 2, 59, 58, 3, 2, 2, 2, 60, 63, 3, 2, 2, 2, 61, 62, 3, 2, 2, 2, 61, 59, 3, 2, 2, 2, 62, 64, 3, 2, 2, 2, 63, 61, 3, 2, 2, 2, 64, 65, 7, 127, 2, 2, 65, 6, 3, 2, 2, 2, 66, 67, 7, 112, 2, 2, 67, 68, 7, 119, 2, 2, 68, 69, 7, 110, 2, 2, 69, 70, 7, 110, 2, 2, 70, 8, 3, 2, 2, 2, 71, 75, 7, 36, 2, 2, 72, 74, 10, 2, 2, 2, 73, 72, 3, 2, 2, 2, 74, 77, 3, 2, 2, 2, 75, 73, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 78, 3, 2, 2, 2, 77, 75, 3, 2, 2, 2, 78, 79, 7, 36, 2, 2, 79, 10, 3, 2, 2, 2, 80, 81, 7, 118, 2, 2, 81, 82, 7, 116, 2, 2, 82, 83, 7, 119, 2, 2, 83, 90, 7, 103, 2, 2, 84, 85, 7, 104, 2, 2, 85, 86, 7, 99, 2, 2, 86, 87, 7, 110, 2, 2, 87, 88, 7, 117, 2, 2, 88, 90, 7, 103, 2, 2, 89, 80, 3, 2, 2, 2, 89, 84, 3, 2, 2, 2, 90, 12, 3, 2, 2, 2, 91, 93, 9, 3, 2, 2, 92, 91, 3, 2, 2, 2, 93, 94, 3, 2, 2, 2, 94, 92, 3, 2, 2, 2, 94, 95, 3, 2, 2, 2, 95, 99, 3, 2, 2, 2, 96, 98, 9, 4, 2, 2, 97, 96, 3, 2, 2, 2, 98, 101, 3, 2, 2, 2, 99, 97, 3, 2, 2, 2, 99, 100, 3, 2, 2, 2, 100, 14, 3, 2, 2, 2, 101, 99, 3, 2, 2, 2, 102, 104, 7, 47, 2, 2, 103, 102, 3, 2, 2, 2, 103, 104, 3, 2, 2, 2, 104, 105, 3, 2, 2, 2, 105, 112, 5, 37, 19, 2, 106, 108, 7, 48, 2, 2, 107, 109, 9, 5, 2, 2, 108, 107, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 110, 108, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111, 113, 3, 2, 2, 2, 112, 106, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 115, 3, 2, 2, 2, 114, 116, 5, 39, 20, 2, 115, 114, 3, 2, 2, 2, 115, 116, 3, 2, 2, 2, 116, 16, 3, 2, 2, 2, 117, 118, 7, 47, 2, 2, 118, 119, 7, 64, 2, 2, 119, 18, 3, 2, 2, 2, 120, 121, 7, 46, 2, 2, 121, 20, 3, 2, 2, 2, 122, 123, 7, 60, 2, 2, 123, 22, 3, 2, 2, 2, 124, 125, 7, 63, 2, 2, 125, 24, 3, 2, 2, 2, 126, 127, 7, 42, 2, 2, 127, 26, 3, 2, 2, 2, 128, 129, 7, 43, 2, 2, 129, 28, 3, 2, 2, 2, 130, 131, 7, 93, 2, 2, 131, 30, 3, 2, 2, 2, 132, 133, 7, 95, 2, 2, 133, 32, 3, 2, 2, 2, 134, 135, 7, 125, 2, 2, 135, 34, 3, 2, 2, 2, 136, 137, 7, 127, 2, 2, 137, 36, 3, 2, 2, 2, 138, 147, 7, 50, 2, 2, 139, 143, 9, 6, 2, 2, 140, 142, 9, 5, 2, 2, 141, 140, 3, 2, 2, 2, 142, 145, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 147, 3, 2, 2, 2, 145, 143, 3, 2, 2, 2, 146, 138, 3, 2, 2, 2, 146, 139, 3, 2, 2, 2, 147, 38, 3, 2, 2, 2, 148, 150, 9, 7, 2, 2, 149, 151, 9, 8, 2, 2, 150, 149, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 153, 5, 37, 19, 2, 153, 40, 3, 2, 2, 2, 154, 155, 9, 9, 2, 2, 155, 156, 3, 2, 2, 2, 156, 157, 8, 21, 2, 2, 157, 42, 3, 2, 2, 2, 158, 159, 9, 10, 2, 2, 159, 160, 3, 2, 2, 2, 160, 161, 8, 22, 2, 2, 161, 44, 3, 2, 2, 2, 162, 163, 7, 49, 2, 2, 163, 164, 7, 44, 2, 2, 164, 165, 7, 44, 2, 2, 165, 169, 3, 2, 2, 2, 166, 168, 11, 2, 2, 2, 167, 166, 3, 2, 2, 2, 168, 171, 3, 2, 2, 2, 169, 170, 3, 2, 2, 2, 169, 167, 3, 2, 2, 2, 170, 175, 3, 2, 2, 2, 171, 169, 3, 2, 2, 2, 172, 173, 7, 44, 2, 2, 173, 176, 7, 49, 2, 2, 174, 176, 7, 2, 2, 3, 175, 172, 3, 2, 2, 2, 175, 174, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 178, 8, 23, 2, 2, 178, 46, 3, 2, 2, 2, 179, 180, 7, 49, 2, 2, 180, 181, 7, 44, 2, 2, 181, 185, 3, 2, 2, 2, 182, 184, 11, 2, 2, 2, 183, 182, 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 186, 191, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 7, 44, 2, 2, 189, 192, 7, 49, 2, 2, 190, 192, 7, 2, 2, 3, 191, 188, 3, 2, 2, 2, 191, 190, 3, 2, 2, 2, 192, 193, 3, 2, 2, 2, 193, 194, 8, 24, 2, 2, 194, 48, 3, 2, 2, 2, 195, 196, 7, 49, 2, 2, 196, 197, 7, 49, 2, 2, 197, 201, 3, 2, 2, 2, 198, 200, 10, 11, 2, 2, 199, 198, 3, 2, 2, 2, 200, 203, 3, 2, 2, 2, 201, 199, 3, 2, 2, 2, 201, 202, 3, 2, 2, 2, 202, 204, 3, 2, 2, 2, 203, 201, 3, 2, 2, 2, 204, 205, 8, 25, 2, 2, 205, 50, 3, 2, 2, 2, 206, 207, 7, 49, 2, 2, 207, 208, 7, 49, 2, 2, 208, 212, 3, 2, 2, 2, 209, 211, 10, 12, 2, 2, 210, 209, 3, 2, 2, 2, 211, 214, 3, 2, 2, 2, 212, 210, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 233, 3, 2, 2, 2, 214, 212, 3, 2, 2, 2, 215, 219, 7, 12, 2, 2, 216, 218, 5, 41, 21, 2, 217, 216, 3, 2, 2, 2, 218, 221, 3, 2, 2, 2, 219, 217, 3, 2, 2, 2, 219, 220, 3, 2, 2, 2, 220, 222, 3, 2, 2, 2, 221, 219, 3, 2, 2, 2, 222, 223, 7, 49, 2, 2, 223, 224, 7, 49, 2, 2, 224, 228, 3, 2, 2, 2, 225, 227, 10, 12, 2, 2, 226, 225, 3, 2, 2, 2, 227, 230, 3, 2, 2, 2, 228, 226, 3, 2, 2, 2, 228, 229, 3, 2, 2, 2, 229, 232, 3, 2, 2, 2, 230, 228, 3, 2, 2, 2, 231, 215, 3, 2, 2, 2, 232, 235, 3, 2, 2, 2, 233, 231, 3, 2, 2, 2, 233, 234, 3, 2, 2, 2, 234, 236, 3, 2, 2, 2, 235, 233, 3, 2, 2, 2, 236, 237, 8, 26, 2, 2, 237, 52, 3, 2, 2, 2, 26, 2, 61, 75, 89, 92, 94, 97, 99, 103, 110, 112, 115, 143, 146, 150, 169, 175, 185, 191, 201, 212, 219, 228, 233, 3, 8, 2, 2] \ No newline at end of file diff --git a/Windows/Shiba/Parser/ShibaLexer.tokens b/Windows/Shiba/Parser/ShibaLexer.tokens deleted file mode 100644 index d08ccdc..0000000 --- a/Windows/Shiba/Parser/ShibaLexer.tokens +++ /dev/null @@ -1,35 +0,0 @@ -T__0=1 -Script=2 -Null=3 -String=4 -Boolean=5 -Identifier=6 -Number=7 -Arrow=8 -Comma=9 -Colon=10 -Assign=11 -LeftParen=12 -RightParen=13 -LeftBracket=14 -RightBracket=15 -LeftBrace=16 -RightBrace=17 -Hws=18 -Vws=19 -DocComment=20 -BlockComment=21 -LineComment=22 -LineCommentExt=23 -'$'=1 -'null'=3 -'->'=8 -','=9 -':'=10 -'='=11 -'('=12 -')'=13 -'['=14 -']'=15 -'{'=16 -'}'=17 diff --git a/Windows/Shiba/Parser/ShibaListener.cs b/Windows/Shiba/Parser/ShibaListener.cs deleted file mode 100644 index ec34e01..0000000 --- a/Windows/Shiba/Parser/ShibaListener.cs +++ /dev/null @@ -1,125 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.7.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from Shiba.g4 by ANTLR 4.7.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace Shiba.Parser { -using Antlr4.Runtime.Misc; -using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener; -using IToken = Antlr4.Runtime.IToken; - -/// -/// This interface defines a complete listener for a parse tree produced by -/// . -/// -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7.1")] -[System.CLSCompliant(false)] -public interface IShibaListener : IParseTreeListener { - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterView([NotNull] ShibaParser.ViewContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitView([NotNull] ShibaParser.ViewContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterProperty([NotNull] ShibaParser.PropertyContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitProperty([NotNull] ShibaParser.PropertyContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterValue([NotNull] ShibaParser.ValueContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitValue([NotNull] ShibaParser.ValueContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterMap([NotNull] ShibaParser.MapContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitMap([NotNull] ShibaParser.MapContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterBasicValue([NotNull] ShibaParser.BasicValueContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitBasicValue([NotNull] ShibaParser.BasicValueContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterFunctionCall([NotNull] ShibaParser.FunctionCallContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitFunctionCall([NotNull] ShibaParser.FunctionCallContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterShibaExtension([NotNull] ShibaParser.ShibaExtensionContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitShibaExtension([NotNull] ShibaParser.ShibaExtensionContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterArray([NotNull] ShibaParser.ArrayContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitArray([NotNull] ShibaParser.ArrayContext context); - /// - /// Enter a parse tree produced by . - /// - /// The parse tree. - void EnterIdentifier([NotNull] ShibaParser.IdentifierContext context); - /// - /// Exit a parse tree produced by . - /// - /// The parse tree. - void ExitIdentifier([NotNull] ShibaParser.IdentifierContext context); -} -} // namespace Shiba.Parser diff --git a/Windows/Shiba/Parser/ShibaParser.cs b/Windows/Shiba/Parser/ShibaParser.cs deleted file mode 100644 index f192d6a..0000000 --- a/Windows/Shiba/Parser/ShibaParser.cs +++ /dev/null @@ -1,855 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.7.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from Shiba.g4 by ANTLR 4.7.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace Shiba.Parser { -using System; -using System.IO; -using System.Text; -using System.Diagnostics; -using System.Collections.Generic; -using Antlr4.Runtime; -using Antlr4.Runtime.Atn; -using Antlr4.Runtime.Misc; -using Antlr4.Runtime.Tree; -using DFA = Antlr4.Runtime.Dfa.DFA; - -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7.1")] -[System.CLSCompliant(false)] -public partial class ShibaParser : Parser { - protected static DFA[] decisionToDFA; - protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); - public const int - T__0=1, Script=2, Null=3, String=4, Boolean=5, Identifier=6, Number=7, - Arrow=8, Comma=9, Colon=10, Assign=11, LeftParen=12, RightParen=13, LeftBracket=14, - RightBracket=15, LeftBrace=16, RightBrace=17, Hws=18, Vws=19, DocComment=20, - BlockComment=21, LineComment=22, LineCommentExt=23; - public const int - RULE_view = 0, RULE_property = 1, RULE_value = 2, RULE_map = 3, RULE_basicValue = 4, - RULE_functionCall = 5, RULE_shibaExtension = 6, RULE_array = 7, RULE_identifier = 8; - public static readonly string[] ruleNames = { - "view", "property", "value", "map", "basicValue", "functionCall", "shibaExtension", - "array", "identifier" - }; - - private static readonly string[] _LiteralNames = { - null, "'$'", null, "'null'", null, null, null, null, "'->'", "','", "':'", - "'='", "'('", "')'", "'['", "']'", "'{'", "'}'" - }; - private static readonly string[] _SymbolicNames = { - null, null, "Script", "Null", "String", "Boolean", "Identifier", "Number", - "Arrow", "Comma", "Colon", "Assign", "LeftParen", "RightParen", "LeftBracket", - "RightBracket", "LeftBrace", "RightBrace", "Hws", "Vws", "DocComment", - "BlockComment", "LineComment", "LineCommentExt" - }; - public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); - - [NotNull] - public override IVocabulary Vocabulary - { - get - { - return DefaultVocabulary; - } - } - - public override string GrammarFileName { get { return "Shiba.g4"; } } - - public override string[] RuleNames { get { return ruleNames; } } - - public override string SerializedAtn { get { return new string(_serializedATN); } } - - static ShibaParser() { - decisionToDFA = new DFA[_ATN.NumberOfDecisions]; - for (int i = 0; i < _ATN.NumberOfDecisions; i++) { - decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i); - } - } - - public ShibaParser(ITokenStream input) : this(input, Console.Out, Console.Error) { } - - public ShibaParser(ITokenStream input, TextWriter output, TextWriter errorOutput) - : base(input, output, errorOutput) - { - Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache); - } - public partial class ViewContext : ParserRuleContext { - public IdentifierContext identifier() { - return GetRuleContext(0); - } - public ITerminalNode LeftBrace() { return GetToken(ShibaParser.LeftBrace, 0); } - public ITerminalNode RightBrace() { return GetToken(ShibaParser.RightBrace, 0); } - public ITerminalNode Arrow() { return GetToken(ShibaParser.Arrow, 0); } - public ValueContext value() { - return GetRuleContext(0); - } - public PropertyContext[] property() { - return GetRuleContexts(); - } - public PropertyContext property(int i) { - return GetRuleContext(i); - } - public ViewContext[] view() { - return GetRuleContexts(); - } - public ViewContext view(int i) { - return GetRuleContext(i); - } - public ITerminalNode[] Comma() { return GetTokens(ShibaParser.Comma); } - public ITerminalNode Comma(int i) { - return GetToken(ShibaParser.Comma, i); - } - public ViewContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_view; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterView(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitView(this); - } - } - - [RuleVersion(0)] - public ViewContext view() { - ViewContext _localctx = new ViewContext(Context, State); - EnterRule(_localctx, 0, RULE_view); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 18; identifier(); - State = 38; - ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case LeftBrace: - { - State = 19; Match(LeftBrace); - State = 29; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while (_la==Identifier) { - { - { - State = 22; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,0,Context) ) { - case 1: - { - State = 20; property(); - } - break; - case 2: - { - State = 21; view(); - } - break; - } - State = 25; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if (_la==Comma) { - { - State = 24; Match(Comma); - } - } - - } - } - State = 31; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 32; Match(RightBrace); - } - break; - case Arrow: - { - State = 33; Match(Arrow); - State = 36; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) { - case 1: - { - State = 34; value(); - } - break; - case 2: - { - State = 35; property(); - } - break; - } - } - break; - case T__0: - case Null: - case String: - case Boolean: - case Identifier: - case Number: - case Comma: - case RightParen: - case LeftBracket: - case RightBracket: - case RightBrace: - break; - default: - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class PropertyContext : ParserRuleContext { - public IdentifierContext identifier() { - return GetRuleContext(0); - } - public ITerminalNode Assign() { return GetToken(ShibaParser.Assign, 0); } - public ValueContext value() { - return GetRuleContext(0); - } - public PropertyContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_property; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterProperty(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitProperty(this); - } - } - - [RuleVersion(0)] - public PropertyContext property() { - PropertyContext _localctx = new PropertyContext(Context, State); - EnterRule(_localctx, 2, RULE_property); - try { - EnterOuterAlt(_localctx, 1); - { - State = 40; identifier(); - State = 41; Match(Assign); - State = 42; value(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class ValueContext : ParserRuleContext { - public BasicValueContext basicValue() { - return GetRuleContext(0); - } - public ArrayContext array() { - return GetRuleContext(0); - } - public MapContext map() { - return GetRuleContext(0); - } - public FunctionCallContext functionCall() { - return GetRuleContext(0); - } - public ShibaExtensionContext shibaExtension() { - return GetRuleContext(0); - } - public ViewContext view() { - return GetRuleContext(0); - } - public ValueContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_value; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterValue(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitValue(this); - } - } - - [RuleVersion(0)] - public ValueContext value() { - ValueContext _localctx = new ValueContext(Context, State); - EnterRule(_localctx, 4, RULE_value); - try { - State = 50; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,5,Context) ) { - case 1: - EnterOuterAlt(_localctx, 1); - { - State = 44; basicValue(); - } - break; - case 2: - EnterOuterAlt(_localctx, 2); - { - State = 45; array(); - } - break; - case 3: - EnterOuterAlt(_localctx, 3); - { - State = 46; map(); - } - break; - case 4: - EnterOuterAlt(_localctx, 4); - { - State = 47; functionCall(); - } - break; - case 5: - EnterOuterAlt(_localctx, 5); - { - State = 48; shibaExtension(); - } - break; - case 6: - EnterOuterAlt(_localctx, 6); - { - State = 49; view(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class MapContext : ParserRuleContext { - public ITerminalNode LeftBracket() { return GetToken(ShibaParser.LeftBracket, 0); } - public ITerminalNode RightBracket() { return GetToken(ShibaParser.RightBracket, 0); } - public PropertyContext[] property() { - return GetRuleContexts(); - } - public PropertyContext property(int i) { - return GetRuleContext(i); - } - public ITerminalNode[] Comma() { return GetTokens(ShibaParser.Comma); } - public ITerminalNode Comma(int i) { - return GetToken(ShibaParser.Comma, i); - } - public MapContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_map; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterMap(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitMap(this); - } - } - - [RuleVersion(0)] - public MapContext map() { - MapContext _localctx = new MapContext(Context, State); - EnterRule(_localctx, 6, RULE_map); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 52; Match(LeftBracket); - State = 59; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while (_la==Identifier) { - { - { - State = 53; property(); - State = 55; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if (_la==Comma) { - { - State = 54; Match(Comma); - } - } - - } - } - State = 61; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 62; Match(RightBracket); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class BasicValueContext : ParserRuleContext { - public ITerminalNode String() { return GetToken(ShibaParser.String, 0); } - public ITerminalNode Number() { return GetToken(ShibaParser.Number, 0); } - public ITerminalNode Boolean() { return GetToken(ShibaParser.Boolean, 0); } - public ITerminalNode Null() { return GetToken(ShibaParser.Null, 0); } - public ITerminalNode Identifier() { return GetToken(ShibaParser.Identifier, 0); } - public BasicValueContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_basicValue; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterBasicValue(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitBasicValue(this); - } - } - - [RuleVersion(0)] - public BasicValueContext basicValue() { - BasicValueContext _localctx = new BasicValueContext(Context, State); - EnterRule(_localctx, 8, RULE_basicValue); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 64; - _la = TokenStream.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Null) | (1L << String) | (1L << Boolean) | (1L << Identifier) | (1L << Number))) != 0)) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class FunctionCallContext : ParserRuleContext { - public ITerminalNode Identifier() { return GetToken(ShibaParser.Identifier, 0); } - public ITerminalNode LeftParen() { return GetToken(ShibaParser.LeftParen, 0); } - public ITerminalNode RightParen() { return GetToken(ShibaParser.RightParen, 0); } - public ValueContext[] value() { - return GetRuleContexts(); - } - public ValueContext value(int i) { - return GetRuleContext(i); - } - public ITerminalNode[] Comma() { return GetTokens(ShibaParser.Comma); } - public ITerminalNode Comma(int i) { - return GetToken(ShibaParser.Comma, i); - } - public FunctionCallContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_functionCall; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterFunctionCall(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitFunctionCall(this); - } - } - - [RuleVersion(0)] - public FunctionCallContext functionCall() { - FunctionCallContext _localctx = new FunctionCallContext(Context, State); - EnterRule(_localctx, 10, RULE_functionCall); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 66; Match(Identifier); - State = 67; Match(LeftParen); - State = 74; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << Null) | (1L << String) | (1L << Boolean) | (1L << Identifier) | (1L << Number) | (1L << LeftBracket))) != 0)) { - { - { - State = 68; value(); - State = 70; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if (_la==Comma) { - { - State = 69; Match(Comma); - } - } - - } - } - State = 76; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 77; Match(RightParen); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class ShibaExtensionContext : ParserRuleContext { - public ITerminalNode Identifier() { return GetToken(ShibaParser.Identifier, 0); } - public BasicValueContext basicValue() { - return GetRuleContext(0); - } - public ITerminalNode Script() { return GetToken(ShibaParser.Script, 0); } - public ShibaExtensionContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_shibaExtension; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterShibaExtension(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitShibaExtension(this); - } - } - - [RuleVersion(0)] - public ShibaExtensionContext shibaExtension() { - ShibaExtensionContext _localctx = new ShibaExtensionContext(Context, State); - EnterRule(_localctx, 12, RULE_shibaExtension); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 79; Match(T__0); - State = 80; Match(Identifier); - State = 82; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,10,Context) ) { - case 1: - { - State = 81; basicValue(); - } - break; - } - State = 85; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if (_la==Script) { - { - State = 84; Match(Script); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class ArrayContext : ParserRuleContext { - public ITerminalNode LeftBracket() { return GetToken(ShibaParser.LeftBracket, 0); } - public ITerminalNode RightBracket() { return GetToken(ShibaParser.RightBracket, 0); } - public ValueContext[] value() { - return GetRuleContexts(); - } - public ValueContext value(int i) { - return GetRuleContext(i); - } - public ITerminalNode[] Comma() { return GetTokens(ShibaParser.Comma); } - public ITerminalNode Comma(int i) { - return GetToken(ShibaParser.Comma, i); - } - public ArrayContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_array; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterArray(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitArray(this); - } - } - - [RuleVersion(0)] - public ArrayContext array() { - ArrayContext _localctx = new ArrayContext(Context, State); - EnterRule(_localctx, 14, RULE_array); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 87; Match(LeftBracket); - State = 94; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << Null) | (1L << String) | (1L << Boolean) | (1L << Identifier) | (1L << Number) | (1L << LeftBracket))) != 0)) { - { - { - State = 88; value(); - State = 90; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if (_la==Comma) { - { - State = 89; Match(Comma); - } - } - - } - } - State = 96; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 97; Match(RightBracket); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class IdentifierContext : ParserRuleContext { - public ITerminalNode[] Identifier() { return GetTokens(ShibaParser.Identifier); } - public ITerminalNode Identifier(int i) { - return GetToken(ShibaParser.Identifier, i); - } - public ITerminalNode Colon() { return GetToken(ShibaParser.Colon, 0); } - public IdentifierContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_identifier; } } - public override void EnterRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.EnterIdentifier(this); - } - public override void ExitRule(IParseTreeListener listener) { - IShibaListener typedListener = listener as IShibaListener; - if (typedListener != null) typedListener.ExitIdentifier(this); - } - } - - [RuleVersion(0)] - public IdentifierContext identifier() { - IdentifierContext _localctx = new IdentifierContext(Context, State); - EnterRule(_localctx, 16, RULE_identifier); - try { - EnterOuterAlt(_localctx, 1); - { - State = 101; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,14,Context) ) { - case 1: - { - State = 99; Match(Identifier); - State = 100; Match(Colon); - } - break; - } - State = 103; Match(Identifier); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - private static char[] _serializedATN = { - '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786', - '\x5964', '\x3', '\x19', 'l', '\x4', '\x2', '\t', '\x2', '\x4', '\x3', - '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4', - '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b', - '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x3', '\x2', '\x3', - '\x2', '\x3', '\x2', '\x3', '\x2', '\x5', '\x2', '\x19', '\n', '\x2', - '\x3', '\x2', '\x5', '\x2', '\x1C', '\n', '\x2', '\a', '\x2', '\x1E', - '\n', '\x2', '\f', '\x2', '\xE', '\x2', '!', '\v', '\x2', '\x3', '\x2', - '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x5', '\x2', '\'', '\n', '\x2', - '\x5', '\x2', ')', '\n', '\x2', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', - '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', - '\x3', '\x4', '\x3', '\x4', '\x5', '\x4', '\x35', '\n', '\x4', '\x3', - '\x5', '\x3', '\x5', '\x3', '\x5', '\x5', '\x5', ':', '\n', '\x5', '\a', - '\x5', '<', '\n', '\x5', '\f', '\x5', '\xE', '\x5', '?', '\v', '\x5', - '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', '\x3', '\x6', '\x3', '\a', '\x3', - '\a', '\x3', '\a', '\x3', '\a', '\x5', '\a', 'I', '\n', '\a', '\a', '\a', - 'K', '\n', '\a', '\f', '\a', '\xE', '\a', 'N', '\v', '\a', '\x3', '\a', - '\x3', '\a', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x5', '\b', 'U', - '\n', '\b', '\x3', '\b', '\x5', '\b', 'X', '\n', '\b', '\x3', '\t', '\x3', - '\t', '\x3', '\t', '\x5', '\t', ']', '\n', '\t', '\a', '\t', '_', '\n', - '\t', '\f', '\t', '\xE', '\t', '\x62', '\v', '\t', '\x3', '\t', '\x3', - '\t', '\x3', '\n', '\x3', '\n', '\x5', '\n', 'h', '\n', '\n', '\x3', '\n', - '\x3', '\n', '\x3', '\n', '\x2', '\x2', '\v', '\x2', '\x4', '\x6', '\b', - '\n', '\f', '\xE', '\x10', '\x12', '\x2', '\x3', '\x3', '\x2', '\x5', - '\t', '\x2', 'v', '\x2', '\x14', '\x3', '\x2', '\x2', '\x2', '\x4', '*', - '\x3', '\x2', '\x2', '\x2', '\x6', '\x34', '\x3', '\x2', '\x2', '\x2', - '\b', '\x36', '\x3', '\x2', '\x2', '\x2', '\n', '\x42', '\x3', '\x2', - '\x2', '\x2', '\f', '\x44', '\x3', '\x2', '\x2', '\x2', '\xE', 'Q', '\x3', - '\x2', '\x2', '\x2', '\x10', 'Y', '\x3', '\x2', '\x2', '\x2', '\x12', - 'g', '\x3', '\x2', '\x2', '\x2', '\x14', '(', '\x5', '\x12', '\n', '\x2', - '\x15', '\x1F', '\a', '\x12', '\x2', '\x2', '\x16', '\x19', '\x5', '\x4', - '\x3', '\x2', '\x17', '\x19', '\x5', '\x2', '\x2', '\x2', '\x18', '\x16', - '\x3', '\x2', '\x2', '\x2', '\x18', '\x17', '\x3', '\x2', '\x2', '\x2', - '\x19', '\x1B', '\x3', '\x2', '\x2', '\x2', '\x1A', '\x1C', '\a', '\v', - '\x2', '\x2', '\x1B', '\x1A', '\x3', '\x2', '\x2', '\x2', '\x1B', '\x1C', - '\x3', '\x2', '\x2', '\x2', '\x1C', '\x1E', '\x3', '\x2', '\x2', '\x2', - '\x1D', '\x18', '\x3', '\x2', '\x2', '\x2', '\x1E', '!', '\x3', '\x2', - '\x2', '\x2', '\x1F', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x1F', ' ', - '\x3', '\x2', '\x2', '\x2', ' ', '\"', '\x3', '\x2', '\x2', '\x2', '!', - '\x1F', '\x3', '\x2', '\x2', '\x2', '\"', ')', '\a', '\x13', '\x2', '\x2', - '#', '&', '\a', '\n', '\x2', '\x2', '$', '\'', '\x5', '\x6', '\x4', '\x2', - '%', '\'', '\x5', '\x4', '\x3', '\x2', '&', '$', '\x3', '\x2', '\x2', - '\x2', '&', '%', '\x3', '\x2', '\x2', '\x2', '\'', ')', '\x3', '\x2', - '\x2', '\x2', '(', '\x15', '\x3', '\x2', '\x2', '\x2', '(', '#', '\x3', - '\x2', '\x2', '\x2', '(', ')', '\x3', '\x2', '\x2', '\x2', ')', '\x3', - '\x3', '\x2', '\x2', '\x2', '*', '+', '\x5', '\x12', '\n', '\x2', '+', - ',', '\a', '\r', '\x2', '\x2', ',', '-', '\x5', '\x6', '\x4', '\x2', '-', - '\x5', '\x3', '\x2', '\x2', '\x2', '.', '\x35', '\x5', '\n', '\x6', '\x2', - '/', '\x35', '\x5', '\x10', '\t', '\x2', '\x30', '\x35', '\x5', '\b', - '\x5', '\x2', '\x31', '\x35', '\x5', '\f', '\a', '\x2', '\x32', '\x35', - '\x5', '\xE', '\b', '\x2', '\x33', '\x35', '\x5', '\x2', '\x2', '\x2', - '\x34', '.', '\x3', '\x2', '\x2', '\x2', '\x34', '/', '\x3', '\x2', '\x2', - '\x2', '\x34', '\x30', '\x3', '\x2', '\x2', '\x2', '\x34', '\x31', '\x3', - '\x2', '\x2', '\x2', '\x34', '\x32', '\x3', '\x2', '\x2', '\x2', '\x34', - '\x33', '\x3', '\x2', '\x2', '\x2', '\x35', '\a', '\x3', '\x2', '\x2', - '\x2', '\x36', '=', '\a', '\x10', '\x2', '\x2', '\x37', '\x39', '\x5', - '\x4', '\x3', '\x2', '\x38', ':', '\a', '\v', '\x2', '\x2', '\x39', '\x38', - '\x3', '\x2', '\x2', '\x2', '\x39', ':', '\x3', '\x2', '\x2', '\x2', ':', - '<', '\x3', '\x2', '\x2', '\x2', ';', '\x37', '\x3', '\x2', '\x2', '\x2', - '<', '?', '\x3', '\x2', '\x2', '\x2', '=', ';', '\x3', '\x2', '\x2', '\x2', - '=', '>', '\x3', '\x2', '\x2', '\x2', '>', '@', '\x3', '\x2', '\x2', '\x2', - '?', '=', '\x3', '\x2', '\x2', '\x2', '@', '\x41', '\a', '\x11', '\x2', - '\x2', '\x41', '\t', '\x3', '\x2', '\x2', '\x2', '\x42', '\x43', '\t', - '\x2', '\x2', '\x2', '\x43', '\v', '\x3', '\x2', '\x2', '\x2', '\x44', - '\x45', '\a', '\b', '\x2', '\x2', '\x45', 'L', '\a', '\xE', '\x2', '\x2', - '\x46', 'H', '\x5', '\x6', '\x4', '\x2', 'G', 'I', '\a', '\v', '\x2', - '\x2', 'H', 'G', '\x3', '\x2', '\x2', '\x2', 'H', 'I', '\x3', '\x2', '\x2', - '\x2', 'I', 'K', '\x3', '\x2', '\x2', '\x2', 'J', '\x46', '\x3', '\x2', - '\x2', '\x2', 'K', 'N', '\x3', '\x2', '\x2', '\x2', 'L', 'J', '\x3', '\x2', - '\x2', '\x2', 'L', 'M', '\x3', '\x2', '\x2', '\x2', 'M', 'O', '\x3', '\x2', - '\x2', '\x2', 'N', 'L', '\x3', '\x2', '\x2', '\x2', 'O', 'P', '\a', '\xF', - '\x2', '\x2', 'P', '\r', '\x3', '\x2', '\x2', '\x2', 'Q', 'R', '\a', '\x3', - '\x2', '\x2', 'R', 'T', '\a', '\b', '\x2', '\x2', 'S', 'U', '\x5', '\n', - '\x6', '\x2', 'T', 'S', '\x3', '\x2', '\x2', '\x2', 'T', 'U', '\x3', '\x2', - '\x2', '\x2', 'U', 'W', '\x3', '\x2', '\x2', '\x2', 'V', 'X', '\a', '\x4', - '\x2', '\x2', 'W', 'V', '\x3', '\x2', '\x2', '\x2', 'W', 'X', '\x3', '\x2', - '\x2', '\x2', 'X', '\xF', '\x3', '\x2', '\x2', '\x2', 'Y', '`', '\a', - '\x10', '\x2', '\x2', 'Z', '\\', '\x5', '\x6', '\x4', '\x2', '[', ']', - '\a', '\v', '\x2', '\x2', '\\', '[', '\x3', '\x2', '\x2', '\x2', '\\', - ']', '\x3', '\x2', '\x2', '\x2', ']', '_', '\x3', '\x2', '\x2', '\x2', - '^', 'Z', '\x3', '\x2', '\x2', '\x2', '_', '\x62', '\x3', '\x2', '\x2', - '\x2', '`', '^', '\x3', '\x2', '\x2', '\x2', '`', '\x61', '\x3', '\x2', - '\x2', '\x2', '\x61', '\x63', '\x3', '\x2', '\x2', '\x2', '\x62', '`', - '\x3', '\x2', '\x2', '\x2', '\x63', '\x64', '\a', '\x11', '\x2', '\x2', - '\x64', '\x11', '\x3', '\x2', '\x2', '\x2', '\x65', '\x66', '\a', '\b', - '\x2', '\x2', '\x66', 'h', '\a', '\f', '\x2', '\x2', 'g', '\x65', '\x3', - '\x2', '\x2', '\x2', 'g', 'h', '\x3', '\x2', '\x2', '\x2', 'h', 'i', '\x3', - '\x2', '\x2', '\x2', 'i', 'j', '\a', '\b', '\x2', '\x2', 'j', '\x13', - '\x3', '\x2', '\x2', '\x2', '\x11', '\x18', '\x1B', '\x1F', '&', '(', - '\x34', '\x39', '=', 'H', 'L', 'T', 'W', '\\', '`', 'g', - }; - - public static readonly ATN _ATN = - new ATNDeserializer().Deserialize(_serializedATN); - - -} -} // namespace Shiba.Parser diff --git a/Windows/Shiba/Parser/ShibaParserWrapper.cs b/Windows/Shiba/Parser/ShibaParserWrapper.cs index 17132ab..35c5a6f 100644 --- a/Windows/Shiba/Parser/ShibaParserWrapper.cs +++ b/Windows/Shiba/Parser/ShibaParserWrapper.cs @@ -2,16 +2,17 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using Antlr4.Runtime; -using Antlr4.Runtime.Tree; +using System.Xml.Linq; using Shiba.Controls; +using Shiba.Internal; namespace Shiba.Parser { internal interface IShibaVisitor { Type HandleType { get; } - object Visit(IParseTree tree); + Type ReturnType { get; } + object Visit(object tree); } internal abstract class ShibaVisitor : IShibaVisitor @@ -31,154 +32,167 @@ static ShibaVisitor() } public abstract Type HandleType { get; } - public abstract object Visit(IParseTree tree); - - protected internal static object GetValue(IParseTree tree) + public abstract Type ReturnType { get; } + public abstract object Visit(object tree); + + //protected internal static object GetValue(object tree) + //{ + // if (tree == null) return null; + // var visitor = Visitors.FirstOrDefault(it => it.HandleType == tree.GetType()); + + // return visitor.Visit(tree); + //} + + protected internal static T GetValue(object tree) { - if (tree == null) return null; - var visitor = Visitors.FirstOrDefault(it => it.HandleType == tree.GetType()); - if (visitor == null) - { - if (tree is ParserRuleContext parserRuleContext) - return GetValue(parserRuleContext.children.FirstOrDefault(it => it is ParserRuleContext)); - - return null; - } + if (tree == null) return default; + var visitor = Visitors.FirstOrDefault(it => it.HandleType == tree.GetType() && it.ReturnType == typeof(T)); - return visitor.Visit(tree); - } + var value = visitor.Visit(tree); - protected static T GetValue(IParseTree tree) - { - var value = GetValue(tree); if (value is T result) return result; return default; } } - internal abstract class GenericVisitor : ShibaVisitor - where T : class, IParseTree { public override Type HandleType { get; } = typeof(T); + public override Type ReturnType { get; } = typeof(K); - public override object Visit(IParseTree tree) + public override object Visit(object tree) { - return Parse(tree as T); + if (tree is T t) + { + return Parse(t); + } + + return null; } protected abstract K Parse(T tree); } - internal sealed class ViewVisitor : GenericVisitor + internal sealed class ViewVisitor : GenericVisitor { - protected override View Parse(ShibaParser.ViewContext tree) + protected override View Parse(XElement tree) { - var viewName = GetValue(tree.identifier()); - var view = new View(viewName, GetValue(tree.value())); + var viewName = GetValue(tree.Name); + var view = new View(viewName, tree.ToString()); - if (tree.property() != null) view.Properties.AddRange(tree.property().Select(GetValue)); + view.Properties.AddRange(tree.Attributes().Select(GetValue)); + var propertyElement = tree.Elements() + .Where(it => + it.Name.LocalName.Contains(".") && + it.Name.LocalName.Split('.').FirstOrDefault() == viewName.Value && + it.Name.NamespaceName == viewName.Prefix).ToList(); + view.Properties.AddRange(propertyElement + .Select(GetValue)); - if (tree.view() != null) - view.Children.AddRange(tree.view().Select(it => - { - var child = GetValue(it); - child.Parent = view; - return child; - })); + view.Children.AddRange(tree.Elements().Except(propertyElement).Select(it => + { + var child = GetValue(it); + child.Parent = view; + return child; + })); return view; } } - internal sealed class PropertyVisitor : GenericVisitor + internal sealed class PropertyElementVisitor : PropertyBaseVisitor { - protected override Property Parse(ShibaParser.PropertyContext tree) + protected override Property Parse(XElement tree) { - var tokenName = GetValue(tree.identifier()); - var value = GetValue(tree.value()); - return new Property(tokenName, value); + var name = GetValue(tree.Name); + if (tree.HasElements) + { + return new Property(name, GetValue(tree.Elements().FirstOrDefault())); + } + else + { + return new Property(name, GetPropertyValue(tree.Value)); + } } } - //internal sealed class ValueVisitor : GenericVisitor - //{ - // protected override object Parse(ShibaParser.ValueContext tree) - // { - // return GetValue(tree.children.FirstOrDefault(it => it is ParserRuleContext)); - // } - //} - - internal sealed class ShibaTokenVisitor : GenericVisitor + internal abstract class PropertyBaseVisitor : GenericVisitor { - protected override ShibaToken Parse(ShibaParser.IdentifierContext tree) + private const char OpenCurly = '{'; + private const char CloseCurly = '}'; + private const char OpenBracket = '['; + private const char CloseBracket = ']'; + + protected object GetPropertyValue(string value) { - switch (tree.Identifier()?.Length) + value = value.Trim(); + var subValue = value.Substring(1, value.Length - 2); + if (value.StartsWith(OpenCurly) && value.EndsWith(CloseCurly)) + { + // TODO: Find a better way + var function = GetValue(subValue); + if (function != null) + { + return function; + } + var extension = GetValue(subValue); + if (extension != null) + { + return extension; + } + } + else if (value.StartsWith(OpenBracket) && value.EndsWith(CloseBracket)) { - case 1: - return new ShibaToken(tree.Identifier().FirstOrDefault()?.GetText()); - case 2: - return new ShibaToken(tree.Identifier().FirstOrDefault()?.GetText(), - tree.Identifier().Skip(1).FirstOrDefault()?.GetText()); - default: - throw new ArgumentOutOfRangeException(); + return GetValue(subValue); } + + return value; } } - internal sealed class ShibaMapVisitor : GenericVisitor + internal sealed class PropertyVisitor : PropertyBaseVisitor { - protected override ShibaMap Parse(ShibaParser.MapContext tree) + protected override Property Parse(XAttribute tree) { - var obj = new ShibaMap(); - if (tree.property() != null) obj.Properties.AddRange(tree.property().Select(GetValue)); - - return obj; + var tokenName = GetValue(tree.Name); + return new Property(tokenName, GetPropertyValue(tree.Value)); } } - internal sealed class BasicValueVisitor : GenericVisitor + internal sealed class ShibaTokenVisitor : GenericVisitor { - protected override BasicValue Parse(ShibaParser.BasicValueContext tree) + protected override ShibaToken Parse(XName tree) { - ShibaValueType type; - object targetValue; - var token = tree.children.FirstOrDefault() as ITerminalNode; - switch (token?.Symbol.Type) + if (tree.LocalName.Contains('.')) + { + return new ShibaToken(tree.LocalName.Split('.').Skip(1).FirstOrDefault()); + } + if (string.IsNullOrEmpty(tree.NamespaceName)) { - case ShibaParser.String: - type = ShibaValueType.String; - targetValue = token.GetText().Trim('"'); - break; - case ShibaParser.Number: - type = ShibaValueType.Number; - targetValue = Convert.ToDecimal(token.GetText()); - break; - case ShibaParser.Boolean: - type = ShibaValueType.Boolean; - targetValue = Convert.ToBoolean(token.GetText()); - break; - case ShibaParser.Null: - type = ShibaValueType.Null; - targetValue = null; - break; - case ShibaParser.Identifier: - type = ShibaValueType.Token; - targetValue = token.GetText(); - break; - default: - throw new ArgumentOutOfRangeException(); + return new ShibaToken(tree.LocalName); } + return new ShibaToken(tree.NamespaceName, tree.LocalName); + } + } - var value = new BasicValue(type, targetValue); - return value; + internal sealed class ShibaMapVisitor : GenericVisitor + { + private const char EqualSign = '='; + private const char Comma = ','; + protected override ShibaMap Parse(string tree) + { + return new ShibaMap(tree + .Split(Comma) + .Select(it => it.Trim()) + .Select(it => it.Split(EqualSign)) + .ToDictionary(it => it.FirstOrDefault(), it => it.Skip(1).FirstOrDefault())); } } - internal sealed class FunctionVisitor : GenericVisitor + internal sealed class FunctionVisitor : GenericVisitor { - protected override ShibaFunction Parse(ShibaParser.FunctionCallContext tree) + protected override ShibaFunction Parse(string tree) { var name = tree.Identifier().GetText(); var function = new ShibaFunction(name); @@ -188,45 +202,47 @@ protected override ShibaFunction Parse(ShibaParser.FunctionCallContext tree) } } - internal sealed class ShibaExtensionVisitor : GenericVisitor + internal sealed class ShibaExtensionVisitor : GenericVisitor { - protected override ShibaExtension Parse(ShibaParser.ShibaExtensionContext tree) - { - var name = tree.Identifier().GetText(); - var value = GetValue(tree.basicValue()); - var script = tree.Script()?.GetText(); - var extension = new ShibaExtension(name, value, script); - return extension; - } - } + private const char ExtensionStart = '$'; + private const char Comma = ','; + private const char EqualSign = '='; - internal sealed class ShibaArrayVisitor : GenericVisitor - { - protected override ShibaArray Parse(ShibaParser.ArrayContext tree) + protected override ShibaExtension Parse(string tree) { - var value = new ShibaArray(); - if (tree.value() != null) value.AddRange(tree.value().Select(GetValue)); + if (!tree.StartsWith(ExtensionStart)) + { + return null; + } - return value; + // Checking for extension name + var value = tree.TrimStart(ExtensionStart); + var index = value.IndexOf(' '); + var name = value.Substring(0, index); + // Checking for extension value + value = value.Substring(index + 1, value.Length - index - 1); + index = value.IndexOf(Comma); + if (index == -1)// value only contains binding like {$bind path} + { + return new ShibaExtension(name.Trim(), value.Trim(), string.Empty); + } + // or value contains some other stuff link {$bind path, script={hello}} + value = value.Substring(index + 1, value.Length - index - 1).Trim(); + var attrs = value.Split(Comma).Select(it => it.Split(EqualSign)) } } public class ShibaParserWrapper { - public object Parse(string input) + public View Parse(string input) { var tree = ParseGrammarTree(input); - return ShibaVisitor.GetValue(tree); + return ShibaVisitor.GetValue(tree); } - private IParseTree ParseGrammarTree(string input) + private XElement ParseGrammarTree(string input) { - var stream = CharStreams.fromstring(input); - var lexer = new ShibaLexer(stream); - var tokens = new CommonTokenStream(lexer); - var parser = new ShibaParser(tokens) {BuildParseTree = true}; - - return parser.view(); + return XDocument.Parse(input).Root; } } } \ No newline at end of file diff --git a/Windows/Shiba/Shiba.csproj b/Windows/Shiba/Shiba.csproj index b422baa..dfb28f1 100644 --- a/Windows/Shiba/Shiba.csproj +++ b/Windows/Shiba/Shiba.csproj @@ -145,10 +145,6 @@ - - - - @@ -173,9 +169,6 @@ - - 4.7.2 - 6.2.3 @@ -183,12 +176,6 @@ 12.0.1 - - - - - - {c5d6ed6a-c8b9-4bed-a226-d1acfaa763e0} diff --git a/Windows/Shiba/ViewMappers/ViewMapper.cs b/Windows/Shiba/ViewMappers/ViewMapper.cs index 8209c9b..aa3f82f 100644 --- a/Windows/Shiba/ViewMappers/ViewMapper.cs +++ b/Windows/Shiba/ViewMappers/ViewMapper.cs @@ -112,8 +112,7 @@ public TNativeView Map(ShibaView view, IShibaContext context) foreach (var property in view.Properties) { - if (!string.IsNullOrEmpty(property.Name.Prefix) && - property.Name.Prefix != ShibaApp.Instance.Configuration.PlatformType) + if (!property.Name.IsCurrentPlatform()) continue; var cache = _propertyCache.FirstOrDefault(it => it.Name == property.Name.Value); diff --git a/Windows/Shiba/Visitors/ValueVisitor.cs b/Windows/Shiba/Visitors/ValueVisitor.cs index 53aeed9..11f1f1f 100644 --- a/Windows/Shiba/Visitors/ValueVisitor.cs +++ b/Windows/Shiba/Visitors/ValueVisitor.cs @@ -77,7 +77,7 @@ protected override NativeView Parse(View view, IShibaContext context) { var attribute = ShibaApp.Instance.ViewMapping.Mappers.LastOrDefault(it => - view.ViewName.IsCurrentPlatform(it.ViewName)); + view.ViewName.IsCurrentPlatformAndCheckValue(it.ViewName)); if (attribute == null) return null; var renderer = Renderer.GetOrAdd(attribute.ViewName, type => CreateRenderer(attribute)); @@ -104,7 +104,7 @@ protected override NativeView Parse(View view, IShibaContext context) { ShibaApp.Instance.Configuration.CommonProperties .Where(cp => cp.Name == prop.Name.Value).ToList() - .ForEach(cp => cp.Handle(prop.Value, it.native, target)); + .ForEach(cp => cp.Handle(prop.Value, it.view, it.native, target)); }); }); } @@ -276,21 +276,21 @@ private ShibaFunction ParseFunction(ShibaFunction item, IShibaContext context) // } // } - internal sealed class ShibaArrayVisitor : GenericVisitor> - { - protected override IEnumerable Parse(ShibaArray item, IShibaContext context) - { - var shibaArray = new ShibaArray(); - shibaArray.AddRange(item.Select(it => GetValue(it, context))); - return shibaArray; - } - } - - internal sealed class BacisValueVisitor : GenericVisitor - { - protected override object Parse(BasicValue item, IShibaContext context) - { - return item.Value; - } - } + //internal sealed class ShibaArrayVisitor : GenericVisitor> + //{ + // protected override IEnumerable Parse(ShibaArray item, IShibaContext context) + // { + // var shibaArray = new ShibaArray(); + // shibaArray.AddRange(item.Select(it => GetValue(it, context))); + // return shibaArray; + // } + //} + + //internal sealed class BacisValueVisitor : GenericVisitor + //{ + // protected override object Parse(BasicValue item, IShibaContext context) + // { + // return item.Value; + // } + //} } \ No newline at end of file From e711a8fa1d34c5de7215beb7f48c71f62713aa55 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Thu, 14 Feb 2019 15:11:15 +0800 Subject: [PATCH 11/27] [UWP] Complete xml parsing --- Windows/Sample/Shiba.UWP.Sample/MainPage.xaml | 10 +-- Windows/Shiba.Test/UnitTest.cs | 4 ++ Windows/Shiba/ConvertExtensions.cs | 12 +++- Windows/Shiba/Parser/ShibaParserWrapper.cs | 64 +++++++++++++------ 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml index b2664bf..e26d47d 100644 --- a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml +++ b/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml @@ -14,17 +14,11 @@ - text -> $bind ${ - if (it === null) return null; - return it.hello.world - } + <text text="$bind ,{ if (it === null) return null; return it.hello.world }" /> - text -> $bind ${ - if (it === null) return null; - return it.hello.world - } + <text text="$bind ,{ if (it === null) return null; return it.hello.world }" /> ) - .add('with some emoji', () => ( - - )); - -storiesOf("shiba", module).add( - "sample", () => ( - \"hello world!\" input}"}/> - )); diff --git a/React/tsconfig.json b/React/tsconfig.json deleted file mode 100644 index e083b32..0000000 --- a/React/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "outDir": "build/dist", - "module": "esnext", - "target": "es5", - "lib": ["es6", "dom"], - "sourceMap": true, - "allowJs": true, - "jsx": "react", - "moduleResolution": "node", - "rootDir": "src", - "forceConsistentCasingInFileNames": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noImplicitAny": true, - "strictNullChecks": true, - "suppressImplicitAnyIndexErrors": true, - "noUnusedLocals": true, - "rootDirs": ["src", "stories"] - }, - "exclude": [ - "node_modules", - "build", - "scripts", - "acceptance-tests", - "webpack", - "jest", - "sample/setupTests.ts" - ] -} diff --git a/React/tsconfig.prod.json b/React/tsconfig.prod.json deleted file mode 100644 index 4144216..0000000 --- a/React/tsconfig.prod.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./tsconfig.json" -} \ No newline at end of file diff --git a/React/tsconfig.test.json b/React/tsconfig.test.json deleted file mode 100644 index 65ffdd4..0000000 --- a/React/tsconfig.test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs" - } -} \ No newline at end of file diff --git a/React/tslint.json b/React/tslint.json deleted file mode 100644 index 2880d80..0000000 --- a/React/tslint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], - "linterOptions": { - "exclude": [ - "config/**/*.js", - "node_modules/**/*.ts", - "coverage/lcov-report/*.js", - "src/parser/*.js" - ] - } -} From 44cde46e98fc29161203029eeedceffc9a6eee30 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sun, 17 Feb 2019 20:25:53 +0800 Subject: [PATCH 20/27] [UWP] Rename Windows to UWP --- {Windows => UWP}/ChakraHosting/ChakraHost.cs | 0 {Windows => UWP}/ChakraHosting/ChakraHosting.csproj | 0 .../JavaScriptBackgroundWorkItemCallback.cs | 0 .../JavaScriptBeforeCollectCallback.cs | 0 {Windows => UWP}/ChakraHosting/JavaScriptContext.cs | 0 .../ChakraHosting/JavaScriptEngineException.cs | 0 .../ChakraHosting/JavaScriptErrorCode.cs | 0 .../ChakraHosting/JavaScriptException.cs | 0 .../ChakraHosting/JavaScriptFatalException.cs | 0 .../JavaScriptMemoryAllocationCallback.cs | 0 .../ChakraHosting/JavaScriptMemoryEventType.cs | 0 .../ChakraHosting/JavaScriptNativeFunction.cs | 0 .../JavaScriptObjectBeforeCollectCallback.cs | 0 .../JavaScriptObjectFinalizeCallback.cs | 0 .../JavaScriptProjectionEnqueueCallback.cs | 0 .../JavaScriptPromiseContinuationCallback.cs | 0 .../ChakraHosting/JavaScriptPropertyId.cs | 0 .../ChakraHosting/JavaScriptPropertyIdType.cs | 0 {Windows => UWP}/ChakraHosting/JavaScriptRuntime.cs | 0 .../ChakraHosting/JavaScriptRuntimeAttributes.cs | 0 .../ChakraHosting/JavaScriptRuntimeVersion.cs | 0 .../ChakraHosting/JavaScriptScriptException.cs | 0 .../JavaScriptSerializedScriptLoadSourceCallback.cs | 0 .../JavaScriptSerializedScriptUnloadCallback.cs | 0 .../ChakraHosting/JavaScriptSourceContext.cs | 0 .../JavaScriptThreadServiceCallback.cs | 0 .../ChakraHosting/JavaScriptTypedArrayType.cs | 0 .../ChakraHosting/JavaScriptUsageException.cs | 0 {Windows => UWP}/ChakraHosting/JavaScriptValue.cs | 0 .../ChakraHosting/JavaScriptValueType.cs | 0 {Windows => UWP}/ChakraHosting/Native.cs | 0 .../ChakraHosting/Properties/AssemblyInfo.cs | 0 .../ChakraHosting/Properties/ChakraHosting.rd.xml | 0 .../Assets/AboutAssets.txt | 0 .../Shiba.Forms.Sample.Android/MainActivity.cs | 0 .../Properties/AndroidManifest.xml | 0 .../Properties/AssemblyInfo.cs | 0 .../Resources/AboutResources.txt | 0 .../Resources/Resource.designer.cs | 0 .../Resources/layout/Tabbar.axml | 0 .../Resources/layout/Toolbar.axml | 0 .../Resources/mipmap-anydpi-v26/icon.xml | 0 .../Resources/mipmap-anydpi-v26/icon_round.xml | 0 .../Resources/mipmap-hdpi/Icon.png | Bin .../Resources/mipmap-hdpi/launcher_foreground.png | Bin .../Resources/mipmap-mdpi/icon.png | Bin .../Resources/mipmap-mdpi/launcher_foreground.png | Bin .../Resources/mipmap-xhdpi/Icon.png | Bin .../Resources/mipmap-xhdpi/launcher_foreground.png | Bin .../Resources/mipmap-xxhdpi/Icon.png | Bin .../Resources/mipmap-xxhdpi/launcher_foreground.png | Bin .../Resources/mipmap-xxxhdpi/Icon.png | Bin .../mipmap-xxxhdpi/launcher_foreground.png | Bin .../Resources/values/colors.xml | 0 .../Resources/values/styles.xml | 0 .../Shiba.Forms.Sample.Android.csproj | 0 .../Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml | 0 .../Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs | 0 .../Assets/LargeTile.scale-100.png | Bin .../Assets/LargeTile.scale-200.png | Bin .../Assets/LargeTile.scale-400.png | Bin .../Assets/SmallTile.scale-100.png | Bin .../Assets/SmallTile.scale-200.png | Bin .../Assets/SmallTile.scale-400.png | Bin .../Assets/SplashScreen.scale-100.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/SplashScreen.scale-400.png | Bin .../Assets/Square150x150Logo.scale-100.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square150x150Logo.scale-400.png | Bin ...uare44x44Logo.altform-unplated_targetsize-16.png | Bin ...are44x44Logo.altform-unplated_targetsize-256.png | Bin ...uare44x44Logo.altform-unplated_targetsize-48.png | Bin .../Assets/Square44x44Logo.scale-100.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-400.png | Bin .../Assets/Square44x44Logo.targetsize-16.png | Bin .../Assets/Square44x44Logo.targetsize-256.png | Bin .../Assets/Square44x44Logo.targetsize-48.png | Bin .../Assets/StoreLogo.backup.png | Bin .../Assets/StoreLogo.scale-100.png | Bin .../Assets/StoreLogo.scale-200.png | Bin .../Assets/StoreLogo.scale-400.png | Bin .../Assets/Wide310x150Logo.scale-100.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin .../Assets/Wide310x150Logo.scale-400.png | Bin .../Forms/Shiba.Forms.Sample.UWP/MainPage.xaml | 0 .../Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs | 0 .../Shiba.Forms.Sample.UWP/Package.appxmanifest | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Default.rd.xml | 0 .../Shiba.Forms.Sample.UWP.csproj | 0 .../Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/AppIcon.appiconset/Icon1024.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon120.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon152.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon167.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon180.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon20.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon29.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon40.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon58.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon60.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon76.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon80.png | Bin .../Assets.xcassets/AppIcon.appiconset/Icon87.png | Bin .../Forms/Shiba.Forms.Sample.iOS/Entitlements.plist | 0 .../Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist | 0 .../Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../Resources/Default-568h@2x.png | Bin .../Resources/Default-Portrait.png | Bin .../Resources/Default-Portrait@2x.png | Bin .../Shiba.Forms.Sample.iOS/Resources/Default.png | Bin .../Shiba.Forms.Sample.iOS/Resources/Default@2x.png | Bin .../Resources/LaunchScreen.storyboard | 0 .../Shiba.Forms.Sample.iOS.csproj | 0 .../Sample/Forms/Shiba.Forms.Sample/App.xaml | 0 .../Sample/Forms/Shiba.Forms.Sample/App.xaml.cs | 0 .../Sample/Forms/Shiba.Forms.Sample/MainPage.xaml | 0 .../Forms/Shiba.Forms.Sample/MainPage.xaml.cs | 0 .../Shiba.Forms.Sample/Shiba.Forms.Sample.csproj | 0 {Windows => UWP}/Sample/Shiba.UWP.Sample/App.xaml | 0 .../Sample/Shiba.UWP.Sample/App.xaml.cs | 0 .../Assets/LockScreenLogo.scale-200.png | Bin .../Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Assets/Square44x44Logo.scale-200.png | Bin ...uare44x44Logo.targetsize-24_altform-unplated.png | Bin .../Sample/Shiba.UWP.Sample/Assets/StoreLogo.png | Bin .../Assets/Wide310x150Logo.scale-200.png | Bin .../Sample/Shiba.UWP.Sample/LivePage.xaml | 0 .../Sample/Shiba.UWP.Sample/LivePage.xaml.cs | 0 .../Sample/Shiba.UWP.Sample/MainPage.xaml | 0 .../Sample/Shiba.UWP.Sample/MainPage.xaml.cs | 0 .../Sample/Shiba.UWP.Sample/Package.appxmanifest | 0 .../Shiba.UWP.Sample/Properties/AssemblyInfo.cs | 0 .../Shiba.UWP.Sample/Properties/Default.rd.xml | 0 .../Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj | 0 {Windows => UWP}/Sample/Shiba.WPF.Sample/App.xaml | 0 .../Sample/Shiba.WPF.Sample/App.xaml.cs | 0 .../Sample/Shiba.WPF.Sample/MainWindow.xaml | 0 .../Sample/Shiba.WPF.Sample/MainWindow.xaml.cs | 0 .../Shiba.WPF.Sample/Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Shiba.WPF.Sample/Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Shiba.WPF.Sample/Properties/Settings.settings | 0 .../Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj | 0 {Windows => UWP}/Sample/Shiba.WPF.Sample/app.config | 0 .../Sample/Shiba.WPF.Sample/packages.config | 0 .../Shiba.Test/Assets/LockScreenLogo.scale-200.png | Bin .../Shiba.Test/Assets/SplashScreen.scale-200.png | Bin .../Assets/Square150x150Logo.scale-200.png | Bin .../Shiba.Test/Assets/Square44x44Logo.scale-200.png | Bin ...uare44x44Logo.targetsize-24_altform-unplated.png | Bin {Windows => UWP}/Shiba.Test/Assets/StoreLogo.png | Bin .../Shiba.Test/Assets/Wide310x150Logo.scale-200.png | Bin {Windows => UWP}/Shiba.Test/Package.appxmanifest | 0 .../Shiba.Test/Properties/AssemblyInfo.cs | 0 .../Shiba.Test/Properties/UnitTestApp.rd.xml | 0 {Windows => UWP}/Shiba.Test/Shiba.Test.csproj | 0 {Windows => UWP}/Shiba.Test/UnitTest.cs | 0 {Windows => UWP}/Shiba.Test/UnitTestApp.xaml | 0 {Windows => UWP}/Shiba.Test/UnitTestApp.xaml.cs | 0 {Windows => UWP}/Shiba.nuspec | 0 {Windows => UWP}/Shiba.sln | 0 .../Shiba/CommonProperty/CommonProperty.cs | 0 .../Shiba/CommonProperty/GridProperty.cs | 0 .../Shiba/CommonProperty/ICommonProperty.cs | 0 .../Shiba/CommonProperty/RelativeProperty.cs | 0 .../Shiba/Controls/ExportMapperAttribute.cs | 0 {Windows => UWP}/Shiba/Controls/IViewRenderer.cs | 0 {Windows => UWP}/Shiba/Controls/View.cs | 0 {Windows => UWP}/Shiba/Controls/ViewMapping.cs | 0 {Windows => UWP}/Shiba/ConvertExtensions.cs | 0 {Windows => UWP}/Shiba/Converter.cs | 0 .../Shiba/ExtensionExecutors/BindingExecutor.cs | 0 .../ExtensionExecutors/IBindingExtensionExecutor.cs | 0 .../Shiba/ExtensionExecutors/IShibaExtension.cs | 0 {Windows => UWP}/Shiba/Extensions.cs | 0 {Windows => UWP}/Shiba/Internal/Singleton.cs | 0 {Windows => UWP}/Shiba/NativeRenderer.cs | 0 {Windows => UWP}/Shiba/Parser/ShibaParserWrapper.cs | 0 {Windows => UWP}/Shiba/Properties/AssemblyInfo.cs | 0 {Windows => UWP}/Shiba/Properties/Shiba.rd.xml | 0 .../Shiba/Scripting/Conversion/JTokenConversion.cs | 0 .../Shiba/Scripting/Conversion/ObjectConversion.cs | 0 .../Shiba/Scripting/Conversion/PromiseConversion.cs | 0 .../Shiba/Scripting/Conversion/TypeConversion.cs | 0 .../Shiba/Scripting/DefaultScriptRuntime.cs | 0 {Windows => UWP}/Shiba/Scripting/IScriptRuntime.cs | 0 .../Shiba/Scripting/JavaScriptValueExtension.cs | 0 {Windows => UWP}/Shiba/Scripting/Runtime/Http.cs | 0 {Windows => UWP}/Shiba/Scripting/Runtime/Storage.cs | 0 {Windows => UWP}/Shiba/Shiba.cs | 0 {Windows => UWP}/Shiba/Shiba.csproj | 0 {Windows => UWP}/Shiba/ShibaHost.cs | 0 {Windows => UWP}/Shiba/ViewMappers/GridMapper.cs | 0 {Windows => UWP}/Shiba/ViewMappers/InputMapper.cs | 0 {Windows => UWP}/Shiba/ViewMappers/ListMapper.cs | 0 {Windows => UWP}/Shiba/ViewMappers/StackMapper.cs | 0 {Windows => UWP}/Shiba/ViewMappers/TextMapper.cs | 0 {Windows => UWP}/Shiba/ViewMappers/ViewMapper.cs | 0 {Windows => UWP}/Shiba/Visitors/ValueVisitor.cs | 0 206 files changed, 0 insertions(+), 0 deletions(-) rename {Windows => UWP}/ChakraHosting/ChakraHost.cs (100%) rename {Windows => UWP}/ChakraHosting/ChakraHosting.csproj (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptBeforeCollectCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptContext.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptEngineException.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptErrorCode.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptException.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptFatalException.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptMemoryAllocationCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptMemoryEventType.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptNativeFunction.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptObjectFinalizeCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptPromiseContinuationCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptPropertyId.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptPropertyIdType.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptRuntime.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptRuntimeAttributes.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptRuntimeVersion.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptScriptException.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptSourceContext.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptThreadServiceCallback.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptTypedArrayType.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptUsageException.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptValue.cs (100%) rename {Windows => UWP}/ChakraHosting/JavaScriptValueType.cs (100%) rename {Windows => UWP}/ChakraHosting/Native.cs (100%) rename {Windows => UWP}/ChakraHosting/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/ChakraHosting/Properties/ChakraHosting.rd.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Assets/AboutAssets.txt (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/MainActivity.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AndroidManifest.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/AboutResources.txt (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Tabbar.axml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Toolbar.axml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/Icon.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/icon.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/Icon.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/Icon.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/colors.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/styles.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.Android/Shiba.Forms.Sample.Android.csproj (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-16.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-256.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-48.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.backup.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-100.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-400.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Package.appxmanifest (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/Default.rd.xml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.UWP/Shiba.Forms.Sample.UWP.csproj (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Entitlements.plist (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-568h@2x.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait@2x.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default@2x.png (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/LaunchScreen.storyboard (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample.iOS/Shiba.Forms.Sample.iOS.csproj (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample/App.xaml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample/App.xaml.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml.cs (100%) rename {Windows => UWP}/Sample/Forms/Shiba.Forms.Sample/Shiba.Forms.Sample.csproj (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/App.xaml (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/App.xaml.cs (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/LockScreenLogo.scale-200.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/SplashScreen.scale-200.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/Square150x150Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/StoreLogo.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Assets/Wide310x150Logo.scale-200.png (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/LivePage.xaml (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/LivePage.xaml.cs (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/MainPage.xaml (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/MainPage.xaml.cs (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Package.appxmanifest (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Properties/Default.rd.xml (100%) rename {Windows => UWP}/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/App.xaml (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/App.xaml.cs (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/MainWindow.xaml (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/MainWindow.xaml.cs (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Properties/Resources.Designer.cs (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Properties/Resources.resx (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Properties/Settings.Designer.cs (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Properties/Settings.settings (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/app.config (100%) rename {Windows => UWP}/Sample/Shiba.WPF.Sample/packages.config (100%) rename {Windows => UWP}/Shiba.Test/Assets/LockScreenLogo.scale-200.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/SplashScreen.scale-200.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/Square150x150Logo.scale-200.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/Square44x44Logo.scale-200.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/StoreLogo.png (100%) rename {Windows => UWP}/Shiba.Test/Assets/Wide310x150Logo.scale-200.png (100%) rename {Windows => UWP}/Shiba.Test/Package.appxmanifest (100%) rename {Windows => UWP}/Shiba.Test/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Shiba.Test/Properties/UnitTestApp.rd.xml (100%) rename {Windows => UWP}/Shiba.Test/Shiba.Test.csproj (100%) rename {Windows => UWP}/Shiba.Test/UnitTest.cs (100%) rename {Windows => UWP}/Shiba.Test/UnitTestApp.xaml (100%) rename {Windows => UWP}/Shiba.Test/UnitTestApp.xaml.cs (100%) rename {Windows => UWP}/Shiba.nuspec (100%) rename {Windows => UWP}/Shiba.sln (100%) rename {Windows => UWP}/Shiba/CommonProperty/CommonProperty.cs (100%) rename {Windows => UWP}/Shiba/CommonProperty/GridProperty.cs (100%) rename {Windows => UWP}/Shiba/CommonProperty/ICommonProperty.cs (100%) rename {Windows => UWP}/Shiba/CommonProperty/RelativeProperty.cs (100%) rename {Windows => UWP}/Shiba/Controls/ExportMapperAttribute.cs (100%) rename {Windows => UWP}/Shiba/Controls/IViewRenderer.cs (100%) rename {Windows => UWP}/Shiba/Controls/View.cs (100%) rename {Windows => UWP}/Shiba/Controls/ViewMapping.cs (100%) rename {Windows => UWP}/Shiba/ConvertExtensions.cs (100%) rename {Windows => UWP}/Shiba/Converter.cs (100%) rename {Windows => UWP}/Shiba/ExtensionExecutors/BindingExecutor.cs (100%) rename {Windows => UWP}/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs (100%) rename {Windows => UWP}/Shiba/ExtensionExecutors/IShibaExtension.cs (100%) rename {Windows => UWP}/Shiba/Extensions.cs (100%) rename {Windows => UWP}/Shiba/Internal/Singleton.cs (100%) rename {Windows => UWP}/Shiba/NativeRenderer.cs (100%) rename {Windows => UWP}/Shiba/Parser/ShibaParserWrapper.cs (100%) rename {Windows => UWP}/Shiba/Properties/AssemblyInfo.cs (100%) rename {Windows => UWP}/Shiba/Properties/Shiba.rd.xml (100%) rename {Windows => UWP}/Shiba/Scripting/Conversion/JTokenConversion.cs (100%) rename {Windows => UWP}/Shiba/Scripting/Conversion/ObjectConversion.cs (100%) rename {Windows => UWP}/Shiba/Scripting/Conversion/PromiseConversion.cs (100%) rename {Windows => UWP}/Shiba/Scripting/Conversion/TypeConversion.cs (100%) rename {Windows => UWP}/Shiba/Scripting/DefaultScriptRuntime.cs (100%) rename {Windows => UWP}/Shiba/Scripting/IScriptRuntime.cs (100%) rename {Windows => UWP}/Shiba/Scripting/JavaScriptValueExtension.cs (100%) rename {Windows => UWP}/Shiba/Scripting/Runtime/Http.cs (100%) rename {Windows => UWP}/Shiba/Scripting/Runtime/Storage.cs (100%) rename {Windows => UWP}/Shiba/Shiba.cs (100%) rename {Windows => UWP}/Shiba/Shiba.csproj (100%) rename {Windows => UWP}/Shiba/ShibaHost.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/GridMapper.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/InputMapper.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/ListMapper.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/StackMapper.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/TextMapper.cs (100%) rename {Windows => UWP}/Shiba/ViewMappers/ViewMapper.cs (100%) rename {Windows => UWP}/Shiba/Visitors/ValueVisitor.cs (100%) diff --git a/Windows/ChakraHosting/ChakraHost.cs b/UWP/ChakraHosting/ChakraHost.cs similarity index 100% rename from Windows/ChakraHosting/ChakraHost.cs rename to UWP/ChakraHosting/ChakraHost.cs diff --git a/Windows/ChakraHosting/ChakraHosting.csproj b/UWP/ChakraHosting/ChakraHosting.csproj similarity index 100% rename from Windows/ChakraHosting/ChakraHosting.csproj rename to UWP/ChakraHosting/ChakraHosting.csproj diff --git a/Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs b/UWP/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs rename to UWP/ChakraHosting/JavaScriptBackgroundWorkItemCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs b/UWP/ChakraHosting/JavaScriptBeforeCollectCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptBeforeCollectCallback.cs rename to UWP/ChakraHosting/JavaScriptBeforeCollectCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptContext.cs b/UWP/ChakraHosting/JavaScriptContext.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptContext.cs rename to UWP/ChakraHosting/JavaScriptContext.cs diff --git a/Windows/ChakraHosting/JavaScriptEngineException.cs b/UWP/ChakraHosting/JavaScriptEngineException.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptEngineException.cs rename to UWP/ChakraHosting/JavaScriptEngineException.cs diff --git a/Windows/ChakraHosting/JavaScriptErrorCode.cs b/UWP/ChakraHosting/JavaScriptErrorCode.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptErrorCode.cs rename to UWP/ChakraHosting/JavaScriptErrorCode.cs diff --git a/Windows/ChakraHosting/JavaScriptException.cs b/UWP/ChakraHosting/JavaScriptException.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptException.cs rename to UWP/ChakraHosting/JavaScriptException.cs diff --git a/Windows/ChakraHosting/JavaScriptFatalException.cs b/UWP/ChakraHosting/JavaScriptFatalException.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptFatalException.cs rename to UWP/ChakraHosting/JavaScriptFatalException.cs diff --git a/Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs b/UWP/ChakraHosting/JavaScriptMemoryAllocationCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptMemoryAllocationCallback.cs rename to UWP/ChakraHosting/JavaScriptMemoryAllocationCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptMemoryEventType.cs b/UWP/ChakraHosting/JavaScriptMemoryEventType.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptMemoryEventType.cs rename to UWP/ChakraHosting/JavaScriptMemoryEventType.cs diff --git a/Windows/ChakraHosting/JavaScriptNativeFunction.cs b/UWP/ChakraHosting/JavaScriptNativeFunction.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptNativeFunction.cs rename to UWP/ChakraHosting/JavaScriptNativeFunction.cs diff --git a/Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs b/UWP/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs rename to UWP/ChakraHosting/JavaScriptObjectBeforeCollectCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs b/UWP/ChakraHosting/JavaScriptObjectFinalizeCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptObjectFinalizeCallback.cs rename to UWP/ChakraHosting/JavaScriptObjectFinalizeCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs b/UWP/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs rename to UWP/ChakraHosting/JavaScriptProjectionEnqueueCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs b/UWP/ChakraHosting/JavaScriptPromiseContinuationCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptPromiseContinuationCallback.cs rename to UWP/ChakraHosting/JavaScriptPromiseContinuationCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptPropertyId.cs b/UWP/ChakraHosting/JavaScriptPropertyId.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptPropertyId.cs rename to UWP/ChakraHosting/JavaScriptPropertyId.cs diff --git a/Windows/ChakraHosting/JavaScriptPropertyIdType.cs b/UWP/ChakraHosting/JavaScriptPropertyIdType.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptPropertyIdType.cs rename to UWP/ChakraHosting/JavaScriptPropertyIdType.cs diff --git a/Windows/ChakraHosting/JavaScriptRuntime.cs b/UWP/ChakraHosting/JavaScriptRuntime.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptRuntime.cs rename to UWP/ChakraHosting/JavaScriptRuntime.cs diff --git a/Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs b/UWP/ChakraHosting/JavaScriptRuntimeAttributes.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptRuntimeAttributes.cs rename to UWP/ChakraHosting/JavaScriptRuntimeAttributes.cs diff --git a/Windows/ChakraHosting/JavaScriptRuntimeVersion.cs b/UWP/ChakraHosting/JavaScriptRuntimeVersion.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptRuntimeVersion.cs rename to UWP/ChakraHosting/JavaScriptRuntimeVersion.cs diff --git a/Windows/ChakraHosting/JavaScriptScriptException.cs b/UWP/ChakraHosting/JavaScriptScriptException.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptScriptException.cs rename to UWP/ChakraHosting/JavaScriptScriptException.cs diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs b/UWP/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs rename to UWP/ChakraHosting/JavaScriptSerializedScriptLoadSourceCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs b/UWP/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs rename to UWP/ChakraHosting/JavaScriptSerializedScriptUnloadCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptSourceContext.cs b/UWP/ChakraHosting/JavaScriptSourceContext.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptSourceContext.cs rename to UWP/ChakraHosting/JavaScriptSourceContext.cs diff --git a/Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs b/UWP/ChakraHosting/JavaScriptThreadServiceCallback.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptThreadServiceCallback.cs rename to UWP/ChakraHosting/JavaScriptThreadServiceCallback.cs diff --git a/Windows/ChakraHosting/JavaScriptTypedArrayType.cs b/UWP/ChakraHosting/JavaScriptTypedArrayType.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptTypedArrayType.cs rename to UWP/ChakraHosting/JavaScriptTypedArrayType.cs diff --git a/Windows/ChakraHosting/JavaScriptUsageException.cs b/UWP/ChakraHosting/JavaScriptUsageException.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptUsageException.cs rename to UWP/ChakraHosting/JavaScriptUsageException.cs diff --git a/Windows/ChakraHosting/JavaScriptValue.cs b/UWP/ChakraHosting/JavaScriptValue.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptValue.cs rename to UWP/ChakraHosting/JavaScriptValue.cs diff --git a/Windows/ChakraHosting/JavaScriptValueType.cs b/UWP/ChakraHosting/JavaScriptValueType.cs similarity index 100% rename from Windows/ChakraHosting/JavaScriptValueType.cs rename to UWP/ChakraHosting/JavaScriptValueType.cs diff --git a/Windows/ChakraHosting/Native.cs b/UWP/ChakraHosting/Native.cs similarity index 100% rename from Windows/ChakraHosting/Native.cs rename to UWP/ChakraHosting/Native.cs diff --git a/Windows/ChakraHosting/Properties/AssemblyInfo.cs b/UWP/ChakraHosting/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/ChakraHosting/Properties/AssemblyInfo.cs rename to UWP/ChakraHosting/Properties/AssemblyInfo.cs diff --git a/Windows/ChakraHosting/Properties/ChakraHosting.rd.xml b/UWP/ChakraHosting/Properties/ChakraHosting.rd.xml similarity index 100% rename from Windows/ChakraHosting/Properties/ChakraHosting.rd.xml rename to UWP/ChakraHosting/Properties/ChakraHosting.rd.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Assets/AboutAssets.txt b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Assets/AboutAssets.txt similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Assets/AboutAssets.txt rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Assets/AboutAssets.txt diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/MainActivity.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/MainActivity.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/MainActivity.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/MainActivity.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AndroidManifest.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AndroidManifest.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AndroidManifest.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AndroidManifest.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AssemblyInfo.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AssemblyInfo.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Properties/AssemblyInfo.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/AboutResources.txt b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/AboutResources.txt similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/AboutResources.txt rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/AboutResources.txt diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/Resource.designer.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Tabbar.axml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Tabbar.axml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Tabbar.axml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Tabbar.axml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Toolbar.axml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Toolbar.axml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Toolbar.axml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/layout/Toolbar.axml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/Icon.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/Icon.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/Icon.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/Icon.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/icon.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/icon.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/icon.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/icon.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/Icon.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/Icon.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/Icon.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/Icon.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/Icon.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/Icon.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/Icon.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/Icon.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/Icon.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/colors.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/colors.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/colors.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/colors.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/styles.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/styles.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/styles.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Resources/values/styles.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.Android/Shiba.Forms.Sample.Android.csproj b/UWP/Sample/Forms/Shiba.Forms.Sample.Android/Shiba.Forms.Sample.Android.csproj similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.Android/Shiba.Forms.Sample.Android.csproj rename to UWP/Sample/Forms/Shiba.Forms.Sample.Android/Shiba.Forms.Sample.Android.csproj diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/App.xaml.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/LargeTile.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SmallTile.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/SplashScreen.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square150x150Logo.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-16.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-16.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-16.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-16.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-256.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-256.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-256.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-256.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-48.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-48.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-48.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Square44x44Logo.targetsize-48.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.backup.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.backup.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.backup.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.backup.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/StoreLogo.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-100.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-100.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-100.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-100.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-200.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-200.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-200.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-400.png b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-400.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-400.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Assets/Wide310x150Logo.scale-400.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/MainPage.xaml.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Package.appxmanifest b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Package.appxmanifest similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Package.appxmanifest rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Package.appxmanifest diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/AssemblyInfo.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/AssemblyInfo.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/AssemblyInfo.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/Default.rd.xml b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/Default.rd.xml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/Default.rd.xml rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Properties/Default.rd.xml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Shiba.Forms.Sample.UWP.csproj b/UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Shiba.Forms.Sample.UWP.csproj similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.UWP/Shiba.Forms.Sample.UWP.csproj rename to UWP/Sample/Forms/Shiba.Forms.Sample.UWP/Shiba.Forms.Sample.UWP.csproj diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/AppDelegate.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Entitlements.plist b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Entitlements.plist similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Entitlements.plist rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Entitlements.plist diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Info.plist diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Main.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Properties/AssemblyInfo.cs b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Properties/AssemblyInfo.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Properties/AssemblyInfo.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-568h@2x.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-568h@2x.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-568h@2x.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-568h@2x.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait@2x.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait@2x.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait@2x.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default-Portrait@2x.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default@2x.png b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default@2x.png similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default@2x.png rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/Default@2x.png diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/LaunchScreen.storyboard b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/LaunchScreen.storyboard similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/LaunchScreen.storyboard rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Resources/LaunchScreen.storyboard diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Shiba.Forms.Sample.iOS.csproj b/UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Shiba.Forms.Sample.iOS.csproj similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample.iOS/Shiba.Forms.Sample.iOS.csproj rename to UWP/Sample/Forms/Shiba.Forms.Sample.iOS/Shiba.Forms.Sample.iOS.csproj diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample/App.xaml b/UWP/Sample/Forms/Shiba.Forms.Sample/App.xaml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample/App.xaml rename to UWP/Sample/Forms/Shiba.Forms.Sample/App.xaml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample/App.xaml.cs b/UWP/Sample/Forms/Shiba.Forms.Sample/App.xaml.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample/App.xaml.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample/App.xaml.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml b/UWP/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml rename to UWP/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml.cs b/UWP/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml.cs similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml.cs rename to UWP/Sample/Forms/Shiba.Forms.Sample/MainPage.xaml.cs diff --git a/Windows/Sample/Forms/Shiba.Forms.Sample/Shiba.Forms.Sample.csproj b/UWP/Sample/Forms/Shiba.Forms.Sample/Shiba.Forms.Sample.csproj similarity index 100% rename from Windows/Sample/Forms/Shiba.Forms.Sample/Shiba.Forms.Sample.csproj rename to UWP/Sample/Forms/Shiba.Forms.Sample/Shiba.Forms.Sample.csproj diff --git a/Windows/Sample/Shiba.UWP.Sample/App.xaml b/UWP/Sample/Shiba.UWP.Sample/App.xaml similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/App.xaml rename to UWP/Sample/Shiba.UWP.Sample/App.xaml diff --git a/Windows/Sample/Shiba.UWP.Sample/App.xaml.cs b/UWP/Sample/Shiba.UWP.Sample/App.xaml.cs similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/App.xaml.cs rename to UWP/Sample/Shiba.UWP.Sample/App.xaml.cs diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/LockScreenLogo.scale-200.png b/UWP/Sample/Shiba.UWP.Sample/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/LockScreenLogo.scale-200.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/LockScreenLogo.scale-200.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/SplashScreen.scale-200.png b/UWP/Sample/Shiba.UWP.Sample/Assets/SplashScreen.scale-200.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/SplashScreen.scale-200.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/SplashScreen.scale-200.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/Square150x150Logo.scale-200.png b/UWP/Sample/Shiba.UWP.Sample/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/Square150x150Logo.scale-200.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/Square150x150Logo.scale-200.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.scale-200.png b/UWP/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.scale-200.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.scale-200.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/UWP/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/StoreLogo.png b/UWP/Sample/Shiba.UWP.Sample/Assets/StoreLogo.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/StoreLogo.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/StoreLogo.png diff --git a/Windows/Sample/Shiba.UWP.Sample/Assets/Wide310x150Logo.scale-200.png b/UWP/Sample/Shiba.UWP.Sample/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Assets/Wide310x150Logo.scale-200.png rename to UWP/Sample/Shiba.UWP.Sample/Assets/Wide310x150Logo.scale-200.png diff --git a/Windows/Sample/Shiba.UWP.Sample/LivePage.xaml b/UWP/Sample/Shiba.UWP.Sample/LivePage.xaml similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/LivePage.xaml rename to UWP/Sample/Shiba.UWP.Sample/LivePage.xaml diff --git a/Windows/Sample/Shiba.UWP.Sample/LivePage.xaml.cs b/UWP/Sample/Shiba.UWP.Sample/LivePage.xaml.cs similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/LivePage.xaml.cs rename to UWP/Sample/Shiba.UWP.Sample/LivePage.xaml.cs diff --git a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml b/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/MainPage.xaml rename to UWP/Sample/Shiba.UWP.Sample/MainPage.xaml diff --git a/Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs b/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml.cs similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/MainPage.xaml.cs rename to UWP/Sample/Shiba.UWP.Sample/MainPage.xaml.cs diff --git a/Windows/Sample/Shiba.UWP.Sample/Package.appxmanifest b/UWP/Sample/Shiba.UWP.Sample/Package.appxmanifest similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Package.appxmanifest rename to UWP/Sample/Shiba.UWP.Sample/Package.appxmanifest diff --git a/Windows/Sample/Shiba.UWP.Sample/Properties/AssemblyInfo.cs b/UWP/Sample/Shiba.UWP.Sample/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Properties/AssemblyInfo.cs rename to UWP/Sample/Shiba.UWP.Sample/Properties/AssemblyInfo.cs diff --git a/Windows/Sample/Shiba.UWP.Sample/Properties/Default.rd.xml b/UWP/Sample/Shiba.UWP.Sample/Properties/Default.rd.xml similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Properties/Default.rd.xml rename to UWP/Sample/Shiba.UWP.Sample/Properties/Default.rd.xml diff --git a/Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj b/UWP/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj similarity index 100% rename from Windows/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj rename to UWP/Sample/Shiba.UWP.Sample/Shiba.UWP.Sample.csproj diff --git a/Windows/Sample/Shiba.WPF.Sample/App.xaml b/UWP/Sample/Shiba.WPF.Sample/App.xaml similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/App.xaml rename to UWP/Sample/Shiba.WPF.Sample/App.xaml diff --git a/Windows/Sample/Shiba.WPF.Sample/App.xaml.cs b/UWP/Sample/Shiba.WPF.Sample/App.xaml.cs similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/App.xaml.cs rename to UWP/Sample/Shiba.WPF.Sample/App.xaml.cs diff --git a/Windows/Sample/Shiba.WPF.Sample/MainWindow.xaml b/UWP/Sample/Shiba.WPF.Sample/MainWindow.xaml similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/MainWindow.xaml rename to UWP/Sample/Shiba.WPF.Sample/MainWindow.xaml diff --git a/Windows/Sample/Shiba.WPF.Sample/MainWindow.xaml.cs b/UWP/Sample/Shiba.WPF.Sample/MainWindow.xaml.cs similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/MainWindow.xaml.cs rename to UWP/Sample/Shiba.WPF.Sample/MainWindow.xaml.cs diff --git a/Windows/Sample/Shiba.WPF.Sample/Properties/AssemblyInfo.cs b/UWP/Sample/Shiba.WPF.Sample/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Properties/AssemblyInfo.cs rename to UWP/Sample/Shiba.WPF.Sample/Properties/AssemblyInfo.cs diff --git a/Windows/Sample/Shiba.WPF.Sample/Properties/Resources.Designer.cs b/UWP/Sample/Shiba.WPF.Sample/Properties/Resources.Designer.cs similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Properties/Resources.Designer.cs rename to UWP/Sample/Shiba.WPF.Sample/Properties/Resources.Designer.cs diff --git a/Windows/Sample/Shiba.WPF.Sample/Properties/Resources.resx b/UWP/Sample/Shiba.WPF.Sample/Properties/Resources.resx similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Properties/Resources.resx rename to UWP/Sample/Shiba.WPF.Sample/Properties/Resources.resx diff --git a/Windows/Sample/Shiba.WPF.Sample/Properties/Settings.Designer.cs b/UWP/Sample/Shiba.WPF.Sample/Properties/Settings.Designer.cs similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Properties/Settings.Designer.cs rename to UWP/Sample/Shiba.WPF.Sample/Properties/Settings.Designer.cs diff --git a/Windows/Sample/Shiba.WPF.Sample/Properties/Settings.settings b/UWP/Sample/Shiba.WPF.Sample/Properties/Settings.settings similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Properties/Settings.settings rename to UWP/Sample/Shiba.WPF.Sample/Properties/Settings.settings diff --git a/Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj b/UWP/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj rename to UWP/Sample/Shiba.WPF.Sample/Shiba.WPF.Sample.csproj diff --git a/Windows/Sample/Shiba.WPF.Sample/app.config b/UWP/Sample/Shiba.WPF.Sample/app.config similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/app.config rename to UWP/Sample/Shiba.WPF.Sample/app.config diff --git a/Windows/Sample/Shiba.WPF.Sample/packages.config b/UWP/Sample/Shiba.WPF.Sample/packages.config similarity index 100% rename from Windows/Sample/Shiba.WPF.Sample/packages.config rename to UWP/Sample/Shiba.WPF.Sample/packages.config diff --git a/Windows/Shiba.Test/Assets/LockScreenLogo.scale-200.png b/UWP/Shiba.Test/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from Windows/Shiba.Test/Assets/LockScreenLogo.scale-200.png rename to UWP/Shiba.Test/Assets/LockScreenLogo.scale-200.png diff --git a/Windows/Shiba.Test/Assets/SplashScreen.scale-200.png b/UWP/Shiba.Test/Assets/SplashScreen.scale-200.png similarity index 100% rename from Windows/Shiba.Test/Assets/SplashScreen.scale-200.png rename to UWP/Shiba.Test/Assets/SplashScreen.scale-200.png diff --git a/Windows/Shiba.Test/Assets/Square150x150Logo.scale-200.png b/UWP/Shiba.Test/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from Windows/Shiba.Test/Assets/Square150x150Logo.scale-200.png rename to UWP/Shiba.Test/Assets/Square150x150Logo.scale-200.png diff --git a/Windows/Shiba.Test/Assets/Square44x44Logo.scale-200.png b/UWP/Shiba.Test/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from Windows/Shiba.Test/Assets/Square44x44Logo.scale-200.png rename to UWP/Shiba.Test/Assets/Square44x44Logo.scale-200.png diff --git a/Windows/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/UWP/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from Windows/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to UWP/Shiba.Test/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/Windows/Shiba.Test/Assets/StoreLogo.png b/UWP/Shiba.Test/Assets/StoreLogo.png similarity index 100% rename from Windows/Shiba.Test/Assets/StoreLogo.png rename to UWP/Shiba.Test/Assets/StoreLogo.png diff --git a/Windows/Shiba.Test/Assets/Wide310x150Logo.scale-200.png b/UWP/Shiba.Test/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from Windows/Shiba.Test/Assets/Wide310x150Logo.scale-200.png rename to UWP/Shiba.Test/Assets/Wide310x150Logo.scale-200.png diff --git a/Windows/Shiba.Test/Package.appxmanifest b/UWP/Shiba.Test/Package.appxmanifest similarity index 100% rename from Windows/Shiba.Test/Package.appxmanifest rename to UWP/Shiba.Test/Package.appxmanifest diff --git a/Windows/Shiba.Test/Properties/AssemblyInfo.cs b/UWP/Shiba.Test/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Shiba.Test/Properties/AssemblyInfo.cs rename to UWP/Shiba.Test/Properties/AssemblyInfo.cs diff --git a/Windows/Shiba.Test/Properties/UnitTestApp.rd.xml b/UWP/Shiba.Test/Properties/UnitTestApp.rd.xml similarity index 100% rename from Windows/Shiba.Test/Properties/UnitTestApp.rd.xml rename to UWP/Shiba.Test/Properties/UnitTestApp.rd.xml diff --git a/Windows/Shiba.Test/Shiba.Test.csproj b/UWP/Shiba.Test/Shiba.Test.csproj similarity index 100% rename from Windows/Shiba.Test/Shiba.Test.csproj rename to UWP/Shiba.Test/Shiba.Test.csproj diff --git a/Windows/Shiba.Test/UnitTest.cs b/UWP/Shiba.Test/UnitTest.cs similarity index 100% rename from Windows/Shiba.Test/UnitTest.cs rename to UWP/Shiba.Test/UnitTest.cs diff --git a/Windows/Shiba.Test/UnitTestApp.xaml b/UWP/Shiba.Test/UnitTestApp.xaml similarity index 100% rename from Windows/Shiba.Test/UnitTestApp.xaml rename to UWP/Shiba.Test/UnitTestApp.xaml diff --git a/Windows/Shiba.Test/UnitTestApp.xaml.cs b/UWP/Shiba.Test/UnitTestApp.xaml.cs similarity index 100% rename from Windows/Shiba.Test/UnitTestApp.xaml.cs rename to UWP/Shiba.Test/UnitTestApp.xaml.cs diff --git a/Windows/Shiba.nuspec b/UWP/Shiba.nuspec similarity index 100% rename from Windows/Shiba.nuspec rename to UWP/Shiba.nuspec diff --git a/Windows/Shiba.sln b/UWP/Shiba.sln similarity index 100% rename from Windows/Shiba.sln rename to UWP/Shiba.sln diff --git a/Windows/Shiba/CommonProperty/CommonProperty.cs b/UWP/Shiba/CommonProperty/CommonProperty.cs similarity index 100% rename from Windows/Shiba/CommonProperty/CommonProperty.cs rename to UWP/Shiba/CommonProperty/CommonProperty.cs diff --git a/Windows/Shiba/CommonProperty/GridProperty.cs b/UWP/Shiba/CommonProperty/GridProperty.cs similarity index 100% rename from Windows/Shiba/CommonProperty/GridProperty.cs rename to UWP/Shiba/CommonProperty/GridProperty.cs diff --git a/Windows/Shiba/CommonProperty/ICommonProperty.cs b/UWP/Shiba/CommonProperty/ICommonProperty.cs similarity index 100% rename from Windows/Shiba/CommonProperty/ICommonProperty.cs rename to UWP/Shiba/CommonProperty/ICommonProperty.cs diff --git a/Windows/Shiba/CommonProperty/RelativeProperty.cs b/UWP/Shiba/CommonProperty/RelativeProperty.cs similarity index 100% rename from Windows/Shiba/CommonProperty/RelativeProperty.cs rename to UWP/Shiba/CommonProperty/RelativeProperty.cs diff --git a/Windows/Shiba/Controls/ExportMapperAttribute.cs b/UWP/Shiba/Controls/ExportMapperAttribute.cs similarity index 100% rename from Windows/Shiba/Controls/ExportMapperAttribute.cs rename to UWP/Shiba/Controls/ExportMapperAttribute.cs diff --git a/Windows/Shiba/Controls/IViewRenderer.cs b/UWP/Shiba/Controls/IViewRenderer.cs similarity index 100% rename from Windows/Shiba/Controls/IViewRenderer.cs rename to UWP/Shiba/Controls/IViewRenderer.cs diff --git a/Windows/Shiba/Controls/View.cs b/UWP/Shiba/Controls/View.cs similarity index 100% rename from Windows/Shiba/Controls/View.cs rename to UWP/Shiba/Controls/View.cs diff --git a/Windows/Shiba/Controls/ViewMapping.cs b/UWP/Shiba/Controls/ViewMapping.cs similarity index 100% rename from Windows/Shiba/Controls/ViewMapping.cs rename to UWP/Shiba/Controls/ViewMapping.cs diff --git a/Windows/Shiba/ConvertExtensions.cs b/UWP/Shiba/ConvertExtensions.cs similarity index 100% rename from Windows/Shiba/ConvertExtensions.cs rename to UWP/Shiba/ConvertExtensions.cs diff --git a/Windows/Shiba/Converter.cs b/UWP/Shiba/Converter.cs similarity index 100% rename from Windows/Shiba/Converter.cs rename to UWP/Shiba/Converter.cs diff --git a/Windows/Shiba/ExtensionExecutors/BindingExecutor.cs b/UWP/Shiba/ExtensionExecutors/BindingExecutor.cs similarity index 100% rename from Windows/Shiba/ExtensionExecutors/BindingExecutor.cs rename to UWP/Shiba/ExtensionExecutors/BindingExecutor.cs diff --git a/Windows/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs b/UWP/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs similarity index 100% rename from Windows/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs rename to UWP/Shiba/ExtensionExecutors/IBindingExtensionExecutor.cs diff --git a/Windows/Shiba/ExtensionExecutors/IShibaExtension.cs b/UWP/Shiba/ExtensionExecutors/IShibaExtension.cs similarity index 100% rename from Windows/Shiba/ExtensionExecutors/IShibaExtension.cs rename to UWP/Shiba/ExtensionExecutors/IShibaExtension.cs diff --git a/Windows/Shiba/Extensions.cs b/UWP/Shiba/Extensions.cs similarity index 100% rename from Windows/Shiba/Extensions.cs rename to UWP/Shiba/Extensions.cs diff --git a/Windows/Shiba/Internal/Singleton.cs b/UWP/Shiba/Internal/Singleton.cs similarity index 100% rename from Windows/Shiba/Internal/Singleton.cs rename to UWP/Shiba/Internal/Singleton.cs diff --git a/Windows/Shiba/NativeRenderer.cs b/UWP/Shiba/NativeRenderer.cs similarity index 100% rename from Windows/Shiba/NativeRenderer.cs rename to UWP/Shiba/NativeRenderer.cs diff --git a/Windows/Shiba/Parser/ShibaParserWrapper.cs b/UWP/Shiba/Parser/ShibaParserWrapper.cs similarity index 100% rename from Windows/Shiba/Parser/ShibaParserWrapper.cs rename to UWP/Shiba/Parser/ShibaParserWrapper.cs diff --git a/Windows/Shiba/Properties/AssemblyInfo.cs b/UWP/Shiba/Properties/AssemblyInfo.cs similarity index 100% rename from Windows/Shiba/Properties/AssemblyInfo.cs rename to UWP/Shiba/Properties/AssemblyInfo.cs diff --git a/Windows/Shiba/Properties/Shiba.rd.xml b/UWP/Shiba/Properties/Shiba.rd.xml similarity index 100% rename from Windows/Shiba/Properties/Shiba.rd.xml rename to UWP/Shiba/Properties/Shiba.rd.xml diff --git a/Windows/Shiba/Scripting/Conversion/JTokenConversion.cs b/UWP/Shiba/Scripting/Conversion/JTokenConversion.cs similarity index 100% rename from Windows/Shiba/Scripting/Conversion/JTokenConversion.cs rename to UWP/Shiba/Scripting/Conversion/JTokenConversion.cs diff --git a/Windows/Shiba/Scripting/Conversion/ObjectConversion.cs b/UWP/Shiba/Scripting/Conversion/ObjectConversion.cs similarity index 100% rename from Windows/Shiba/Scripting/Conversion/ObjectConversion.cs rename to UWP/Shiba/Scripting/Conversion/ObjectConversion.cs diff --git a/Windows/Shiba/Scripting/Conversion/PromiseConversion.cs b/UWP/Shiba/Scripting/Conversion/PromiseConversion.cs similarity index 100% rename from Windows/Shiba/Scripting/Conversion/PromiseConversion.cs rename to UWP/Shiba/Scripting/Conversion/PromiseConversion.cs diff --git a/Windows/Shiba/Scripting/Conversion/TypeConversion.cs b/UWP/Shiba/Scripting/Conversion/TypeConversion.cs similarity index 100% rename from Windows/Shiba/Scripting/Conversion/TypeConversion.cs rename to UWP/Shiba/Scripting/Conversion/TypeConversion.cs diff --git a/Windows/Shiba/Scripting/DefaultScriptRuntime.cs b/UWP/Shiba/Scripting/DefaultScriptRuntime.cs similarity index 100% rename from Windows/Shiba/Scripting/DefaultScriptRuntime.cs rename to UWP/Shiba/Scripting/DefaultScriptRuntime.cs diff --git a/Windows/Shiba/Scripting/IScriptRuntime.cs b/UWP/Shiba/Scripting/IScriptRuntime.cs similarity index 100% rename from Windows/Shiba/Scripting/IScriptRuntime.cs rename to UWP/Shiba/Scripting/IScriptRuntime.cs diff --git a/Windows/Shiba/Scripting/JavaScriptValueExtension.cs b/UWP/Shiba/Scripting/JavaScriptValueExtension.cs similarity index 100% rename from Windows/Shiba/Scripting/JavaScriptValueExtension.cs rename to UWP/Shiba/Scripting/JavaScriptValueExtension.cs diff --git a/Windows/Shiba/Scripting/Runtime/Http.cs b/UWP/Shiba/Scripting/Runtime/Http.cs similarity index 100% rename from Windows/Shiba/Scripting/Runtime/Http.cs rename to UWP/Shiba/Scripting/Runtime/Http.cs diff --git a/Windows/Shiba/Scripting/Runtime/Storage.cs b/UWP/Shiba/Scripting/Runtime/Storage.cs similarity index 100% rename from Windows/Shiba/Scripting/Runtime/Storage.cs rename to UWP/Shiba/Scripting/Runtime/Storage.cs diff --git a/Windows/Shiba/Shiba.cs b/UWP/Shiba/Shiba.cs similarity index 100% rename from Windows/Shiba/Shiba.cs rename to UWP/Shiba/Shiba.cs diff --git a/Windows/Shiba/Shiba.csproj b/UWP/Shiba/Shiba.csproj similarity index 100% rename from Windows/Shiba/Shiba.csproj rename to UWP/Shiba/Shiba.csproj diff --git a/Windows/Shiba/ShibaHost.cs b/UWP/Shiba/ShibaHost.cs similarity index 100% rename from Windows/Shiba/ShibaHost.cs rename to UWP/Shiba/ShibaHost.cs diff --git a/Windows/Shiba/ViewMappers/GridMapper.cs b/UWP/Shiba/ViewMappers/GridMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/GridMapper.cs rename to UWP/Shiba/ViewMappers/GridMapper.cs diff --git a/Windows/Shiba/ViewMappers/InputMapper.cs b/UWP/Shiba/ViewMappers/InputMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/InputMapper.cs rename to UWP/Shiba/ViewMappers/InputMapper.cs diff --git a/Windows/Shiba/ViewMappers/ListMapper.cs b/UWP/Shiba/ViewMappers/ListMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/ListMapper.cs rename to UWP/Shiba/ViewMappers/ListMapper.cs diff --git a/Windows/Shiba/ViewMappers/StackMapper.cs b/UWP/Shiba/ViewMappers/StackMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/StackMapper.cs rename to UWP/Shiba/ViewMappers/StackMapper.cs diff --git a/Windows/Shiba/ViewMappers/TextMapper.cs b/UWP/Shiba/ViewMappers/TextMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/TextMapper.cs rename to UWP/Shiba/ViewMappers/TextMapper.cs diff --git a/Windows/Shiba/ViewMappers/ViewMapper.cs b/UWP/Shiba/ViewMappers/ViewMapper.cs similarity index 100% rename from Windows/Shiba/ViewMappers/ViewMapper.cs rename to UWP/Shiba/ViewMappers/ViewMapper.cs diff --git a/Windows/Shiba/Visitors/ValueVisitor.cs b/UWP/Shiba/Visitors/ValueVisitor.cs similarity index 100% rename from Windows/Shiba/Visitors/ValueVisitor.cs rename to UWP/Shiba/Visitors/ValueVisitor.cs From 07afad4085a222c7b9a664bd229b66a81d8492d8 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sun, 17 Feb 2019 20:28:02 +0800 Subject: [PATCH 21/27] Fix build --- .../java/moe/tlaster/shiba/ExampleInstrumentedTest.kt | 6 ------ .../test/java/moe/tlaster/shiba/ExampleUnitTest.kt | 11 ----------- appveyor.yml | 6 +++--- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/Android/shiba/src/androidTest/java/moe/tlaster/shiba/ExampleInstrumentedTest.kt b/Android/shiba/src/androidTest/java/moe/tlaster/shiba/ExampleInstrumentedTest.kt index 26c9449..6724218 100644 --- a/Android/shiba/src/androidTest/java/moe/tlaster/shiba/ExampleInstrumentedTest.kt +++ b/Android/shiba/src/androidTest/java/moe/tlaster/shiba/ExampleInstrumentedTest.kt @@ -21,12 +21,6 @@ class ExampleInstrumentedTest { @Test @Throws(Exception::class) fun useAppContext() { - Shiba.init(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext) - val result = Shiba.configuration.scriptRuntime.execute("storage.save(\"sample\", \"hello\"); storage.load(\"sample\", \"world\")") - - assert(result == "hello") - - // val runtime = JSContext() // // runtime.evaluateScript("function resolveAfter2Seconds() {\n" + diff --git a/Android/shiba/src/test/java/moe/tlaster/shiba/ExampleUnitTest.kt b/Android/shiba/src/test/java/moe/tlaster/shiba/ExampleUnitTest.kt index 8daa894..271563e 100644 --- a/Android/shiba/src/test/java/moe/tlaster/shiba/ExampleUnitTest.kt +++ b/Android/shiba/src/test/java/moe/tlaster/shiba/ExampleUnitTest.kt @@ -14,17 +14,6 @@ class ExampleUnitTest { @Test @Throws(Exception::class) fun test() { - val input = "\n" + - " \n" + - " \n" + - "" - val dom = DocumentBuilderFactory.newInstance().apply { - isNamespaceAware = true - }.newDocumentBuilder().parse(input) - val nodeName = dom.documentElement.childNodes.item(1).nodeName - val localName = dom.documentElement.childNodes.item(1).localName - val namespaceURI = dom.documentElement.childNodes.item(1).namespaceURI - assertNotNull(namespaceURI) } } diff --git a/appveyor.yml b/appveyor.yml index a3bb55b..b274874 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,11 +2,11 @@ version: 0.0.{build} image: Visual Studio 2017 build_script: - ps: >- - nuget restore "Windows\\Shiba.sln" + nuget restore "UWP\\Shiba.sln" - msbuild "Windows\\Shiba.sln" /m /verbosity:minimal /p:Configuration=Release + msbuild "UWP\\Shiba.sln" /m /verbosity:minimal /p:Configuration=Release - nuget pack "Windows\\Shiba.nuspec" -Version $env:appveyor_build_version + nuget pack "UWP\\Shiba.nuspec" -Version $env:appveyor_build_version artifacts: - path: '*.nupkg' From df0fff48cc33afd7219fe377937d4b96e7997293 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sun, 17 Feb 2019 20:42:22 +0800 Subject: [PATCH 22/27] Update version --- Android/shiba/build.gradle | 2 +- README.md | 2 +- appveyor.yml | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Android/shiba/build.gradle b/Android/shiba/build.gradle index 113c4c8..230bcdd 100644 --- a/Android/shiba/build.gradle +++ b/Android/shiba/build.gradle @@ -81,7 +81,7 @@ def issueUrl = 'https://github.com/Tlaster/Shiba/issues' def buildNum = System.getenv('TRAVIS_BUILD_NUMBER') group = "moe.tlaster" -version = "0.0.$buildNum" +version = "0.1.$buildNum" install { repositories.mavenInstaller { diff --git a/README.md b/README.md index bd4feb1..331b5ac 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ ShibaApp.Init(); ## For Android: ``` -implementation 'moe.tlaster:shiba:0.0.+' +implementation 'moe.tlaster:shiba:0.1.+' ``` And call the initialization (Better from your App's onCreate): ``` diff --git a/appveyor.yml b/appveyor.yml index b274874..212ffb3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.0.{build} +version: 0.1.{build} image: Visual Studio 2017 build_script: - ps: >- @@ -11,4 +11,9 @@ build_script: artifacts: - path: '*.nupkg' name: nuget +deploy: +- provider: Environment + name: nuget + on: + branch: master From 8849b2aeeebdf03dbe3377e89718e4c52f59610c Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sun, 17 Feb 2019 20:43:47 +0800 Subject: [PATCH 23/27] Remove updated document --- README.md | 4 +- README.zh.md | 2 +- doc/GettingStart.md | 83 ----------------- doc/GettingStart.zh.md | 83 ----------------- doc/WritingShiba.md | 196 ----------------------------------------- doc/WritingShiba.zh.md | 196 ----------------------------------------- 6 files changed, 3 insertions(+), 561 deletions(-) delete mode 100644 doc/GettingStart.md delete mode 100644 doc/GettingStart.zh.md delete mode 100644 doc/WritingShiba.md delete mode 100644 doc/WritingShiba.zh.md diff --git a/README.md b/README.md index 331b5ac..91bd79c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ # Show Case ![showcase](image/showcase.gif) -# [Getting Start](doc/GettingStart.md) +# Getting Start ## For WPF/UWP/Xamarin.Forms: You can install from nuget @@ -38,7 +38,7 @@ Still working on it, you can add your PR to help me All the initialization can be called from anywhere, e.g. you want delay initialization, just call it before actually using Shiba ## More -[Document](doc/GettingStart.md) +WIP # Goal Not like other cross-platform frameworks, Shiba is **NOT** a framework to replace the native development, Shiba will let you take both of the advantages of cross-platform and native. diff --git a/README.zh.md b/README.zh.md index 2ebbcce..7365ae5 100644 --- a/README.zh.md +++ b/README.zh.md @@ -38,7 +38,7 @@ Shiba.init(this) 初始化方法可在任意位置调用,比如你需要延迟初始化来提高你的程序启动速度,只要你在真正使用 Shiba 之前调用即可 ## 更多 -[参见文档](doc/GettingStart.zh.md) +文档正在更新中 # 目标 不像其他跨平台框架, Shiba **不是**用于取代原生开发的框架, Shiba 将会让你同时获得跨平台和原生开发的优点。 diff --git a/doc/GettingStart.md b/doc/GettingStart.md deleted file mode 100644 index b4fad09..0000000 --- a/doc/GettingStart.md +++ /dev/null @@ -1,83 +0,0 @@ -[English](GettingStart.md) | [中文](GettingStart.zh.md) -# Getting Start - -## For WPF/UWP/Xamarin.Forms: -You can install from nuget -``` -dotnet add package Shiba -``` -And call the initialization (Better from your App's OnLaunched): -``` -ShibaApp.Init(); -``` - -## For Android: -``` -implementation 'moe.tlaster:shiba:0.0.+' -``` -And call the initialization (Better from your App's onCreate): -``` -Shiba.init(this) -``` - -## iOS and others: -Still working on it, you can add your PR to help me - -## Notes -All the initialization can be called from anywhere, e.g. you want delay initialization, just call it before actually using Shiba - -# Useage - -## Android -Add ```moe.tlaster.shiba.ShibaHost``` to where you want to use -``` - -``` -Load your layout from your code (Kotlin is recommended) -``` -val yourLayout: String = ... -shibaHost.load(yourLayout, null) -``` -```yourLayout``` can be fetch from anywhere, e.g. a web server -If you have a data context (a class extends from ```moe.tlaster.shiba.BaseNotifyObject```), you can set the dataContext to ShibaHost -``` -val dataContext = ... -val yourLayout: String = ... -shibaHost.load(yourLayout, dataContext) -``` -Or -``` -val dataContext = ... -shibaHost.dataContext = dataContext -``` - -## UWP/WPF -Add ```ShibaHost`` to where you want to use -``` - -``` -You can load your layout from code behind -``` -var yourLayout = ...; -shibaHost.Layout = yourLayout; -``` -Or from xaml -``` - - yourLayout... - -``` -You can set the DataContext of the ```ShibaHost``` just like a normal ```FrameworkElement``` -``` -var dataContext = ...; -shibaHost.DataContext = dataContext; -``` -Or from xaml -``` - -``` -# What's Next? -- [WritingShiba](WritingShiba.md) \ No newline at end of file diff --git a/doc/GettingStart.zh.md b/doc/GettingStart.zh.md deleted file mode 100644 index 0d3a6e6..0000000 --- a/doc/GettingStart.zh.md +++ /dev/null @@ -1,83 +0,0 @@ -[English](GettingStart.md) | [中文](GettingStart.zh.md) -# 开始使用 - -## WPF/UWP/Xamarin.Forms: -从 Nuget 上安装 -``` -dotnet add package Shiba -``` -记得初始化 (最好在 App 的 OnLaunched 方法内): -``` -ShibaApp.Init(); -``` - -## Android: -``` -implementation 'moe.tlaster:shiba:0.0.+' -``` -记得初始化 (最好在 App 的 onCreate 方法内): -``` -Shiba.init(this) -``` -## iOS 和其他平台: -仍在开发中,你可以提起你的 PR 来帮助我 - -## Notes -初始化方法可在任意位置调用,比如你需要延迟初始化来提高你的程序启动速度,只要你在真正使用 Shiba 之前调用即可 - -# 基础使用 - -## Android -添加 ```moe.tlaster.shiba.ShibaHost``` 到任意你想使用的地方 -``` - -``` -通过代码设置你的layout (推荐使用kotlin) -``` -val yourLayout: String = ... -shibaHost.load(yourLayout, null) -``` -```yourLayout``` 可以从任意位置加载,比如你的服务器 -如果你有数据上下文 (继承自 ```moe.tlaster.shiba.BaseNotifyObject``` 的 class ), 你可以设置 shibaHost 的数据上下文 -``` -val dataContext = ... -val yourLayout: String = ... -shibaHost.load(yourLayout, dataContext) -``` -或者 -``` -val dataContext = ... -shibaHost.dataContext = dataContext -``` - -## UWP/WPF -添加 ```ShibaHost`` 到你希望使用的地方 -``` - -``` -你可以从代码中载入你的 layout -``` -var yourLayout = ...; -shibaHost.Layout = yourLayout; -``` -或者在 xaml 中直接设置 -``` - - yourLayout... - -``` -你可以设置 ```ShibaHost``` 的数据上下文,和普通的 ```FrameworkElement``` 一样 -``` -var dataContext = ...; -shibaHost.DataContext = dataContext; -``` -或者直接在 xaml 中设置 -``` - -``` - -# 下一步 -- [编写Shiba](WritingShiba.zh.md) \ No newline at end of file diff --git a/doc/WritingShiba.md b/doc/WritingShiba.md deleted file mode 100644 index 651dbe1..0000000 --- a/doc/WritingShiba.md +++ /dev/null @@ -1,196 +0,0 @@ -[English](WritingShiba.md) | [中文](WritingShiba.zh.md) -# Writing Shiba -A simple layout like this -``` -stack { - text { - text = "Hello world!" - } -} -``` -And it will show the text "Hello world!" - -## writing a view -You can write a view like this -``` -view { - -} -``` -If your view just contain single property like -``` -text { - text = "Hello world!" -} -``` -You can simplify it -``` -text -> "Hello world!" -``` -**NOTE: ```text -> "Hello world!"``` is different from ```text = "Hello world"```** -## Add child view -Just add a new view inside a view -``` -view { - childView { - - } -} -``` -## Custom view -You can add your custom view easily, [read more](CustomView.md) - -# Property -## Types -- [Number](#Number) -- [String](#String) -- [Boolean](#Boolean) -- ```null``` -- [Array](#Array) -- [Map](#Array) - -### Number -All platform will convert to decimal value if possible - -### String -A string will match all content inside ```""```, which contains the ```\n``` and others - -### Boolean -```true``` or ```false``` - -### Array -An array can contain any object, e.g. -``` -["Hello World!", 1, false] -``` -It will convert to ```List``` if possible - -### Map -A map is similar to Array, but it contains keys -``` -[ - "Hello" = "World!", - "True" = false -] -``` -**NOTE: Map start with ```[``` and end with ```]``` NOT ```{``` and ```}```** - -# Extension -You can provide some extension to set the property value, the extension start with ```$``` -``` -text -> $resource hello -``` -It will provide a native resource by key ```hello``` and set the property -You can [add your custom extension](CustomExtension.md) easily - -# DataBinding -You can use data binding to bind your property to your data context, and data binding is a specific extension -All property that use data binding will be update when data context fire a ```propertyChanged``` -``` -text -> $bind hello -``` -It will provide the ```hello``` property value from the data context -Your data context class look like this: -### Android -``` -class Model : BaseNotifyObject() { - @get:Binding(name = "hello") - @set:Binding(name = "hello") - var text = "World" - set(text) { - field = text - notifyPropertyChanged("text") - } -} -``` -### .Net -``` -public class Model : INotifyPropertyChanged -{ - private string _hello = "World!"; - public string Hello - { - get => _hello; - set - { - _hello = value; - OnPropertyChanged("hello"); - } - } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } -} -``` -Some View's property is two-way binding as default, e.g. -``` -stack { - input -> $bind text - text -> $bind text -} -``` -The text below will show the input's text - -You can add some converter for some use case, Shiba use JavaScript as the default scripting language -``` -text -> append(hello($bind world), "awesome") -``` -It will provide the ```world``` property value from data context, and pass it to ```hello()```, then pass the result to ```append()```, finally set the final result to view's property -You can go to [here](#Converter) to see how to add the converter -Or just writing the script after the extension -``` -text -> $bind hello ${ - return it + " world!"; -} -``` -It will provide the ```hello``` property value from data context, and pass it to the script -This kind of script start with ```${``` and end with ```}```, the parameter name is ```it``` and currently **cannot be changed** - -# Scripting -Shiba allow using JavaScript as the script language - -| Platform | Runtime | -|:---:|:---:| -|.Net|[ChakraCore](https://github.com/Microsoft/ChakraCore)| -|Android|V8 (By [LiquidCore](https://github.com/LiquidPlayer/LiquidCore/))| -|iOS|JavaScript Core| - -## Converter -Currently, you can use JavaScript to write some converter for DataBinding -### Android -``` -Shiba.addConverter("function hello(data) { return data + \" world!\"; }") -``` -### .Net -``` -AbstractShiba.Instance.AddConverter("function hello(data) { return data + \" world!\"; }") -``` - -## Native Object -You can add a native object as a global property -### Android -[Example](../Android/shiba/src/main/java/moe/tlaster/shiba/scripting/runtime/Storage.kt) -```YourObject``` must extends from ```JSObject``` -``` -(Shiba.configuration.scriptRuntime as DefaultScriptRuntime).addObject("yourObject") { - YourObject(it) -} - -``` -### .Net -[Example](../Windows/Shiba.Shared/Scripting/Runtime/Storage.cs) -You must add ```[JsExport(Name = "yourMethod")]``` attribute in order to export your method to JavaScript Runtime -``` -ShibaApp.Instance.ScriptRuntime.AddObject("yourObject", new YourObject()); -``` - -### Build in native object -- storage - -# More -- [DataBinding](DataBinding.md) -- [Scripting](Scripting.md) -- [Custom View](CustomView.md) -- [Custom Extension](CustomExtension.md) \ No newline at end of file diff --git a/doc/WritingShiba.zh.md b/doc/WritingShiba.zh.md deleted file mode 100644 index bf295d9..0000000 --- a/doc/WritingShiba.zh.md +++ /dev/null @@ -1,196 +0,0 @@ -[English](WritingShiba.md) | [中文](WritingShiba.zh.md) -# 编写 Shiba -一个简单的布局定义如下 -``` -stack { - text { - text = "Hello world!" - } -} -``` -这会在屏幕上显示 "Hello world!" - -## 一个简单的 View 定义 -一个简单的 View 的定义如下 -``` -view { - -} -``` -如果你的 View 只有一个属性,比如下面这样 -``` -text { - text = "Hello world!" -} -``` -你可以简写为: -``` -text -> "Hello world!" -``` -**注意: ```text -> "Hello world!"``` 和 ```text = "Hello world"```** 是不一样的! -## 定义子 View -在 View 内部再定义一个 View即可 -``` -view { - childView { - - } -} -``` -## 自定义 View -你可以简单的定义一个自定义的 View,[阅读这里](CustomView.zh.md) - -# 属性 -## 类型 -- [Number](#Number) -- [String](#String) -- [Boolean](#Boolean) -- ```null``` -- [Array](#Array) -- [Map](#Array) - -### Number -所有平台都会转换为 decimal 如果可能的话 - -### String -String 会匹配所有在 ```""``` 之内的字符, 也就是说诸如换行符 ```\n``` 也会被匹配到 - -### Boolean -```true``` or ```false``` - -### Array -一个数组可以包含任意数据类型, e.g. -``` -["Hello World!", 1, false] -``` -在 Native 层将会是 ```List``` - -### Map -字典和数组类似,但是包含有 Key -``` -[ - "Hello" = "World!", - "True" = false -] -``` -**NOTE: 字典以 ```[``` 开始, 以 ```]``` 结束,而不是 ```{``` 和 ```}```** - -# Extension -你可以使用 Extension 来给属性提供值,Extension 以 ```$``` 开始 -所有使用了数据绑定的属性都会在 DataContext 出发 ```propertyChanged``` 的时候得到更新 -``` -text -> $resource hello -``` -这会在 Native 层返回 Key 是 ```hello``` 的资源并设置到 View 的对应属性中 -你可以简单的[添加自定义 Extension](CustomExtension.zh.md) - -# DataBinding -你可以将属性的值绑定到 DataContext 上的属性,数据绑定是一组特殊的 Extension -``` -text -> $bind hello -``` -这会在 DataContext 中寻找名为 hello 的属性并将其值设置到 View 的对应属性中 -你的 DataContext 类应该类似这样 -### Android -``` -class Model : BaseNotifyObject() { - @get:Binding(name = "hello") - @set:Binding(name = "hello") - var text = "World" - set(text) { - field = text - notifyPropertyChanged("text") - } -} -``` -### .Net -``` -public class Model : INotifyPropertyChanged -{ - private string _hello = "World!"; - public string Hello - { - get => _hello; - set - { - _hello = value; - OnPropertyChanged("hello"); - } - } - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } -} -``` -一些 View 的一些属性默认是双向绑定的,比如 -``` -stack { - input -> $bind text - text -> $bind text -} -``` -下面的 text 将会显示上面 input 所输入的内容 - -在一些应用情况下,你可以添加一些转换器。Shiba 使用 JavaScript 作为默认的脚本语言。 -``` -text -> append(hello($bind world), "awesome") -``` -这会在 DataContext 中寻找名为 ```world``` 的属性并将其值传给 ```hello()``` ,计算完成后将结果传给 ```append()``` ,最后将最终结果赋值给 View 对应的属性 -你可以跳转到[这里](#Converter)去看如何添加转换器 -或者直接在 Extension 后面添加 -``` -text -> $bind hello ${ - return it + " world!"; -} -``` -这会在 DataContext 中寻找名为 ```hello``` 的属性并将其值传给脚本 -这种类型的转换器以 ```${``` 开始, 并以 ```}``` 结束, 默认参数名为 ```it``` 并且目前**尚不能修改** - -# Scripting -Siba 默认使用 JavaScript 作为脚本语言 - -| 平台 | Runtime | -|:---:|:---:| -|.Net|[ChakraCore](https://github.com/Microsoft/ChakraCore)| -|Android|V8 (By [LiquidCore](https://github.com/LiquidPlayer/LiquidCore/))| -|iOS|JavaScript Core| - -## 转换器 -你可以添加一下 JavaScript function 作为转换器使用 -### Android -``` -Shiba.addConverter("function hello(data) { return data + \" world!\"; }") -``` -### .Net -``` -AbstractShiba.Instance.AddConverter("function hello(data) { return data + \" world!\"; }") -``` - -## Native Object -你可以添加一些 Native 的实例作为 JavaScript 中 global 的一个属性 -### Android -[Example](../Android/shiba/src/main/java/moe/tlaster/shiba/scripting/runtime/Storage.kt) -```YourObject``` 必须继承自 ```JSObject``` -``` -(Shiba.configuration.scriptRuntime as DefaultScriptRuntime).addObject("yourObject") { - YourObject(it) -} - -``` -### .Net -[Example](../Windows/Shiba.Shared/Scripting/Runtime/Storage.cs) -你需要添加 ```[JsExport(Name = "yourMethod")]``` attribute 来将你的方法暴露给 JavaScript Runtime -``` -ShibaApp.Instance.ScriptRuntime.AddObject("yourObject", new YourObject()); -``` - -### 自带的 Native Object -- storage - -# 更多阅读 -- [DataBinding](DataBinding.zh.md) -- [Scripting](Scripting.zh.md) -- [自定义 View](CustomView.zh.md) -- [自定义 Extension](CustomExtension.zh.md) \ No newline at end of file From 283727f82b54c101c8ebf094685ffea3eda85922 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Sun, 17 Feb 2019 21:22:34 +0800 Subject: [PATCH 24/27] [UWP] Move ChakraHosting separate repo && bug fix --- UWP/Sample/Shiba.UWP.Sample/MainPage.xaml | 4 ++-- .../Shiba.UWP.Sample/Shiba.UWP.Sample.csproj | 4 ---- UWP/Shiba.Test/Shiba.Test.csproj | 4 ---- UWP/Shiba.sln | 22 ------------------- UWP/Shiba/Parser/ShibaParserWrapper.cs | 2 +- UWP/Shiba/Shiba.csproj | 9 +++----- 6 files changed, 6 insertions(+), 39 deletions(-) diff --git a/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml b/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml index 476fa72..4130803 100644 --- a/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml +++ b/UWP/Sample/Shiba.UWP.Sample/MainPage.xaml @@ -14,11 +14,11 @@ - <text text="$bind { if (it === null) return null; return it.hello.world }" /> + <text text="$bind { if (it === null) return null; return it.hello.world; }" /> - <text text="$bind { if (it === null) return null; return it.hello.world }" /> + <text text="$bind { if (it === null) return null; return it.hello.world; }" />