From 44d68b4557ac11aa6a1b0fce5e007d2df8ffcbde Mon Sep 17 00:00:00 2001 From: Huajiang Wei Date: Tue, 18 Feb 2020 20:40:31 +0800 Subject: [PATCH] change execution engine to simplify the expression and statement execution --- ExecutionEngine/ExecutionEngine.cs | 200 -- ExecutionEngine/ExecutionEngine.csproj | 64 - ExecutionEngine/Properties/AssemblyInfo.cs | 36 - ExecutionEngine/Thread.cs | 207 -- ScrachEditor/Form1.Designer.cs | 39 - ScrachEditor/Form1.cs | 19 - ScrachEditor/Program.cs | 21 - ScrachEditor/Properties/AssemblyInfo.cs | 36 - ScrachEditor/Properties/Resources.Designer.cs | 71 - ScrachEditor/Properties/Settings.Designer.cs | 30 - ScrachEditor/Properties/Settings.settings | 7 - ScrachEditor/ScrachEditor.csproj | 82 - ScratchControl/Properties/Resources.resx | 117 - ScratchNet.sln | 26 +- ScratchNet/appearance/SizeExpression.cs | 65 - ScratchNet/movement/DegreeExpression.cs | 65 - ScratchNet/movement/TimedMoveStatement.cs | 184 - ScratchNet/movement/YPositionExpression.cs | 67 - ScriptEngine/BlockStatement.cs | 71 - ScriptEngine/runtime/Identifier.cs | 64 - ScriptEngine/runtime/flow/ForStatement.cs | 117 - ScriptEngine/runtime/flow/IfStatement.cs | 126 - ScriptEngine/runtime/flow/WhileStatement.cs | 116 - .../runtime/logic/CompareExpression.cs | 129 - ScriptEngine/runtime/math/RandomExpression.cs | 96 - .../runtime/operator/BinaryExpression.cs | 144 - ScriptEngine/script/Execution.cs | 41 - ScriptEngine/script/ExecutionEnvironment.cs | 112 - ScriptEngine/script/IExecutionEngine.cs | 15 - WPF/Font.Awesome.WPF.Net35.sln | 25 - WPF/Font.Awesome.WPF.Net40.sln | 25 - WPF/Font.Awesome.WPF.Net40.sln.DotSettings | 2 - WPF/Font.Awesome.WPFNet35.sln.DotSettings | 2 - WPF/FontAwesome.WPF/Attributes.cs | 54 - WPF/FontAwesome.WPF/Awesome.cs | 69 - WPF/FontAwesome.WPF/ControlExtensions.cs | 134 - .../Converters/CssClassNameConverter.cs | 107 - .../Converters/DescriptionConverter.cs | 42 - .../Converters/ImageSourceConverter.cs | 40 - WPF/FontAwesome.WPF/FontAwesome.Icon.png | Bin 319 -> 0 bytes .../FontAwesome.WPF.Net35.csproj | 104 - .../FontAwesome.WPF.Net40.csproj | 107 - WPF/FontAwesome.WPF/FontAwesome.cs | 178 - WPF/FontAwesome.WPF/FontAwesomeIcon.cs | 3168 ----------------- WPF/FontAwesome.WPF/IFlippable.cs | 36 - WPF/FontAwesome.WPF/IRotatable.cs | 13 - WPF/FontAwesome.WPF/ISpinable.cs | 23 - WPF/FontAwesome.WPF/ImageAwesome.Icon.png | Bin 319 -> 0 bytes WPF/FontAwesome.WPF/ImageAwesome.cs | 219 -- .../Properties/AssemblyInfo.cs | 31 - .../DemoScriptEditor}/App.config | 0 .../DemoScriptEditor}/App.xaml | 5 +- .../DemoScriptEditor}/App.xaml.cs | 0 .../DemoScriptEditor}/ConsoleItem.cs | 0 .../DemoScriptEditor}/DemoScriptEditor.csproj | 10 +- .../DemoScriptEditor}/LogStatement.cs | 49 +- .../DemoScriptEditor}/MainWindow.xaml | 58 +- .../DemoScriptEditor}/MainWindow.xaml.cs | 151 +- .../DemoScriptEditor}/Persistance.cs | 6 +- .../Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Properties/Settings.settings | 0 .../DemoScriptEditor}/Script.cs | 0 {ScratchNet => demo/ScratchNet}/App.xaml | 0 {ScratchNet => demo/ScratchNet}/App.xaml.cs | 0 .../ScratchNet}/MainWindow.xaml | 0 .../ScratchNet}/MainWindow.xaml.cs | 2 +- .../ScratchNet}/Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../ScratchNet}/Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../ScratchNet}/Properties/Settings.settings | 0 .../ScratchNet}/ResourceList.xaml | 0 .../ScratchNet}/ResourceList.xaml.cs | 0 .../ScratchNet}/ScratchNet.csproj | 10 +- .../ScratchNet}/ScriptPlayer.xaml | 0 .../ScratchNet}/ScriptPlayer.xaml.cs | 118 +- .../ScratchNet}/SpriteList.xaml | 0 .../ScratchNet}/SpriteList.xaml.cs | 0 .../ScratchNet}/app.config | 0 .../ScratchNet}/appearance/HideStatement.cs | 44 +- .../ScratchNet}/appearance/LogStatement.cs | 42 +- .../ScratchNet}/appearance/ResizeStatement.cs | 54 +- .../ScratchNet}/appearance/SayStatement.cs | 0 .../appearance/SetImageStatement.cs | 92 +- .../appearance/SetNextImageStatement.cs | 45 +- .../ScratchNet}/appearance/ShowStatement.cs | 44 +- demo/ScratchNet/appearance/SizeExpression.cs | 40 + .../ScratchNet}/appearance/ThinkStatement.cs | 0 .../ScratchNet}/character/Background.cs | 0 .../character/CharacterRotationMode.cs | 0 .../ScratchNet}/character/Game.cs | 0 .../ScratchNet}/character/ResourceList.cs | 0 .../ScratchNet}/character/Sprite.cs | 0 .../ScratchNet}/control/CurrentEnviroment.cs | 0 .../convertor/ActualWidthMinusConverter.cs | 0 .../convertor/ActualWidthMinusConverter2.cs | 0 .../ScriptContainerWidthConverter.cs | 0 .../convertor/SpriteToImageConverter.cs | 0 .../ScratchNet}/event/ClickEventHandler.cs | 0 .../ScratchNet}/event/Events.cs | 0 .../ScratchNet}/event/KeyEventHandler.cs | 0 .../ScratchNet}/event/MessageEvent.cs | 0 .../ScratchNet}/event/MessageEvetHandler.cs | 0 .../ScratchNet}/event/StartEventHandler.cs | 0 .../ScratchNet}/images/backdrop1.png | Bin .../ScratchNet}/images/run.png | Bin {ScratchNet => demo/ScratchNet}/images/th.jpg | Bin .../ScratchNet}/localization/Localize.cs | 0 .../localization/Strings.Designer.cs | 0 .../localization/Strings.ja-JP.Designer.cs | 0 .../localization/Strings.ja-JP.resx | 0 .../ScratchNet}/localization/Strings.resx | 0 .../localization/Strings.zh-CN.Designer.cs | 0 .../localization/Strings.zh-CN.resx | 0 demo/ScratchNet/movement/DegreeExpression.cs | 40 + .../ScratchNet}/movement/MoveStatement.cs | 91 +- .../movement/ReflectionModeStatement.cs | 27 +- .../ScratchNet}/movement/RotationStatement.cs | 65 +- .../movement/SetDegreeStatement.cs | 64 +- .../movement/SetPositionStatement.cs | 88 +- .../movement/SetPositionXStatement.cs | 56 +- .../movement/SetPositionYStatement.cs | 55 +- .../movement/SetRotationModeStatement.cs | 44 +- .../ScratchNet/movement/TimedMoveStatement.cs | 146 + .../movement/XPositionExpression.cs | 29 +- .../movement/YPositionExpression.cs | 41 + .../ScratchNet}/runtime/ArgumentExpression.cs | 0 .../ScratchNet}/runtime/BinaryExpression.cs | 0 .../ScratchNet}/runtime/BreakStatement.cs | 0 .../ScratchNet}/runtime/CallExpression.cs | 0 .../ScratchNet}/runtime/CompareExpression.cs | 0 .../runtime/ConditionalExpression.cs | 0 .../runtime/ExpressionStatement.cs | 0 .../ScratchNet}/runtime/ForInStatement.cs | 0 .../ScratchNet}/runtime/ForStatement.cs | 0 .../runtime/FunctionDeclaration.cs | 0 .../ScratchNet}/runtime/Identifier.cs | 0 .../ScratchNet}/runtime/IfStatement.cs | 0 .../ScratchNet}/runtime/Literal.cs | 0 .../ScratchNet}/runtime/LogicExpression.cs | 0 .../ScratchNet}/runtime/NotExpression.cs | 0 .../ScratchNet}/runtime/ReturnStatement.cs | 0 .../ScratchNet}/runtime/TryCatchStatement.cs | 0 .../runtime/VariableAssignmentExpression.cs | 0 .../ScratchNet}/runtime/WaitStatement.cs | 0 .../ScratchNet}/runtime/WhileStatement.cs | 0 .../ScratchNet}/script/Declaration.cs | 0 .../ScratchNet}/script/Event.cs | 0 .../ScratchNet}/script/Execution.cs | 0 .../script/ExecutionEnvironment.cs | 0 .../ScratchNet}/script/Expression.cs | 0 .../ScratchNet}/script/Function.cs | 0 .../ScratchNet}/script/Script.cs | 0 .../ScratchNet}/script/Statement.cs | 0 .../ScratchNet}/script/Types.cs | 0 .../ScratchNet}/script/Variable.cs | 0 .../script/descriptor/BlockDescriptor.cs | 0 .../script/descriptor/Descriptor.cs | 0 .../ScratchNet}/util/Serialization.cs | 0 .../ScratchControl}/App.xaml | 0 .../ScratchControl}/App.xaml.cs | 0 .../ScratchControl}/MainWindow.xaml | 0 .../ScratchControl}/MainWindow.xaml.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../ScratchControl}/Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Properties/Settings.settings | 0 .../ScratchControl}/ScratchControl.csproj | 0 {ScratchNet => src/ScratchControl}/app.config | 0 .../expression/BooleanExpressionControl.xaml | 0 .../BooleanExpressionControl.xaml.cs | 0 .../expression/BooleanExpressionHolder.xaml | 0 .../BooleanExpressionHolder.xaml.cs | 0 .../expression/ExpressionControl.cs | 0 .../expression/ExpressionHelper.cs | 0 .../expression/ExpressionHolder.cs | 0 .../expression/NumberExpressionControl.xaml | 0 .../NumberExpressionControl.xaml.cs | 0 .../expression/NumberExpressionHolder.xaml | 0 .../expression/NumberExpressionHolder.xaml.cs | 0 .../expression/ObjectExpressionControl.xaml | 0 .../ObjectExpressionControl.xaml.cs | 0 .../expression/SelectionItemControl.xaml | 0 .../expression/SelectionItemControl.xaml.cs | 0 .../ScratchControl}/global/GlobalResource.cs | 0 .../ScratchEditor}/ActualSizeAdjustment.cs | 0 .../ScratchEditor}/BlockIndicator.xaml | 0 .../ScratchEditor}/BlockIndicator.xaml.cs | 0 .../ScratchEditor}/BlockStatementControl.xaml | 0 .../BlockStatementControl.xaml.cs | 0 .../ScratchEditor}/CreateFunctionDlg.xaml | 0 .../ScratchEditor}/CreateFunctionDlg.xaml.cs | 0 .../ScratchEditor}/ExpressionControl.xaml | 0 .../ScratchEditor}/ExpressionControl.xaml.cs | 15 +- .../ScratchEditor}/FunctionControl.xaml | 0 .../ScratchEditor}/FunctionControl.xaml.cs | 0 .../ScratchEditor}/GraphicScriptEditor.xaml | 0 .../GraphicScriptEditor.xaml.cs | 23 + src/ScratchEditor/IErrorHighlight.cs | 63 + .../ScratchEditor}/ParameterIndicator.xaml | 0 .../ScratchEditor}/ParameterIndicator.xaml.cs | 0 .../ScratchEditor}/Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../ScratchEditor}/Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Properties/Settings.settings | 0 .../ScratchEditor}/Properties/colors.txt | 0 .../ScriptControlDataTemplateSelector.cs | 0 .../ScratchEditor}/ScriptEditor.csproj | 3 +- .../ScratchEditor}/SetVariableNameDialog.xaml | 0 .../SetVariableNameDialog.xaml.cs | 0 .../ScratchEditor}/StatementControl.xaml | 4 +- .../ScratchEditor}/StatementControl.xaml.cs | 13 +- .../TextBoxExpressionHolder.xaml | 0 .../TextBoxExpressionHolder.xaml.cs | 16 +- .../control/CurrentEnviroment.cs | 0 .../ScratchEditor}/control/ScriptStepGroup.cs | 0 .../convertor/ActualWidthMinusConverter.cs | 0 .../convertor/ActualWidthMinusConverter2.cs | 0 .../convertor/BooleanVisiblityConverter.cs | 0 .../convertor/CanBooleanConverter.cs | 0 .../EventHandlerVisibilityConverter.cs | 0 .../convertor/ExpressionBarBackground.cs | 0 .../ExpressionHolderBorderConverter.cs | 0 .../convertor/ImageConverter.cs | 0 .../convertor/IsExpressionConverter.cs | 0 .../convertor/IsNullVisibilityConverter.cs | 0 .../ScriptContainerWidthConverter.cs | 0 .../convertor/StringLiteralConverter.cs | 0 .../convertor/TextNotEmptyConverter.cs | 0 .../ScratchEditor}/images/delete-512.png | Bin .../ScratchEditor}/localization/Localize.cs | 0 .../localization/Strings.Designer.cs | 0 .../localization/Strings.ja-JP.Designer.cs | 0 .../localization/Strings.ja-JP.resx | 0 .../ScratchEditor}/localization/Strings.resx | 0 .../localization/Strings.zh-CN.Designer.cs | 0 .../localization/Strings.zh-CN.resx | 0 .../ScratchEditor}/util/Utility.cs | 129 +- .../ScriptEngine}/Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Properties/Resources.ja-JP.resx | 0 .../ScriptEngine}/Properties/Resources.resx | 0 .../Properties/Resources.zh-CN.resx | 0 .../ScriptEngine}/ScriptEngine.csproj | 20 +- src/ScriptEngine/execute/Completion.cs | 48 + src/ScriptEngine/execute/Delegate.cs | 69 + .../execute/ExcutionEnvironment.cs | 204 ++ src/ScriptEngine/execute/Execution.cs | 13 + src/ScriptEngine/execute/ScriptValue.cs | 71 + src/ScriptEngine/execute/TypeConverters.cs | 115 + .../runtime/AssignmentStatement.cs | 63 +- .../runtime/ExpressionStatement.cs | 34 +- src/ScriptEngine/runtime/Identifier.cs | 39 + .../ScriptEngine}/runtime/Literal.cs | 45 +- .../runtime/VariableDeclarationcs.cs | 5 +- .../runtime/event/EventHandlerDelcaration.cs | 35 +- .../runtime/exception/TryCatchStatement.cs | 92 +- .../runtime/flow/BreakStatement.cs | 31 +- .../runtime/flow/ContinueStatement.cs | 30 +- .../runtime/flow/ForInStatement.cs | 0 src/ScriptEngine/runtime/flow/ForStatement.cs | 94 + src/ScriptEngine/runtime/flow/IfStatement.cs | 99 + .../runtime/flow/LoopStatement.cs | 92 + .../runtime/flow/ReturnStatement.cs | 39 +- .../runtime/flow/WhileStatement.cs | 94 + .../runtime/function/ArgumentExpression.cs | 29 +- .../runtime/function/CallExpression.cs | 140 + .../runtime/function/CallStatement.cs | 101 +- .../runtime/function/FunctionDeclaration.cs | 0 .../runtime/function/FunctionDeclarationEx.cs | 41 +- .../runtime/logic/CompareExpression.cs | 169 + .../runtime/logic/LogicExpression.cs | 89 +- .../runtime/logic/NotExpression.cs | 34 +- .../runtime/math/RandomExpression.cs | 79 + .../runtime/operator/BinaryExpression.cs | 213 ++ .../runtime/operator/ConditionalExpression.cs | 70 +- .../runtime/string/ConcateExpression.cs | 4 +- .../runtime/thread/WaitStatement.cs | 41 +- src/ScriptEngine/script/BlockStatement.cs | 41 + .../ScriptEngine}/script/Class.cs | 0 .../ScriptEngine}/script/Declaration.cs | 2 +- .../ScriptEngine}/script/EventHandler.cs | 0 .../ScriptEngine}/script/Expression.cs | 2 +- .../ScriptEngine}/script/Function.cs | 2 +- .../ScriptEngine/script/INode.cs | 4 +- .../ScriptEngine}/script/Instance.cs | 0 .../ScriptEngine}/script/Loop.cs | 0 src/ScriptEngine/script/Module.cs | 12 + .../ScriptEngine}/script/Statement.cs | 2 +- .../ScriptEngine}/script/Types.cs | 0 .../ScriptEngine}/script/Variable.cs | 0 .../script/descriptor/BlockDescriptor.cs | 3 +- .../script/descriptor/Descriptor.cs | 0 .../SelectionExpressionItemDescriptor.cs | 0 test/UnitTestProject/AstExectuion.cs | 212 ++ test/UnitTestProject/AstExecutionTest.cs | 98 + .../Properties/AssemblyInfo.cs | 20 + test/UnitTestProject/TestEnvronment.cs | 63 + test/UnitTestProject/TestExpression.cs | 36 + test/UnitTestProject/UnitTestProject.csproj | 77 + test/UnitTestProject/packages.config | 5 + 306 files changed, 3440 insertions(+), 8009 deletions(-) delete mode 100644 ExecutionEngine/ExecutionEngine.cs delete mode 100644 ExecutionEngine/ExecutionEngine.csproj delete mode 100644 ExecutionEngine/Properties/AssemblyInfo.cs delete mode 100644 ExecutionEngine/Thread.cs delete mode 100644 ScrachEditor/Form1.Designer.cs delete mode 100644 ScrachEditor/Form1.cs delete mode 100644 ScrachEditor/Program.cs delete mode 100644 ScrachEditor/Properties/AssemblyInfo.cs delete mode 100644 ScrachEditor/Properties/Resources.Designer.cs delete mode 100644 ScrachEditor/Properties/Settings.Designer.cs delete mode 100644 ScrachEditor/Properties/Settings.settings delete mode 100644 ScrachEditor/ScrachEditor.csproj delete mode 100644 ScratchControl/Properties/Resources.resx delete mode 100644 ScratchNet/appearance/SizeExpression.cs delete mode 100644 ScratchNet/movement/DegreeExpression.cs delete mode 100644 ScratchNet/movement/TimedMoveStatement.cs delete mode 100644 ScratchNet/movement/YPositionExpression.cs delete mode 100644 ScriptEngine/BlockStatement.cs delete mode 100644 ScriptEngine/runtime/Identifier.cs delete mode 100644 ScriptEngine/runtime/flow/ForStatement.cs delete mode 100644 ScriptEngine/runtime/flow/IfStatement.cs delete mode 100644 ScriptEngine/runtime/flow/WhileStatement.cs delete mode 100644 ScriptEngine/runtime/logic/CompareExpression.cs delete mode 100644 ScriptEngine/runtime/math/RandomExpression.cs delete mode 100644 ScriptEngine/runtime/operator/BinaryExpression.cs delete mode 100644 ScriptEngine/script/Execution.cs delete mode 100644 ScriptEngine/script/ExecutionEnvironment.cs delete mode 100644 ScriptEngine/script/IExecutionEngine.cs delete mode 100644 WPF/Font.Awesome.WPF.Net35.sln delete mode 100644 WPF/Font.Awesome.WPF.Net40.sln delete mode 100644 WPF/Font.Awesome.WPF.Net40.sln.DotSettings delete mode 100644 WPF/Font.Awesome.WPFNet35.sln.DotSettings delete mode 100644 WPF/FontAwesome.WPF/Attributes.cs delete mode 100644 WPF/FontAwesome.WPF/Awesome.cs delete mode 100644 WPF/FontAwesome.WPF/ControlExtensions.cs delete mode 100644 WPF/FontAwesome.WPF/Converters/CssClassNameConverter.cs delete mode 100644 WPF/FontAwesome.WPF/Converters/DescriptionConverter.cs delete mode 100644 WPF/FontAwesome.WPF/Converters/ImageSourceConverter.cs delete mode 100644 WPF/FontAwesome.WPF/FontAwesome.Icon.png delete mode 100644 WPF/FontAwesome.WPF/FontAwesome.WPF.Net35.csproj delete mode 100644 WPF/FontAwesome.WPF/FontAwesome.WPF.Net40.csproj delete mode 100644 WPF/FontAwesome.WPF/FontAwesome.cs delete mode 100644 WPF/FontAwesome.WPF/FontAwesomeIcon.cs delete mode 100644 WPF/FontAwesome.WPF/IFlippable.cs delete mode 100644 WPF/FontAwesome.WPF/IRotatable.cs delete mode 100644 WPF/FontAwesome.WPF/ISpinable.cs delete mode 100644 WPF/FontAwesome.WPF/ImageAwesome.Icon.png delete mode 100644 WPF/FontAwesome.WPF/ImageAwesome.cs delete mode 100644 WPF/FontAwesome.WPF/Properties/AssemblyInfo.cs rename {DemoScriptEditor => demo/DemoScriptEditor}/App.config (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/App.xaml (75%) rename {DemoScriptEditor => demo/DemoScriptEditor}/App.xaml.cs (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/ConsoleItem.cs (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/DemoScriptEditor.csproj (91%) rename {DemoScriptEditor => demo/DemoScriptEditor}/LogStatement.cs (58%) rename {DemoScriptEditor => demo/DemoScriptEditor}/MainWindow.xaml (64%) rename {DemoScriptEditor => demo/DemoScriptEditor}/MainWindow.xaml.cs (57%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Persistance.cs (99%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Properties/AssemblyInfo.cs (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Properties/Resources.Designer.cs (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Properties/Resources.resx (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Properties/Settings.Designer.cs (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Properties/Settings.settings (100%) rename {DemoScriptEditor => demo/DemoScriptEditor}/Script.cs (100%) rename {ScratchNet => demo/ScratchNet}/App.xaml (100%) rename {ScratchNet => demo/ScratchNet}/App.xaml.cs (100%) rename {ScratchNet => demo/ScratchNet}/MainWindow.xaml (100%) rename {ScratchNet => demo/ScratchNet}/MainWindow.xaml.cs (99%) rename {ScratchNet => demo/ScratchNet}/Properties/AssemblyInfo.cs (100%) rename {ScratchNet => demo/ScratchNet}/Properties/Resources.Designer.cs (100%) rename {ScratchNet => demo/ScratchNet}/Properties/Resources.resx (100%) rename {ScratchNet => demo/ScratchNet}/Properties/Settings.Designer.cs (100%) rename {ScratchControl => demo/ScratchNet}/Properties/Settings.settings (100%) rename {ScratchNet => demo/ScratchNet}/ResourceList.xaml (100%) rename {ScratchNet => demo/ScratchNet}/ResourceList.xaml.cs (100%) rename {ScratchNet => demo/ScratchNet}/ScratchNet.csproj (95%) rename {ScratchNet => demo/ScratchNet}/ScriptPlayer.xaml (100%) rename {ScratchNet => demo/ScratchNet}/ScriptPlayer.xaml.cs (64%) rename {ScratchNet => demo/ScratchNet}/SpriteList.xaml (100%) rename {ScratchNet => demo/ScratchNet}/SpriteList.xaml.cs (100%) rename {ScratchControl => demo/ScratchNet}/app.config (100%) rename {ScratchNet => demo/ScratchNet}/appearance/HideStatement.cs (54%) rename {ScratchNet => demo/ScratchNet}/appearance/LogStatement.cs (60%) rename {ScratchNet => demo/ScratchNet}/appearance/ResizeStatement.cs (56%) rename {ScratchNet => demo/ScratchNet}/appearance/SayStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/appearance/SetImageStatement.cs (62%) rename {ScratchNet => demo/ScratchNet}/appearance/SetNextImageStatement.cs (59%) rename {ScratchNet => demo/ScratchNet}/appearance/ShowStatement.cs (54%) create mode 100644 demo/ScratchNet/appearance/SizeExpression.cs rename {ScratchNet => demo/ScratchNet}/appearance/ThinkStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/character/Background.cs (100%) rename {ScratchNet => demo/ScratchNet}/character/CharacterRotationMode.cs (100%) rename {ScratchNet => demo/ScratchNet}/character/Game.cs (100%) rename {ScratchNet => demo/ScratchNet}/character/ResourceList.cs (100%) rename {ScratchNet => demo/ScratchNet}/character/Sprite.cs (100%) rename {ScratchNet => demo/ScratchNet}/control/CurrentEnviroment.cs (100%) rename {ScratchEditor => demo/ScratchNet}/convertor/ActualWidthMinusConverter.cs (100%) rename {ScratchEditor => demo/ScratchNet}/convertor/ActualWidthMinusConverter2.cs (100%) rename {ScratchEditor => demo/ScratchNet}/convertor/ScriptContainerWidthConverter.cs (100%) rename {ScratchNet => demo/ScratchNet}/convertor/SpriteToImageConverter.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/ClickEventHandler.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/Events.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/KeyEventHandler.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/MessageEvent.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/MessageEvetHandler.cs (100%) rename {ScratchNet => demo/ScratchNet}/event/StartEventHandler.cs (100%) rename {ScratchNet => demo/ScratchNet}/images/backdrop1.png (100%) rename {ScratchNet => demo/ScratchNet}/images/run.png (100%) rename {ScratchNet => demo/ScratchNet}/images/th.jpg (100%) rename {ScratchNet => demo/ScratchNet}/localization/Localize.cs (100%) rename {ScratchNet => demo/ScratchNet}/localization/Strings.Designer.cs (100%) rename {ScratchEditor => demo/ScratchNet}/localization/Strings.ja-JP.Designer.cs (100%) rename {ScratchNet => demo/ScratchNet}/localization/Strings.ja-JP.resx (100%) rename {ScratchNet => demo/ScratchNet}/localization/Strings.resx (100%) rename {ScratchEditor => demo/ScratchNet}/localization/Strings.zh-CN.Designer.cs (100%) rename {ScratchNet => demo/ScratchNet}/localization/Strings.zh-CN.resx (100%) create mode 100644 demo/ScratchNet/movement/DegreeExpression.cs rename {ScratchNet => demo/ScratchNet}/movement/MoveStatement.cs (65%) rename {ScratchNet => demo/ScratchNet}/movement/ReflectionModeStatement.cs (57%) rename {ScratchNet => demo/ScratchNet}/movement/RotationStatement.cs (59%) rename {ScratchNet => demo/ScratchNet}/movement/SetDegreeStatement.cs (58%) rename {ScratchNet => demo/ScratchNet}/movement/SetPositionStatement.cs (53%) rename {ScratchNet => demo/ScratchNet}/movement/SetPositionXStatement.cs (57%) rename {ScratchNet => demo/ScratchNet}/movement/SetPositionYStatement.cs (57%) rename {ScratchNet => demo/ScratchNet}/movement/SetRotationModeStatement.cs (64%) create mode 100644 demo/ScratchNet/movement/TimedMoveStatement.cs rename {ScratchNet => demo/ScratchNet}/movement/XPositionExpression.cs (50%) create mode 100644 demo/ScratchNet/movement/YPositionExpression.cs rename {ScratchNet => demo/ScratchNet}/runtime/ArgumentExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/BinaryExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/BreakStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/CallExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/CompareExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/ConditionalExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/ExpressionStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/ForInStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/ForStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/FunctionDeclaration.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/Identifier.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/IfStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/Literal.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/LogicExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/NotExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/ReturnStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/TryCatchStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/VariableAssignmentExpression.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/WaitStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/runtime/WhileStatement.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Declaration.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Event.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Execution.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/ExecutionEnvironment.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Expression.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Function.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Script.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Statement.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Types.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/Variable.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/descriptor/BlockDescriptor.cs (100%) rename {ScratchNet => demo/ScratchNet}/script/descriptor/Descriptor.cs (100%) rename {ScratchNet => demo/ScratchNet}/util/Serialization.cs (100%) rename {ScratchControl => src/ScratchControl}/App.xaml (100%) rename {ScratchControl => src/ScratchControl}/App.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/MainWindow.xaml (100%) rename {ScratchControl => src/ScratchControl}/MainWindow.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/Properties/AssemblyInfo.cs (100%) rename {ScratchControl => src/ScratchControl}/Properties/Resources.Designer.cs (100%) rename {ScrachEditor => src/ScratchControl}/Properties/Resources.resx (100%) rename {ScratchControl => src/ScratchControl}/Properties/Settings.Designer.cs (100%) rename {ScratchEditor => src/ScratchControl}/Properties/Settings.settings (100%) rename {ScratchControl => src/ScratchControl}/ScratchControl.csproj (100%) rename {ScratchNet => src/ScratchControl}/app.config (100%) rename {ScratchControl => src/ScratchControl}/expression/BooleanExpressionControl.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/BooleanExpressionControl.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/BooleanExpressionHolder.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/BooleanExpressionHolder.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/ExpressionControl.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/ExpressionHelper.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/ExpressionHolder.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/NumberExpressionControl.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/NumberExpressionControl.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/NumberExpressionHolder.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/NumberExpressionHolder.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/ObjectExpressionControl.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/ObjectExpressionControl.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/expression/SelectionItemControl.xaml (100%) rename {ScratchControl => src/ScratchControl}/expression/SelectionItemControl.xaml.cs (100%) rename {ScratchControl => src/ScratchControl}/global/GlobalResource.cs (100%) rename {ScratchEditor => src/ScratchEditor}/ActualSizeAdjustment.cs (100%) rename {ScratchEditor => src/ScratchEditor}/BlockIndicator.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/BlockIndicator.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/BlockStatementControl.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/BlockStatementControl.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/CreateFunctionDlg.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/CreateFunctionDlg.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/ExpressionControl.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/ExpressionControl.xaml.cs (83%) rename {ScratchEditor => src/ScratchEditor}/FunctionControl.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/FunctionControl.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/GraphicScriptEditor.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/GraphicScriptEditor.xaml.cs (98%) create mode 100644 src/ScratchEditor/IErrorHighlight.cs rename {ScratchEditor => src/ScratchEditor}/ParameterIndicator.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/ParameterIndicator.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/Properties/AssemblyInfo.cs (100%) rename {ScratchEditor => src/ScratchEditor}/Properties/Resources.Designer.cs (100%) rename {ScratchEditor => src/ScratchEditor}/Properties/Resources.resx (100%) rename {ScratchEditor => src/ScratchEditor}/Properties/Settings.Designer.cs (100%) rename {ScratchNet => src/ScratchEditor}/Properties/Settings.settings (100%) rename {ScratchEditor => src/ScratchEditor}/Properties/colors.txt (100%) rename {ScratchEditor => src/ScratchEditor}/ScriptControlDataTemplateSelector.cs (100%) rename {ScratchEditor => src/ScratchEditor}/ScriptEditor.csproj (98%) rename {ScratchEditor => src/ScratchEditor}/SetVariableNameDialog.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/SetVariableNameDialog.xaml.cs (100%) rename {ScratchEditor => src/ScratchEditor}/StatementControl.xaml (99%) rename {ScratchEditor => src/ScratchEditor}/StatementControl.xaml.cs (90%) rename {ScratchEditor => src/ScratchEditor}/TextBoxExpressionHolder.xaml (100%) rename {ScratchEditor => src/ScratchEditor}/TextBoxExpressionHolder.xaml.cs (89%) rename {ScratchEditor => src/ScratchEditor}/control/CurrentEnviroment.cs (100%) rename {ScratchEditor => src/ScratchEditor}/control/ScriptStepGroup.cs (100%) rename {ScratchNet => src/ScratchEditor}/convertor/ActualWidthMinusConverter.cs (100%) rename {ScratchNet => src/ScratchEditor}/convertor/ActualWidthMinusConverter2.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/BooleanVisiblityConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/CanBooleanConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/EventHandlerVisibilityConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/ExpressionBarBackground.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/ExpressionHolderBorderConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/ImageConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/IsExpressionConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/IsNullVisibilityConverter.cs (100%) rename {ScratchNet => src/ScratchEditor}/convertor/ScriptContainerWidthConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/StringLiteralConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/convertor/TextNotEmptyConverter.cs (100%) rename {ScratchEditor => src/ScratchEditor}/images/delete-512.png (100%) rename {ScratchEditor => src/ScratchEditor}/localization/Localize.cs (100%) rename {ScratchEditor => src/ScratchEditor}/localization/Strings.Designer.cs (100%) rename {ScratchNet => src/ScratchEditor}/localization/Strings.ja-JP.Designer.cs (100%) rename {ScratchEditor => src/ScratchEditor}/localization/Strings.ja-JP.resx (100%) rename {ScratchEditor => src/ScratchEditor}/localization/Strings.resx (100%) rename {ScratchNet => src/ScratchEditor}/localization/Strings.zh-CN.Designer.cs (100%) rename {ScratchEditor => src/ScratchEditor}/localization/Strings.zh-CN.resx (100%) rename {ScratchEditor => src/ScratchEditor}/util/Utility.cs (76%) rename {ScriptEngine => src/ScriptEngine}/Properties/AssemblyInfo.cs (100%) rename {ScriptEngine => src/ScriptEngine}/Properties/Resources.Designer.cs (100%) rename {ScriptEngine => src/ScriptEngine}/Properties/Resources.ja-JP.resx (100%) rename {ScriptEngine => src/ScriptEngine}/Properties/Resources.resx (100%) rename {ScriptEngine => src/ScriptEngine}/Properties/Resources.zh-CN.resx (100%) rename {ScriptEngine => src/ScriptEngine}/ScriptEngine.csproj (89%) create mode 100644 src/ScriptEngine/execute/Completion.cs create mode 100644 src/ScriptEngine/execute/Delegate.cs create mode 100644 src/ScriptEngine/execute/ExcutionEnvironment.cs create mode 100644 src/ScriptEngine/execute/Execution.cs create mode 100644 src/ScriptEngine/execute/ScriptValue.cs create mode 100644 src/ScriptEngine/execute/TypeConverters.cs rename {ScriptEngine => src/ScriptEngine}/runtime/AssignmentStatement.cs (50%) rename {ScriptEngine => src/ScriptEngine}/runtime/ExpressionStatement.cs (54%) create mode 100644 src/ScriptEngine/runtime/Identifier.cs rename {ScriptEngine => src/ScriptEngine}/runtime/Literal.cs (52%) rename {ScriptEngine => src/ScriptEngine}/runtime/VariableDeclarationcs.cs (67%) rename {ScriptEngine => src/ScriptEngine}/runtime/event/EventHandlerDelcaration.cs (73%) rename {ScriptEngine => src/ScriptEngine}/runtime/exception/TryCatchStatement.cs (61%) rename {ScriptEngine => src/ScriptEngine}/runtime/flow/BreakStatement.cs (53%) rename {ScriptEngine => src/ScriptEngine}/runtime/flow/ContinueStatement.cs (54%) rename {ScriptEngine => src/ScriptEngine}/runtime/flow/ForInStatement.cs (100%) create mode 100644 src/ScriptEngine/runtime/flow/ForStatement.cs create mode 100644 src/ScriptEngine/runtime/flow/IfStatement.cs create mode 100644 src/ScriptEngine/runtime/flow/LoopStatement.cs rename {ScriptEngine => src/ScriptEngine}/runtime/flow/ReturnStatement.cs (53%) create mode 100644 src/ScriptEngine/runtime/flow/WhileStatement.cs rename {ScriptEngine => src/ScriptEngine}/runtime/function/ArgumentExpression.cs (51%) create mode 100644 src/ScriptEngine/runtime/function/CallExpression.cs rename ScriptEngine/runtime/function/CallExpression.cs => src/ScriptEngine/runtime/function/CallStatement.cs (66%) rename {ScriptEngine => src/ScriptEngine}/runtime/function/FunctionDeclaration.cs (100%) rename {ScriptEngine => src/ScriptEngine}/runtime/function/FunctionDeclarationEx.cs (72%) create mode 100644 src/ScriptEngine/runtime/logic/CompareExpression.cs rename {ScriptEngine => src/ScriptEngine}/runtime/logic/LogicExpression.cs (51%) rename {ScriptEngine => src/ScriptEngine}/runtime/logic/NotExpression.cs (52%) create mode 100644 src/ScriptEngine/runtime/math/RandomExpression.cs create mode 100644 src/ScriptEngine/runtime/operator/BinaryExpression.cs rename {ScriptEngine => src/ScriptEngine}/runtime/operator/ConditionalExpression.cs (50%) rename {ScriptEngine => src/ScriptEngine}/runtime/string/ConcateExpression.cs (88%) rename {ScriptEngine => src/ScriptEngine}/runtime/thread/WaitStatement.cs (57%) create mode 100644 src/ScriptEngine/script/BlockStatement.cs rename {ScriptEngine => src/ScriptEngine}/script/Class.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/Declaration.cs (70%) rename {ScriptEngine => src/ScriptEngine}/script/EventHandler.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/Expression.cs (86%) rename {ScriptEngine => src/ScriptEngine}/script/Function.cs (93%) rename ExecutionEngine/ExecutionMode.cs => src/ScriptEngine/script/INode.cs (68%) rename {ScriptEngine => src/ScriptEngine}/script/Instance.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/Loop.cs (100%) create mode 100644 src/ScriptEngine/script/Module.cs rename {ScriptEngine => src/ScriptEngine}/script/Statement.cs (89%) rename {ScriptEngine => src/ScriptEngine}/script/Types.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/Variable.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/descriptor/BlockDescriptor.cs (95%) rename {ScriptEngine => src/ScriptEngine}/script/descriptor/Descriptor.cs (100%) rename {ScriptEngine => src/ScriptEngine}/script/descriptor/SelectionExpressionItemDescriptor.cs (100%) create mode 100644 test/UnitTestProject/AstExectuion.cs create mode 100644 test/UnitTestProject/AstExecutionTest.cs create mode 100644 test/UnitTestProject/Properties/AssemblyInfo.cs create mode 100644 test/UnitTestProject/TestEnvronment.cs create mode 100644 test/UnitTestProject/TestExpression.cs create mode 100644 test/UnitTestProject/UnitTestProject.csproj create mode 100644 test/UnitTestProject/packages.config diff --git a/ExecutionEngine/ExecutionEngine.cs b/ExecutionEngine/ExecutionEngine.cs deleted file mode 100644 index 3f2b1c4..0000000 --- a/ExecutionEngine/ExecutionEngine.cs +++ /dev/null @@ -1,200 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace ScratchNet -{ - public class ExecutionEngine : IExecutionEngine - { - //List Classes { get; set; } - List Instances { get; set; } - public ExecutionEnvironment BaseEnvironment { get; internal set; } - public ExecutionMode Mode { get; set; } = ExecutionMode.Infinite; - public bool IsCompleted { get; internal set; } = false; - List Threads = new List(); - Dictionary ThreadNextRun = new Dictionary(); - Thread RunThread; - bool requestStop = false; - AutoResetEvent resetEvent = new AutoResetEvent(true); - public ExecutionEngine() - { - Instances = new List(); - BaseEnvironment = new ExecutionEnvironment(this); - Threads = new List(); - } - public void AddInstance(Instance inst) - { - - Lock(); - Instances.Add(inst); - inst.States.Clear(); - foreach (Variable v in inst.Class.Variables) - { - inst.States.Add(v.Name, v.Value); - } - UnLock(); - } - public Instance CreateInstance(Class c) - { - Lock(); - Instance inst = new Instance(c) ; - Instances.Add(inst); - foreach (Variable v in inst.Class.Variables) - { - inst.States.Add(v.Name, v.Value); - } - UnLock(); - return inst; - } - - public void Start() - { - requestStop = false; - RunThread = new Thread(new ThreadStart(Run)); - RunThread.Start(); - } - public void Stop() - { - requestStop = true; - if(RunThread!=null) - RunThread.Join(); - } - private void Run() - { - Nullable nextRun = DateTime.Now.AddMilliseconds(10); - while (!requestStop) - { - Lock(); - - foreach (RunThread t in Threads) - { - if (ThreadNextRun.ContainsKey(t)) - { - DateTime d = ThreadNextRun[t]; - if (d < DateTime.Now) - { - ThreadNextRun.Remove(t); - nextRun = null; - } - else - { - if (nextRun != null && nextRun > d) - nextRun = d; - continue; - } - } - else - { - nextRun = null; - } - if (!t.IsCompleted) - { - Nullable next = t.Step(); - if (next != null) - { - ThreadNextRun.Add(t, next.Value); - if (nextRun!=null && next < nextRun) - nextRun = next; - } - else - { - nextRun = null; - } - } - } - bool allCompleted = true; - foreach (RunThread t in Threads) - { - if(t.IsCompleted) - { - Threads.Remove(t); - break; - } - else - { - allCompleted = false; - } - } - UnLock(); - - if (nextRun != null) - { - Thread.Sleep(10); - } - if (allCompleted && Mode == ExecutionMode.ExitWhenFinish) - { - IsCompleted = true; - Console.WriteLine("run finished"); - return; - } - } - } - public void RunFunction(Function function) - { - Lock(); - foreach (Instance inst in Instances) - { - foreach (var func in inst.Class.Functions) - { - if (func.Equals(function)) - { - Threads.Add(new RunThread(inst, func, BaseEnvironment)); - } - } - } - UnLock(); - } - public void SendEvent(Event e) - { - Lock(); - foreach (Instance inst in Instances) - { - foreach (EventHandler func in inst.Class.Handlers) - { - if (func.IsProcessEvent(e)) - { - Threads.Add(new RunThread(inst, func, e,BaseEnvironment)); - } - } - } - UnLock(); - } - public void SendEventAsych(Event e) - { - new Thread(new ThreadStart(() => - { - SendEvent(e); - })).Start(); - } - public void SendEventAsych(Instance inst, Event e) - { - new Thread(new ThreadStart(() => - { - SendEvent(inst, e); - })).Start(); - } - public void SendEvent(Instance inst, Event e){ - Lock(); - foreach (EventHandler func in inst.Class.Handlers) - { - if (func.IsProcessEvent(e)) - { - Threads.Add(new RunThread(inst, func, e, BaseEnvironment)); - } - } - UnLock(); - } - public void Lock() - { - resetEvent.WaitOne(); - } - public void UnLock() - { - resetEvent.Set(); - } - } -} diff --git a/ExecutionEngine/ExecutionEngine.csproj b/ExecutionEngine/ExecutionEngine.csproj deleted file mode 100644 index d339e8e..0000000 --- a/ExecutionEngine/ExecutionEngine.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Debug - AnyCPU - {86044555-48E3-4128-92EE-59F55F9D8B53} - Library - Properties - ScratchNet - ExecutionEngine - v4.5.1 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - {9efe2134-8015-4957-a9e1-f7d2fbb4cda7} - ScriptEngine - - - - - \ No newline at end of file diff --git a/ExecutionEngine/Properties/AssemblyInfo.cs b/ExecutionEngine/Properties/AssemblyInfo.cs deleted file mode 100644 index d42484a..0000000 --- a/ExecutionEngine/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("ExecutionEngine")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ExecutionEngine")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("cbc3a394-17fc-41a4-b58d-982c19713ce9")] - -// 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")] diff --git a/ExecutionEngine/Thread.cs b/ExecutionEngine/Thread.cs deleted file mode 100644 index 38e7b35..0000000 --- a/ExecutionEngine/Thread.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ScratchNet -{ - public class RunThread - { - public Instance Instance { get; internal set; } - public ExecutionEnvironment Environment { get; internal set; } - public bool IsStarted { get; internal set; } - public bool IsCompleted { get; internal set; } - Stack Stacks { get; set; } - public RunThread(Instance instance, Function fun, ExecutionEnvironment environment) - { - Instance = instance; - IsStarted = false; - IsCompleted = false; - Stacks = new Stack(); - Execution2 exe = fun as Execution2; - Environment = new ExecutionEnvironment(environment, instance); - - ExecutionEnvironment env = exe.StartCall(Environment); - Stacks.Push(new ExecStackItem(exe, FinishCallback, env, Environment)); - } - public RunThread(Instance instance, EventHandler fun, Event e, ExecutionEnvironment environment) - { - Instance = instance; - fun.Event = e; - IsStarted = false; - IsCompleted = false; - Stacks = new Stack(); - Execution2 exe = fun as Execution2; - Environment = new ExecutionEnvironment(environment, instance); - - ExecutionEnvironment env= exe.StartCall(Environment); - Stacks.Push(new ExecStackItem(exe, FinishCallback, env, Environment)); - } - Nullable FinishCallback(object value, object exception, ExecutionEnvironment e) - { - IsCompleted = true; - return null; - } - public Nullable Step() - { - IsStarted = true; - if (Stacks.Count == 0) - { - IsCompleted = true; - return null; - } - ExecStackItem current = Stacks.Peek(); - if (!current.HasMoreExecution) - { - return EndCall(current); - } - object execution; - ExecutionCallback callback; - current.HasMoreExecution = (current.Execution.PopStack(out execution, out callback, current.Environment)); - //Console.WriteLine("current is " + execution); - if (execution is Execution2) - { - Execution2 exec = execution as Execution2; - ExecutionEnvironment e= exec.StartCall(current.Environment); - Stacks.Push(new ExecStackItem(exec, callback, e, current.Environment)); - } - else - { - return EndCall(current); - } - - return null; - } - void HandleException(Exception e) - { - Console.WriteLine("Exception occur"); - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - ExecutionCallback callback = null; - while (Stacks.Count > 0) - { - ExecStackItem item = Stacks.Peek(); - bool handle = false; - try - { - handle=item.Execution.HandleException(e); - callback(null, e, item.Previous); - } - catch (Exception excption) { } - if (handle) - { - return; - } - else - { - Stacks.Pop(); - callback = item.Callback; - } - } - Console.WriteLine("Exception occur and no try block, so exit"); - //TO DO terminate execution - } - Nullable ExecCallBack(ExecutionCallback callback, object value, object exception, ExecutionEnvironment env) - { - Exception ex = null; - try - { - return callback(value, exception, env); - } - catch (Exception e) { - ex = e; - } - if(ex!=null) - HandleException(ex); - return null; - } - Nullable EndCall(ExecStackItem current) - { - Exception ex = null; - Completion retVal = null; - try - { - retVal = current.Execution.EndCall(current.Environment); - } - catch (Exception e) - { - ex = e; - } - if (ex != null) - { - HandleException(ex); - return null; - } - Stacks.Pop(); - if (current.Execution is ReturnStatement) - { - ExecStackItem func = Stacks.Peek(); - while (!(func.Execution is Function)) - { - Stacks.Pop(); - func = Stacks.Peek(); - } - ExecCallBack(func.Callback,retVal.ReturnValue, null, func.Previous); - return null; - } - else if (current.Execution is BreakStatement) - { - ExecStackItem func = Stacks.Peek(); - while (!(func.Execution is Loop)) - { - Stacks.Pop(); - func = Stacks.Peek(); - if (Stacks.Count == 1) - break; - } - func = Stacks.Pop(); - if(!(func.Execution is Loop)) - { - HandleException(new Exception("Break must be in a loop")); - return null; - } - ExecCallBack(func.Callback, retVal.ReturnValue, null, func.Previous); - return null; - } - else if (current.Execution is ContinueStatement) - { - ExecStackItem func = Stacks.Peek(); - ExecStackItem last=null; - ExecutionCallback callBack = null; - while (!(func.Execution is Loop)) - { - callBack = func.Callback; - last = func; - Stacks.Pop(); - func = Stacks.Peek(); - if (Stacks.Count == 1) - break; - } - if (!(func.Execution is Loop)) - { - HandleException(new Exception("continue must be in a loop")); - return null; - } - return ExecCallBack(last.Callback, retVal.ReturnValue, null, last.Environment); - } - return ExecCallBack(current.Callback, retVal.ReturnValue, null, current.Previous); - } - } - class ExecStackItem - { - public ExecStackItem(Execution2 exec, ExecutionCallback callback, ExecutionEnvironment env, ExecutionEnvironment preEnv) - { - Execution = exec; - Callback = callback; - Environment = env; - HasMoreExecution = true; - Previous = preEnv; - } - public Execution2 Execution { get; set; } - public ExecutionCallback Callback { get; set; } - public ExecutionEnvironment Environment { get; set; } - public ExecutionEnvironment Previous { get; set; } - public bool HasMoreExecution { get; set; } - } -} diff --git a/ScrachEditor/Form1.Designer.cs b/ScrachEditor/Form1.Designer.cs deleted file mode 100644 index 1c3c4a9..0000000 --- a/ScrachEditor/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ScrachEditor -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; - } - - #endregion - } -} - diff --git a/ScrachEditor/Form1.cs b/ScrachEditor/Form1.cs deleted file mode 100644 index dbd9d7c..0000000 --- a/ScrachEditor/Form1.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace ScrachEditor -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ScrachEditor/Program.cs b/ScrachEditor/Program.cs deleted file mode 100644 index c6c6ceb..0000000 --- a/ScrachEditor/Program.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - -namespace ScrachEditor -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/ScrachEditor/Properties/AssemblyInfo.cs b/ScrachEditor/Properties/AssemblyInfo.cs deleted file mode 100644 index c6bbee6..0000000 --- a/ScrachEditor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("ScrachEditor")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ScrachEditor")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a369d98a-8957-436d-8cfd-7b1f0c1d1f91")] - -// 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")] diff --git a/ScrachEditor/Properties/Resources.Designer.cs b/ScrachEditor/Properties/Resources.Designer.cs deleted file mode 100644 index 2445bca..0000000 --- a/ScrachEditor/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18408 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ScrachEditor.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [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() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [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("ScrachEditor.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [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/ScrachEditor/Properties/Settings.Designer.cs b/ScrachEditor/Properties/Settings.Designer.cs deleted file mode 100644 index 942a49a..0000000 --- a/ScrachEditor/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18408 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ScrachEditor.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/ScrachEditor/Properties/Settings.settings b/ScrachEditor/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/ScrachEditor/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ScrachEditor/ScrachEditor.csproj b/ScrachEditor/ScrachEditor.csproj deleted file mode 100644 index 728edc9..0000000 --- a/ScrachEditor/ScrachEditor.csproj +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Debug - AnyCPU - a369d98a-8957-436d-8cfd-7b1f0c1d1f91 - WinExe - Properties - ScrachEditor - ScrachEditor - v4.0 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - \ No newline at end of file diff --git a/ScratchControl/Properties/Resources.resx b/ScratchControl/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/ScratchControl/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/ScratchNet.sln b/ScratchNet.sln index 1faef0a..d5093a2 100644 --- a/ScratchNet.sln +++ b/ScratchNet.sln @@ -3,17 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29728.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScratchNet", "ScratchNet\ScratchNet.csproj", "{79F40D09-D4EE-469F-883D-0D471E22AE20}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScratchNet", "demo\ScratchNet\ScratchNet.csproj", "{79F40D09-D4EE-469F-883D-0D471E22AE20}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEngine", "ScriptEngine\ScriptEngine.csproj", "{9EFE2134-8015-4957-A9E1-F7D2FBB4CDA7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEngine", "src\ScriptEngine\ScriptEngine.csproj", "{9EFE2134-8015-4957-A9E1-F7D2FBB4CDA7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FontAwesome.WPF", "FontAwesome.WPF\FontAwesome.WPF.csproj", "{7006AC9F-D218-4D7B-98EB-5D2D91F69C57}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExecutionEngine", "ExecutionEngine\ExecutionEngine.csproj", "{86044555-48E3-4128-92EE-59F55F9D8B53}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScratchControl", "src\ScratchControl\ScratchControl.csproj", "{E1C33987-94F5-472F-B191-8CBEDDEE5D99}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScratchControl", "ScratchControl\ScratchControl.csproj", "{E1C33987-94F5-472F-B191-8CBEDDEE5D99}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEditor", "ScratchEditor\ScriptEditor.csproj", "{801CFD14-89D2-4B1E-9332-B22EC959BABA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptEditor", "src\ScratchEditor\ScriptEditor.csproj", "{801CFD14-89D2-4B1E-9332-B22EC959BABA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{574786AA-DCD3-435B-8411-3C0850428F93}" EndProject @@ -21,7 +19,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "demo", "demo", "{98B9AB53-D EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "improve", "improve", "{CE3FE9EE-1EC5-4CAB-990F-27F21F2586FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoScriptEditor", "DemoScriptEditor\DemoScriptEditor.csproj", "{692B38FD-DD40-4DAE-858C-5966C50E7D3D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoScriptEditor", "demo\DemoScriptEditor\DemoScriptEditor.csproj", "{692B38FD-DD40-4DAE-858C-5966C50E7D3D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{86E202C1-9FAE-4FB1-8259-03A9D423A717}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "test\UnitTestProject\UnitTestProject.csproj", "{584AAAFE-1EAE-4F99-9E9B-C375098B7A9E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -41,10 +43,6 @@ Global {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Debug|Any CPU.Build.0 = Debug|Any CPU {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.ActiveCfg = Release|Any CPU {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.Build.0 = Release|Any CPU - {86044555-48E3-4128-92EE-59F55F9D8B53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86044555-48E3-4128-92EE-59F55F9D8B53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86044555-48E3-4128-92EE-59F55F9D8B53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86044555-48E3-4128-92EE-59F55F9D8B53}.Release|Any CPU.Build.0 = Release|Any CPU {E1C33987-94F5-472F-B191-8CBEDDEE5D99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1C33987-94F5-472F-B191-8CBEDDEE5D99}.Debug|Any CPU.Build.0 = Debug|Any CPU {E1C33987-94F5-472F-B191-8CBEDDEE5D99}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -57,6 +55,10 @@ Global {692B38FD-DD40-4DAE-858C-5966C50E7D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {692B38FD-DD40-4DAE-858C-5966C50E7D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {692B38FD-DD40-4DAE-858C-5966C50E7D3D}.Release|Any CPU.Build.0 = Release|Any CPU + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -65,10 +67,10 @@ Global {79F40D09-D4EE-469F-883D-0D471E22AE20} = {98B9AB53-DABC-4E87-B63B-BFFB0B7BAB81} {9EFE2134-8015-4957-A9E1-F7D2FBB4CDA7} = {574786AA-DCD3-435B-8411-3C0850428F93} {7006AC9F-D218-4D7B-98EB-5D2D91F69C57} = {574786AA-DCD3-435B-8411-3C0850428F93} - {86044555-48E3-4128-92EE-59F55F9D8B53} = {574786AA-DCD3-435B-8411-3C0850428F93} {E1C33987-94F5-472F-B191-8CBEDDEE5D99} = {CE3FE9EE-1EC5-4CAB-990F-27F21F2586FD} {801CFD14-89D2-4B1E-9332-B22EC959BABA} = {574786AA-DCD3-435B-8411-3C0850428F93} {692B38FD-DD40-4DAE-858C-5966C50E7D3D} = {98B9AB53-DABC-4E87-B63B-BFFB0B7BAB81} + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E} = {86E202C1-9FAE-4FB1-8259-03A9D423A717} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0BD434C9-8675-4D9D-B905-6C481145EB9A} diff --git a/ScratchNet/appearance/SizeExpression.cs b/ScratchNet/appearance/SizeExpression.cs deleted file mode 100644 index 92655c3..0000000 --- a/ScratchNet/appearance/SizeExpression.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class SizeExpression : Expression - { - public string ReturnType - { - get { return "number"; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "Size")); - return desc; - } - } - - public string Type - { - get { return "XPositionExpression"; } - } - public bool IsClosing - { - get { return false; } - } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - double size=((_env.This as Instance).Class as Sprite).Size; - return new Completion(size); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScratchNet/movement/DegreeExpression.cs b/ScratchNet/movement/DegreeExpression.cs deleted file mode 100644 index 149eb3f..0000000 --- a/ScratchNet/movement/DegreeExpression.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class DegreeExpression: Expression - { - public string ReturnType - { - get { return "number"; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "Angle")); - return desc; - } - } - - public string Type - { - get { return "DegreeExpression"; } - } - public bool IsClosing - { - get { return false; } - } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - double result = ((_env.This as Instance).Class as Sprite).Direction; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScratchNet/movement/TimedMoveStatement.cs b/ScratchNet/movement/TimedMoveStatement.cs deleted file mode 100644 index 3af6ffe..0000000 --- a/ScratchNet/movement/TimedMoveStatement.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class TimedMoveStatement : Statement - { - public TimedMoveStatement() - { - Time = new Literal() { Raw = "2" }; - } - public Expression Time { get; set; } - public Expression X { get; set; } - public Expression Y { get; set; } - public string ReturnType - { - get { return "void"; } - } - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, Localize.GetString("cs_In"))); - desc.Add(new ExpressionDescriptor(this, "Time", "number")); - desc.Add(new TextItemDescriptor(this, Localize.GetString("cs_MoveXinSec"))); - desc.Add(new ExpressionDescriptor(this, "X", "number")); - desc.Add(new TextItemDescriptor(this, ", Y ")); - desc.Add(new ExpressionDescriptor(this, "Y", "number")); - return desc; - } - } - public string Type - { - get - { - return "MoveStatement"; - } - } - - - public BlockDescriptor BlockDescriptor - { - get { return null; } - } - - - public bool IsClosing - { - get { return false; } - } - - double current = 0; - double time; - double x; - double y; - DateTime startTime; - DateTime finishTime; - bool finish = false; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - current = 0; - time = 0; - x = 0; - y = 0; - startTime = DateTime.Now; - finish = false; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - sp.X = (int)x; - sp.Y = (int)y; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - callback = Callback; - if (current == 0) - { - execution = Time; - return true; - } - else if (current == 1) - { - execution = X; - return true; - } - else if (current == 2) - { - execution = Y; - return true; - } - else if(!finish) - { - execution = new Literal() { Raw="1" }; - return true; - } - execution = null; - return false; - } - double orgin_x; - double orgin_y; - double totalTime; - Nullable Callback(object value, object exception, ExecutionEnvironment _env) - { - if (current == 0) - { - time = (double)value; - current++; - return null; - } - else if (current == 1) - { - x = (double)value; - current++; - return null; - } - else if (current == 2) - { - y = (double)value; - Sprite sp = (_env.This as Instance).Class as Sprite; - if (x < 0) - x = 0; - if (x > CurrentEnviroment.ScreenWidth) - x = CurrentEnviroment.ScreenWidth; - if (y < 0) - y = 0; - if (y > CurrentEnviroment.ScreenHeight) - y = CurrentEnviroment.ScreenHeight; - orgin_x = sp.X; - orgin_y = sp.Y; - startTime = DateTime.Now; - finishTime = DateTime.Now.AddSeconds(time); - current++; - if (finishTime <= startTime) - { - finish = true; - return null; - } - totalTime = (finishTime - startTime).TotalMilliseconds; - return DateTime.Now.AddMilliseconds(20); - } - else - { - current++; - if (DateTime.Now > finishTime) - { - finish = true; - return null; - } - double duration = (DateTime.Now - startTime).TotalMilliseconds; - - Sprite sp = (_env.This as Instance).Class as Sprite; - sp.X = (int)(orgin_x + (x - orgin_x) * duration / totalTime); - sp.Y = (int)(orgin_y + (y - orgin_y) * duration / totalTime); - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - return DateTime.Now.AddMilliseconds(20); - } - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScratchNet/movement/YPositionExpression.cs b/ScratchNet/movement/YPositionExpression.cs deleted file mode 100644 index 9f1ffd5..0000000 --- a/ScratchNet/movement/YPositionExpression.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - - public class YPositionExpression : Expression - { - public string ReturnType - { - get { return "number"; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "Y")); - return desc; - } - } - - public string Type - { - get { return "YPositionExpression"; } - } - public bool IsClosing - { - get { return false; } - } - - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - double result = ((_env.This as Instance).Class as Sprite).Y; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/BlockStatement.cs b/ScriptEngine/BlockStatement.cs deleted file mode 100644 index 0bba8b6..0000000 --- a/ScriptEngine/BlockStatement.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ScratchNet -{ - - //定义代码块和flow control, 比如if, while - public class BlockStatement : Execution2 - { - ObservableCollection _body = new ObservableCollection(); - public ObservableCollection Body - { - get { return _body; } - set - { - _body = value; - } - } - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment ex = new ExecutionEnvironment(e); - ex.SetState("current", 0); - ex.SetState("retVal", null); - return ex; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(e.GetState("retVal")); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - callback = Callback; - int current = (int)e.GetState("current"); - if (current < Body.Count) - { - execution = Body[current]; - if (execution is ReturnStatement) - { - return false; - } - } - else - { - execution = null; - return false; - } - return (current + 1) != Body.Count; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - current++; - if (current == Body.Count) - e.SetState("retVal", value); - e.SetState("current", current); - return null; - } - - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/Identifier.cs b/ScriptEngine/runtime/Identifier.cs deleted file mode 100644 index 3c68c75..0000000 --- a/ScriptEngine/runtime/Identifier.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class Identifier:Expression - { - public String Variable { get; set; } - public string VarType { get; set; } - public string ReturnType - { - get { return VarType; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, Variable)); - return desc; - } - } - - public string Type - { - get { return VarType; } - } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment _env) - { - object result = _env.GetValue(Variable); - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/flow/ForStatement.cs b/ScriptEngine/runtime/flow/ForStatement.cs deleted file mode 100644 index 0e23aa5..0000000 --- a/ScriptEngine/runtime/flow/ForStatement.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class ForStatement : Loop, Execution2 - { - public ForStatement() - { - Body = new BlockStatement(); - } - public Expression Loop { get; set; } - public BlockStatement Body - { - get; - set; - } - public string ReturnType - { - get { return "void"; } - } - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "Loop ")); - desc.Add(new ExpressionDescriptor(this, "Loop", "number")); - desc.Add(new TextItemDescriptor(this, " time")); - return desc; - } - } - public BlockDescriptor BlockDescriptor - { - get - { - BlockDescriptor desc = new BlockDescriptor(); - desc.Add(new BlockStatementDescriptor(this, "Body")); - return desc; - } - } - public string Type - { - get - { - return "WhileStatement"; - } - } - public bool IsClosing - { - get { return false; } - } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment ex = new ExecutionEnvironment(e); - ex.SetState("loopNumber", 0); - ex.SetState("currentNumber", 0); - ex.SetState("current", 0); - ex.SetState("result", null); - return ex; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(e.GetState("result")); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - int currentNumber = (int)e.GetState("currentNumber"); - int loopNumber = (int)e.GetState("loopNumber"); - if (current == 0) - { - execution = Loop; - callback = Callback; - return true; - } - else - { - execution = Body; - callback = Callback; - return currentNumber Callback(object value, object exception, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - int currentNumber = (int)e.GetState("currentNumber"); - if (current == 0) - { - e.SetState("loopNumber", int.Parse(value + "")); - } - else - { - e.SetState("currentNumber", currentNumber+1); - } - e.SetState("current", current+1); - current = (int)e.GetState("current"); - e.SetState("result", value); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/flow/IfStatement.cs b/ScriptEngine/runtime/flow/IfStatement.cs deleted file mode 100644 index f47a744..0000000 --- a/ScriptEngine/runtime/flow/IfStatement.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class IfStatement : Statement, Execution2 - { - public IfStatement() - { - Consequent = new BlockStatement(); - } - public Expression Test { get; set; } - public BlockStatement Consequent - { - get; - set; - } - public BlockStatement Alternate { get; set; } - public string ReturnType - { - get { return "void"; } - } - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "If ")); - desc.Add(new ExpressionDescriptor(this, "Test", "boolean")); - desc.Add(new TextItemDescriptor(this, " then")); - return desc; - } - } - public BlockDescriptor BlockDescriptor - { - get - { - BlockDescriptor desc = new BlockDescriptor(); - desc.Add(new BlockStatementDescriptor(this, "Consequent")); - if (Alternate != null) - { - desc.Add(new TextBlockStatementDescritor(this, "Alternate", "Else")); - desc.Add(new BlockStatementDescriptor(this, "Alternate")); - } - return desc; - } - } - public string Type - { - get - { - return "IfStatement"; - } - } - public bool IsClosing - { - get { return false; } - } - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment ex = new ExecutionEnvironment(e); - ex.SetState("current", 0); - ex.SetState("result", null); - ex.SetState("testResult", false); - return ex; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(e.GetState("result")); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - bool testResult = (bool)e.GetState("testResult"); - if (current == 0) - { - execution = Test; - callback = Callback; - return true; - } - else if(current==1) - { - if (testResult) - { - execution = Consequent; - } - else - execution = Alternate; - callback = Callback; - return false; - } - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - if (current == 0) - { - e.SetState("testResult",value); - } - else - { - } - current++; - e.SetState("current", current); - e.SetState("result", value); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/flow/WhileStatement.cs b/ScriptEngine/runtime/flow/WhileStatement.cs deleted file mode 100644 index b93193e..0000000 --- a/ScriptEngine/runtime/flow/WhileStatement.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - - public class WhileStatement : Loop, Execution2 - { - public WhileStatement() - { - Body = new BlockStatement(); - } - public Expression Test { get; set; } - public BlockStatement Body - { - get; - set; - } - public string ReturnType - { - get { return "void"; } - } - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "While(")); - desc.Add(new ExpressionDescriptor(this, "Test", "boolean")); - desc.Add(new TextItemDescriptor(this, " )")); - return desc; - } - } - public BlockDescriptor BlockDescriptor - { - get - { - BlockDescriptor desc = new BlockDescriptor(); - desc.Add(new BlockStatementDescriptor(this, "Body")); - return desc; - } - } - public string Type - { - get - { - return "WhileStatement"; - } - } - public bool IsClosing - { - get { return false; } - } - //execution - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment ex = new ExecutionEnvironment(e); - ex.SetState("canContinue", false); - ex.SetState("current", 0); - ex.SetState("result", null); - return ex; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(e.GetState("result")); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - bool canContinue = (bool)e.GetState("canContinue"); - if (current %2 == 0) - { - execution = Test; - callback = Callback; - return true; - } - else if(canContinue) - { - execution = Body; - callback = Callback; - return true; - } - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - if (current%2 == 0) - { - e.SetState("canContinue", value); - } - else - { - e.SetState("result", value); - } - current++; - e.SetState("current", current); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/logic/CompareExpression.cs b/ScriptEngine/runtime/logic/CompareExpression.cs deleted file mode 100644 index 903bdf2..0000000 --- a/ScriptEngine/runtime/logic/CompareExpression.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class CompareExpression : Expression, Execution2 - { - public Expression Left { get; set; } - public Operator Operator { get; set; } - public Expression Right { get; set; } - - public CompareExpression() - { - Operator = Operator.Equal; - } - - public string ReturnType - { - get { return "boolean"; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new ExpressionDescriptor(this, "Left", "number")); - desc.Add(new TextItemDescriptor(this, " ")); - desc.Add(new SelectionItemDescriptor(this, "Operator", - new object[]{"=","!=",">",">=","<","<="}, - new object[]{Operator.Equal, Operator.NotEqual, Operator.Great, Operator.GreatOrEqual, Operator.Less, Operator.LessOrEqual})); - - desc.Add(new TextItemDescriptor(this, " ")); - desc.Add(new ExpressionDescriptor(this, "Right", "number")); - return desc; - } - } - - public string Type - { - get { return "BinaryExpression"; } - } - public bool IsClosing - { - get { return false; } - } - - //execution - private bool result; - private double leftValue; - private int current = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = false; - current = 0; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = Left; - callback = Callback; - return true; - } - if (current == 1) - { - execution = Right; - callback = Callback; - return false; - } - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if (current == 0) - { - leftValue = double.Parse(value + ""); - } - if (current == 1) - { - double r = double.Parse(value + ""); - switch (Operator) - { - case Operator.Equal: - result = leftValue == r; - break; - case Operator.NotEqual: - result = leftValue != r; - break; - case Operator.Great: - result = leftValue > r; - break; - case Operator.GreatOrEqual: - result = leftValue >= r; - break; - case Operator.Less: - result = leftValue < r; - break; - case Operator.LessOrEqual: - result = leftValue <= r; - break; - } - } - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } -} diff --git a/ScriptEngine/runtime/math/RandomExpression.cs b/ScriptEngine/runtime/math/RandomExpression.cs deleted file mode 100644 index 4a7f028..0000000 --- a/ScriptEngine/runtime/math/RandomExpression.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ScratchNet -{ - public class RandomExpression : Expression - { - public string ReturnType - { - get { return "number"; } - } - public Expression Min { get; set; } - public Expression Max { get; set; } - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new ExpressionDescriptor(this, "Min", "number")); - //desc.Add(new TextItemDescriptor(this, "和")); - desc.Add(new TextItemDescriptor(this, Properties.Resources.random1)); - desc.Add(new ExpressionDescriptor(this, "Max", "number")); - //desc.Add(new TextItemDescriptor(this, "之间的随机数")); - desc.Add(new TextItemDescriptor(this, Properties.Resources.random2)); - return desc; - } - } - public string Type - { - get { return "RandomExpression"; } - } - public bool IsClosing - { - get { return false; } - }//execution - - static Random random = new Random(); - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment ex = new ExecutionEnvironment(e); - ex.SetState("minimum", 0); - ex.SetState("maximum", 0); - ex.SetState("current", 0); - return ex; - } - - public Completion EndCall(ExecutionEnvironment e) - { - double r = random.Next((int)e.GetState("minimum"), (int)e.GetState("maximum")); - return new Completion(r); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - callback = Callback; - if (current == 0) - { - execution = Min; - return true; - } - else - { - execution = Max; - return false; - } - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - int current = (int)e.GetState("current"); - if (current == 0) - { - e.SetState("minimum", (int)Math.Ceiling((double)value)); - } - else - { - e.SetState("maximum", (int)Math.Floor((double)value)); - } - e.SetState("current", current + 1); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } - -} diff --git a/ScriptEngine/runtime/operator/BinaryExpression.cs b/ScriptEngine/runtime/operator/BinaryExpression.cs deleted file mode 100644 index 093e1a7..0000000 --- a/ScriptEngine/runtime/operator/BinaryExpression.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class BinaryExpression : Expression - { - public Expression Left { get; set; } - public Operator Operator { get; set; } - public Expression Right { get; set; } - public BinaryExpression() - { - Operator = Operator.Add; - } - - public string ReturnType - { - get { return "number"; } - } - - public Completion Execute(ExecutionEnvironment enviroment) - { - return Completion.Void; - } - - public Descriptor Descriptor - { - get - { - Descriptor desc = new Descriptor(); - desc.Add(new ExpressionDescriptor(this, "Left", "number") ); - desc.Add(new TextItemDescriptor(this, " ")); - desc.Add(new SelectionItemDescriptor(this, "Operator", new object[] { "+", "-", "*", "/" }, - new object[] { Operator.Add, Operator.Minus, Operator.Mulitiply, Operator.Divide })); - desc.Add(new TextItemDescriptor(this, " ")); - desc.Add(new ExpressionDescriptor(this, "Right", "number")); - return desc; - } - } - - public string Type - { - get { return "BinaryExpression"; } - } - public bool IsClosing - { - get { return false; } - } - //execution - double result; - int current = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = 0; - current = 0; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = Left; - callback = Callback; - return true; - } - if (current == 1) - { - execution = Right; - callback = Callback; - return false; - } - execution = null; - callback = null; - return false; - } - double GetValue(object value) - { - if (value is double) - return (double)value; - else if ((value + "") == "") - return 0; - return double.NaN; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if(current==0) - { - result = GetValue(value); - } - if (current == 1) - { - double r = GetValue(value); - switch (Operator) - { - case Operator.Add: - result+=r; - break; - case Operator.Minus: - result=result-r; - break; - case Operator.Mulitiply: - result = result * r; - break; - case Operator.Divide: - if (r == 0) - result = result<0?double.NegativeInfinity:double.PositiveInfinity; - else - result = result / r; - break; - } - } - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } - } - public enum Operator - { - Add, - Minus, - Mulitiply, - Divide, - Equal, - Great, - Less, - NotEqual, - GreatOrEqual, - LessOrEqual, - And, - Or - } -} diff --git a/ScriptEngine/script/Execution.cs b/ScriptEngine/script/Execution.cs deleted file mode 100644 index 0067ac0..0000000 --- a/ScriptEngine/script/Execution.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class Completion - { - public static Completion Void = new Completion(); - public Completion() - { - ReturnValue = null; - } - public Completion(object value) - { - ReturnValue = value; - } - public object ReturnValue { get; internal set; } - - } - //用于定义如何执行 - public interface Execution - { - Completion Execute(ExecutionEnvironment enviroment); - } - - public interface Execution2 - { - ExecutionEnvironment StartCall(ExecutionEnvironment e); - Completion EndCall(ExecutionEnvironment e); - bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e);//has more step, return true; - bool HandleException(object exception); - } - public class StackItem - { - public Execution Value { get; set; } - } - //每步执行的回调函数,value为步骤计算值,exception为异常, DateTime为下个步骤执行时间,null为立刻执行 - public delegate Nullable ExecutionCallback(object value, object exception, ExecutionEnvironment e); -} diff --git a/ScriptEngine/script/ExecutionEnvironment.cs b/ScriptEngine/script/ExecutionEnvironment.cs deleted file mode 100644 index 68c0623..0000000 --- a/ScriptEngine/script/ExecutionEnvironment.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ScratchNet -{ - public class ExecutionEnvironment - { - ExecutionEnvironment _parent; - Instance _this; - public Instance This - { - get - { - if (_this != null) - return _this; - if (_parent != null) - return _parent.This; - return null; - } - } - public int Level - { - get - { - int level = 1; - ExecutionEnvironment p = this;; - while ((p = p.Parent) != null) - level++; - return level; - } - } - public ExecutionEnvironment Parent - { - get - { - return _parent; - } - } - public IExecutionEngine Engine { get; internal set; } - public ExecutionEnvironment(IExecutionEngine engine) - { - Engine = engine; - currentScope = new Dictionary(); - } - public ExecutionEnvironment(ExecutionEnvironment parent) - { - _parent = parent; - Engine = parent.Engine; - currentScope = new Dictionary(); - } - public ExecutionEnvironment(ExecutionEnvironment parent, Instance instance) - { - _parent = parent; - Engine = parent.Engine; - currentScope = instance.States; - _this = instance; - } - Dictionary currentScope; - Dictionary state = new Dictionary(); - public void SetState(string name, object v) - { - state[name] = v; - } - public object GetState(string name) - { - return state[name]; - } - public void ClearState(string name) - { - if (state.ContainsKey(name)) - state.Remove(name); - } - public bool Has(string variable) - { - if (currentScope.ContainsKey(variable)) - return true; - if (_parent!=null && _parent.Has(variable)) - return true; - return false; - } - public void RegisterValue(string variable, object value) - { - currentScope.Add(variable, value); - } - public object GetValue(string variable) - { - if (currentScope.ContainsKey(variable)) - { - return currentScope[variable]; - } - if (_parent != null) - return _parent.GetValue(variable); - return null; - } - public void SetValue(string variable, object value) - { - if (currentScope.ContainsKey(variable)) - { - currentScope[variable] = value; - return; - } - if (_parent != null && _parent.Has(variable)) - { - _parent.SetValue(variable, value); - return; - } - currentScope.Add(variable, value); - } - } -} diff --git a/ScriptEngine/script/IExecutionEngine.cs b/ScriptEngine/script/IExecutionEngine.cs deleted file mode 100644 index 69deb6b..0000000 --- a/ScriptEngine/script/IExecutionEngine.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ScratchNet -{ - public interface IExecutionEngine - { - void SendEvent(Event e); - Instance CreateInstance(Class c); - ExecutionEnvironment BaseEnvironment { get; } - } -} diff --git a/WPF/Font.Awesome.WPF.Net35.sln b/WPF/Font.Awesome.WPF.Net35.sln deleted file mode 100644 index 5d3cc15..0000000 --- a/WPF/Font.Awesome.WPF.Net35.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FontAwesome.WPF.Net35", "FontAwesome.WPF\FontAwesome.WPF.Net35.csproj", "{7006AC9F-D218-4D7B-98EB-5D2D91F69C57}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Signed|Any CPU = Signed|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.Build.0 = Release|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Signed|Any CPU.ActiveCfg = Signed|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Signed|Any CPU.Build.0 = Signed|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/WPF/Font.Awesome.WPF.Net40.sln b/WPF/Font.Awesome.WPF.Net40.sln deleted file mode 100644 index 93948d2..0000000 --- a/WPF/Font.Awesome.WPF.Net40.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FontAwesome.WPF.Net40", "FontAwesome.WPF\FontAwesome.WPF.Net40.csproj", "{7006AC9F-D218-4D7B-98EB-5D2D91F69C57}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Signed|Any CPU = Signed|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Release|Any CPU.Build.0 = Release|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Signed|Any CPU.ActiveCfg = Signed|Any CPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57}.Signed|Any CPU.Build.0 = Signed|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/WPF/Font.Awesome.WPF.Net40.sln.DotSettings b/WPF/Font.Awesome.WPF.Net40.sln.DotSettings deleted file mode 100644 index fce745a..0000000 --- a/WPF/Font.Awesome.WPF.Net40.sln.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/WPF/Font.Awesome.WPFNet35.sln.DotSettings b/WPF/Font.Awesome.WPFNet35.sln.DotSettings deleted file mode 100644 index fce745a..0000000 --- a/WPF/Font.Awesome.WPFNet35.sln.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/WPF/FontAwesome.WPF/Attributes.cs b/WPF/FontAwesome.WPF/Attributes.cs deleted file mode 100644 index f86de1f..0000000 --- a/WPF/FontAwesome.WPF/Attributes.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace FontAwesome.WPF -{ - /// - /// Represents the category of a fontawesome icon. - /// - [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] - public class IconCategoryAttribute - : Attribute - { - /// - /// Gets or sets the category of the icon. - /// - public string Category { get; set; } - /// - /// Initializes a new instance of the FontAwesome.WPF.IconCategoryAttribute class. - /// - /// The icon category. - public IconCategoryAttribute(string category) - { - Category = category; - } - } - /// - /// Represents the field is an alias of another icon. - /// - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)] - public class IconAliasAttribute - : Attribute - { } - - /// - /// Represents the id (css class name) of the icon. - /// - [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)] - public class IconIdAttribute - : Attribute - { - /// - /// Gets or sets the id (css class name) of the icon. - /// - public string Id { get; set; } - - /// - /// Initializes a new instance of the FontAwesome.WPF.IconIdAttribute class. - /// - /// The icon id (css class name). - public IconIdAttribute(string id) - { - Id = id; - } - } -} diff --git a/WPF/FontAwesome.WPF/Awesome.cs b/WPF/FontAwesome.WPF/Awesome.cs deleted file mode 100644 index ca8eb65..0000000 --- a/WPF/FontAwesome.WPF/Awesome.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace FontAwesome.WPF -{ - /// - /// Provides attached properties to set FontAwesome icons on controls. - /// - public static class Awesome - { - - /// - /// FontAwesome FontFamily. - /// - private static readonly FontFamily FontAwesomeFontFamily = new FontFamily(new Uri("pack://application:,,,/FontAwesome.WPF;component/"), "./#FontAwesome"); - - /// - /// Identifies the FontAwesome.WPF.Awesome.Content attached dependency property. - /// - public static readonly DependencyProperty ContentProperty = - DependencyProperty.RegisterAttached( - "Content", - typeof(FontAwesomeIcon), - typeof(Awesome), - new PropertyMetadata(DEFAULT_CONTENT, ContentChanged)); - - /// - /// Gets the content of a ContentControl, expressed as a FontAwesome icon. - /// - /// The ContentControl subject of the query - /// FontAwesome icon found as content - public static FontAwesomeIcon GetContent(DependencyObject target) - { - return (FontAwesomeIcon)target.GetValue(ContentProperty); - } - - /// - /// Sets the content of a ContentControl expressed as a FontAwesome icon. This will cause the content to be redrawn. - /// - /// The ContentControl where to set the content - /// FontAwesome icon to set as content - public static void SetContent(DependencyObject target, FontAwesomeIcon value) - { - target.SetValue(ContentProperty, value); - } - - private static void ContentChanged(DependencyObject sender, DependencyPropertyChangedEventArgs evt) - { - // If target is not a ContenControl just ignore: Awesome.Content property can only be set on a ContentControl element - if (!(sender is ContentControl)) return; - - ContentControl target = (ContentControl) sender; - - // If value is not a FontAwesomeIcon just ignore: Awesome.Content property can only be set to a FontAwesomeIcon value - if (!(evt.NewValue is FontAwesomeIcon)) return; - - FontAwesomeIcon symbolIcon = (FontAwesomeIcon)evt.NewValue; - int symbolCode = (int)symbolIcon; - char symbolChar = (char)symbolCode; - - target.FontFamily = FontAwesomeFontFamily; - target.Content = symbolChar; - } - - private const FontAwesomeIcon DEFAULT_CONTENT = FontAwesomeIcon.None; - } -} diff --git a/WPF/FontAwesome.WPF/ControlExtensions.cs b/WPF/FontAwesome.WPF/ControlExtensions.cs deleted file mode 100644 index e72aa94..0000000 --- a/WPF/FontAwesome.WPF/ControlExtensions.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Media; -using System.Windows.Media.Animation; - -namespace FontAwesome.WPF -{ - /// - /// Control extensions - /// - public static class ControlExtensions - { - /// - /// The key used for storing the spinner Storyboard. - /// - private static readonly string SpinnerStoryBoardName = String.Format("{0}Spinner", typeof(FontAwesome).Name); - - /// - /// Start the spinning animation - /// - /// FrameworkElement and ISpinable - /// Control to apply the rotation - public static void BeginSpin(this T control) - where T : FrameworkElement, ISpinable - { - var transformGroup = control.RenderTransform as TransformGroup ?? new TransformGroup(); - - var rotateTransform = transformGroup.Children.OfType().FirstOrDefault(); - - if (rotateTransform != null) - { - rotateTransform.Angle = 0; - } - else - { - transformGroup.Children.Add(new RotateTransform(0.0)); - control.RenderTransform = transformGroup; - control.RenderTransformOrigin = new Point(0.5, 0.5); - } - - var storyboard = new Storyboard(); - - var animation = new DoubleAnimation - { - From = 0, - To = 360, - AutoReverse = false, - RepeatBehavior = RepeatBehavior.Forever, - Duration = new Duration(TimeSpan.FromSeconds(control.SpinDuration)) - }; - storyboard.Children.Add(animation); - - Storyboard.SetTarget(animation, control); - Storyboard.SetTargetProperty(animation, - new PropertyPath("(0).(1)[0].(2)", UIElement.RenderTransformProperty, - TransformGroup.ChildrenProperty, RotateTransform.AngleProperty)); - - storyboard.Begin(); - control.Resources.Add(SpinnerStoryBoardName, storyboard); - } - - /// - /// Stop the spinning animation - /// - /// FrameworkElement and ISpinable - /// Control to stop the rotation. - public static void StopSpin(this T control) - where T : FrameworkElement, ISpinable - { - var storyboard = control.Resources[SpinnerStoryBoardName] as Storyboard; - - if (storyboard == null) return; - - storyboard.Stop(); - - control.Resources.Remove(SpinnerStoryBoardName); - } - - /// - /// Sets the rotation for the control - /// - /// FrameworkElement and IRotatable - /// Control to apply the rotation - public static void SetRotation(this T control) - where T : FrameworkElement, IRotatable - { - var transformGroup = control.RenderTransform as TransformGroup ?? new TransformGroup(); - - var rotateTransform = transformGroup.Children.OfType().FirstOrDefault(); - - if (rotateTransform != null) - { - rotateTransform.Angle = control.Rotation; - } - else - { - transformGroup.Children.Add(new RotateTransform(control.Rotation)); - control.RenderTransform = transformGroup; - control.RenderTransformOrigin = new Point(0.5, 0.5); - } - } - - /// - /// Sets the flip orientation for the control - /// - /// FrameworkElement and IRotatable - /// Control to apply the rotation - public static void SetFlipOrientation(this T control) - where T : FrameworkElement, IFlippable - { - var transformGroup = control.RenderTransform as TransformGroup ?? new TransformGroup(); - - var scaleX = control.FlipOrientation == FlipOrientation.Normal || control.FlipOrientation == FlipOrientation.Vertical ? 1 : -1; - var scaleY = control.FlipOrientation == FlipOrientation.Normal || control.FlipOrientation == FlipOrientation.Horizontal ? 1 : -1; - - var scaleTransform = transformGroup.Children.OfType().FirstOrDefault(); - - if (scaleTransform != null) - { - scaleTransform.ScaleX = scaleX; - scaleTransform.ScaleY = scaleY; - } - else - { - transformGroup.Children.Add(new ScaleTransform(scaleX, scaleY)); - control.RenderTransform = transformGroup; - control.RenderTransformOrigin = new Point(0.5, 0.5); - } - } - } -} diff --git a/WPF/FontAwesome.WPF/Converters/CssClassNameConverter.cs b/WPF/FontAwesome.WPF/Converters/CssClassNameConverter.cs deleted file mode 100644 index 21daab2..0000000 --- a/WPF/FontAwesome.WPF/Converters/CssClassNameConverter.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Windows.Data; -using System.Windows.Markup; - -namespace FontAwesome.WPF.Converters -{ - /// - /// Converts the CSS class name to a FontAwesomIcon and vice-versa. - /// - public class CssClassNameConverter - : MarkupExtension, IValueConverter - { - private static readonly IDictionary ClassNameLookup = new Dictionary(); - private static readonly IDictionary IconLookup = new Dictionary(); - - static CssClassNameConverter() - { - foreach (var value in Enum.GetValues(typeof(FontAwesomeIcon))) - { - var memInfo = typeof(FontAwesomeIcon).GetMember(value.ToString()); - var attributes = memInfo[0].GetCustomAttributes(typeof(IconIdAttribute), false); - - if (attributes.Length == 0) continue; // alias - - var id = ((IconIdAttribute)attributes[0]).Id; - - if (ClassNameLookup.ContainsKey(id)) continue; - - ClassNameLookup.Add(id, (FontAwesomeIcon)value); - IconLookup.Add((FontAwesomeIcon)value, id); - } - } - - /// - /// Gets or sets the mode of the converter - /// - public CssClassConverterMode Mode { get; set; } - - private static FontAwesomeIcon FromStringToIcon(object value) - { - var icon = value as string; - - if (string.IsNullOrEmpty(icon)) return FontAwesomeIcon.None; - - FontAwesomeIcon rValue; - - if (!ClassNameLookup.TryGetValue(icon, out rValue)) - { - rValue = FontAwesomeIcon.None; - } - - return rValue; - } - - private static string FromIconToString(object value) - { - if (!(value is FontAwesomeIcon)) return null; - - string rValue = null; - - IconLookup.TryGetValue((FontAwesomeIcon) value, out rValue); - - return rValue; - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (Mode == CssClassConverterMode.FromStringToIcon) - return FromStringToIcon(value); - - return FromIconToString(value); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - if (Mode == CssClassConverterMode.FromStringToIcon) - return FromIconToString(value); - - return FromStringToIcon(value); - } - - public override object ProvideValue(IServiceProvider serviceProvider) - { - return this; - } - } - - /// - /// Defines the CssClassNameConverter mode. - /// - public enum CssClassConverterMode - { - /// - /// Default mode. Expects a string and converts to a FontAwesomeIcon. - /// - FromStringToIcon = 0, - /// - /// Expects a FontAwesomeIcon and converts it to a string. - /// - FromIconToString - } -} diff --git a/WPF/FontAwesome.WPF/Converters/DescriptionConverter.cs b/WPF/FontAwesome.WPF/Converters/DescriptionConverter.cs deleted file mode 100644 index 83b045b..0000000 --- a/WPF/FontAwesome.WPF/Converters/DescriptionConverter.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Windows.Data; -using System.Windows.Markup; - -namespace FontAwesome.WPF.Converters -{ - /// - /// Converts a FontAwesomIcon to its description. - /// - public class DescriptionConverter - : MarkupExtension, IValueConverter - { - public override object ProvideValue(IServiceProvider serviceProvider) - { - return this; - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (!(value is FontAwesomeIcon)) return null; - - var icon = (FontAwesomeIcon) value; - - var memInfo = typeof(FontAwesomeIcon).GetMember(icon.ToString()); - var attributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); - - if (attributes.Length == 0) return null; // alias - - return ((DescriptionAttribute)attributes[0]).Description; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/WPF/FontAwesome.WPF/Converters/ImageSourceConverter.cs b/WPF/FontAwesome.WPF/Converters/ImageSourceConverter.cs deleted file mode 100644 index 8c057d1..0000000 --- a/WPF/FontAwesome.WPF/Converters/ImageSourceConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Windows.Data; -using System.Windows.Markup; -using System.Windows.Media; - -namespace FontAwesome.WPF.Converters -{ - /// - /// Converts a FontAwesomIcon to an ImageSource. Use the ConverterParameter to pass the Brush. - /// - public class ImageSourceConverter - : MarkupExtension, IValueConverter - { - public override object ProvideValue(IServiceProvider serviceProvider) - { - return this; - } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (!(value is FontAwesomeIcon)) return null; - - var brush = parameter as Brush; - - if (brush == null) - brush = Brushes.Black; - - return ImageAwesome.CreateImageSource((FontAwesomeIcon)value, brush); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/WPF/FontAwesome.WPF/FontAwesome.Icon.png b/WPF/FontAwesome.WPF/FontAwesome.Icon.png deleted file mode 100644 index 8f2ba5a049e9462d77e86d0b88358c33ad1dc179..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmV-F0l@x=P)+fG;6frc-R}d<8pe-^AL&G9kT1NVk20NR&S_1KAWV zY}}L?_+bumJ_bD_Q55Bo5b{B@9mpyO!kaA14|Gr7X>dy@^1^_X6;TwyvaF-Xi36;e zt#KUB4<$+BAU)=Fz%UF<(}bpJ;CUXpuERXf9No5!*RJbA6h-K|j;gAVB*_oJw7&0A zmL-0>ilW#9bzT1_AkXv5z_Ki8+ZJ&g^EVy@0k79}JvR@-0LO9mK$c}tRrTUG*E9`b z7{a#g-5h*=18JJxG>IJWeIKT29tY@!c>Tj=dS)lMXB#@Erz4>~PxM!C_XXs5-}pr1 Rea8R*002ovPDHLkV1k&GiVFY$ diff --git a/WPF/FontAwesome.WPF/FontAwesome.WPF.Net35.csproj b/WPF/FontAwesome.WPF/FontAwesome.WPF.Net35.csproj deleted file mode 100644 index bbc1b1d..0000000 --- a/WPF/FontAwesome.WPF/FontAwesome.WPF.Net35.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - - Debug - AnyCPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57} - Library - Properties - FontAwesome.WPF - FontAwesome.WPF - v3.5 - 512 - Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\FontAwesome.WPF.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\FontAwesome.WPF.xml - - - bin\Signed-Net35\ - TRACE - bin\Signed-Net35\FontAwesome.WPF.xml - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client\PresentationCore.dll - - - ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client\PresentationFramework.dll - - - - - - - - - - - - - - - - - - FontAwesomeIcon.log - - - - - - - - - - - FontAwesome.otf - - - - - - - - - - - - - - if $(ConfigurationName) == Signed ( -"C:\Program Files\BrutalDev\.NET Assembly Strong-Name Signer\StrongNameSigner.Console.exe" -a $(TargetDir)$(TargetFileName) -k $(SolutionDir)..\..\prv\FontAwesome.snk -) - - - \ No newline at end of file diff --git a/WPF/FontAwesome.WPF/FontAwesome.WPF.Net40.csproj b/WPF/FontAwesome.WPF/FontAwesome.WPF.Net40.csproj deleted file mode 100644 index 0cb07ae..0000000 --- a/WPF/FontAwesome.WPF/FontAwesome.WPF.Net40.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Debug - AnyCPU - {7006AC9F-D218-4D7B-98EB-5D2D91F69C57} - Library - Properties - FontAwesome.WPF - FontAwesome.WPF - v4.0 - 512 - Client - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET40 - prompt - 4 - bin\Debug\FontAwesome.WPF.xml - - - pdbonly - true - bin\Release\ - TRACE;NET40 - prompt - 4 - bin\Release\FontAwesome.WPF.xml - - - bin\Signed-Net40\ - TRACE;NET40 - bin\Signed-Net40\FontAwesome.WPF.xml - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - - - - ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll - - - ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationFramework.dll - - - - - - - - - - - - - - - - - - - - FontAwesomeIcon.log - - - - - - - - - - - FontAwesome.otf - PreserveNewest - - - - - - - - - - - - - - if $(ConfigurationName) == Signed ( -"C:\Program Files\BrutalDev\.NET Assembly Strong-Name Signer\StrongNameSigner.Console.exe" -a $(TargetDir)$(TargetFileName) -k $(SolutionDir)..\..\prv\FontAwesome.snk -) - - - \ No newline at end of file diff --git a/WPF/FontAwesome.WPF/FontAwesome.cs b/WPF/FontAwesome.WPF/FontAwesome.cs deleted file mode 100644 index 5f4ca04..0000000 --- a/WPF/FontAwesome.WPF/FontAwesome.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace FontAwesome.WPF -{ - /// - /// Provides a lightweight control for displaying a FontAwesome icon as text. - /// - public class FontAwesome - : TextBlock, ISpinable, IRotatable, IFlippable - { - /// - /// FontAwesome FontFamily. - /// - private static readonly FontFamily FontAwesomeFontFamily = new FontFamily(new Uri("pack://application:,,,/FontAwesome.WPF;component/"), "./#FontAwesome"); - /// - /// Identifies the FontAwesome.WPF.FontAwesome.Icon dependency property. - /// - public static readonly DependencyProperty IconProperty = - DependencyProperty.Register("Icon", typeof(FontAwesomeIcon), typeof(FontAwesome), new PropertyMetadata(FontAwesomeIcon.None, OnIconPropertyChanged)); - /// - /// Identifies the FontAwesome.WPF.FontAwesome.Spin dependency property. - /// - public static readonly DependencyProperty SpinProperty = - DependencyProperty.Register("Spin", typeof(bool), typeof(FontAwesome), new PropertyMetadata(false, OnSpinPropertyChanged, SpinCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.FontAwesome.Spin dependency property. - /// - public static readonly DependencyProperty SpinDurationProperty = - DependencyProperty.Register("SpinDuration", typeof(double), typeof(FontAwesome), new PropertyMetadata(1d, SpinDurationChanged, SpinDurationCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.FontAwesome.Rotation dependency property. - /// - public static readonly DependencyProperty RotationProperty = - DependencyProperty.Register("Rotation", typeof(double), typeof(FontAwesome), new PropertyMetadata(0d, RotationChanged, RotationCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.FontAwesome.FlipOrientation dependency property. - /// - public static readonly DependencyProperty FlipOrientationProperty = - DependencyProperty.Register("FlipOrientation", typeof(FlipOrientation), typeof(FontAwesome), new PropertyMetadata(FlipOrientation.Normal, FlipOrientationChanged)); - - static FontAwesome() - { - OpacityProperty.OverrideMetadata(typeof(FontAwesome), new UIPropertyMetadata(1.0, OpacityChanged)); - } - - public FontAwesome() - { - IsVisibleChanged += (s, a) => CoerceValue(SpinProperty); - } - - private static void OpacityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - d.CoerceValue(SpinProperty); - } - - /// - /// Gets or sets the FontAwesome icon. Changing this property will cause the icon to be redrawn. - /// - public FontAwesomeIcon Icon - { - get { return (FontAwesomeIcon)GetValue(IconProperty); } - set { SetValue(IconProperty, value); } - } - /// - /// Gets or sets the current spin (angle) animation of the icon. - /// - public bool Spin - { - get { return (bool)GetValue(SpinProperty); } - set { SetValue(SpinProperty, value); } - } - - private static void OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { -#if NET40 - d.SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.ClearType); -#endif - d.SetValue(FontFamilyProperty, FontAwesomeFontFamily); - d.SetValue(TextAlignmentProperty, TextAlignment.Center); - d.SetValue(TextProperty, char.ConvertFromUtf32((int)e.NewValue)); - } - - private static void OnSpinPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var fontAwesome = d as FontAwesome; - - if (fontAwesome == null) return; - - if ((bool)e.NewValue) - fontAwesome.BeginSpin(); - else - { - fontAwesome.StopSpin(); - fontAwesome.SetRotation(); - } - } - - private static object SpinCoerceValue(DependencyObject d, object basevalue) - { - var fontAwesome = (FontAwesome)d; - - if (!fontAwesome.IsVisible || fontAwesome.Opacity == 0.0 || fontAwesome.SpinDuration == 0.0) - return false; - - return basevalue; - } - - /// - /// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation. - /// - public double SpinDuration - { - get { return (double)GetValue(SpinDurationProperty); } - set { SetValue(SpinDurationProperty, value); } - } - - private static void SpinDurationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var fontAwesome = d as FontAwesome; - - if (null == fontAwesome || !fontAwesome.Spin || !(e.NewValue is double) || e.NewValue.Equals(e.OldValue)) return; - - fontAwesome.StopSpin(); - fontAwesome.BeginSpin(); - } - - private static object SpinDurationCoerceValue(DependencyObject d, object value) - { - double val = (double)value; - return val < 0 ? 0d : value; - } - - /// - /// Gets or sets the current rotation (angle). - /// - public double Rotation - { - get { return (double)GetValue(RotationProperty); } - set { SetValue(RotationProperty, value); } - } - - private static void RotationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var fontAwesome = d as FontAwesome; - - if (null == fontAwesome || fontAwesome.Spin || !(e.NewValue is double) || e.NewValue.Equals(e.OldValue)) return; - - fontAwesome.SetRotation(); - } - - private static object RotationCoerceValue(DependencyObject d, object value) - { - double val = (double)value; - return val < 0 ? 0d : (val > 360 ? 360d : value); - } - - /// - /// Gets or sets the current orientation (horizontal, vertical). - /// - public FlipOrientation FlipOrientation - { - get { return (FlipOrientation)GetValue(FlipOrientationProperty); } - set { SetValue(FlipOrientationProperty, value); } - } - - private static void FlipOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var fontAwesome = d as FontAwesome; - - if (null == fontAwesome || !(e.NewValue is FlipOrientation) || e.NewValue.Equals(e.OldValue)) return; - - fontAwesome.SetFlipOrientation(); - } - } -} diff --git a/WPF/FontAwesome.WPF/FontAwesomeIcon.cs b/WPF/FontAwesome.WPF/FontAwesomeIcon.cs deleted file mode 100644 index 6353b4d..0000000 --- a/WPF/FontAwesome.WPF/FontAwesomeIcon.cs +++ /dev/null @@ -1,3168 +0,0 @@ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ -namespace FontAwesome.WPF { - using System.ComponentModel; - /// - /// FontAwesome v4.7.0 by Dave Gandy (@davegandy) - /// The iconic font and CSS toolkit - /// License http://fontawesome.io/license (Font: v4.7.0, C#: MIT License) - /// - /// - /// - /// - public enum FontAwesomeIcon { - ///Set this value to show no icon. - None = 0x0, - ///Glass (created: 1.0) - /// - [Description("Glass"),IconId("glass"),IconCategory("Web Application Icons")] - Glass = 0xf000, - ///Music (created: 1.0) - /// - [Description("Music"),IconId("music"),IconCategory("Web Application Icons")] - Music = 0xf001, - ///Search (created: 1.0) - /// - [Description("Search"),IconId("search"),IconCategory("Web Application Icons")] - Search = 0xf002, - ///Envelope Outlined (created: 1.0) - /// - [Description("Envelope Outlined"),IconId("envelope-o"),IconCategory("Web Application Icons")] - EnvelopeOutline = 0xf003, - ///Heart (created: 1.0) - /// - [Description("Heart"),IconId("heart"),IconCategory("Web Application Icons"),IconCategory("Medical Icons")] - Heart = 0xf004, - ///Star (created: 1.0) - /// - [Description("Star"),IconId("star"),IconCategory("Web Application Icons")] - Star = 0xf005, - ///Star Outlined (created: 1.0) - /// - [Description("Star Outlined"),IconId("star-o"),IconCategory("Web Application Icons")] - StarOutline = 0xf006, - ///User (created: 1.0) - /// - [Description("User"),IconId("user"),IconCategory("Web Application Icons")] - User = 0xf007, - ///Film (created: 1.0) - /// - [Description("Film"),IconId("film"),IconCategory("Web Application Icons")] - Film = 0xf008, - ///th-large (created: 1.0) - /// - [Description("th-large"),IconId("th-large"),IconCategory("Text Editor Icons")] - ThLarge = 0xf009, - ///th (created: 1.0) - /// - [Description("th"),IconId("th"),IconCategory("Text Editor Icons")] - Th = 0xf00a, - ///th-list (created: 1.0) - /// - [Description("th-list"),IconId("th-list"),IconCategory("Text Editor Icons")] - ThList = 0xf00b, - ///Check (created: 1.0) - /// - [Description("Check"),IconId("check"),IconCategory("Web Application Icons")] - Check = 0xf00c, - ///Times (created: 1.0) - /// - [Description("Times"),IconId("times"),IconCategory("Web Application Icons")] - Times = 0xf00d, - ///Alias of: Times - /// - [IconAlias] - Remove = Times, - ///Alias of: Times - /// - [IconAlias] - Close = Times, - ///Search Plus (created: 1.0) - /// - [Description("Search Plus"),IconId("search-plus"),IconCategory("Web Application Icons")] - SearchPlus = 0xf00e, - ///Search Minus (created: 1.0) - /// - [Description("Search Minus"),IconId("search-minus"),IconCategory("Web Application Icons")] - SearchMinus = 0xf010, - ///Power Off (created: 1.0) - /// - [Description("Power Off"),IconId("power-off"),IconCategory("Web Application Icons")] - PowerOff = 0xf011, - ///signal (created: 1.0) - /// - [Description("signal"),IconId("signal"),IconCategory("Web Application Icons")] - Signal = 0xf012, - ///cog (created: 1.0) - /// - [Description("cog"),IconId("cog"),IconCategory("Web Application Icons"),IconCategory("Spinner Icons")] - Cog = 0xf013, - ///Alias of: Cog - /// - [IconAlias] - Gear = Cog, - ///Trash Outlined (created: 1.0) - /// - [Description("Trash Outlined"),IconId("trash-o"),IconCategory("Web Application Icons")] - TrashOutline = 0xf014, - ///home (created: 1.0) - /// - [Description("home"),IconId("home"),IconCategory("Web Application Icons")] - Home = 0xf015, - ///File Outlined (created: 1.0) - /// - [Description("File Outlined"),IconId("file-o"),IconCategory("Text Editor Icons"),IconCategory("File Type Icons")] - FileOutline = 0xf016, - ///Clock Outlined (created: 1.0) - /// - [Description("Clock Outlined"),IconId("clock-o"),IconCategory("Web Application Icons")] - ClockOutline = 0xf017, - ///road (created: 1.0) - /// - [Description("road"),IconId("road"),IconCategory("Web Application Icons")] - Road = 0xf018, - ///Download (created: 1.0) - /// - [Description("Download"),IconId("download"),IconCategory("Web Application Icons")] - Download = 0xf019, - ///Arrow Circle Outlined Down (created: 1.0) - /// - [Description("Arrow Circle Outlined Down"),IconId("arrow-circle-o-down"),IconCategory("Directional Icons")] - ArrowCircleOutlineDown = 0xf01a, - ///Arrow Circle Outlined Up (created: 1.0) - /// - [Description("Arrow Circle Outlined Up"),IconId("arrow-circle-o-up"),IconCategory("Directional Icons")] - ArrowCircleOutlineUp = 0xf01b, - ///inbox (created: 1.0) - /// - [Description("inbox"),IconId("inbox"),IconCategory("Web Application Icons")] - Inbox = 0xf01c, - ///Play Circle Outlined (created: 1.0) - /// - [Description("Play Circle Outlined"),IconId("play-circle-o"),IconCategory("Video Player Icons")] - PlayCircleOutline = 0xf01d, - ///Repeat (created: 1.0) - /// - [Description("Repeat"),IconId("repeat"),IconCategory("Text Editor Icons")] - Repeat = 0xf01e, - ///Alias of: Repeat - /// - [IconAlias] - RotateRight = Repeat, - ///refresh (created: 1.0) - /// - [Description("refresh"),IconId("refresh"),IconCategory("Web Application Icons"),IconCategory("Spinner Icons")] - Refresh = 0xf021, - ///list-alt (created: 1.0) - /// - [Description("list-alt"),IconId("list-alt"),IconCategory("Text Editor Icons")] - ListAlt = 0xf022, - ///lock (created: 1.0) - /// - [Description("lock"),IconId("lock"),IconCategory("Web Application Icons")] - Lock = 0xf023, - ///flag (created: 1.0) - /// - [Description("flag"),IconId("flag"),IconCategory("Web Application Icons")] - Flag = 0xf024, - ///headphones (created: 1.0) - /// - [Description("headphones"),IconId("headphones"),IconCategory("Web Application Icons")] - Headphones = 0xf025, - ///volume-off (created: 1.0) - /// - [Description("volume-off"),IconId("volume-off"),IconCategory("Web Application Icons")] - VolumeOff = 0xf026, - ///volume-down (created: 1.0) - /// - [Description("volume-down"),IconId("volume-down"),IconCategory("Web Application Icons")] - VolumeDown = 0xf027, - ///volume-up (created: 1.0) - /// - [Description("volume-up"),IconId("volume-up"),IconCategory("Web Application Icons")] - VolumeUp = 0xf028, - ///qrcode (created: 1.0) - /// - [Description("qrcode"),IconId("qrcode"),IconCategory("Web Application Icons")] - Qrcode = 0xf029, - ///barcode (created: 1.0) - /// - [Description("barcode"),IconId("barcode"),IconCategory("Web Application Icons")] - Barcode = 0xf02a, - ///tag (created: 1.0) - /// - [Description("tag"),IconId("tag"),IconCategory("Web Application Icons")] - Tag = 0xf02b, - ///tags (created: 1.0) - /// - [Description("tags"),IconId("tags"),IconCategory("Web Application Icons")] - Tags = 0xf02c, - ///book (created: 1.0) - /// - [Description("book"),IconId("book"),IconCategory("Web Application Icons")] - Book = 0xf02d, - ///bookmark (created: 1.0) - /// - [Description("bookmark"),IconId("bookmark"),IconCategory("Web Application Icons")] - Bookmark = 0xf02e, - ///print (created: 1.0) - /// - [Description("print"),IconId("print"),IconCategory("Web Application Icons")] - Print = 0xf02f, - ///camera (created: 1.0) - /// - [Description("camera"),IconId("camera"),IconCategory("Web Application Icons")] - Camera = 0xf030, - ///font (created: 1.0) - /// - [Description("font"),IconId("font"),IconCategory("Text Editor Icons")] - Font = 0xf031, - ///bold (created: 1.0) - /// - [Description("bold"),IconId("bold"),IconCategory("Text Editor Icons")] - Bold = 0xf032, - ///italic (created: 1.0) - /// - [Description("italic"),IconId("italic"),IconCategory("Text Editor Icons")] - Italic = 0xf033, - ///text-height (created: 1.0) - /// - [Description("text-height"),IconId("text-height"),IconCategory("Text Editor Icons")] - TextHeight = 0xf034, - ///text-width (created: 1.0) - /// - [Description("text-width"),IconId("text-width"),IconCategory("Text Editor Icons")] - TextWidth = 0xf035, - ///align-left (created: 1.0) - /// - [Description("align-left"),IconId("align-left"),IconCategory("Text Editor Icons")] - AlignLeft = 0xf036, - ///align-center (created: 1.0) - /// - [Description("align-center"),IconId("align-center"),IconCategory("Text Editor Icons")] - AlignCenter = 0xf037, - ///align-right (created: 1.0) - /// - [Description("align-right"),IconId("align-right"),IconCategory("Text Editor Icons")] - AlignRight = 0xf038, - ///align-justify (created: 1.0) - /// - [Description("align-justify"),IconId("align-justify"),IconCategory("Text Editor Icons")] - AlignJustify = 0xf039, - ///list (created: 1.0) - /// - [Description("list"),IconId("list"),IconCategory("Text Editor Icons")] - List = 0xf03a, - ///Outdent (created: 1.0) - /// - [Description("Outdent"),IconId("outdent"),IconCategory("Text Editor Icons")] - Outdent = 0xf03b, - ///Alias of: Outdent - /// - [IconAlias] - Dedent = Outdent, - ///Indent (created: 1.0) - /// - [Description("Indent"),IconId("indent"),IconCategory("Text Editor Icons")] - Indent = 0xf03c, - ///Video Camera (created: 1.0) - /// - [Description("Video Camera"),IconId("video-camera"),IconCategory("Web Application Icons")] - VideoCamera = 0xf03d, - ///Picture Outlined (created: 1.0) - /// - [Description("Picture Outlined"),IconId("picture-o"),IconCategory("Web Application Icons")] - PictureOutline = 0xf03e, - ///Alias of: PictureOutline - /// - [IconAlias] - Photo = PictureOutline, - ///Alias of: PictureOutline - /// - [IconAlias] - Image = PictureOutline, - ///pencil (created: 1.0) - /// - [Description("pencil"),IconId("pencil"),IconCategory("Web Application Icons")] - Pencil = 0xf040, - ///map-marker (created: 1.0) - /// - [Description("map-marker"),IconId("map-marker"),IconCategory("Web Application Icons")] - MapMarker = 0xf041, - ///adjust (created: 1.0) - /// - [Description("adjust"),IconId("adjust"),IconCategory("Web Application Icons")] - Adjust = 0xf042, - ///tint (created: 1.0) - /// - [Description("tint"),IconId("tint"),IconCategory("Web Application Icons")] - Tint = 0xf043, - ///Pencil Square Outlined (created: 1.0) - /// - [Description("Pencil Square Outlined"),IconId("pencil-square-o"),IconCategory("Web Application Icons")] - PencilSquareOutline = 0xf044, - ///Alias of: PencilSquareOutline - /// - [IconAlias] - Edit = PencilSquareOutline, - ///Share Square Outlined (created: 1.0) - /// - [Description("Share Square Outlined"),IconId("share-square-o"),IconCategory("Web Application Icons")] - ShareSquareOutline = 0xf045, - ///Check Square Outlined (created: 1.0) - /// - [Description("Check Square Outlined"),IconId("check-square-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - CheckSquareOutline = 0xf046, - ///Arrows (created: 1.0) - /// - [Description("Arrows"),IconId("arrows"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - Arrows = 0xf047, - ///step-backward (created: 1.0) - /// - [Description("step-backward"),IconId("step-backward"),IconCategory("Video Player Icons")] - StepBackward = 0xf048, - ///fast-backward (created: 1.0) - /// - [Description("fast-backward"),IconId("fast-backward"),IconCategory("Video Player Icons")] - FastBackward = 0xf049, - ///backward (created: 1.0) - /// - [Description("backward"),IconId("backward"),IconCategory("Video Player Icons")] - Backward = 0xf04a, - ///play (created: 1.0) - /// - [Description("play"),IconId("play"),IconCategory("Video Player Icons")] - Play = 0xf04b, - ///pause (created: 1.0) - /// - [Description("pause"),IconId("pause"),IconCategory("Video Player Icons")] - Pause = 0xf04c, - ///stop (created: 1.0) - /// - [Description("stop"),IconId("stop"),IconCategory("Video Player Icons")] - Stop = 0xf04d, - ///forward (created: 1.0) - /// - [Description("forward"),IconId("forward"),IconCategory("Video Player Icons")] - Forward = 0xf04e, - ///fast-forward (created: 1.0) - /// - [Description("fast-forward"),IconId("fast-forward"),IconCategory("Video Player Icons")] - FastForward = 0xf050, - ///step-forward (created: 1.0) - /// - [Description("step-forward"),IconId("step-forward"),IconCategory("Video Player Icons")] - StepForward = 0xf051, - ///eject (created: 1.0) - /// - [Description("eject"),IconId("eject"),IconCategory("Video Player Icons")] - Eject = 0xf052, - ///chevron-left (created: 1.0) - /// - [Description("chevron-left"),IconId("chevron-left"),IconCategory("Directional Icons")] - ChevronLeft = 0xf053, - ///chevron-right (created: 1.0) - /// - [Description("chevron-right"),IconId("chevron-right"),IconCategory("Directional Icons")] - ChevronRight = 0xf054, - ///Plus Circle (created: 1.0) - /// - [Description("Plus Circle"),IconId("plus-circle"),IconCategory("Web Application Icons")] - PlusCircle = 0xf055, - ///Minus Circle (created: 1.0) - /// - [Description("Minus Circle"),IconId("minus-circle"),IconCategory("Web Application Icons")] - MinusCircle = 0xf056, - ///Times Circle (created: 1.0) - /// - [Description("Times Circle"),IconId("times-circle"),IconCategory("Web Application Icons")] - TimesCircle = 0xf057, - ///Check Circle (created: 1.0) - /// - [Description("Check Circle"),IconId("check-circle"),IconCategory("Web Application Icons")] - CheckCircle = 0xf058, - ///Question Circle (created: 1.0) - /// - [Description("Question Circle"),IconId("question-circle"),IconCategory("Web Application Icons")] - QuestionCircle = 0xf059, - ///Info Circle (created: 1.0) - /// - [Description("Info Circle"),IconId("info-circle"),IconCategory("Web Application Icons")] - InfoCircle = 0xf05a, - ///Crosshairs (created: 1.0) - /// - [Description("Crosshairs"),IconId("crosshairs"),IconCategory("Web Application Icons")] - Crosshairs = 0xf05b, - ///Times Circle Outlined (created: 1.0) - /// - [Description("Times Circle Outlined"),IconId("times-circle-o"),IconCategory("Web Application Icons")] - TimesCircleOutline = 0xf05c, - ///Check Circle Outlined (created: 1.0) - /// - [Description("Check Circle Outlined"),IconId("check-circle-o"),IconCategory("Web Application Icons")] - CheckCircleOutline = 0xf05d, - ///ban (created: 1.0) - /// - [Description("ban"),IconId("ban"),IconCategory("Web Application Icons")] - Ban = 0xf05e, - ///arrow-left (created: 1.0) - /// - [Description("arrow-left"),IconId("arrow-left"),IconCategory("Directional Icons")] - ArrowLeft = 0xf060, - ///arrow-right (created: 1.0) - /// - [Description("arrow-right"),IconId("arrow-right"),IconCategory("Directional Icons")] - ArrowRight = 0xf061, - ///arrow-up (created: 1.0) - /// - [Description("arrow-up"),IconId("arrow-up"),IconCategory("Directional Icons")] - ArrowUp = 0xf062, - ///arrow-down (created: 1.0) - /// - [Description("arrow-down"),IconId("arrow-down"),IconCategory("Directional Icons")] - ArrowDown = 0xf063, - ///Share (created: 1.0) - /// - [Description("Share"),IconId("share"),IconCategory("Web Application Icons")] - Share = 0xf064, - ///Alias of: Share - /// - [IconAlias] - MailForward = Share, - ///Expand (created: 1.0) - /// - [Description("Expand"),IconId("expand"),IconCategory("Video Player Icons")] - Expand = 0xf065, - ///Compress (created: 1.0) - /// - [Description("Compress"),IconId("compress"),IconCategory("Video Player Icons")] - Compress = 0xf066, - ///plus (created: 1.0) - /// - [Description("plus"),IconId("plus"),IconCategory("Web Application Icons")] - Plus = 0xf067, - ///minus (created: 1.0) - /// - [Description("minus"),IconId("minus"),IconCategory("Web Application Icons")] - Minus = 0xf068, - ///asterisk (created: 1.0) - /// - [Description("asterisk"),IconId("asterisk"),IconCategory("Web Application Icons")] - Asterisk = 0xf069, - ///Exclamation Circle (created: 1.0) - /// - [Description("Exclamation Circle"),IconId("exclamation-circle"),IconCategory("Web Application Icons")] - ExclamationCircle = 0xf06a, - ///gift (created: 1.0) - /// - [Description("gift"),IconId("gift"),IconCategory("Web Application Icons")] - Gift = 0xf06b, - ///leaf (created: 1.0) - /// - [Description("leaf"),IconId("leaf"),IconCategory("Web Application Icons")] - Leaf = 0xf06c, - ///fire (created: 1.0) - /// - [Description("fire"),IconId("fire"),IconCategory("Web Application Icons")] - Fire = 0xf06d, - ///Eye (created: 1.0) - /// - [Description("Eye"),IconId("eye"),IconCategory("Web Application Icons")] - Eye = 0xf06e, - ///Eye Slash (created: 1.0) - /// - [Description("Eye Slash"),IconId("eye-slash"),IconCategory("Web Application Icons")] - EyeSlash = 0xf070, - ///Exclamation Triangle (created: 1.0) - /// - [Description("Exclamation Triangle"),IconId("exclamation-triangle"),IconCategory("Web Application Icons")] - ExclamationTriangle = 0xf071, - ///Alias of: ExclamationTriangle - /// - [IconAlias] - Warning = ExclamationTriangle, - ///plane (created: 1.0) - /// - [Description("plane"),IconId("plane"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Plane = 0xf072, - ///calendar (created: 1.0) - /// - [Description("calendar"),IconId("calendar"),IconCategory("Web Application Icons")] - Calendar = 0xf073, - ///random (created: 1.0) - /// - [Description("random"),IconId("random"),IconCategory("Web Application Icons"),IconCategory("Video Player Icons")] - Random = 0xf074, - ///comment (created: 1.0) - /// - [Description("comment"),IconId("comment"),IconCategory("Web Application Icons")] - Comment = 0xf075, - ///magnet (created: 1.0) - /// - [Description("magnet"),IconId("magnet"),IconCategory("Web Application Icons")] - Magnet = 0xf076, - ///chevron-up (created: 1.0) - /// - [Description("chevron-up"),IconId("chevron-up"),IconCategory("Directional Icons")] - ChevronUp = 0xf077, - ///chevron-down (created: 1.0) - /// - [Description("chevron-down"),IconId("chevron-down"),IconCategory("Directional Icons")] - ChevronDown = 0xf078, - ///retweet (created: 1.0) - /// - [Description("retweet"),IconId("retweet"),IconCategory("Web Application Icons")] - Retweet = 0xf079, - ///shopping-cart (created: 1.0) - /// - [Description("shopping-cart"),IconId("shopping-cart"),IconCategory("Web Application Icons")] - ShoppingCart = 0xf07a, - ///Folder (created: 1.0) - /// - [Description("Folder"),IconId("folder"),IconCategory("Web Application Icons")] - Folder = 0xf07b, - ///Folder Open (created: 1.0) - /// - [Description("Folder Open"),IconId("folder-open"),IconCategory("Web Application Icons")] - FolderOpen = 0xf07c, - ///Arrows Vertical (created: 1.0) - /// - [Description("Arrows Vertical"),IconId("arrows-v"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - ArrowsV = 0xf07d, - ///Arrows Horizontal (created: 1.0) - /// - [Description("Arrows Horizontal"),IconId("arrows-h"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - ArrowsH = 0xf07e, - ///Bar Chart (created: 1.0) - /// - [Description("Bar Chart"),IconId("bar-chart"),IconCategory("Web Application Icons"),IconCategory("Chart Icons")] - BarChart = 0xf080, - ///Alias of: BarChart - /// - [IconAlias] - BarChartOutline = BarChart, - ///Twitter Square (created: 1.0) - /// - [Description("Twitter Square"),IconId("twitter-square"),IconCategory("Brand Icons")] - TwitterSquare = 0xf081, - ///Facebook Square (created: 1.0) - /// - [Description("Facebook Square"),IconId("facebook-square"),IconCategory("Brand Icons")] - FacebookSquare = 0xf082, - ///camera-retro (created: 1.0) - /// - [Description("camera-retro"),IconId("camera-retro"),IconCategory("Web Application Icons")] - CameraRetro = 0xf083, - ///key (created: 1.0) - /// - [Description("key"),IconId("key"),IconCategory("Web Application Icons")] - Key = 0xf084, - ///cogs (created: 1.0) - /// - [Description("cogs"),IconId("cogs"),IconCategory("Web Application Icons")] - Cogs = 0xf085, - ///Alias of: Cogs - /// - [IconAlias] - Gears = Cogs, - ///comments (created: 1.0) - /// - [Description("comments"),IconId("comments"),IconCategory("Web Application Icons")] - Comments = 0xf086, - ///Thumbs Up Outlined (created: 1.0) - /// - [Description("Thumbs Up Outlined"),IconId("thumbs-o-up"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - ThumbsOutlineUp = 0xf087, - ///Thumbs Down Outlined (created: 1.0) - /// - [Description("Thumbs Down Outlined"),IconId("thumbs-o-down"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - ThumbsOutlineDown = 0xf088, - ///star-half (created: 1.0) - /// - [Description("star-half"),IconId("star-half"),IconCategory("Web Application Icons")] - StarHalf = 0xf089, - ///Heart Outlined (created: 1.0) - /// - [Description("Heart Outlined"),IconId("heart-o"),IconCategory("Web Application Icons"),IconCategory("Medical Icons")] - HeartOutline = 0xf08a, - ///Sign Out (created: 1.0) - /// - [Description("Sign Out"),IconId("sign-out"),IconCategory("Web Application Icons")] - SignOut = 0xf08b, - ///LinkedIn Square (created: 1.0) - /// - [Description("LinkedIn Square"),IconId("linkedin-square"),IconCategory("Brand Icons")] - LinkedinSquare = 0xf08c, - ///Thumb Tack (created: 1.0) - /// - [Description("Thumb Tack"),IconId("thumb-tack"),IconCategory("Web Application Icons")] - ThumbTack = 0xf08d, - ///External Link (created: 1.0) - /// - [Description("External Link"),IconId("external-link"),IconCategory("Web Application Icons")] - ExternalLink = 0xf08e, - ///Sign In (created: 1.0) - /// - [Description("Sign In"),IconId("sign-in"),IconCategory("Web Application Icons")] - SignIn = 0xf090, - ///trophy (created: 1.0) - /// - [Description("trophy"),IconId("trophy"),IconCategory("Web Application Icons")] - Trophy = 0xf091, - ///GitHub Square (created: 1.0) - /// - [Description("GitHub Square"),IconId("github-square"),IconCategory("Brand Icons")] - GithubSquare = 0xf092, - ///Upload (created: 1.0) - /// - [Description("Upload"),IconId("upload"),IconCategory("Web Application Icons")] - Upload = 0xf093, - ///Lemon Outlined (created: 1.0) - /// - [Description("Lemon Outlined"),IconId("lemon-o"),IconCategory("Web Application Icons")] - LemonOutline = 0xf094, - ///Phone (created: 2.0) - /// - [Description("Phone"),IconId("phone"),IconCategory("Web Application Icons")] - Phone = 0xf095, - ///Square Outlined (created: 2.0) - /// - [Description("Square Outlined"),IconId("square-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - SquareOutline = 0xf096, - ///Bookmark Outlined (created: 2.0) - /// - [Description("Bookmark Outlined"),IconId("bookmark-o"),IconCategory("Web Application Icons")] - BookmarkOutline = 0xf097, - ///Phone Square (created: 2.0) - /// - [Description("Phone Square"),IconId("phone-square"),IconCategory("Web Application Icons")] - PhoneSquare = 0xf098, - ///Twitter (created: 2.0) - /// - [Description("Twitter"),IconId("twitter"),IconCategory("Brand Icons")] - Twitter = 0xf099, - ///Facebook (created: 2.0) - /// - [Description("Facebook"),IconId("facebook"),IconCategory("Brand Icons")] - Facebook = 0xf09a, - ///Alias of: Facebook - /// - [IconAlias] - FacebookF = Facebook, - ///GitHub (created: 2.0) - /// - [Description("GitHub"),IconId("github"),IconCategory("Brand Icons")] - Github = 0xf09b, - ///unlock (created: 2.0) - /// - [Description("unlock"),IconId("unlock"),IconCategory("Web Application Icons")] - Unlock = 0xf09c, - ///credit-card (created: 2.0) - /// - [Description("credit-card"),IconId("credit-card"),IconCategory("Web Application Icons"),IconCategory("Payment Icons")] - CreditCard = 0xf09d, - ///rss (created: 2.0) - /// - [Description("rss"),IconId("rss"),IconCategory("Web Application Icons")] - Rss = 0xf09e, - ///Alias of: Rss - /// - [IconAlias] - Feed = Rss, - ///HDD (created: 2.0) - /// - [Description("HDD"),IconId("hdd-o"),IconCategory("Web Application Icons")] - HddOutline = 0xf0a0, - ///bullhorn (created: 2.0) - /// - [Description("bullhorn"),IconId("bullhorn"),IconCategory("Web Application Icons")] - Bullhorn = 0xf0a1, - ///bell (created: 2.0) - /// - [Description("bell"),IconId("bell"),IconCategory("Web Application Icons")] - Bell = 0xf0f3, - ///certificate (created: 2.0) - /// - [Description("certificate"),IconId("certificate"),IconCategory("Web Application Icons")] - Certificate = 0xf0a3, - ///Hand Outlined Right (created: 2.0) - /// - [Description("Hand Outlined Right"),IconId("hand-o-right"),IconCategory("Directional Icons"),IconCategory("Hand Icons")] - HandOutlineRight = 0xf0a4, - ///Hand Outlined Left (created: 2.0) - /// - [Description("Hand Outlined Left"),IconId("hand-o-left"),IconCategory("Directional Icons"),IconCategory("Hand Icons")] - HandOutlineLeft = 0xf0a5, - ///Hand Outlined Up (created: 2.0) - /// - [Description("Hand Outlined Up"),IconId("hand-o-up"),IconCategory("Directional Icons"),IconCategory("Hand Icons")] - HandOutlineUp = 0xf0a6, - ///Hand Outlined Down (created: 2.0) - /// - [Description("Hand Outlined Down"),IconId("hand-o-down"),IconCategory("Directional Icons"),IconCategory("Hand Icons")] - HandOutlineDown = 0xf0a7, - ///Arrow Circle Left (created: 2.0) - /// - [Description("Arrow Circle Left"),IconId("arrow-circle-left"),IconCategory("Directional Icons")] - ArrowCircleLeft = 0xf0a8, - ///Arrow Circle Right (created: 2.0) - /// - [Description("Arrow Circle Right"),IconId("arrow-circle-right"),IconCategory("Directional Icons")] - ArrowCircleRight = 0xf0a9, - ///Arrow Circle Up (created: 2.0) - /// - [Description("Arrow Circle Up"),IconId("arrow-circle-up"),IconCategory("Directional Icons")] - ArrowCircleUp = 0xf0aa, - ///Arrow Circle Down (created: 2.0) - /// - [Description("Arrow Circle Down"),IconId("arrow-circle-down"),IconCategory("Directional Icons")] - ArrowCircleDown = 0xf0ab, - ///Globe (created: 2.0) - /// - [Description("Globe"),IconId("globe"),IconCategory("Web Application Icons")] - Globe = 0xf0ac, - ///Wrench (created: 2.0) - /// - [Description("Wrench"),IconId("wrench"),IconCategory("Web Application Icons")] - Wrench = 0xf0ad, - ///Tasks (created: 2.0) - /// - [Description("Tasks"),IconId("tasks"),IconCategory("Web Application Icons")] - Tasks = 0xf0ae, - ///Filter (created: 2.0) - /// - [Description("Filter"),IconId("filter"),IconCategory("Web Application Icons")] - Filter = 0xf0b0, - ///Briefcase (created: 2.0) - /// - [Description("Briefcase"),IconId("briefcase"),IconCategory("Web Application Icons")] - Briefcase = 0xf0b1, - ///Arrows Alt (created: 2.0) - /// - [Description("Arrows Alt"),IconId("arrows-alt"),IconCategory("Video Player Icons"),IconCategory("Directional Icons")] - ArrowsAlt = 0xf0b2, - ///Users (created: 2.0) - /// - [Description("Users"),IconId("users"),IconCategory("Web Application Icons")] - Users = 0xf0c0, - ///Alias of: Users - /// - [IconAlias] - Group = Users, - ///Link (created: 2.0) - /// - [Description("Link"),IconId("link"),IconCategory("Text Editor Icons")] - Link = 0xf0c1, - ///Alias of: Link - /// - [IconAlias] - Chain = Link, - ///Cloud (created: 2.0) - /// - [Description("Cloud"),IconId("cloud"),IconCategory("Web Application Icons")] - Cloud = 0xf0c2, - ///Flask (created: 2.0) - /// - [Description("Flask"),IconId("flask"),IconCategory("Web Application Icons")] - Flask = 0xf0c3, - ///Scissors (created: 2.0) - /// - [Description("Scissors"),IconId("scissors"),IconCategory("Text Editor Icons")] - Scissors = 0xf0c4, - ///Alias of: Scissors - /// - [IconAlias] - Cut = Scissors, - ///Files Outlined (created: 2.0) - /// - [Description("Files Outlined"),IconId("files-o"),IconCategory("Text Editor Icons")] - FilesOutline = 0xf0c5, - ///Alias of: FilesOutline - /// - [IconAlias] - Copy = FilesOutline, - ///Paperclip (created: 2.0) - /// - [Description("Paperclip"),IconId("paperclip"),IconCategory("Text Editor Icons")] - Paperclip = 0xf0c6, - ///Floppy Outlined (created: 2.0) - /// - [Description("Floppy Outlined"),IconId("floppy-o"),IconCategory("Text Editor Icons")] - FloppyOutline = 0xf0c7, - ///Alias of: FloppyOutline - /// - [IconAlias] - Save = FloppyOutline, - ///Square (created: 2.0) - /// - [Description("Square"),IconId("square"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - Square = 0xf0c8, - ///Bars (created: 2.0) - /// - [Description("Bars"),IconId("bars"),IconCategory("Web Application Icons")] - Bars = 0xf0c9, - ///Alias of: Bars - /// - [IconAlias] - Navicon = Bars, - ///Alias of: Bars - /// - [IconAlias] - Reorder = Bars, - ///list-ul (created: 2.0) - /// - [Description("list-ul"),IconId("list-ul"),IconCategory("Text Editor Icons")] - ListUl = 0xf0ca, - ///list-ol (created: 2.0) - /// - [Description("list-ol"),IconId("list-ol"),IconCategory("Text Editor Icons")] - ListOl = 0xf0cb, - ///Strikethrough (created: 2.0) - /// - [Description("Strikethrough"),IconId("strikethrough"),IconCategory("Text Editor Icons")] - Strikethrough = 0xf0cc, - ///Underline (created: 2.0) - /// - [Description("Underline"),IconId("underline"),IconCategory("Text Editor Icons")] - Underline = 0xf0cd, - ///table (created: 2.0) - /// - [Description("table"),IconId("table"),IconCategory("Text Editor Icons")] - Table = 0xf0ce, - ///magic (created: 2.0) - /// - [Description("magic"),IconId("magic"),IconCategory("Web Application Icons")] - Magic = 0xf0d0, - ///truck (created: 2.0) - /// - [Description("truck"),IconId("truck"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Truck = 0xf0d1, - ///Pinterest (created: 2.0) - /// - [Description("Pinterest"),IconId("pinterest"),IconCategory("Brand Icons")] - Pinterest = 0xf0d2, - ///Pinterest Square (created: 2.0) - /// - [Description("Pinterest Square"),IconId("pinterest-square"),IconCategory("Brand Icons")] - PinterestSquare = 0xf0d3, - ///Google Plus Square (created: 2.0) - /// - [Description("Google Plus Square"),IconId("google-plus-square"),IconCategory("Brand Icons")] - GooglePlusSquare = 0xf0d4, - ///Google Plus (created: 2.0) - /// - [Description("Google Plus"),IconId("google-plus"),IconCategory("Brand Icons")] - GooglePlus = 0xf0d5, - ///Money (created: 2.0) - /// - [Description("Money"),IconId("money"),IconCategory("Web Application Icons"),IconCategory("Currency Icons")] - Money = 0xf0d6, - ///Caret Down (created: 2.0) - /// - [Description("Caret Down"),IconId("caret-down"),IconCategory("Directional Icons")] - CaretDown = 0xf0d7, - ///Caret Up (created: 2.0) - /// - [Description("Caret Up"),IconId("caret-up"),IconCategory("Directional Icons")] - CaretUp = 0xf0d8, - ///Caret Left (created: 2.0) - /// - [Description("Caret Left"),IconId("caret-left"),IconCategory("Directional Icons")] - CaretLeft = 0xf0d9, - ///Caret Right (created: 2.0) - /// - [Description("Caret Right"),IconId("caret-right"),IconCategory("Directional Icons")] - CaretRight = 0xf0da, - ///Columns (created: 2.0) - /// - [Description("Columns"),IconId("columns"),IconCategory("Text Editor Icons")] - Columns = 0xf0db, - ///Sort (created: 2.0) - /// - [Description("Sort"),IconId("sort"),IconCategory("Web Application Icons")] - Sort = 0xf0dc, - ///Alias of: Sort - /// - [IconAlias] - Unsorted = Sort, - ///Sort Descending (created: 2.0) - /// - [Description("Sort Descending"),IconId("sort-desc"),IconCategory("Web Application Icons")] - SortDesc = 0xf0dd, - ///Alias of: SortDesc - /// - [IconAlias] - SortDown = SortDesc, - ///Sort Ascending (created: 2.0) - /// - [Description("Sort Ascending"),IconId("sort-asc"),IconCategory("Web Application Icons")] - SortAsc = 0xf0de, - ///Alias of: SortAsc - /// - [IconAlias] - SortUp = SortAsc, - ///Envelope (created: 2.0) - /// - [Description("Envelope"),IconId("envelope"),IconCategory("Web Application Icons")] - Envelope = 0xf0e0, - ///LinkedIn (created: 2.0) - /// - [Description("LinkedIn"),IconId("linkedin"),IconCategory("Brand Icons")] - Linkedin = 0xf0e1, - ///Undo (created: 2.0) - /// - [Description("Undo"),IconId("undo"),IconCategory("Text Editor Icons")] - Undo = 0xf0e2, - ///Alias of: Undo - /// - [IconAlias] - RotateLeft = Undo, - ///Gavel (created: 2.0) - /// - [Description("Gavel"),IconId("gavel"),IconCategory("Web Application Icons")] - Gavel = 0xf0e3, - ///Alias of: Gavel - /// - [IconAlias] - Legal = Gavel, - ///Tachometer (created: 2.0) - /// - [Description("Tachometer"),IconId("tachometer"),IconCategory("Web Application Icons")] - Tachometer = 0xf0e4, - ///Alias of: Tachometer - /// - [IconAlias] - Dashboard = Tachometer, - ///comment-o (created: 2.0) - /// - [Description("comment-o"),IconId("comment-o"),IconCategory("Web Application Icons")] - CommentOutline = 0xf0e5, - ///comments-o (created: 2.0) - /// - [Description("comments-o"),IconId("comments-o"),IconCategory("Web Application Icons")] - CommentsOutline = 0xf0e6, - ///Lightning Bolt (created: 2.0) - /// - [Description("Lightning Bolt"),IconId("bolt"),IconCategory("Web Application Icons")] - Bolt = 0xf0e7, - ///Alias of: Bolt - /// - [IconAlias] - Flash = Bolt, - ///Sitemap (created: 2.0) - /// - [Description("Sitemap"),IconId("sitemap"),IconCategory("Web Application Icons")] - Sitemap = 0xf0e8, - ///Umbrella (created: 2.0) - /// - [Description("Umbrella"),IconId("umbrella"),IconCategory("Web Application Icons")] - Umbrella = 0xf0e9, - ///Clipboard (created: 2.0) - /// - [Description("Clipboard"),IconId("clipboard"),IconCategory("Text Editor Icons")] - Clipboard = 0xf0ea, - ///Alias of: Clipboard - /// - [IconAlias] - Paste = Clipboard, - ///Lightbulb Outlined (created: 3.0) - /// - [Description("Lightbulb Outlined"),IconId("lightbulb-o"),IconCategory("Web Application Icons")] - LightbulbOutline = 0xf0eb, - ///Exchange (created: 3.0) - /// - [Description("Exchange"),IconId("exchange"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - Exchange = 0xf0ec, - ///Cloud Download (created: 3.0) - /// - [Description("Cloud Download"),IconId("cloud-download"),IconCategory("Web Application Icons")] - CloudDownload = 0xf0ed, - ///Cloud Upload (created: 3.0) - /// - [Description("Cloud Upload"),IconId("cloud-upload"),IconCategory("Web Application Icons")] - CloudUpload = 0xf0ee, - ///user-md (created: 2.0) - /// - [Description("user-md"),IconId("user-md"),IconCategory("Medical Icons")] - UserMd = 0xf0f0, - ///Stethoscope (created: 3.0) - /// - [Description("Stethoscope"),IconId("stethoscope"),IconCategory("Medical Icons")] - Stethoscope = 0xf0f1, - ///Suitcase (created: 3.0) - /// - [Description("Suitcase"),IconId("suitcase"),IconCategory("Web Application Icons")] - Suitcase = 0xf0f2, - ///Bell Outlined (created: 3.0) - /// - [Description("Bell Outlined"),IconId("bell-o"),IconCategory("Web Application Icons")] - BellOutline = 0xf0a2, - ///Coffee (created: 3.0) - /// - [Description("Coffee"),IconId("coffee"),IconCategory("Web Application Icons")] - Coffee = 0xf0f4, - ///Cutlery (created: 3.0) - /// - [Description("Cutlery"),IconId("cutlery"),IconCategory("Web Application Icons")] - Cutlery = 0xf0f5, - ///File Text Outlined (created: 3.0) - /// - [Description("File Text Outlined"),IconId("file-text-o"),IconCategory("Text Editor Icons"),IconCategory("File Type Icons")] - FileTextOutline = 0xf0f6, - ///Building Outlined (created: 3.0) - /// - [Description("Building Outlined"),IconId("building-o"),IconCategory("Web Application Icons")] - BuildingOutline = 0xf0f7, - ///hospital Outlined (created: 3.0) - /// - [Description("hospital Outlined"),IconId("hospital-o"),IconCategory("Medical Icons")] - HospitalOutline = 0xf0f8, - ///ambulance (created: 3.0) - /// - [Description("ambulance"),IconId("ambulance"),IconCategory("Medical Icons"),IconCategory("Transportation Icons")] - Ambulance = 0xf0f9, - ///medkit (created: 3.0) - /// - [Description("medkit"),IconId("medkit"),IconCategory("Medical Icons")] - Medkit = 0xf0fa, - ///fighter-jet (created: 3.0) - /// - [Description("fighter-jet"),IconId("fighter-jet"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - FighterJet = 0xf0fb, - ///beer (created: 3.0) - /// - [Description("beer"),IconId("beer"),IconCategory("Web Application Icons")] - Beer = 0xf0fc, - ///H Square (created: 3.0) - /// - [Description("H Square"),IconId("h-square"),IconCategory("Medical Icons")] - HSquare = 0xf0fd, - ///Plus Square (created: 3.0) - /// - [Description("Plus Square"),IconId("plus-square"),IconCategory("Medical Icons"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - PlusSquare = 0xf0fe, - ///Angle Double Left (created: 3.0) - /// - [Description("Angle Double Left"),IconId("angle-double-left"),IconCategory("Directional Icons")] - AngleDoubleLeft = 0xf100, - ///Angle Double Right (created: 3.0) - /// - [Description("Angle Double Right"),IconId("angle-double-right"),IconCategory("Directional Icons")] - AngleDoubleRight = 0xf101, - ///Angle Double Up (created: 3.0) - /// - [Description("Angle Double Up"),IconId("angle-double-up"),IconCategory("Directional Icons")] - AngleDoubleUp = 0xf102, - ///Angle Double Down (created: 3.0) - /// - [Description("Angle Double Down"),IconId("angle-double-down"),IconCategory("Directional Icons")] - AngleDoubleDown = 0xf103, - ///angle-left (created: 3.0) - /// - [Description("angle-left"),IconId("angle-left"),IconCategory("Directional Icons")] - AngleLeft = 0xf104, - ///angle-right (created: 3.0) - /// - [Description("angle-right"),IconId("angle-right"),IconCategory("Directional Icons")] - AngleRight = 0xf105, - ///angle-up (created: 3.0) - /// - [Description("angle-up"),IconId("angle-up"),IconCategory("Directional Icons")] - AngleUp = 0xf106, - ///angle-down (created: 3.0) - /// - [Description("angle-down"),IconId("angle-down"),IconCategory("Directional Icons")] - AngleDown = 0xf107, - ///Desktop (created: 3.0) - /// - [Description("Desktop"),IconId("desktop"),IconCategory("Web Application Icons")] - Desktop = 0xf108, - ///Laptop (created: 3.0) - /// - [Description("Laptop"),IconId("laptop"),IconCategory("Web Application Icons")] - Laptop = 0xf109, - ///tablet (created: 3.0) - /// - [Description("tablet"),IconId("tablet"),IconCategory("Web Application Icons")] - Tablet = 0xf10a, - ///Mobile Phone (created: 3.0) - /// - [Description("Mobile Phone"),IconId("mobile"),IconCategory("Web Application Icons")] - Mobile = 0xf10b, - ///Alias of: Mobile - /// - [IconAlias] - MobilePhone = Mobile, - ///Circle Outlined (created: 3.0) - /// - [Description("Circle Outlined"),IconId("circle-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - CircleOutline = 0xf10c, - ///quote-left (created: 3.0) - /// - [Description("quote-left"),IconId("quote-left"),IconCategory("Web Application Icons")] - QuoteLeft = 0xf10d, - ///quote-right (created: 3.0) - /// - [Description("quote-right"),IconId("quote-right"),IconCategory("Web Application Icons")] - QuoteRight = 0xf10e, - ///Spinner (created: 3.0) - /// - [Description("Spinner"),IconId("spinner"),IconCategory("Web Application Icons"),IconCategory("Spinner Icons")] - Spinner = 0xf110, - ///Circle (created: 3.0) - /// - [Description("Circle"),IconId("circle"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - Circle = 0xf111, - ///Reply (created: 3.0) - /// - [Description("Reply"),IconId("reply"),IconCategory("Web Application Icons")] - Reply = 0xf112, - ///Alias of: Reply - /// - [IconAlias] - MailReply = Reply, - ///GitHub Alt (created: 3.0) - /// - [Description("GitHub Alt"),IconId("github-alt"),IconCategory("Brand Icons")] - GithubAlt = 0xf113, - ///Folder Outlined (created: 3.0) - /// - [Description("Folder Outlined"),IconId("folder-o"),IconCategory("Web Application Icons")] - FolderOutline = 0xf114, - ///Folder Open Outlined (created: 3.0) - /// - [Description("Folder Open Outlined"),IconId("folder-open-o"),IconCategory("Web Application Icons")] - FolderOutlinepenOutline = 0xf115, - ///Smile Outlined (created: 3.1) - /// - [Description("Smile Outlined"),IconId("smile-o"),IconCategory("Web Application Icons")] - SmileOutline = 0xf118, - ///Frown Outlined (created: 3.1) - /// - [Description("Frown Outlined"),IconId("frown-o"),IconCategory("Web Application Icons")] - FrownOutline = 0xf119, - ///Meh Outlined (created: 3.1) - /// - [Description("Meh Outlined"),IconId("meh-o"),IconCategory("Web Application Icons")] - MehOutline = 0xf11a, - ///Gamepad (created: 3.1) - /// - [Description("Gamepad"),IconId("gamepad"),IconCategory("Web Application Icons")] - Gamepad = 0xf11b, - ///Keyboard Outlined (created: 3.1) - /// - [Description("Keyboard Outlined"),IconId("keyboard-o"),IconCategory("Web Application Icons")] - KeyboardOutline = 0xf11c, - ///Flag Outlined (created: 3.1) - /// - [Description("Flag Outlined"),IconId("flag-o"),IconCategory("Web Application Icons")] - FlagOutline = 0xf11d, - ///flag-checkered (created: 3.1) - /// - [Description("flag-checkered"),IconId("flag-checkered"),IconCategory("Web Application Icons")] - FlagCheckered = 0xf11e, - ///Terminal (created: 3.1) - /// - [Description("Terminal"),IconId("terminal"),IconCategory("Web Application Icons")] - Terminal = 0xf120, - ///Code (created: 3.1) - /// - [Description("Code"),IconId("code"),IconCategory("Web Application Icons")] - Code = 0xf121, - ///reply-all (created: 3.1) - /// - [Description("reply-all"),IconId("reply-all"),IconCategory("Web Application Icons")] - ReplyAll = 0xf122, - ///Alias of: ReplyAll - /// - [IconAlias] - MailReplyAll = ReplyAll, - ///Star Half Outlined (created: 3.1) - /// - [Description("Star Half Outlined"),IconId("star-half-o"),IconCategory("Web Application Icons")] - StarHalfOutline = 0xf123, - ///Alias of: StarHalfOutline - /// - [IconAlias] - StarHalfEmpty = StarHalfOutline, - ///Alias of: StarHalfOutline - /// - [IconAlias] - StarHalfFull = StarHalfOutline, - ///location-arrow (created: 3.1) - /// - [Description("location-arrow"),IconId("location-arrow"),IconCategory("Web Application Icons")] - LocationArrow = 0xf124, - ///crop (created: 3.1) - /// - [Description("crop"),IconId("crop"),IconCategory("Web Application Icons")] - Crop = 0xf125, - ///code-fork (created: 3.1) - /// - [Description("code-fork"),IconId("code-fork"),IconCategory("Web Application Icons")] - CodeFork = 0xf126, - ///Chain Broken (created: 3.1) - /// - [Description("Chain Broken"),IconId("chain-broken"),IconCategory("Text Editor Icons")] - ChainBroken = 0xf127, - ///Alias of: ChainBroken - /// - [IconAlias] - Unlink = ChainBroken, - ///Question (created: 3.1) - /// - [Description("Question"),IconId("question"),IconCategory("Web Application Icons")] - Question = 0xf128, - ///Info (created: 3.1) - /// - [Description("Info"),IconId("info"),IconCategory("Web Application Icons")] - Info = 0xf129, - ///exclamation (created: 3.1) - /// - [Description("exclamation"),IconId("exclamation"),IconCategory("Web Application Icons")] - Exclamation = 0xf12a, - ///superscript (created: 3.1) - /// - [Description("superscript"),IconId("superscript"),IconCategory("Text Editor Icons")] - Superscript = 0xf12b, - ///subscript (created: 3.1) - /// - [Description("subscript"),IconId("subscript"),IconCategory("Text Editor Icons")] - Subscript = 0xf12c, - ///eraser (created: 3.1) - /// - [Description("eraser"),IconId("eraser"),IconCategory("Text Editor Icons"),IconCategory("Web Application Icons")] - Eraser = 0xf12d, - ///Puzzle Piece (created: 3.1) - /// - [Description("Puzzle Piece"),IconId("puzzle-piece"),IconCategory("Web Application Icons")] - PuzzlePiece = 0xf12e, - ///microphone (created: 3.1) - /// - [Description("microphone"),IconId("microphone"),IconCategory("Web Application Icons")] - Microphone = 0xf130, - ///Microphone Slash (created: 3.1) - /// - [Description("Microphone Slash"),IconId("microphone-slash"),IconCategory("Web Application Icons")] - MicrophoneSlash = 0xf131, - ///shield (created: 3.1) - /// - [Description("shield"),IconId("shield"),IconCategory("Web Application Icons")] - Shield = 0xf132, - ///calendar-o (created: 3.1) - /// - [Description("calendar-o"),IconId("calendar-o"),IconCategory("Web Application Icons")] - CalendarOutline = 0xf133, - ///fire-extinguisher (created: 3.1) - /// - [Description("fire-extinguisher"),IconId("fire-extinguisher"),IconCategory("Web Application Icons")] - FireExtinguisher = 0xf134, - ///rocket (created: 3.1) - /// - [Description("rocket"),IconId("rocket"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Rocket = 0xf135, - ///MaxCDN (created: 3.1) - /// - [Description("MaxCDN"),IconId("maxcdn"),IconCategory("Brand Icons")] - Maxcdn = 0xf136, - ///Chevron Circle Left (created: 3.1) - /// - [Description("Chevron Circle Left"),IconId("chevron-circle-left"),IconCategory("Directional Icons")] - ChevronCircleLeft = 0xf137, - ///Chevron Circle Right (created: 3.1) - /// - [Description("Chevron Circle Right"),IconId("chevron-circle-right"),IconCategory("Directional Icons")] - ChevronCircleRight = 0xf138, - ///Chevron Circle Up (created: 3.1) - /// - [Description("Chevron Circle Up"),IconId("chevron-circle-up"),IconCategory("Directional Icons")] - ChevronCircleUp = 0xf139, - ///Chevron Circle Down (created: 3.1) - /// - [Description("Chevron Circle Down"),IconId("chevron-circle-down"),IconCategory("Directional Icons")] - ChevronCircleDown = 0xf13a, - ///HTML 5 Logo (created: 3.1) - /// - [Description("HTML 5 Logo"),IconId("html5"),IconCategory("Brand Icons")] - Html5 = 0xf13b, - ///CSS 3 Logo (created: 3.1) - /// - [Description("CSS 3 Logo"),IconId("css3"),IconCategory("Brand Icons")] - Css3 = 0xf13c, - ///Anchor (created: 3.1) - /// - [Description("Anchor"),IconId("anchor"),IconCategory("Web Application Icons")] - Anchor = 0xf13d, - ///Unlock Alt (created: 3.1) - /// - [Description("Unlock Alt"),IconId("unlock-alt"),IconCategory("Web Application Icons")] - UnlockAlt = 0xf13e, - ///Bullseye (created: 3.1) - /// - [Description("Bullseye"),IconId("bullseye"),IconCategory("Web Application Icons")] - Bullseye = 0xf140, - ///Ellipsis Horizontal (created: 3.1) - /// - [Description("Ellipsis Horizontal"),IconId("ellipsis-h"),IconCategory("Web Application Icons")] - EllipsisH = 0xf141, - ///Ellipsis Vertical (created: 3.1) - /// - [Description("Ellipsis Vertical"),IconId("ellipsis-v"),IconCategory("Web Application Icons")] - EllipsisV = 0xf142, - ///RSS Square (created: 3.1) - /// - [Description("RSS Square"),IconId("rss-square"),IconCategory("Web Application Icons")] - RssSquare = 0xf143, - ///Play Circle (created: 3.1) - /// - [Description("Play Circle"),IconId("play-circle"),IconCategory("Video Player Icons")] - PlayCircle = 0xf144, - ///Ticket (created: 3.1) - /// - [Description("Ticket"),IconId("ticket"),IconCategory("Web Application Icons")] - Ticket = 0xf145, - ///Minus Square (created: 3.1) - /// - [Description("Minus Square"),IconId("minus-square"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - MinusSquare = 0xf146, - ///Minus Square Outlined (created: 3.1) - /// - [Description("Minus Square Outlined"),IconId("minus-square-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - MinusSquareOutline = 0xf147, - ///Level Up (created: 3.1) - /// - [Description("Level Up"),IconId("level-up"),IconCategory("Web Application Icons")] - LevelUp = 0xf148, - ///Level Down (created: 3.1) - /// - [Description("Level Down"),IconId("level-down"),IconCategory("Web Application Icons")] - LevelDown = 0xf149, - ///Check Square (created: 3.1) - /// - [Description("Check Square"),IconId("check-square"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - CheckSquare = 0xf14a, - ///Pencil Square (created: 3.1) - /// - [Description("Pencil Square"),IconId("pencil-square"),IconCategory("Web Application Icons")] - PencilSquare = 0xf14b, - ///External Link Square (created: 3.1) - /// - [Description("External Link Square"),IconId("external-link-square"),IconCategory("Web Application Icons")] - ExternalLinkSquare = 0xf14c, - ///Share Square (created: 3.1) - /// - [Description("Share Square"),IconId("share-square"),IconCategory("Web Application Icons")] - ShareSquare = 0xf14d, - ///Compass (created: 3.2) - /// - [Description("Compass"),IconId("compass"),IconCategory("Web Application Icons")] - Compass = 0xf14e, - ///Caret Square Outlined Down (created: 3.2) - /// - [Description("Caret Square Outlined Down"),IconId("caret-square-o-down"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - CaretSquareOutlineDown = 0xf150, - ///Alias of: CaretSquareOutlineDown - /// - [IconAlias] - ToggleDown = CaretSquareOutlineDown, - ///Caret Square Outlined Up (created: 3.2) - /// - [Description("Caret Square Outlined Up"),IconId("caret-square-o-up"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - CaretSquareOutlineUp = 0xf151, - ///Alias of: CaretSquareOutlineUp - /// - [IconAlias] - ToggleUp = CaretSquareOutlineUp, - ///Caret Square Outlined Right (created: 3.2) - /// - [Description("Caret Square Outlined Right"),IconId("caret-square-o-right"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - CaretSquareOutlineRight = 0xf152, - ///Alias of: CaretSquareOutlineRight - /// - [IconAlias] - ToggleRight = CaretSquareOutlineRight, - ///Euro (EUR) (created: 3.2) - /// - [Description("Euro (EUR)"),IconId("eur"),IconCategory("Currency Icons")] - Eur = 0xf153, - ///Alias of: Eur - /// - [IconAlias] - Euro = Eur, - ///GBP (created: 3.2) - /// - [Description("GBP"),IconId("gbp"),IconCategory("Currency Icons")] - Gbp = 0xf154, - ///US Dollar (created: 3.2) - /// - [Description("US Dollar"),IconId("usd"),IconCategory("Currency Icons")] - Usd = 0xf155, - ///Alias of: Usd - /// - [IconAlias] - Dollar = Usd, - ///Indian Rupee (INR) (created: 3.2) - /// - [Description("Indian Rupee (INR)"),IconId("inr"),IconCategory("Currency Icons")] - Inr = 0xf156, - ///Alias of: Inr - /// - [IconAlias] - Rupee = Inr, - ///Japanese Yen (JPY) (created: 3.2) - /// - [Description("Japanese Yen (JPY)"),IconId("jpy"),IconCategory("Currency Icons")] - Jpy = 0xf157, - ///Alias of: Jpy - /// - [IconAlias] - Cny = Jpy, - ///Alias of: Jpy - /// - [IconAlias] - Rmb = Jpy, - ///Alias of: Jpy - /// - [IconAlias] - Yen = Jpy, - ///Russian Ruble (RUB) (created: 4.0) - /// - [Description("Russian Ruble (RUB)"),IconId("rub"),IconCategory("Currency Icons")] - Rub = 0xf158, - ///Alias of: Rub - /// - [IconAlias] - Ruble = Rub, - ///Alias of: Rub - /// - [IconAlias] - Rouble = Rub, - ///Korean Won (KRW) (created: 3.2) - /// - [Description("Korean Won (KRW)"),IconId("krw"),IconCategory("Currency Icons")] - Krw = 0xf159, - ///Alias of: Krw - /// - [IconAlias] - Won = Krw, - ///Bitcoin (BTC) (created: 3.2) - /// - [Description("Bitcoin (BTC)"),IconId("btc"),IconCategory("Currency Icons"),IconCategory("Brand Icons")] - Btc = 0xf15a, - ///Alias of: Btc - /// - [IconAlias] - Bitcoin = Btc, - ///File (created: 3.2) - /// - [Description("File"),IconId("file"),IconCategory("Text Editor Icons"),IconCategory("File Type Icons")] - File = 0xf15b, - ///File Text (created: 3.2) - /// - [Description("File Text"),IconId("file-text"),IconCategory("Text Editor Icons"),IconCategory("File Type Icons")] - FileText = 0xf15c, - ///Sort Alpha Ascending (created: 3.2) - /// - [Description("Sort Alpha Ascending"),IconId("sort-alpha-asc"),IconCategory("Web Application Icons")] - SortAlphaAsc = 0xf15d, - ///Sort Alpha Descending (created: 3.2) - /// - [Description("Sort Alpha Descending"),IconId("sort-alpha-desc"),IconCategory("Web Application Icons")] - SortAlphaDesc = 0xf15e, - ///Sort Amount Ascending (created: 3.2) - /// - [Description("Sort Amount Ascending"),IconId("sort-amount-asc"),IconCategory("Web Application Icons")] - SortAmountAsc = 0xf160, - ///Sort Amount Descending (created: 3.2) - /// - [Description("Sort Amount Descending"),IconId("sort-amount-desc"),IconCategory("Web Application Icons")] - SortAmountDesc = 0xf161, - ///Sort Numeric Ascending (created: 3.2) - /// - [Description("Sort Numeric Ascending"),IconId("sort-numeric-asc"),IconCategory("Web Application Icons")] - SortNumericAsc = 0xf162, - ///Sort Numeric Descending (created: 3.2) - /// - [Description("Sort Numeric Descending"),IconId("sort-numeric-desc"),IconCategory("Web Application Icons")] - SortNumericDesc = 0xf163, - ///thumbs-up (created: 3.2) - /// - [Description("thumbs-up"),IconId("thumbs-up"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - ThumbsUp = 0xf164, - ///thumbs-down (created: 3.2) - /// - [Description("thumbs-down"),IconId("thumbs-down"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - ThumbsDown = 0xf165, - ///YouTube Square (created: 3.2) - /// - [Description("YouTube Square"),IconId("youtube-square"),IconCategory("Brand Icons")] - YoutubeSquare = 0xf166, - ///YouTube (created: 3.2) - /// - [Description("YouTube"),IconId("youtube"),IconCategory("Brand Icons")] - Youtube = 0xf167, - ///Xing (created: 3.2) - /// - [Description("Xing"),IconId("xing"),IconCategory("Brand Icons")] - Xing = 0xf168, - ///Xing Square (created: 3.2) - /// - [Description("Xing Square"),IconId("xing-square"),IconCategory("Brand Icons")] - XingSquare = 0xf169, - ///YouTube Play (created: 3.2) - /// - [Description("YouTube Play"),IconId("youtube-play"),IconCategory("Brand Icons"),IconCategory("Video Player Icons")] - YoutubePlay = 0xf16a, - ///Dropbox (created: 3.2) - /// - [Description("Dropbox"),IconId("dropbox"),IconCategory("Brand Icons")] - Dropbox = 0xf16b, - ///Stack Overflow (created: 3.2) - /// - [Description("Stack Overflow"),IconId("stack-overflow"),IconCategory("Brand Icons")] - StackOverflow = 0xf16c, - ///Instagram (created: 4.6) - /// - [Description("Instagram"),IconId("instagram"),IconCategory("Brand Icons")] - Instagram = 0xf16d, - ///Flickr (created: 3.2) - /// - [Description("Flickr"),IconId("flickr"),IconCategory("Brand Icons")] - Flickr = 0xf16e, - ///App.net (created: 3.2) - /// - [Description("App.net"),IconId("adn"),IconCategory("Brand Icons")] - Adn = 0xf170, - ///Bitbucket (created: 3.2) - /// - [Description("Bitbucket"),IconId("bitbucket"),IconCategory("Brand Icons")] - Bitbucket = 0xf171, - ///Bitbucket Square (created: 3.2) - /// - [Description("Bitbucket Square"),IconId("bitbucket-square"),IconCategory("Brand Icons")] - BitbucketSquare = 0xf172, - ///Tumblr (created: 3.2) - /// - [Description("Tumblr"),IconId("tumblr"),IconCategory("Brand Icons")] - Tumblr = 0xf173, - ///Tumblr Square (created: 3.2) - /// - [Description("Tumblr Square"),IconId("tumblr-square"),IconCategory("Brand Icons")] - TumblrSquare = 0xf174, - ///Long Arrow Down (created: 3.2) - /// - [Description("Long Arrow Down"),IconId("long-arrow-down"),IconCategory("Directional Icons")] - LongArrowDown = 0xf175, - ///Long Arrow Up (created: 3.2) - /// - [Description("Long Arrow Up"),IconId("long-arrow-up"),IconCategory("Directional Icons")] - LongArrowUp = 0xf176, - ///Long Arrow Left (created: 3.2) - /// - [Description("Long Arrow Left"),IconId("long-arrow-left"),IconCategory("Directional Icons")] - LongArrowLeft = 0xf177, - ///Long Arrow Right (created: 3.2) - /// - [Description("Long Arrow Right"),IconId("long-arrow-right"),IconCategory("Directional Icons")] - LongArrowRight = 0xf178, - ///Apple (created: 3.2) - /// - [Description("Apple"),IconId("apple"),IconCategory("Brand Icons")] - Apple = 0xf179, - ///Windows (created: 3.2) - /// - [Description("Windows"),IconId("windows"),IconCategory("Brand Icons")] - Windows = 0xf17a, - ///Android (created: 3.2) - /// - [Description("Android"),IconId("android"),IconCategory("Brand Icons")] - Android = 0xf17b, - ///Linux (created: 3.2) - /// - [Description("Linux"),IconId("linux"),IconCategory("Brand Icons")] - Linux = 0xf17c, - ///Dribbble (created: 3.2) - /// - [Description("Dribbble"),IconId("dribbble"),IconCategory("Brand Icons")] - Dribbble = 0xf17d, - ///Skype (created: 3.2) - /// - [Description("Skype"),IconId("skype"),IconCategory("Brand Icons")] - Skype = 0xf17e, - ///Foursquare (created: 3.2) - /// - [Description("Foursquare"),IconId("foursquare"),IconCategory("Brand Icons")] - Foursquare = 0xf180, - ///Trello (created: 3.2) - /// - [Description("Trello"),IconId("trello"),IconCategory("Brand Icons")] - Trello = 0xf181, - ///Female (created: 3.2) - /// - [Description("Female"),IconId("female"),IconCategory("Web Application Icons")] - Female = 0xf182, - ///Male (created: 3.2) - /// - [Description("Male"),IconId("male"),IconCategory("Web Application Icons")] - Male = 0xf183, - ///Gratipay (Gittip) (created: 3.2) - /// - [Description("Gratipay (Gittip)"),IconId("gratipay"),IconCategory("Brand Icons")] - Gratipay = 0xf184, - ///Alias of: Gratipay - /// - [IconAlias] - Gittip = Gratipay, - ///Sun Outlined (created: 3.2) - /// - [Description("Sun Outlined"),IconId("sun-o"),IconCategory("Web Application Icons")] - SunOutline = 0xf185, - ///Moon Outlined (created: 3.2) - /// - [Description("Moon Outlined"),IconId("moon-o"),IconCategory("Web Application Icons")] - MoonOutline = 0xf186, - ///Archive (created: 3.2) - /// - [Description("Archive"),IconId("archive"),IconCategory("Web Application Icons")] - Archive = 0xf187, - ///Bug (created: 3.2) - /// - [Description("Bug"),IconId("bug"),IconCategory("Web Application Icons")] - Bug = 0xf188, - ///VK (created: 3.2) - /// - [Description("VK"),IconId("vk"),IconCategory("Brand Icons")] - Vk = 0xf189, - ///Weibo (created: 3.2) - /// - [Description("Weibo"),IconId("weibo"),IconCategory("Brand Icons")] - Weibo = 0xf18a, - ///Renren (created: 3.2) - /// - [Description("Renren"),IconId("renren"),IconCategory("Brand Icons")] - Renren = 0xf18b, - ///Pagelines (created: 4.0) - /// - [Description("Pagelines"),IconId("pagelines"),IconCategory("Brand Icons")] - Pagelines = 0xf18c, - ///Stack Exchange (created: 4.0) - /// - [Description("Stack Exchange"),IconId("stack-exchange"),IconCategory("Brand Icons")] - StackExchange = 0xf18d, - ///Arrow Circle Outlined Right (created: 4.0) - /// - [Description("Arrow Circle Outlined Right"),IconId("arrow-circle-o-right"),IconCategory("Directional Icons")] - ArrowCircleOutlineRight = 0xf18e, - ///Arrow Circle Outlined Left (created: 4.0) - /// - [Description("Arrow Circle Outlined Left"),IconId("arrow-circle-o-left"),IconCategory("Directional Icons")] - ArrowCircleOutlineLeft = 0xf190, - ///Caret Square Outlined Left (created: 4.0) - /// - [Description("Caret Square Outlined Left"),IconId("caret-square-o-left"),IconCategory("Web Application Icons"),IconCategory("Directional Icons")] - CaretSquareOutlineLeft = 0xf191, - ///Alias of: CaretSquareOutlineLeft - /// - [IconAlias] - ToggleLeft = CaretSquareOutlineLeft, - ///Dot Circle Outlined (created: 4.0) - /// - [Description("Dot Circle Outlined"),IconId("dot-circle-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - DotCircleOutline = 0xf192, - ///Wheelchair (created: 4.0) - /// - [Description("Wheelchair"),IconId("wheelchair"),IconCategory("Web Application Icons"),IconCategory("Medical Icons"),IconCategory("Transportation Icons"),IconCategory("Accessibility Icons")] - Wheelchair = 0xf193, - ///Vimeo Square (created: 4.0) - /// - [Description("Vimeo Square"),IconId("vimeo-square"),IconCategory("Brand Icons")] - VimeoSquare = 0xf194, - ///Turkish Lira (TRY) (created: 4.0) - /// - [Description("Turkish Lira (TRY)"),IconId("try"),IconCategory("Currency Icons")] - Try = 0xf195, - ///Alias of: Try - /// - [IconAlias] - TurkishLira = Try, - ///Plus Square Outlined (created: 4.0) - /// - [Description("Plus Square Outlined"),IconId("plus-square-o"),IconCategory("Web Application Icons"),IconCategory("Form Control Icons")] - PlusSquareOutline = 0xf196, - ///Space Shuttle (created: 4.1) - /// - [Description("Space Shuttle"),IconId("space-shuttle"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - SpaceShuttle = 0xf197, - ///Slack Logo (created: 4.1) - /// - [Description("Slack Logo"),IconId("slack"),IconCategory("Brand Icons")] - Slack = 0xf198, - ///Envelope Square (created: 4.1) - /// - [Description("Envelope Square"),IconId("envelope-square"),IconCategory("Web Application Icons")] - EnvelopeSquare = 0xf199, - ///WordPress Logo (created: 4.1) - /// - [Description("WordPress Logo"),IconId("wordpress"),IconCategory("Brand Icons")] - Wordpress = 0xf19a, - ///OpenID (created: 4.1) - /// - [Description("OpenID"),IconId("openid"),IconCategory("Brand Icons")] - Openid = 0xf19b, - ///University (created: 4.1) - /// - [Description("University"),IconId("university"),IconCategory("Web Application Icons")] - University = 0xf19c, - ///Alias of: University - /// - [IconAlias] - Institution = University, - ///Alias of: University - /// - [IconAlias] - Bank = University, - ///Graduation Cap (created: 4.1) - /// - [Description("Graduation Cap"),IconId("graduation-cap"),IconCategory("Web Application Icons")] - GraduationCap = 0xf19d, - ///Alias of: GraduationCap - /// - [IconAlias] - MortarBoard = GraduationCap, - ///Yahoo Logo (created: 4.1) - /// - [Description("Yahoo Logo"),IconId("yahoo"),IconCategory("Brand Icons")] - Yahoo = 0xf19e, - ///Google Logo (created: 4.1) - /// - [Description("Google Logo"),IconId("google"),IconCategory("Brand Icons")] - Google = 0xf1a0, - ///reddit Logo (created: 4.1) - /// - [Description("reddit Logo"),IconId("reddit"),IconCategory("Brand Icons")] - Reddit = 0xf1a1, - ///reddit Square (created: 4.1) - /// - [Description("reddit Square"),IconId("reddit-square"),IconCategory("Brand Icons")] - RedditSquare = 0xf1a2, - ///StumbleUpon Circle (created: 4.1) - /// - [Description("StumbleUpon Circle"),IconId("stumbleupon-circle"),IconCategory("Brand Icons")] - StumbleuponCircle = 0xf1a3, - ///StumbleUpon Logo (created: 4.1) - /// - [Description("StumbleUpon Logo"),IconId("stumbleupon"),IconCategory("Brand Icons")] - Stumbleupon = 0xf1a4, - ///Delicious Logo (created: 4.1) - /// - [Description("Delicious Logo"),IconId("delicious"),IconCategory("Brand Icons")] - Delicious = 0xf1a5, - ///Digg Logo (created: 4.1) - /// - [Description("Digg Logo"),IconId("digg"),IconCategory("Brand Icons")] - Digg = 0xf1a6, - ///Pied Piper PP Logo (Old) (created: 4.1) - /// - [Description("Pied Piper PP Logo (Old)"),IconId("pied-piper-pp"),IconCategory("Brand Icons")] - PiedPiperPp = 0xf1a7, - ///Pied Piper Alternate Logo (created: 4.1) - /// - [Description("Pied Piper Alternate Logo"),IconId("pied-piper-alt"),IconCategory("Brand Icons")] - PiedPiperAlt = 0xf1a8, - ///Drupal Logo (created: 4.1) - /// - [Description("Drupal Logo"),IconId("drupal"),IconCategory("Brand Icons")] - Drupal = 0xf1a9, - ///Joomla Logo (created: 4.1) - /// - [Description("Joomla Logo"),IconId("joomla"),IconCategory("Brand Icons")] - Joomla = 0xf1aa, - ///Language (created: 4.1) - /// - [Description("Language"),IconId("language"),IconCategory("Web Application Icons")] - Language = 0xf1ab, - ///Fax (created: 4.1) - /// - [Description("Fax"),IconId("fax"),IconCategory("Web Application Icons")] - Fax = 0xf1ac, - ///Building (created: 4.1) - /// - [Description("Building"),IconId("building"),IconCategory("Web Application Icons")] - Building = 0xf1ad, - ///Child (created: 4.1) - /// - [Description("Child"),IconId("child"),IconCategory("Web Application Icons")] - Child = 0xf1ae, - ///Paw (created: 4.1) - /// - [Description("Paw"),IconId("paw"),IconCategory("Web Application Icons")] - Paw = 0xf1b0, - ///spoon (created: 4.1) - /// - [Description("spoon"),IconId("spoon"),IconCategory("Web Application Icons")] - Spoon = 0xf1b1, - ///Cube (created: 4.1) - /// - [Description("Cube"),IconId("cube"),IconCategory("Web Application Icons")] - Cube = 0xf1b2, - ///Cubes (created: 4.1) - /// - [Description("Cubes"),IconId("cubes"),IconCategory("Web Application Icons")] - Cubes = 0xf1b3, - ///Behance (created: 4.1) - /// - [Description("Behance"),IconId("behance"),IconCategory("Brand Icons")] - Behance = 0xf1b4, - ///Behance Square (created: 4.1) - /// - [Description("Behance Square"),IconId("behance-square"),IconCategory("Brand Icons")] - BehanceSquare = 0xf1b5, - ///Steam (created: 4.1) - /// - [Description("Steam"),IconId("steam"),IconCategory("Brand Icons")] - Steam = 0xf1b6, - ///Steam Square (created: 4.1) - /// - [Description("Steam Square"),IconId("steam-square"),IconCategory("Brand Icons")] - SteamSquare = 0xf1b7, - ///Recycle (created: 4.1) - /// - [Description("Recycle"),IconId("recycle"),IconCategory("Web Application Icons")] - Recycle = 0xf1b8, - ///Car (created: 4.1) - /// - [Description("Car"),IconId("car"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Car = 0xf1b9, - ///Alias of: Car - /// - [IconAlias] - Automobile = Car, - ///Taxi (created: 4.1) - /// - [Description("Taxi"),IconId("taxi"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Taxi = 0xf1ba, - ///Alias of: Taxi - /// - [IconAlias] - Cab = Taxi, - ///Tree (created: 4.1) - /// - [Description("Tree"),IconId("tree"),IconCategory("Web Application Icons")] - Tree = 0xf1bb, - ///Spotify (created: 4.1) - /// - [Description("Spotify"),IconId("spotify"),IconCategory("Brand Icons")] - Spotify = 0xf1bc, - ///deviantART (created: 4.1) - /// - [Description("deviantART"),IconId("deviantart"),IconCategory("Brand Icons")] - Deviantart = 0xf1bd, - ///SoundCloud (created: 4.1) - /// - [Description("SoundCloud"),IconId("soundcloud"),IconCategory("Brand Icons")] - Soundcloud = 0xf1be, - ///Database (created: 4.1) - /// - [Description("Database"),IconId("database"),IconCategory("Web Application Icons")] - Database = 0xf1c0, - ///PDF File Outlined (created: 4.1) - /// - [Description("PDF File Outlined"),IconId("file-pdf-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FilePdfOutline = 0xf1c1, - ///Word File Outlined (created: 4.1) - /// - [Description("Word File Outlined"),IconId("file-word-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileWordOutline = 0xf1c2, - ///Excel File Outlined (created: 4.1) - /// - [Description("Excel File Outlined"),IconId("file-excel-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileExcelOutline = 0xf1c3, - ///Powerpoint File Outlined (created: 4.1) - /// - [Description("Powerpoint File Outlined"),IconId("file-powerpoint-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FilePowerpointOutline = 0xf1c4, - ///Image File Outlined (created: 4.1) - /// - [Description("Image File Outlined"),IconId("file-image-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileImageOutline = 0xf1c5, - ///Alias of: FileImageOutline - /// - [IconAlias] - FilePhotoOutline = FileImageOutline, - ///Alias of: FileImageOutline - /// - [IconAlias] - FilePictureOutline = FileImageOutline, - ///Archive File Outlined (created: 4.1) - /// - [Description("Archive File Outlined"),IconId("file-archive-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileArchiveOutline = 0xf1c6, - ///Alias of: FileArchiveOutline - /// - [IconAlias] - FileZipOutline = FileArchiveOutline, - ///Audio File Outlined (created: 4.1) - /// - [Description("Audio File Outlined"),IconId("file-audio-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileAudioOutline = 0xf1c7, - ///Alias of: FileAudioOutline - /// - [IconAlias] - FileSoundOutline = FileAudioOutline, - ///Video File Outlined (created: 4.1) - /// - [Description("Video File Outlined"),IconId("file-video-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileVideoOutline = 0xf1c8, - ///Alias of: FileVideoOutline - /// - [IconAlias] - FileMovieOutline = FileVideoOutline, - ///Code File Outlined (created: 4.1) - /// - [Description("Code File Outlined"),IconId("file-code-o"),IconCategory("Web Application Icons"),IconCategory("File Type Icons")] - FileCodeOutline = 0xf1c9, - ///Vine (created: 4.1) - /// - [Description("Vine"),IconId("vine"),IconCategory("Brand Icons")] - Vine = 0xf1ca, - ///Codepen (created: 4.1) - /// - [Description("Codepen"),IconId("codepen"),IconCategory("Brand Icons")] - Codepen = 0xf1cb, - ///jsFiddle (created: 4.1) - /// - [Description("jsFiddle"),IconId("jsfiddle"),IconCategory("Brand Icons")] - Jsfiddle = 0xf1cc, - ///Life Ring (created: 4.1) - /// - [Description("Life Ring"),IconId("life-ring"),IconCategory("Web Application Icons")] - LifeRing = 0xf1cd, - ///Alias of: LifeRing - /// - [IconAlias] - LifeBouy = LifeRing, - ///Alias of: LifeRing - /// - [IconAlias] - LifeBuoy = LifeRing, - ///Alias of: LifeRing - /// - [IconAlias] - LifeSaver = LifeRing, - ///Alias of: LifeRing - /// - [IconAlias] - Support = LifeRing, - ///Circle Outlined Notched (created: 4.1) - /// - [Description("Circle Outlined Notched"),IconId("circle-o-notch"),IconCategory("Web Application Icons"),IconCategory("Spinner Icons")] - CircleOutlineNotch = 0xf1ce, - ///Rebel Alliance (created: 4.1) - /// - [Description("Rebel Alliance"),IconId("rebel"),IconCategory("Brand Icons")] - Rebel = 0xf1d0, - ///Alias of: Rebel - /// - [IconAlias] - Ra = Rebel, - ///Alias of: Rebel - /// - [IconAlias] - Resistance = Rebel, - ///Galactic Empire (created: 4.1) - /// - [Description("Galactic Empire"),IconId("empire"),IconCategory("Brand Icons")] - Empire = 0xf1d1, - ///Alias of: Empire - /// - [IconAlias] - Ge = Empire, - ///Git Square (created: 4.1) - /// - [Description("Git Square"),IconId("git-square"),IconCategory("Brand Icons")] - GitSquare = 0xf1d2, - ///Git (created: 4.1) - /// - [Description("Git"),IconId("git"),IconCategory("Brand Icons")] - Git = 0xf1d3, - ///Hacker News (created: 4.1) - /// - [Description("Hacker News"),IconId("hacker-news"),IconCategory("Brand Icons")] - HackerNews = 0xf1d4, - ///Alias of: HackerNews - /// - [IconAlias] - YCombinatorSquare = HackerNews, - ///Alias of: HackerNews - /// - [IconAlias] - YcSquare = HackerNews, - ///Tencent Weibo (created: 4.1) - /// - [Description("Tencent Weibo"),IconId("tencent-weibo"),IconCategory("Brand Icons")] - TencentWeibo = 0xf1d5, - ///QQ (created: 4.1) - /// - [Description("QQ"),IconId("qq"),IconCategory("Brand Icons")] - Qq = 0xf1d6, - ///Weixin (WeChat) (created: 4.1) - /// - [Description("Weixin (WeChat)"),IconId("weixin"),IconCategory("Brand Icons")] - Weixin = 0xf1d7, - ///Alias of: Weixin - /// - [IconAlias] - Wechat = Weixin, - ///Paper Plane (created: 4.1) - /// - [Description("Paper Plane"),IconId("paper-plane"),IconCategory("Web Application Icons")] - PaperPlane = 0xf1d8, - ///Alias of: PaperPlane - /// - [IconAlias] - Send = PaperPlane, - ///Paper Plane Outlined (created: 4.1) - /// - [Description("Paper Plane Outlined"),IconId("paper-plane-o"),IconCategory("Web Application Icons")] - PaperPlaneOutline = 0xf1d9, - ///Alias of: PaperPlaneOutline - /// - [IconAlias] - SendOutline = PaperPlaneOutline, - ///History (created: 4.1) - /// - [Description("History"),IconId("history"),IconCategory("Web Application Icons")] - History = 0xf1da, - ///Circle Outlined Thin (created: 4.1) - /// - [Description("Circle Outlined Thin"),IconId("circle-thin"),IconCategory("Web Application Icons")] - CircleThin = 0xf1db, - ///header (created: 4.1) - /// - [Description("header"),IconId("header"),IconCategory("Text Editor Icons")] - Header = 0xf1dc, - ///paragraph (created: 4.1) - /// - [Description("paragraph"),IconId("paragraph"),IconCategory("Text Editor Icons")] - Paragraph = 0xf1dd, - ///Sliders (created: 4.1) - /// - [Description("Sliders"),IconId("sliders"),IconCategory("Web Application Icons")] - Sliders = 0xf1de, - ///Share Alt (created: 4.1) - /// - [Description("Share Alt"),IconId("share-alt"),IconCategory("Web Application Icons"),IconCategory("Brand Icons")] - ShareAlt = 0xf1e0, - ///Share Alt Square (created: 4.1) - /// - [Description("Share Alt Square"),IconId("share-alt-square"),IconCategory("Web Application Icons"),IconCategory("Brand Icons")] - ShareAltSquare = 0xf1e1, - ///Bomb (created: 4.1) - /// - [Description("Bomb"),IconId("bomb"),IconCategory("Web Application Icons")] - Bomb = 0xf1e2, - ///Futbol Outlined (created: 4.2) - /// - [Description("Futbol Outlined"),IconId("futbol-o"),IconCategory("Web Application Icons")] - FutbolOutline = 0xf1e3, - ///Alias of: FutbolOutline - /// - [IconAlias] - SoccerBallOutline = FutbolOutline, - ///TTY (created: 4.2) - /// - [Description("TTY"),IconId("tty"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - Tty = 0xf1e4, - ///Binoculars (created: 4.2) - /// - [Description("Binoculars"),IconId("binoculars"),IconCategory("Web Application Icons")] - Binoculars = 0xf1e5, - ///Plug (created: 4.2) - /// - [Description("Plug"),IconId("plug"),IconCategory("Web Application Icons")] - Plug = 0xf1e6, - ///Slideshare (created: 4.2) - /// - [Description("Slideshare"),IconId("slideshare"),IconCategory("Brand Icons")] - Slideshare = 0xf1e7, - ///Twitch (created: 4.2) - /// - [Description("Twitch"),IconId("twitch"),IconCategory("Brand Icons")] - Twitch = 0xf1e8, - ///Yelp (created: 4.2) - /// - [Description("Yelp"),IconId("yelp"),IconCategory("Brand Icons")] - Yelp = 0xf1e9, - ///Newspaper Outlined (created: 4.2) - /// - [Description("Newspaper Outlined"),IconId("newspaper-o"),IconCategory("Web Application Icons")] - NewspaperOutline = 0xf1ea, - ///WiFi (created: 4.2) - /// - [Description("WiFi"),IconId("wifi"),IconCategory("Web Application Icons")] - Wifi = 0xf1eb, - ///Calculator (created: 4.2) - /// - [Description("Calculator"),IconId("calculator"),IconCategory("Web Application Icons")] - Calculator = 0xf1ec, - ///Paypal (created: 4.2) - /// - [Description("Paypal"),IconId("paypal"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - Paypal = 0xf1ed, - ///Google Wallet (created: 4.2) - /// - [Description("Google Wallet"),IconId("google-wallet"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - GoogleWallet = 0xf1ee, - ///Visa Credit Card (created: 4.2) - /// - [Description("Visa Credit Card"),IconId("cc-visa"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcVisa = 0xf1f0, - ///MasterCard Credit Card (created: 4.2) - /// - [Description("MasterCard Credit Card"),IconId("cc-mastercard"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcMastercard = 0xf1f1, - ///Discover Credit Card (created: 4.2) - /// - [Description("Discover Credit Card"),IconId("cc-discover"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcDiscover = 0xf1f2, - ///American Express Credit Card (created: 4.2) - /// - [Description("American Express Credit Card"),IconId("cc-amex"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcAmex = 0xf1f3, - ///Paypal Credit Card (created: 4.2) - /// - [Description("Paypal Credit Card"),IconId("cc-paypal"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcPaypal = 0xf1f4, - ///Stripe Credit Card (created: 4.2) - /// - [Description("Stripe Credit Card"),IconId("cc-stripe"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcStripe = 0xf1f5, - ///Bell Slash (created: 4.2) - /// - [Description("Bell Slash"),IconId("bell-slash"),IconCategory("Web Application Icons")] - BellSlash = 0xf1f6, - ///Bell Slash Outlined (created: 4.2) - /// - [Description("Bell Slash Outlined"),IconId("bell-slash-o"),IconCategory("Web Application Icons")] - BellSlashOutline = 0xf1f7, - ///Trash (created: 4.2) - /// - [Description("Trash"),IconId("trash"),IconCategory("Web Application Icons")] - Trash = 0xf1f8, - ///Copyright (created: 4.2) - /// - [Description("Copyright"),IconId("copyright"),IconCategory("Web Application Icons")] - Copyright = 0xf1f9, - ///At (created: 4.2) - /// - [Description("At"),IconId("at"),IconCategory("Web Application Icons")] - At = 0xf1fa, - ///Eyedropper (created: 4.2) - /// - [Description("Eyedropper"),IconId("eyedropper"),IconCategory("Web Application Icons")] - Eyedropper = 0xf1fb, - ///Paint Brush (created: 4.2) - /// - [Description("Paint Brush"),IconId("paint-brush"),IconCategory("Web Application Icons")] - PaintBrush = 0xf1fc, - ///Birthday Cake (created: 4.2) - /// - [Description("Birthday Cake"),IconId("birthday-cake"),IconCategory("Web Application Icons")] - BirthdayCake = 0xf1fd, - ///Area Chart (created: 4.2) - /// - [Description("Area Chart"),IconId("area-chart"),IconCategory("Web Application Icons"),IconCategory("Chart Icons")] - AreaChart = 0xf1fe, - ///Pie Chart (created: 4.2) - /// - [Description("Pie Chart"),IconId("pie-chart"),IconCategory("Web Application Icons"),IconCategory("Chart Icons")] - PieChart = 0xf200, - ///Line Chart (created: 4.2) - /// - [Description("Line Chart"),IconId("line-chart"),IconCategory("Web Application Icons"),IconCategory("Chart Icons")] - LineChart = 0xf201, - ///last.fm (created: 4.2) - /// - [Description("last.fm"),IconId("lastfm"),IconCategory("Brand Icons")] - Lastfm = 0xf202, - ///last.fm Square (created: 4.2) - /// - [Description("last.fm Square"),IconId("lastfm-square"),IconCategory("Brand Icons")] - LastfmSquare = 0xf203, - ///Toggle Off (created: 4.2) - /// - [Description("Toggle Off"),IconId("toggle-off"),IconCategory("Web Application Icons")] - ToggleOff = 0xf204, - ///Toggle On (created: 4.2) - /// - [Description("Toggle On"),IconId("toggle-on"),IconCategory("Web Application Icons")] - ToggleOn = 0xf205, - ///Bicycle (created: 4.2) - /// - [Description("Bicycle"),IconId("bicycle"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Bicycle = 0xf206, - ///Bus (created: 4.2) - /// - [Description("Bus"),IconId("bus"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Bus = 0xf207, - ///ioxhost (created: 4.2) - /// - [Description("ioxhost"),IconId("ioxhost"),IconCategory("Brand Icons")] - Ioxhost = 0xf208, - ///AngelList (created: 4.2) - /// - [Description("AngelList"),IconId("angellist"),IconCategory("Brand Icons")] - Angellist = 0xf209, - ///Closed Captions (created: 4.2) - /// - [Description("Closed Captions"),IconId("cc"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - Cc = 0xf20a, - ///Shekel (ILS) (created: 4.2) - /// - [Description("Shekel (ILS)"),IconId("ils"),IconCategory("Currency Icons")] - Ils = 0xf20b, - ///Alias of: Ils - /// - [IconAlias] - Shekel = Ils, - ///Alias of: Ils - /// - [IconAlias] - Sheqel = Ils, - ///meanpath (created: 4.2) - /// - [Description("meanpath"),IconId("meanpath"),IconCategory("Brand Icons")] - Meanpath = 0xf20c, - ///BuySellAds (created: 4.3) - /// - [Description("BuySellAds"),IconId("buysellads"),IconCategory("Brand Icons")] - Buysellads = 0xf20d, - ///Connect Develop (created: 4.3) - /// - [Description("Connect Develop"),IconId("connectdevelop"),IconCategory("Brand Icons")] - Connectdevelop = 0xf20e, - ///DashCube (created: 4.3) - /// - [Description("DashCube"),IconId("dashcube"),IconCategory("Brand Icons")] - Dashcube = 0xf210, - ///Forumbee (created: 4.3) - /// - [Description("Forumbee"),IconId("forumbee"),IconCategory("Brand Icons")] - Forumbee = 0xf211, - ///Leanpub (created: 4.3) - /// - [Description("Leanpub"),IconId("leanpub"),IconCategory("Brand Icons")] - Leanpub = 0xf212, - ///Sellsy (created: 4.3) - /// - [Description("Sellsy"),IconId("sellsy"),IconCategory("Brand Icons")] - Sellsy = 0xf213, - ///Shirts in Bulk (created: 4.3) - /// - [Description("Shirts in Bulk"),IconId("shirtsinbulk"),IconCategory("Brand Icons")] - Shirtsinbulk = 0xf214, - ///SimplyBuilt (created: 4.3) - /// - [Description("SimplyBuilt"),IconId("simplybuilt"),IconCategory("Brand Icons")] - Simplybuilt = 0xf215, - ///skyatlas (created: 4.3) - /// - [Description("skyatlas"),IconId("skyatlas"),IconCategory("Brand Icons")] - Skyatlas = 0xf216, - ///Add to Shopping Cart (created: 4.3) - /// - [Description("Add to Shopping Cart"),IconId("cart-plus"),IconCategory("Web Application Icons")] - CartPlus = 0xf217, - ///Shopping Cart Arrow Down (created: 4.3) - /// - [Description("Shopping Cart Arrow Down"),IconId("cart-arrow-down"),IconCategory("Web Application Icons")] - CartArrowDown = 0xf218, - ///Diamond (created: 4.3) - /// - [Description("Diamond"),IconId("diamond"),IconCategory("Web Application Icons")] - Diamond = 0xf219, - ///Ship (created: 4.3) - /// - [Description("Ship"),IconId("ship"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Ship = 0xf21a, - ///User Secret (created: 4.3) - /// - [Description("User Secret"),IconId("user-secret"),IconCategory("Web Application Icons")] - UserSecret = 0xf21b, - ///Motorcycle (created: 4.3) - /// - [Description("Motorcycle"),IconId("motorcycle"),IconCategory("Web Application Icons"),IconCategory("Transportation Icons")] - Motorcycle = 0xf21c, - ///Street View (created: 4.3) - /// - [Description("Street View"),IconId("street-view"),IconCategory("Web Application Icons")] - StreetView = 0xf21d, - ///Heartbeat (created: 4.3) - /// - [Description("Heartbeat"),IconId("heartbeat"),IconCategory("Web Application Icons"),IconCategory("Medical Icons")] - Heartbeat = 0xf21e, - ///Venus (created: 4.3) - /// - [Description("Venus"),IconId("venus"),IconCategory("Gender Icons")] - Venus = 0xf221, - ///Mars (created: 4.3) - /// - [Description("Mars"),IconId("mars"),IconCategory("Gender Icons")] - Mars = 0xf222, - ///Mercury (created: 4.3) - /// - [Description("Mercury"),IconId("mercury"),IconCategory("Gender Icons")] - Mercury = 0xf223, - ///Transgender (created: 4.3) - /// - [Description("Transgender"),IconId("transgender"),IconCategory("Gender Icons")] - Transgender = 0xf224, - ///Alias of: Transgender - /// - [IconAlias] - Intersex = Transgender, - ///Transgender Alt (created: 4.3) - /// - [Description("Transgender Alt"),IconId("transgender-alt"),IconCategory("Gender Icons")] - TransgenderAlt = 0xf225, - ///Venus Double (created: 4.3) - /// - [Description("Venus Double"),IconId("venus-double"),IconCategory("Gender Icons")] - VenusDouble = 0xf226, - ///Mars Double (created: 4.3) - /// - [Description("Mars Double"),IconId("mars-double"),IconCategory("Gender Icons")] - MarsDouble = 0xf227, - ///Venus Mars (created: 4.3) - /// - [Description("Venus Mars"),IconId("venus-mars"),IconCategory("Gender Icons")] - VenusMars = 0xf228, - ///Mars Stroke (created: 4.3) - /// - [Description("Mars Stroke"),IconId("mars-stroke"),IconCategory("Gender Icons")] - MarsStroke = 0xf229, - ///Mars Stroke Vertical (created: 4.3) - /// - [Description("Mars Stroke Vertical"),IconId("mars-stroke-v"),IconCategory("Gender Icons")] - MarsStrokeV = 0xf22a, - ///Mars Stroke Horizontal (created: 4.3) - /// - [Description("Mars Stroke Horizontal"),IconId("mars-stroke-h"),IconCategory("Gender Icons")] - MarsStrokeH = 0xf22b, - ///Neuter (created: 4.3) - /// - [Description("Neuter"),IconId("neuter"),IconCategory("Gender Icons")] - Neuter = 0xf22c, - ///Genderless (created: 4.4) - /// - [Description("Genderless"),IconId("genderless"),IconCategory("Gender Icons")] - Genderless = 0xf22d, - ///Facebook Official (created: 4.3) - /// - [Description("Facebook Official"),IconId("facebook-official"),IconCategory("Brand Icons")] - FacebookOfficial = 0xf230, - ///Pinterest P (created: 4.3) - /// - [Description("Pinterest P"),IconId("pinterest-p"),IconCategory("Brand Icons")] - PinterestP = 0xf231, - ///What's App (created: 4.3) - /// - [Description("What's App"),IconId("whatsapp"),IconCategory("Brand Icons")] - Whatsapp = 0xf232, - ///Server (created: 4.3) - /// - [Description("Server"),IconId("server"),IconCategory("Web Application Icons")] - Server = 0xf233, - ///Add User (created: 4.3) - /// - [Description("Add User"),IconId("user-plus"),IconCategory("Web Application Icons")] - UserPlus = 0xf234, - ///Remove User (created: 4.3) - /// - [Description("Remove User"),IconId("user-times"),IconCategory("Web Application Icons")] - UserTimes = 0xf235, - ///Bed (created: 4.3) - /// - [Description("Bed"),IconId("bed"),IconCategory("Web Application Icons")] - Bed = 0xf236, - ///Alias of: Bed - /// - [IconAlias] - Hotel = Bed, - ///Viacoin (created: 4.3) - /// - [Description("Viacoin"),IconId("viacoin"),IconCategory("Brand Icons")] - Viacoin = 0xf237, - ///Train (created: 4.3) - /// - [Description("Train"),IconId("train"),IconCategory("Transportation Icons")] - Train = 0xf238, - ///Subway (created: 4.3) - /// - [Description("Subway"),IconId("subway"),IconCategory("Transportation Icons")] - Subway = 0xf239, - ///Medium (created: 4.3) - /// - [Description("Medium"),IconId("medium"),IconCategory("Brand Icons")] - Medium = 0xf23a, - ///Y Combinator (created: 4.4) - /// - [Description("Y Combinator"),IconId("y-combinator"),IconCategory("Brand Icons")] - YCombinator = 0xf23b, - ///Alias of: YCombinator - /// - [IconAlias] - Yc = YCombinator, - ///Optin Monster (created: 4.4) - /// - [Description("Optin Monster"),IconId("optin-monster"),IconCategory("Brand Icons")] - OptinMonster = 0xf23c, - ///OpenCart (created: 4.4) - /// - [Description("OpenCart"),IconId("opencart"),IconCategory("Brand Icons")] - Opencart = 0xf23d, - ///ExpeditedSSL (created: 4.4) - /// - [Description("ExpeditedSSL"),IconId("expeditedssl"),IconCategory("Brand Icons")] - Expeditedssl = 0xf23e, - ///Battery Full (created: 4.4) - /// - [Description("Battery Full"),IconId("battery-full"),IconCategory("Web Application Icons")] - BatteryFull = 0xf240, - ///Alias of: BatteryFull - /// - [IconAlias] - Battery4 = BatteryFull, - ///Alias of: BatteryFull - /// - [IconAlias] - Battery = BatteryFull, - ///Battery 3/4 Full (created: 4.4) - /// - [Description("Battery 3/4 Full"),IconId("battery-three-quarters"),IconCategory("Web Application Icons")] - BatteryThreeQuarters = 0xf241, - ///Alias of: BatteryThreeQuarters - /// - [IconAlias] - Battery3 = BatteryThreeQuarters, - ///Battery 1/2 Full (created: 4.4) - /// - [Description("Battery 1/2 Full"),IconId("battery-half"),IconCategory("Web Application Icons")] - BatteryHalf = 0xf242, - ///Alias of: BatteryHalf - /// - [IconAlias] - Battery2 = BatteryHalf, - ///Battery 1/4 Full (created: 4.4) - /// - [Description("Battery 1/4 Full"),IconId("battery-quarter"),IconCategory("Web Application Icons")] - BatteryQuarter = 0xf243, - ///Alias of: BatteryQuarter - /// - [IconAlias] - Battery1 = BatteryQuarter, - ///Battery Empty (created: 4.4) - /// - [Description("Battery Empty"),IconId("battery-empty"),IconCategory("Web Application Icons")] - BatteryEmpty = 0xf244, - ///Alias of: BatteryEmpty - /// - [IconAlias] - Battery0 = BatteryEmpty, - ///Mouse Pointer (created: 4.4) - /// - [Description("Mouse Pointer"),IconId("mouse-pointer"),IconCategory("Web Application Icons")] - MousePointer = 0xf245, - ///I Beam Cursor (created: 4.4) - /// - [Description("I Beam Cursor"),IconId("i-cursor"),IconCategory("Web Application Icons")] - ICursor = 0xf246, - ///Object Group (created: 4.4) - /// - [Description("Object Group"),IconId("object-group"),IconCategory("Web Application Icons")] - ObjectGroup = 0xf247, - ///Object Ungroup (created: 4.4) - /// - [Description("Object Ungroup"),IconId("object-ungroup"),IconCategory("Web Application Icons")] - ObjectUngroup = 0xf248, - ///Sticky Note (created: 4.4) - /// - [Description("Sticky Note"),IconId("sticky-note"),IconCategory("Web Application Icons")] - StickyNote = 0xf249, - ///Sticky Note Outlined (created: 4.4) - /// - [Description("Sticky Note Outlined"),IconId("sticky-note-o"),IconCategory("Web Application Icons")] - StickyNoteOutline = 0xf24a, - ///JCB Credit Card (created: 4.4) - /// - [Description("JCB Credit Card"),IconId("cc-jcb"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcJcb = 0xf24b, - ///Diner's Club Credit Card (created: 4.4) - /// - [Description("Diner's Club Credit Card"),IconId("cc-diners-club"),IconCategory("Brand Icons"),IconCategory("Payment Icons")] - CcDinersClub = 0xf24c, - ///Clone (created: 4.4) - /// - [Description("Clone"),IconId("clone"),IconCategory("Web Application Icons")] - Clone = 0xf24d, - ///Balance Scale (created: 4.4) - /// - [Description("Balance Scale"),IconId("balance-scale"),IconCategory("Web Application Icons")] - BalanceScale = 0xf24e, - ///Hourglass Outlined (created: 4.4) - /// - [Description("Hourglass Outlined"),IconId("hourglass-o"),IconCategory("Web Application Icons")] - HourglassOutline = 0xf250, - ///Hourglass Start (created: 4.4) - /// - [Description("Hourglass Start"),IconId("hourglass-start"),IconCategory("Web Application Icons")] - HourglassStart = 0xf251, - ///Alias of: HourglassStart - /// - [IconAlias] - Hourglass1 = HourglassStart, - ///Hourglass Half (created: 4.4) - /// - [Description("Hourglass Half"),IconId("hourglass-half"),IconCategory("Web Application Icons")] - HourglassHalf = 0xf252, - ///Alias of: HourglassHalf - /// - [IconAlias] - Hourglass2 = HourglassHalf, - ///Hourglass End (created: 4.4) - /// - [Description("Hourglass End"),IconId("hourglass-end"),IconCategory("Web Application Icons")] - HourglassEnd = 0xf253, - ///Alias of: HourglassEnd - /// - [IconAlias] - Hourglass3 = HourglassEnd, - ///Hourglass (created: 4.4) - /// - [Description("Hourglass"),IconId("hourglass"),IconCategory("Web Application Icons")] - Hourglass = 0xf254, - ///Rock (Hand) (created: 4.4) - /// - [Description("Rock (Hand)"),IconId("hand-rock-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandRockOutline = 0xf255, - ///Alias of: HandRockOutline - /// - [IconAlias] - HandGrabOutline = HandRockOutline, - ///Paper (Hand) (created: 4.4) - /// - [Description("Paper (Hand)"),IconId("hand-paper-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandPaperOutline = 0xf256, - ///Alias of: HandPaperOutline - /// - [IconAlias] - HandStopOutline = HandPaperOutline, - ///Scissors (Hand) (created: 4.4) - /// - [Description("Scissors (Hand)"),IconId("hand-scissors-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandScissorsOutline = 0xf257, - ///Lizard (Hand) (created: 4.4) - /// - [Description("Lizard (Hand)"),IconId("hand-lizard-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandLizardOutline = 0xf258, - ///Spock (Hand) (created: 4.4) - /// - [Description("Spock (Hand)"),IconId("hand-spock-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandSpockOutline = 0xf259, - ///Hand Pointer (created: 4.4) - /// - [Description("Hand Pointer"),IconId("hand-pointer-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandPointerOutline = 0xf25a, - ///Hand Peace (created: 4.4) - /// - [Description("Hand Peace"),IconId("hand-peace-o"),IconCategory("Web Application Icons"),IconCategory("Hand Icons")] - HandPeaceOutline = 0xf25b, - ///Trademark (created: 4.4) - /// - [Description("Trademark"),IconId("trademark"),IconCategory("Web Application Icons")] - Trademark = 0xf25c, - ///Registered Trademark (created: 4.4) - /// - [Description("Registered Trademark"),IconId("registered"),IconCategory("Web Application Icons")] - Registered = 0xf25d, - ///Creative Commons (created: 4.4) - /// - [Description("Creative Commons"),IconId("creative-commons"),IconCategory("Web Application Icons")] - CreativeCommons = 0xf25e, - ///GG Currency (created: 4.4) - /// - [Description("GG Currency"),IconId("gg"),IconCategory("Currency Icons"),IconCategory("Brand Icons")] - Gg = 0xf260, - ///GG Currency Circle (created: 4.4) - /// - [Description("GG Currency Circle"),IconId("gg-circle"),IconCategory("Currency Icons"),IconCategory("Brand Icons")] - GgCircle = 0xf261, - ///TripAdvisor (created: 4.4) - /// - [Description("TripAdvisor"),IconId("tripadvisor"),IconCategory("Brand Icons")] - Tripadvisor = 0xf262, - ///Odnoklassniki (created: 4.4) - /// - [Description("Odnoklassniki"),IconId("odnoklassniki"),IconCategory("Brand Icons")] - Odnoklassniki = 0xf263, - ///Odnoklassniki Square (created: 4.4) - /// - [Description("Odnoklassniki Square"),IconId("odnoklassniki-square"),IconCategory("Brand Icons")] - OdnoklassnikiSquare = 0xf264, - ///Get Pocket (created: 4.4) - /// - [Description("Get Pocket"),IconId("get-pocket"),IconCategory("Brand Icons")] - GetPocket = 0xf265, - ///Wikipedia W (created: 4.4) - /// - [Description("Wikipedia W"),IconId("wikipedia-w"),IconCategory("Brand Icons")] - WikipediaW = 0xf266, - ///Safari (created: 4.4) - /// - [Description("Safari"),IconId("safari"),IconCategory("Brand Icons")] - Safari = 0xf267, - ///Chrome (created: 4.4) - /// - [Description("Chrome"),IconId("chrome"),IconCategory("Brand Icons")] - Chrome = 0xf268, - ///Firefox (created: 4.4) - /// - [Description("Firefox"),IconId("firefox"),IconCategory("Brand Icons")] - Firefox = 0xf269, - ///Opera (created: 4.4) - /// - [Description("Opera"),IconId("opera"),IconCategory("Brand Icons")] - Opera = 0xf26a, - ///Internet-explorer (created: 4.4) - /// - [Description("Internet-explorer"),IconId("internet-explorer"),IconCategory("Brand Icons")] - InternetExplorer = 0xf26b, - ///Television (created: 4.4) - /// - [Description("Television"),IconId("television"),IconCategory("Web Application Icons")] - Television = 0xf26c, - ///Alias of: Television - /// - [IconAlias] - Tv = Television, - ///Contao (created: 4.4) - /// - [Description("Contao"),IconId("contao"),IconCategory("Brand Icons")] - Contao = 0xf26d, - ///500px (created: 4.4) - /// - [Description("500px"),IconId("500px"),IconCategory("Brand Icons")] - _500Px = 0xf26e, - ///Amazon (created: 4.4) - /// - [Description("Amazon"),IconId("amazon"),IconCategory("Brand Icons")] - Amazon = 0xf270, - ///Calendar Plus Outlined (created: 4.4) - /// - [Description("Calendar Plus Outlined"),IconId("calendar-plus-o"),IconCategory("Web Application Icons")] - CalendarPlusOutline = 0xf271, - ///Calendar Minus Outlined (created: 4.4) - /// - [Description("Calendar Minus Outlined"),IconId("calendar-minus-o"),IconCategory("Web Application Icons")] - CalendarMinusOutline = 0xf272, - ///Calendar Times Outlined (created: 4.4) - /// - [Description("Calendar Times Outlined"),IconId("calendar-times-o"),IconCategory("Web Application Icons")] - CalendarTimesOutline = 0xf273, - ///Calendar Check Outlined (created: 4.4) - /// - [Description("Calendar Check Outlined"),IconId("calendar-check-o"),IconCategory("Web Application Icons")] - CalendarCheckOutline = 0xf274, - ///Industry (created: 4.4) - /// - [Description("Industry"),IconId("industry"),IconCategory("Web Application Icons")] - Industry = 0xf275, - ///Map Pin (created: 4.4) - /// - [Description("Map Pin"),IconId("map-pin"),IconCategory("Web Application Icons")] - MapPin = 0xf276, - ///Map Signs (created: 4.4) - /// - [Description("Map Signs"),IconId("map-signs"),IconCategory("Web Application Icons")] - MapSigns = 0xf277, - ///Map Outlined (created: 4.4) - /// - [Description("Map Outlined"),IconId("map-o"),IconCategory("Web Application Icons")] - MapOutline = 0xf278, - ///Map (created: 4.4) - /// - [Description("Map"),IconId("map"),IconCategory("Web Application Icons")] - Map = 0xf279, - ///Commenting (created: 4.4) - /// - [Description("Commenting"),IconId("commenting"),IconCategory("Web Application Icons")] - Commenting = 0xf27a, - ///Commenting Outlined (created: 4.4) - /// - [Description("Commenting Outlined"),IconId("commenting-o"),IconCategory("Web Application Icons")] - CommentingOutline = 0xf27b, - ///Houzz (created: 4.4) - /// - [Description("Houzz"),IconId("houzz"),IconCategory("Brand Icons")] - Houzz = 0xf27c, - ///Vimeo (created: 4.4) - /// - [Description("Vimeo"),IconId("vimeo"),IconCategory("Brand Icons")] - Vimeo = 0xf27d, - ///Font Awesome Black Tie (created: 4.4) - /// - [Description("Font Awesome Black Tie"),IconId("black-tie"),IconCategory("Brand Icons")] - BlackTie = 0xf27e, - ///Fonticons (created: 4.4) - /// - [Description("Fonticons"),IconId("fonticons"),IconCategory("Brand Icons")] - Fonticons = 0xf280, - ///reddit Alien (created: 4.5) - /// - [Description("reddit Alien"),IconId("reddit-alien"),IconCategory("Brand Icons")] - RedditAlien = 0xf281, - ///Edge Browser (created: 4.5) - /// - [Description("Edge Browser"),IconId("edge"),IconCategory("Brand Icons")] - Edge = 0xf282, - ///Credit Card (created: 4.5) - /// - [Description("Credit Card"),IconId("credit-card-alt"),IconCategory("Payment Icons"),IconCategory("Web Application Icons")] - CreditCardAlt = 0xf283, - ///Codie Pie (created: 4.5) - /// - [Description("Codie Pie"),IconId("codiepie"),IconCategory("Brand Icons")] - Codiepie = 0xf284, - ///MODX (created: 4.5) - /// - [Description("MODX"),IconId("modx"),IconCategory("Brand Icons")] - Modx = 0xf285, - ///Fort Awesome (created: 4.5) - /// - [Description("Fort Awesome"),IconId("fort-awesome"),IconCategory("Brand Icons")] - FortAwesome = 0xf286, - ///USB (created: 4.5) - /// - [Description("USB"),IconId("usb"),IconCategory("Brand Icons")] - Usb = 0xf287, - ///Product Hunt (created: 4.5) - /// - [Description("Product Hunt"),IconId("product-hunt"),IconCategory("Brand Icons")] - ProductHunt = 0xf288, - ///Mixcloud (created: 4.5) - /// - [Description("Mixcloud"),IconId("mixcloud"),IconCategory("Brand Icons")] - Mixcloud = 0xf289, - ///Scribd (created: 4.5) - /// - [Description("Scribd"),IconId("scribd"),IconCategory("Brand Icons")] - Scribd = 0xf28a, - ///Pause Circle (created: 4.5) - /// - [Description("Pause Circle"),IconId("pause-circle"),IconCategory("Video Player Icons")] - PauseCircle = 0xf28b, - ///Pause Circle Outlined (created: 4.5) - /// - [Description("Pause Circle Outlined"),IconId("pause-circle-o"),IconCategory("Video Player Icons")] - PauseCircleOutline = 0xf28c, - ///Stop Circle (created: 4.5) - /// - [Description("Stop Circle"),IconId("stop-circle"),IconCategory("Video Player Icons")] - StopCircle = 0xf28d, - ///Stop Circle Outlined (created: 4.5) - /// - [Description("Stop Circle Outlined"),IconId("stop-circle-o"),IconCategory("Video Player Icons")] - StopCircleOutline = 0xf28e, - ///Shopping Bag (created: 4.5) - /// - [Description("Shopping Bag"),IconId("shopping-bag"),IconCategory("Web Application Icons")] - ShoppingBag = 0xf290, - ///Shopping Basket (created: 4.5) - /// - [Description("Shopping Basket"),IconId("shopping-basket"),IconCategory("Web Application Icons")] - ShoppingBasket = 0xf291, - ///Hashtag (created: 4.5) - /// - [Description("Hashtag"),IconId("hashtag"),IconCategory("Web Application Icons")] - Hashtag = 0xf292, - ///Bluetooth (created: 4.5) - /// - [Description("Bluetooth"),IconId("bluetooth"),IconCategory("Web Application Icons"),IconCategory("Brand Icons")] - Bluetooth = 0xf293, - ///Bluetooth (created: 4.5) - /// - [Description("Bluetooth"),IconId("bluetooth-b"),IconCategory("Web Application Icons"),IconCategory("Brand Icons")] - BluetoothB = 0xf294, - ///Percent (created: 4.5) - /// - [Description("Percent"),IconId("percent"),IconCategory("Web Application Icons")] - Percent = 0xf295, - ///GitLab (created: 4.6) - /// - [Description("GitLab"),IconId("gitlab"),IconCategory("Brand Icons")] - Gitlab = 0xf296, - ///WPBeginner (created: 4.6) - /// - [Description("WPBeginner"),IconId("wpbeginner"),IconCategory("Brand Icons")] - Wpbeginner = 0xf297, - ///WPForms (created: 4.6) - /// - [Description("WPForms"),IconId("wpforms"),IconCategory("Brand Icons")] - Wpforms = 0xf298, - ///Envira Gallery (created: 4.6) - /// - [Description("Envira Gallery"),IconId("envira"),IconCategory("Brand Icons")] - Envira = 0xf299, - ///Universal Access (created: 4.6) - /// - [Description("Universal Access"),IconId("universal-access"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - UniversalAccess = 0xf29a, - ///Wheelchair Alt (created: 4.6) - /// - [Description("Wheelchair Alt"),IconId("wheelchair-alt"),IconCategory("Web Application Icons"),IconCategory("Medical Icons"),IconCategory("Transportation Icons"),IconCategory("Accessibility Icons")] - WheelchairAlt = 0xf29b, - ///Question Circle Outlined (created: 4.6) - /// - [Description("Question Circle Outlined"),IconId("question-circle-o"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - QuestionCircleOutline = 0xf29c, - ///Blind (created: 4.6) - /// - [Description("Blind"),IconId("blind"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - Blind = 0xf29d, - ///Audio Description (created: 4.6) - /// - [Description("Audio Description"),IconId("audio-description"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - AudioDescription = 0xf29e, - ///Volume Control Phone (created: 4.6) - /// - [Description("Volume Control Phone"),IconId("volume-control-phone"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - VolumeControlPhone = 0xf2a0, - ///Braille (created: 4.6) - /// - [Description("Braille"),IconId("braille"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - Braille = 0xf2a1, - ///Assistive Listening Systems (created: 4.6) - /// - [Description("Assistive Listening Systems"),IconId("assistive-listening-systems"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - AssistiveListeningSystems = 0xf2a2, - ///American Sign Language Interpreting (created: 4.6) - /// - [Description("American Sign Language Interpreting"),IconId("american-sign-language-interpreting"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - AmericanSignLanguageInterpreting = 0xf2a3, - ///Alias of: AmericanSignLanguageInterpreting - /// - [IconAlias] - AslInterpreting = AmericanSignLanguageInterpreting, - ///Deaf (created: 4.6) - /// - [Description("Deaf"),IconId("deaf"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - Deaf = 0xf2a4, - ///Alias of: Deaf - /// - [IconAlias] - Deafness = Deaf, - ///Alias of: Deaf - /// - [IconAlias] - HardOfHearing = Deaf, - ///Glide (created: 4.6) - /// - [Description("Glide"),IconId("glide"),IconCategory("Brand Icons")] - Glide = 0xf2a5, - ///Glide G (created: 4.6) - /// - [Description("Glide G"),IconId("glide-g"),IconCategory("Brand Icons")] - GlideG = 0xf2a6, - ///Sign Language (created: 4.6) - /// - [Description("Sign Language"),IconId("sign-language"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - SignLanguage = 0xf2a7, - ///Alias of: SignLanguage - /// - [IconAlias] - Signing = SignLanguage, - ///Low Vision (created: 4.6) - /// - [Description("Low Vision"),IconId("low-vision"),IconCategory("Web Application Icons"),IconCategory("Accessibility Icons")] - LowVision = 0xf2a8, - ///Viadeo (created: 4.6) - /// - [Description("Viadeo"),IconId("viadeo"),IconCategory("Brand Icons")] - Viadeo = 0xf2a9, - ///Viadeo Square (created: 4.6) - /// - [Description("Viadeo Square"),IconId("viadeo-square"),IconCategory("Brand Icons")] - ViadeoSquare = 0xf2aa, - ///Snapchat (created: 4.6) - /// - [Description("Snapchat"),IconId("snapchat"),IconCategory("Brand Icons")] - Snapchat = 0xf2ab, - ///Snapchat Ghost (created: 4.6) - /// - [Description("Snapchat Ghost"),IconId("snapchat-ghost"),IconCategory("Brand Icons")] - SnapchatGhost = 0xf2ac, - ///Snapchat Square (created: 4.6) - /// - [Description("Snapchat Square"),IconId("snapchat-square"),IconCategory("Brand Icons")] - SnapchatSquare = 0xf2ad, - ///Pied Piper Logo (created: 4.6) - /// - [Description("Pied Piper Logo"),IconId("pied-piper"),IconCategory("Brand Icons")] - PiedPiper = 0xf2ae, - ///First Order (created: 4.6) - /// - [Description("First Order"),IconId("first-order"),IconCategory("Brand Icons")] - FirstOrder = 0xf2b0, - ///Yoast (created: 4.6) - /// - [Description("Yoast"),IconId("yoast"),IconCategory("Brand Icons")] - Yoast = 0xf2b1, - ///ThemeIsle (created: 4.6) - /// - [Description("ThemeIsle"),IconId("themeisle"),IconCategory("Brand Icons")] - Themeisle = 0xf2b2, - ///Google Plus Official (created: 4.6) - /// - [Description("Google Plus Official"),IconId("google-plus-official"),IconCategory("Brand Icons")] - GooglePlusOfficial = 0xf2b3, - ///Alias of: GooglePlusOfficial - /// - [IconAlias] - GooglePlusCircle = GooglePlusOfficial, - ///Font Awesome (created: 4.6) - /// - [Description("Font Awesome"),IconId("font-awesome"),IconCategory("Brand Icons")] - FontAwesome = 0xf2b4, - ///Alias of: FontAwesome - /// - [IconAlias] - Fa = FontAwesome, - ///Handshake Outlined (created: 4.7) - /// - [Description("Handshake Outlined"),IconId("handshake-o"),IconCategory("Web Application Icons")] - HandshakeOutline = 0xf2b5, - ///Envelope Open (created: 4.7) - /// - [Description("Envelope Open"),IconId("envelope-open"),IconCategory("Web Application Icons")] - EnvelopeOpen = 0xf2b6, - ///Envelope Open Outlined (created: 4.7) - /// - [Description("Envelope Open Outlined"),IconId("envelope-open-o"),IconCategory("Web Application Icons")] - EnvelopeOutlinepenOutline = 0xf2b7, - ///Linode (created: 4.7) - /// - [Description("Linode"),IconId("linode"),IconCategory("Brand Icons")] - Linode = 0xf2b8, - ///Address Book (created: 4.7) - /// - [Description("Address Book"),IconId("address-book"),IconCategory("Web Application Icons")] - AddressBook = 0xf2b9, - ///Address Book Outlined (created: 4.7) - /// - [Description("Address Book Outlined"),IconId("address-book-o"),IconCategory("Web Application Icons")] - AddressBookOutline = 0xf2ba, - ///Address Card (created: 4.7) - /// - [Description("Address Card"),IconId("address-card"),IconCategory("Web Application Icons")] - AddressCard = 0xf2bb, - ///Alias of: AddressCard - /// - [IconAlias] - Vcard = AddressCard, - ///Address Card Outlined (created: 4.7) - /// - [Description("Address Card Outlined"),IconId("address-card-o"),IconCategory("Web Application Icons")] - AddressCardOutline = 0xf2bc, - ///Alias of: AddressCardOutline - /// - [IconAlias] - VcardOutline = AddressCardOutline, - ///User Circle (created: 4.7) - /// - [Description("User Circle"),IconId("user-circle"),IconCategory("Web Application Icons")] - UserCircle = 0xf2bd, - ///User Circle Outlined (created: 4.7) - /// - [Description("User Circle Outlined"),IconId("user-circle-o"),IconCategory("Web Application Icons")] - UserCircleOutline = 0xf2be, - ///User Outlined (created: 4.7) - /// - [Description("User Outlined"),IconId("user-o"),IconCategory("Web Application Icons")] - UserOutline = 0xf2c0, - ///Identification Badge (created: 4.7) - /// - [Description("Identification Badge"),IconId("id-badge"),IconCategory("Web Application Icons")] - IdBadge = 0xf2c1, - ///Identification Card (created: 4.7) - /// - [Description("Identification Card"),IconId("id-card"),IconCategory("Web Application Icons")] - IdCard = 0xf2c2, - ///Alias of: IdCard - /// - [IconAlias] - DriversLicense = IdCard, - ///Identification Card Outlined (created: 4.7) - /// - [Description("Identification Card Outlined"),IconId("id-card-o"),IconCategory("Web Application Icons")] - IdCardOutline = 0xf2c3, - ///Alias of: IdCardOutline - /// - [IconAlias] - DriversLicenseOutline = IdCardOutline, - ///Quora (created: 4.7) - /// - [Description("Quora"),IconId("quora"),IconCategory("Brand Icons")] - Quora = 0xf2c4, - ///Free Code Camp (created: 4.7) - /// - [Description("Free Code Camp"),IconId("free-code-camp"),IconCategory("Brand Icons")] - FreeCodeCamp = 0xf2c5, - ///Telegram (created: 4.7) - /// - [Description("Telegram"),IconId("telegram"),IconCategory("Brand Icons")] - Telegram = 0xf2c6, - ///Thermometer Full (created: 4.7) - /// - [Description("Thermometer Full"),IconId("thermometer-full"),IconCategory("Web Application Icons")] - ThermometerFull = 0xf2c7, - ///Alias of: ThermometerFull - /// - [IconAlias] - Thermometer4 = ThermometerFull, - ///Alias of: ThermometerFull - /// - [IconAlias] - Thermometer = ThermometerFull, - ///Thermometer 3/4 Full (created: 4.7) - /// - [Description("Thermometer 3/4 Full"),IconId("thermometer-three-quarters"),IconCategory("Web Application Icons")] - ThermometerThreeQuarters = 0xf2c8, - ///Alias of: ThermometerThreeQuarters - /// - [IconAlias] - Thermometer3 = ThermometerThreeQuarters, - ///Thermometer 1/2 Full (created: 4.7) - /// - [Description("Thermometer 1/2 Full"),IconId("thermometer-half"),IconCategory("Web Application Icons")] - ThermometerHalf = 0xf2c9, - ///Alias of: ThermometerHalf - /// - [IconAlias] - Thermometer2 = ThermometerHalf, - ///Thermometer 1/4 Full (created: 4.7) - /// - [Description("Thermometer 1/4 Full"),IconId("thermometer-quarter"),IconCategory("Web Application Icons")] - ThermometerQuarter = 0xf2ca, - ///Alias of: ThermometerQuarter - /// - [IconAlias] - Thermometer1 = ThermometerQuarter, - ///Thermometer Empty (created: 4.7) - /// - [Description("Thermometer Empty"),IconId("thermometer-empty"),IconCategory("Web Application Icons")] - ThermometerEmpty = 0xf2cb, - ///Alias of: ThermometerEmpty - /// - [IconAlias] - Thermometer0 = ThermometerEmpty, - ///Shower (created: 4.7) - /// - [Description("Shower"),IconId("shower"),IconCategory("Web Application Icons")] - Shower = 0xf2cc, - ///Bath (created: 4.7) - /// - [Description("Bath"),IconId("bath"),IconCategory("Web Application Icons")] - Bath = 0xf2cd, - ///Alias of: Bath - /// - [IconAlias] - Bathtub = Bath, - ///Alias of: Bath - /// - [IconAlias] - S15 = Bath, - ///Podcast (created: 4.7) - /// - [Description("Podcast"),IconId("podcast"),IconCategory("Web Application Icons")] - Podcast = 0xf2ce, - ///Window Maximize (created: 4.7) - /// - [Description("Window Maximize"),IconId("window-maximize"),IconCategory("Web Application Icons")] - WindowMaximize = 0xf2d0, - ///Window Minimize (created: 4.7) - /// - [Description("Window Minimize"),IconId("window-minimize"),IconCategory("Web Application Icons")] - WindowMinimize = 0xf2d1, - ///Window Restore (created: 4.7) - /// - [Description("Window Restore"),IconId("window-restore"),IconCategory("Web Application Icons")] - WindowRestore = 0xf2d2, - ///Window Close (created: 4.7) - /// - [Description("Window Close"),IconId("window-close"),IconCategory("Web Application Icons")] - WindowClose = 0xf2d3, - ///Alias of: WindowClose - /// - [IconAlias] - TimesRectangle = WindowClose, - ///Window Close Outline (created: 4.7) - /// - [Description("Window Close Outline"),IconId("window-close-o"),IconCategory("Web Application Icons")] - WindowCloseOutline = 0xf2d4, - ///Alias of: WindowCloseOutline - /// - [IconAlias] - TimesRectangleOutline = WindowCloseOutline, - ///Bandcamp (created: 4.7) - /// - [Description("Bandcamp"),IconId("bandcamp"),IconCategory("Brand Icons")] - Bandcamp = 0xf2d5, - ///Grav (created: 4.7) - /// - [Description("Grav"),IconId("grav"),IconCategory("Brand Icons")] - Grav = 0xf2d6, - ///Etsy (created: 4.7) - /// - [Description("Etsy"),IconId("etsy"),IconCategory("Brand Icons")] - Etsy = 0xf2d7, - ///IMDB (created: 4.7) - /// - [Description("IMDB"),IconId("imdb"),IconCategory("Brand Icons")] - Imdb = 0xf2d8, - ///Ravelry (created: 4.7) - /// - [Description("Ravelry"),IconId("ravelry"),IconCategory("Brand Icons")] - Ravelry = 0xf2d9, - ///Eercast (created: 4.7) - /// - [Description("Eercast"),IconId("eercast"),IconCategory("Brand Icons")] - Eercast = 0xf2da, - ///Microchip (created: 4.7) - /// - [Description("Microchip"),IconId("microchip"),IconCategory("Web Application Icons")] - Microchip = 0xf2db, - ///Snowflake Outlined (created: 4.7) - /// - [Description("Snowflake Outlined"),IconId("snowflake-o"),IconCategory("Web Application Icons")] - SnowflakeOutline = 0xf2dc, - ///Superpowers (created: 4.7) - /// - [Description("Superpowers"),IconId("superpowers"),IconCategory("Brand Icons")] - Superpowers = 0xf2dd, - ///WPExplorer (created: 4.7) - /// - [Description("WPExplorer"),IconId("wpexplorer"),IconCategory("Brand Icons")] - Wpexplorer = 0xf2de, - ///Meetup (created: 4.7) - /// - [Description("Meetup"),IconId("meetup"),IconCategory("Brand Icons")] - Meetup = 0xf2e0, - } -} diff --git a/WPF/FontAwesome.WPF/IFlippable.cs b/WPF/FontAwesome.WPF/IFlippable.cs deleted file mode 100644 index 7dacb0d..0000000 --- a/WPF/FontAwesome.WPF/IFlippable.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace FontAwesome.WPF -{ - /// - /// Defines the different flip orientations that a icon can have. - /// - [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] - public enum FlipOrientation - { - /// - /// Default - /// - Normal = 0, - /// - /// Flip horizontally (on x-achsis) - /// - Horizontal, - /// - /// Flip vertically (on y-achsis) - /// - Vertical, - } - - /// - /// Represents a flippable control - /// - public interface IFlippable - { - /// - /// Gets or sets the current orientation (horizontal, vertical). - /// - FlipOrientation FlipOrientation { get; set; } - } -} \ No newline at end of file diff --git a/WPF/FontAwesome.WPF/IRotatable.cs b/WPF/FontAwesome.WPF/IRotatable.cs deleted file mode 100644 index 073bc4b..0000000 --- a/WPF/FontAwesome.WPF/IRotatable.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace FontAwesome.WPF -{ - /// - /// Represents a rotatable control - /// - public interface IRotatable - { - /// - /// Gets or sets the current rotation (angle). - /// - double Rotation { get; set; } - } -} \ No newline at end of file diff --git a/WPF/FontAwesome.WPF/ISpinable.cs b/WPF/FontAwesome.WPF/ISpinable.cs deleted file mode 100644 index 06a66eb..0000000 --- a/WPF/FontAwesome.WPF/ISpinable.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace FontAwesome.WPF -{ - /// - /// Represents a spinable control - /// - public interface ISpinable - { - /// - /// Gets or sets the current spin (angle) animation of the icon. - /// - bool Spin { get; set; } - - /// - /// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation. - /// - double SpinDuration { get; set; } - } -} diff --git a/WPF/FontAwesome.WPF/ImageAwesome.Icon.png b/WPF/FontAwesome.WPF/ImageAwesome.Icon.png deleted file mode 100644 index 8f2ba5a049e9462d77e86d0b88358c33ad1dc179..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmV-F0l@x=P)+fG;6frc-R}d<8pe-^AL&G9kT1NVk20NR&S_1KAWV zY}}L?_+bumJ_bD_Q55Bo5b{B@9mpyO!kaA14|Gr7X>dy@^1^_X6;TwyvaF-Xi36;e zt#KUB4<$+BAU)=Fz%UF<(}bpJ;CUXpuERXf9No5!*RJbA6h-K|j;gAVB*_oJw7&0A zmL-0>ilW#9bzT1_AkXv5z_Ki8+ZJ&g^EVy@0k79}JvR@-0LO9mK$c}tRrTUG*E9`b z7{a#g-5h*=18JJxG>IJWeIKT29tY@!c>Tj=dS)lMXB#@Erz4>~PxM!C_XXs5-}pr1 Rea8R*002ovPDHLkV1k&GiVFY$ diff --git a/WPF/FontAwesome.WPF/ImageAwesome.cs b/WPF/FontAwesome.WPF/ImageAwesome.cs deleted file mode 100644 index da37e0b..0000000 --- a/WPF/FontAwesome.WPF/ImageAwesome.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Globalization; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace FontAwesome.WPF -{ - /// - /// Represents a control that draws an FontAwesome icon as an image. - /// - public class ImageAwesome - : Image, ISpinable, IRotatable, IFlippable - { - /// - /// FontAwesome FontFamily. - /// - private static readonly FontFamily FontAwesomeFontFamily = new FontFamily(new Uri("pack://application:,,,/FontAwesome.WPF;component/"), "./#FontAwesome"); - /// - /// Typeface used to generate FontAwesome icon. - /// - private static readonly Typeface FontAwesomeTypeface = new Typeface(FontAwesomeFontFamily, FontStyles.Normal, - FontWeights.Normal, FontStretches.Normal); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.Foreground dependency property. - /// - public static readonly DependencyProperty ForegroundProperty = - DependencyProperty.Register("Foreground", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(Brushes.Black, OnIconPropertyChanged)); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.Icon dependency property. - /// - public static readonly DependencyProperty IconProperty = - DependencyProperty.Register("Icon", typeof(FontAwesomeIcon), typeof(ImageAwesome), new PropertyMetadata(FontAwesomeIcon.None, OnIconPropertyChanged)); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.Spin dependency property. - /// - public static readonly DependencyProperty SpinProperty = - DependencyProperty.Register("Spin", typeof(bool), typeof(ImageAwesome), new PropertyMetadata(false, OnSpinPropertyChanged, SpinCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.Spin dependency property. - /// - public static readonly DependencyProperty SpinDurationProperty = - DependencyProperty.Register("SpinDuration", typeof(double), typeof(ImageAwesome), new PropertyMetadata(1d, SpinDurationChanged, SpinDurationCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.Rotation dependency property. - /// - public static readonly DependencyProperty RotationProperty = - DependencyProperty.Register("Rotation", typeof(double), typeof(ImageAwesome), new PropertyMetadata(0d, RotationChanged, RotationCoerceValue)); - /// - /// Identifies the FontAwesome.WPF.ImageAwesome.FlipOrientation dependency property. - /// - public static readonly DependencyProperty FlipOrientationProperty = - DependencyProperty.Register("FlipOrientation", typeof(FlipOrientation), typeof(ImageAwesome), new PropertyMetadata(FlipOrientation.Normal, FlipOrientationChanged)); - - static ImageAwesome() - { - OpacityProperty.OverrideMetadata(typeof(ImageAwesome), new UIPropertyMetadata(1.0, OpacityChanged)); - } - - public ImageAwesome() - { - IsVisibleChanged += (s, a) => CoerceValue(SpinProperty); - } - - private static void OpacityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - d.CoerceValue(SpinProperty); - } - - /// - /// Gets or sets the foreground brush of the icon. Changing this property will cause the icon to be redrawn. - /// - public Brush Foreground - { - get { return (Brush)GetValue(ForegroundProperty); } - set { SetValue(ForegroundProperty, value); } - } - /// - /// Gets or sets the FontAwesome icon. Changing this property will cause the icon to be redrawn. - /// - public FontAwesomeIcon Icon - { - get { return (FontAwesomeIcon)GetValue(IconProperty); } - set { SetValue(IconProperty, value); } - } - /// - /// Gets or sets the current spin (angle) animation of the icon. - /// - public bool Spin - { - get { return (bool)GetValue(SpinProperty); } - set { SetValue(SpinProperty, value); } - } - - private static void OnSpinPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var imageAwesome = d as ImageAwesome; - - if (imageAwesome == null) return; - - if ((bool)e.NewValue) - imageAwesome.BeginSpin(); - else - { - imageAwesome.StopSpin(); - imageAwesome.SetRotation(); - } - } - - private static object SpinCoerceValue(DependencyObject d, object basevalue) - { - var imageAwesome = (ImageAwesome)d; - - if (!imageAwesome.IsVisible || imageAwesome.Opacity == 0.0 || imageAwesome.SpinDuration == 0.0) - return false; - - return basevalue; - } - - /// - /// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation. - /// - public double SpinDuration - { - get { return (double)GetValue(SpinDurationProperty); } - set { SetValue(SpinDurationProperty, value); } - } - - private static void SpinDurationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var imageAwesome = d as ImageAwesome; - - if (null == imageAwesome || !imageAwesome.Spin || !(e.NewValue is double) || e.NewValue.Equals(e.OldValue)) return; - - imageAwesome.StopSpin(); - imageAwesome.BeginSpin(); - } - - private static object SpinDurationCoerceValue(DependencyObject d, object value) - { - double val = (double)value; - return val < 0 ? 0d : value; - } - - /// - /// Gets or sets the current rotation (angle). - /// - public double Rotation - { - get { return (double)GetValue(RotationProperty); } - set { SetValue(RotationProperty, value); } - } - - - private static void RotationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var imageAwesome = d as ImageAwesome; - - if (null == imageAwesome || imageAwesome.Spin || !(e.NewValue is double) || e.NewValue.Equals(e.OldValue)) return; - - imageAwesome.SetRotation(); - } - - private static object RotationCoerceValue(DependencyObject d, object value) - { - double val = (double)value; - return val < 0 ? 0d : (val > 360 ? 360d : value); - } - - /// - /// Gets or sets the current orientation (horizontal, vertical). - /// - public FlipOrientation FlipOrientation - { - get { return (FlipOrientation)GetValue(FlipOrientationProperty); } - set { SetValue(FlipOrientationProperty, value); } - } - - private static void FlipOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var imageAwesome = d as ImageAwesome; - - if (null == imageAwesome || !(e.NewValue is FlipOrientation) || e.NewValue.Equals(e.OldValue)) return; - - imageAwesome.SetFlipOrientation(); - } - - private static void OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var imageAwesome = d as ImageAwesome; - - if (imageAwesome == null) return; - - imageAwesome.SetValue(SourceProperty, CreateImageSource(imageAwesome.Icon, imageAwesome.Foreground)); - } - - - /// - /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush. - /// - /// The FontAwesome icon to be drawn. - /// The System.Windows.Media.Brush to be used as the foreground. - /// A new System.Windows.Media.ImageSource - public static ImageSource CreateImageSource(FontAwesomeIcon icon, Brush foregroundBrush, double emSize = 100) - { - var charIcon = char.ConvertFromUtf32((int)icon); - - var visual = new DrawingVisual(); - using (var drawingContext = visual.RenderOpen()) - { - drawingContext.DrawText( - new FormattedText(charIcon, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, - FontAwesomeTypeface, emSize, foregroundBrush) { TextAlignment = TextAlignment.Center }, new Point(0, 0)); - } - return new DrawingImage(visual.Drawing); - } - - } -} diff --git a/WPF/FontAwesome.WPF/Properties/AssemblyInfo.cs b/WPF/FontAwesome.WPF/Properties/AssemblyInfo.cs deleted file mode 100644 index 5ee9f3d..0000000 --- a/WPF/FontAwesome.WPF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows.Markup; - - -[assembly: AssemblyTitle("Font Awesome WPF")] -[assembly: AssemblyDescription("Wpf components for the iconic font and CSS toolkit Font-Awesome")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("charri")] -[assembly: AssemblyProduct("FontAwesome.WPF")] -[assembly: AssemblyCopyright("Copyright © 2015-2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c1ef07d8-c739-421a-a811-278c9341677c")] - -// Version: First three numbers is FontAwesome version, the last number specifies code revision -// -[assembly: AssemblyVersion("4.7.0.*")] -[assembly: AssemblyFileVersion("4.7.0.9")] - -[assembly: XmlnsPrefix("http://schemas.fontawesome.io/icons/", "fa")] -[assembly: XmlnsDefinition("http://schemas.fontawesome.io/icons/", "FontAwesome.WPF")] -[assembly: XmlnsDefinition("http://schemas.fontawesome.io/icons/", "FontAwesome.WPF.Converters")] \ No newline at end of file diff --git a/DemoScriptEditor/App.config b/demo/DemoScriptEditor/App.config similarity index 100% rename from DemoScriptEditor/App.config rename to demo/DemoScriptEditor/App.config diff --git a/DemoScriptEditor/App.xaml b/demo/DemoScriptEditor/App.xaml similarity index 75% rename from DemoScriptEditor/App.xaml rename to demo/DemoScriptEditor/App.xaml index 7268161..c54e9a4 100644 --- a/DemoScriptEditor/App.xaml +++ b/demo/DemoScriptEditor/App.xaml @@ -4,6 +4,9 @@ xmlns:local="clr-namespace:DemoScriptEditor" StartupUri="MainWindow.xaml"> - + + diff --git a/DemoScriptEditor/App.xaml.cs b/demo/DemoScriptEditor/App.xaml.cs similarity index 100% rename from DemoScriptEditor/App.xaml.cs rename to demo/DemoScriptEditor/App.xaml.cs diff --git a/DemoScriptEditor/ConsoleItem.cs b/demo/DemoScriptEditor/ConsoleItem.cs similarity index 100% rename from DemoScriptEditor/ConsoleItem.cs rename to demo/DemoScriptEditor/ConsoleItem.cs diff --git a/DemoScriptEditor/DemoScriptEditor.csproj b/demo/DemoScriptEditor/DemoScriptEditor.csproj similarity index 91% rename from DemoScriptEditor/DemoScriptEditor.csproj rename to demo/DemoScriptEditor/DemoScriptEditor.csproj index 502a400..fb760f7 100644 --- a/DemoScriptEditor/DemoScriptEditor.csproj +++ b/demo/DemoScriptEditor/DemoScriptEditor.csproj @@ -99,19 +99,15 @@ - - {86044555-48e3-4128-92ee-59f55f9d8b53} - ExecutionEngine - - + {7006ac9f-d218-4d7b-98eb-5d2d91f69c57} FontAwesome.WPF - + {801cfd14-89d2-4b1e-9332-b22ec959baba} ScriptEditor - + {9efe2134-8015-4957-a9e1-f7d2fbb4cda7} ScriptEngine diff --git a/DemoScriptEditor/LogStatement.cs b/demo/DemoScriptEditor/LogStatement.cs similarity index 58% rename from DemoScriptEditor/LogStatement.cs rename to demo/DemoScriptEditor/LogStatement.cs index e025216..4e13c73 100644 --- a/DemoScriptEditor/LogStatement.cs +++ b/demo/DemoScriptEditor/LogStatement.cs @@ -9,7 +9,7 @@ namespace DemoScriptEditor { public delegate void OutWriteLine(object obj, params object[] param); - public class LogStatement : Statement, Execution2 + public class LogStatement : Statement { public LogStatement() { @@ -22,6 +22,17 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (Message == null) + return Completion.Void; + var c = Message.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + var value = c.ReturnValue; + //Console.WriteLine(DateTime.Now + ":" + DateTime.Now.Millisecond + " " + value); + if (WriteLine != null) + { + WriteLine(value); + } return Completion.Void; } @@ -31,7 +42,7 @@ public Descriptor Descriptor { Descriptor desc = new Descriptor(); desc.Add(new TextItemDescriptor(this, "Console.WriteLine(")); - desc.Add(new ExpressionDescriptor(this, "Message", "string|number|boolean") { IsOnlyNumberAllowed = false }); + desc.Add(new ExpressionDescriptor(this, "Message", "any") { IsOnlyNumberAllowed = false }); desc.Add(new TextItemDescriptor(this, ")")); return desc; } @@ -57,38 +68,6 @@ public bool IsClosing } public static OutWriteLine WriteLine { get; set; } - //execution - object logValue = null; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - Console.WriteLine(DateTime.Now + ":" + DateTime.Now.Millisecond + " " + logValue); - if (WriteLine != null) - { - WriteLine(logValue); - } - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Message; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - logValue = value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } } diff --git a/DemoScriptEditor/MainWindow.xaml b/demo/DemoScriptEditor/MainWindow.xaml similarity index 64% rename from DemoScriptEditor/MainWindow.xaml rename to demo/DemoScriptEditor/MainWindow.xaml index 0b5192d..8652b3c 100644 --- a/DemoScriptEditor/MainWindow.xaml +++ b/demo/DemoScriptEditor/MainWindow.xaml @@ -12,11 +12,14 @@ - - + + - - - - - - + - - - - - - - + + + + + + + + + + + + + + diff --git a/DemoScriptEditor/MainWindow.xaml.cs b/demo/DemoScriptEditor/MainWindow.xaml.cs similarity index 57% rename from DemoScriptEditor/MainWindow.xaml.cs rename to demo/DemoScriptEditor/MainWindow.xaml.cs index 27c6102..8cd7e79 100644 --- a/DemoScriptEditor/MainWindow.xaml.cs +++ b/demo/DemoScriptEditor/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using Microsoft.Win32; +using ScratchEditor; using ScratchNet; using System; using System.Collections.Generic; @@ -7,6 +8,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -34,6 +36,7 @@ public MainWindow() { AllocConsole(); InitializeComponent(); + ConifgFileName =Environment.CurrentDirectory+"\\ "+"config.ini"; Editor.IsEnabled = false; List toolbar = new List(); toolbar.Add(new ScriptStepGroup() @@ -61,6 +64,7 @@ public MainWindow() new IfStatement(), new IfStatement(){Alternate=new BlockStatement()}, new ForStatement(), + new LoopStatement(), new WhileStatement(), new BreakStatement(), new ContinueStatement(), @@ -70,9 +74,11 @@ public MainWindow() }); toolbar.Add(new ScriptStepGroup() { - Name = "Console", + Name = "Others", Types = new List(){ - new LogStatement() + new LogStatement(), + new WaitStatement(), + new ExpressionStatement() } }); /* @@ -101,6 +107,26 @@ public MainWindow() Editor.SetToolBar(toolbar); LogStatement.WriteLine = WriteLineFunc; ConsoleList.ItemsSource = consoles; + new Thread(() => + { + Thread.Sleep(300); + + if (!string.IsNullOrEmpty(File) && System.IO.File.Exists(File)) + { + Dispatcher.InvokeAsync(() => + { + Editor.Script = null; + Editor.IsEnabled = false; + Script script = Serialization.Load(File); + Editor.Script = script; + Editor.IsEnabled = true; + ButtonStart.IsEnabled = true; + ButtonOpen.IsEnabled = true; + ButtonSave.IsEnabled = true; + }); + } + }).Start(); + } void WriteLineFunc(object obj, params object[] param) { @@ -112,45 +138,90 @@ void WriteLineFunc(object obj, params object[] param) } - ExecutionEngine engine; + //ExecutionEngine engine; private void OnStartRun(object sender, RoutedEventArgs e) { consoles.Clear(); - foreach(var func in Editor.Script.Functions) + + ExecutionEnvironment engine = new ExecutionEnvironment(); + ButtonStart.IsEnabled = false; + ButtonStop.IsEnabled = true; + Editor.IsEnabled = false; + engine.ExecutionCompleted += Engine_ExecutionCompleted; + engine.ExecutionAborted += Engine_ExecutionAborted; + engine.ExecuteAsync(Editor.Script); + Console.WriteLine("Start run"); + return; + } + + private void Engine_ExecutionCompleted(object engine, object arg) + { + Dispatcher.InvokeAsync(() => { - if("main".Equals(func.Format, StringComparison.OrdinalIgnoreCase)) + Editor.IsEnabled = true; + ButtonStart.IsEnabled = true; + ButtonStop.IsEnabled = false; + }); + } + IErrorHighlight lastErrorEditor; + private void Engine_ExecutionAborted(object engine, Completion arg) + { + if (arg != null) + { + Console.WriteLine(arg.ReturnValue); + Console.WriteLine(arg.Location); + Dispatcher.InvokeAsync(() => { - if (engine != null) + var editor = Editor.FindEditorFor(arg.Location); + if (editor != null) { - engine.Stop(); - engine = null; + Console.WriteLine("last " + editor); + lastErrorEditor = (editor as IErrorHighlight); + lastErrorEditor?.HighlightError(); } - engine = new ExecutionEngine(); - engine.Mode = ExecutionMode.ExitWhenFinish; - engine.AddInstance(new Instance(Editor.Script)); - engine.RunFunction(func); - engine.Start(); - Console.WriteLine("Start run"); - return; - } + //var p = Editor.FindParent(arg.Location); + // var pe = Editor.FindEditorFor(p); + }); } - MessageBox.Show(this, "找不到main主方法", "无法运行", MessageBoxButton.OK, MessageBoxImage.Warning); + Dispatcher.InvokeAsync(() => + { + Editor.IsEnabled = true; + ButtonStart.IsEnabled = true; + ButtonStop.IsEnabled = false; + }); } private void OnStopRun(object sender, RoutedEventArgs e) { + /* if (engine != null) { + engine.ExecutionCompleted -= Engine_ExecutionCompleted; engine.Stop(); engine = null; } + */ } protected override void OnClosing(CancelEventArgs e) { OnStopRun(this, null); base.OnClosing(e); } - public string File { get; set; } + string _currentFile; + public string File + { + get + { + if(string.IsNullOrEmpty(_currentFile)) + _currentFile = ReadValue("Editor", "LastOpen"); + return _currentFile; + } + set + { + _currentFile = value; + WriteValue("Editor", "LastOpen", value); + } + } private void OnOpen(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); @@ -161,7 +232,6 @@ private void OnOpen(object sender, RoutedEventArgs e) ButtonOpen.IsEnabled = false; ButtonSave.IsEnabled = false; ButtonStart.IsEnabled = false; - ButtonStop.IsEnabled = false; Nullable result = dlg.ShowDialog(); if (result == true) { @@ -172,7 +242,6 @@ private void OnOpen(object sender, RoutedEventArgs e) Editor.Script = script; Editor.IsEnabled = true; ButtonStart.IsEnabled = true; - ButtonStop.IsEnabled = true; } ButtonOpen.IsEnabled = true; ButtonSave.IsEnabled = true; @@ -206,12 +275,52 @@ private void OnSave(object sender, RoutedEventArgs e) private void OnNew(object sender, RoutedEventArgs e) { + File = null; Editor.Script = new Script(); Editor.IsEnabled = true; ButtonOpen.IsEnabled = true; ButtonSave.IsEnabled = true; ButtonStart.IsEnabled = true; - ButtonStop.IsEnabled = true; } + [DllImport("kernel32")] + private static extern long WritePrivateProfileString(string section, + string key, string val, string filePath); + [DllImport("kernel32")] + private static extern int GetPrivateProfileString(string section, + string key, string def, StringBuilder retVal, + int size, string filePath); + [DllImport("kernel32.dll")] + private static extern int GetPrivateProfileSection(string lpAppName, byte[] lpszReturnBuffer, int nSize, string lpFileName); + + public void WriteValue(string Section, string Key, string Value) + { + WritePrivateProfileString(Section, Key, Value, ConifgFileName); + } + + public string ReadValue(string Section, string Key) + { + StringBuilder temp = new StringBuilder(255); + int i = GetPrivateProfileString(Section, Key, "", temp, + 255, ConifgFileName); + if (i <= 0) + return null; + String Value = temp.ToString(); + return Value; + + } + /// + /// Ini configuration file name + /// + string ConifgFileName = "config.ini"; + + private void OnClearError(object sender, RoutedEventArgs e) + { + lastErrorEditor?.ClearHighlightError(); + } + + /// + /// constructor + /// + /// Ini configuration file name } } diff --git a/DemoScriptEditor/Persistance.cs b/demo/DemoScriptEditor/Persistance.cs similarity index 99% rename from DemoScriptEditor/Persistance.cs rename to demo/DemoScriptEditor/Persistance.cs index f2573de..124b46d 100644 --- a/DemoScriptEditor/Persistance.cs +++ b/demo/DemoScriptEditor/Persistance.cs @@ -11,7 +11,7 @@ namespace DemoScriptEditor { class Serialization { - private static XmlNode CreateClassNode(Class sp, XmlDocument xmlDoc) + private static XmlNode CreateClassNode(Script sp, XmlDocument xmlDoc) { XmlNode spNode = xmlDoc.CreateElement("Class"); PropertyInfo[] pinfo = sp.GetType().GetProperties(); @@ -309,9 +309,9 @@ public static Script Load(string file) XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(file); XmlNode root = xmlDoc.SelectSingleNode("/Script/Class"); - return LoadClass(root); + return LoadModule(root); } - private static Script LoadClass(XmlNode root) + private static Script LoadModule(XmlNode root) { if (root.Name != "Class") return null; diff --git a/DemoScriptEditor/Properties/AssemblyInfo.cs b/demo/DemoScriptEditor/Properties/AssemblyInfo.cs similarity index 100% rename from DemoScriptEditor/Properties/AssemblyInfo.cs rename to demo/DemoScriptEditor/Properties/AssemblyInfo.cs diff --git a/DemoScriptEditor/Properties/Resources.Designer.cs b/demo/DemoScriptEditor/Properties/Resources.Designer.cs similarity index 100% rename from DemoScriptEditor/Properties/Resources.Designer.cs rename to demo/DemoScriptEditor/Properties/Resources.Designer.cs diff --git a/DemoScriptEditor/Properties/Resources.resx b/demo/DemoScriptEditor/Properties/Resources.resx similarity index 100% rename from DemoScriptEditor/Properties/Resources.resx rename to demo/DemoScriptEditor/Properties/Resources.resx diff --git a/DemoScriptEditor/Properties/Settings.Designer.cs b/demo/DemoScriptEditor/Properties/Settings.Designer.cs similarity index 100% rename from DemoScriptEditor/Properties/Settings.Designer.cs rename to demo/DemoScriptEditor/Properties/Settings.Designer.cs diff --git a/DemoScriptEditor/Properties/Settings.settings b/demo/DemoScriptEditor/Properties/Settings.settings similarity index 100% rename from DemoScriptEditor/Properties/Settings.settings rename to demo/DemoScriptEditor/Properties/Settings.settings diff --git a/DemoScriptEditor/Script.cs b/demo/DemoScriptEditor/Script.cs similarity index 100% rename from DemoScriptEditor/Script.cs rename to demo/DemoScriptEditor/Script.cs diff --git a/ScratchNet/App.xaml b/demo/ScratchNet/App.xaml similarity index 100% rename from ScratchNet/App.xaml rename to demo/ScratchNet/App.xaml diff --git a/ScratchNet/App.xaml.cs b/demo/ScratchNet/App.xaml.cs similarity index 100% rename from ScratchNet/App.xaml.cs rename to demo/ScratchNet/App.xaml.cs diff --git a/ScratchNet/MainWindow.xaml b/demo/ScratchNet/MainWindow.xaml similarity index 100% rename from ScratchNet/MainWindow.xaml rename to demo/ScratchNet/MainWindow.xaml diff --git a/ScratchNet/MainWindow.xaml.cs b/demo/ScratchNet/MainWindow.xaml.cs similarity index 99% rename from ScratchNet/MainWindow.xaml.cs rename to demo/ScratchNet/MainWindow.xaml.cs index 68f90ef..4c72513 100644 --- a/ScratchNet/MainWindow.xaml.cs +++ b/demo/ScratchNet/MainWindow.xaml.cs @@ -91,7 +91,7 @@ public MainWindow() Types = new List(){ new IfStatement(), new IfStatement(){Alternate=new BlockStatement()}, - new ForStatement(), + new LoopStatement(), new WhileStatement(), new BreakStatement(), new ContinueStatement(), diff --git a/ScratchNet/Properties/AssemblyInfo.cs b/demo/ScratchNet/Properties/AssemblyInfo.cs similarity index 100% rename from ScratchNet/Properties/AssemblyInfo.cs rename to demo/ScratchNet/Properties/AssemblyInfo.cs diff --git a/ScratchNet/Properties/Resources.Designer.cs b/demo/ScratchNet/Properties/Resources.Designer.cs similarity index 100% rename from ScratchNet/Properties/Resources.Designer.cs rename to demo/ScratchNet/Properties/Resources.Designer.cs diff --git a/ScratchNet/Properties/Resources.resx b/demo/ScratchNet/Properties/Resources.resx similarity index 100% rename from ScratchNet/Properties/Resources.resx rename to demo/ScratchNet/Properties/Resources.resx diff --git a/ScratchNet/Properties/Settings.Designer.cs b/demo/ScratchNet/Properties/Settings.Designer.cs similarity index 100% rename from ScratchNet/Properties/Settings.Designer.cs rename to demo/ScratchNet/Properties/Settings.Designer.cs diff --git a/ScratchControl/Properties/Settings.settings b/demo/ScratchNet/Properties/Settings.settings similarity index 100% rename from ScratchControl/Properties/Settings.settings rename to demo/ScratchNet/Properties/Settings.settings diff --git a/ScratchNet/ResourceList.xaml b/demo/ScratchNet/ResourceList.xaml similarity index 100% rename from ScratchNet/ResourceList.xaml rename to demo/ScratchNet/ResourceList.xaml diff --git a/ScratchNet/ResourceList.xaml.cs b/demo/ScratchNet/ResourceList.xaml.cs similarity index 100% rename from ScratchNet/ResourceList.xaml.cs rename to demo/ScratchNet/ResourceList.xaml.cs diff --git a/ScratchNet/ScratchNet.csproj b/demo/ScratchNet/ScratchNet.csproj similarity index 95% rename from ScratchNet/ScratchNet.csproj rename to demo/ScratchNet/ScratchNet.csproj index ce941bd..194c9d3 100644 --- a/ScratchNet/ScratchNet.csproj +++ b/demo/ScratchNet/ScratchNet.csproj @@ -184,19 +184,15 @@ - - {86044555-48e3-4128-92ee-59f55f9d8b53} - ExecutionEngine - - + {7006ac9f-d218-4d7b-98eb-5d2d91f69c57} FontAwesome.WPF - + {801cfd14-89d2-4b1e-9332-b22ec959baba} ScriptEditor - + {9efe2134-8015-4957-a9e1-f7d2fbb4cda7} ScriptEngine diff --git a/ScratchNet/ScriptPlayer.xaml b/demo/ScratchNet/ScriptPlayer.xaml similarity index 100% rename from ScratchNet/ScriptPlayer.xaml rename to demo/ScratchNet/ScriptPlayer.xaml diff --git a/ScratchNet/ScriptPlayer.xaml.cs b/demo/ScratchNet/ScriptPlayer.xaml.cs similarity index 64% rename from ScratchNet/ScriptPlayer.xaml.cs rename to demo/ScratchNet/ScriptPlayer.xaml.cs index 9ae9ecf..0c7b730 100644 --- a/ScratchNet/ScriptPlayer.xaml.cs +++ b/demo/ScratchNet/ScriptPlayer.xaml.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -79,70 +80,83 @@ public void Clear() //Image backgroundImage = new Image(); public void DrawScript() { - /* - backgroundImage.Source = CurrentEnviroment.Game.Background.Images[CurrentEnviroment.Game.Background.CurrentImage].Image; - if (!PlayScreen.Children.Contains(backgroundImage)) + lock (this) { - backgroundImage.Stretch = Stretch.Fill; - PlayScreen.Children.Add(backgroundImage); - Canvas.SetLeft(backgroundImage, 0); - Canvas.SetTop(backgroundImage, 0); - } - backgroundImage.Width = PlayScreen.ActualWidth; - backgroundImage.Height = PlayScreen.ActualHeight; - Canvas.SetBottom(backgroundImage, PlayScreen.ActualHeight); - Canvas.SetRight(backgroundImage, PlayScreen.ActualWidth); - */ - foreach (Instance inst in CurrentEnviroment.Game.Instances.Keys) - { - if (controls.ContainsKey(inst)) + /* + backgroundImage.Source = CurrentEnviroment.Game.Background.Images[CurrentEnviroment.Game.Background.CurrentImage].Image; + if (!PlayScreen.Children.Contains(backgroundImage)) { - Image img = controls[inst] as Image; - Setup(img, inst); + backgroundImage.Stretch = Stretch.Fill; + PlayScreen.Children.Add(backgroundImage); + Canvas.SetLeft(backgroundImage, 0); + Canvas.SetTop(backgroundImage, 0); } - else + backgroundImage.Width = PlayScreen.ActualWidth; + backgroundImage.Height = PlayScreen.ActualHeight; + Canvas.SetBottom(backgroundImage, PlayScreen.ActualHeight); + Canvas.SetRight(backgroundImage, PlayScreen.ActualWidth); + */ + foreach (Instance inst in CurrentEnviroment.Game.Instances.Keys) { - Image img = new Image(); - Setup(img, inst); - PlayScreen.Children.Add(img); - img.Tag = inst; - controls.Add(inst, img); + if (controls.ContainsKey(inst)) + { + Image img = controls[inst] as Image; + Setup(img, inst); + } + else + { + Image img = new Image(); + Setup(img, inst); + PlayScreen.Children.Add(img); + img.Tag = inst; + controls.Add(inst, img); + } } } } - ExecutionEngine engine; + ExecutionEnvironment engine; + Dictionary allEnvs = new Dictionary(); private void OnRun(object sender, RoutedEventArgs e) { //ButtonStart.IsEnabled = false; //ButtonStop.IsEnabled = true; if(engine!=null) { - engine.Stop(); - engine = null; + ///engine.Stop(); + /// engine = null; } - engine = new ExecutionEngine(); + engine = new ExecutionEnvironment(); PlayScreen.Children.Clear(); controls.Clear(); CurrentEnviroment.Game.Instances.Clear(); - engine.BaseEnvironment.RegisterValue("$$Player", this); + allEnvs.Clear(); + engine.RegisterValue("$$Player", this); foreach (Sprite sp in CurrentEnviroment.Game.Sprites) { CurrentEnviroment.Game.Instances.Add(new Instance(sp), sp); + ExecutionEnvironment playEnv = new ExecutionEnvironment(engine); + allEnvs.Add(sp, playEnv); + playEnv.RegisterValue("$$INSTANCE$$", sp); + playEnv.Execute(sp); + foreach(var f in sp.Handlers) + { + if(f is StartEventHandler) + { + new Thread(() => + { + f.Execute(playEnv); + }).Start(); + } + } } - foreach (Instance s in CurrentEnviroment.Game.Instances.Keys) - { - engine.AddInstance(s); - } - engine.Start(); - engine.SendEvent(new StartEvent()); } private void OnStop(object sender, RoutedEventArgs e) { if (engine != null) { - engine.Stop(); - engine = null; + ///engine.Stop(); + ///engine = null; } //ButtonStart.IsEnabled = true; //ButtonStop.IsEnabled = false; @@ -152,9 +166,23 @@ private void OnKeyDownGlobal(object sender, KeyEventArgs e) { if (current % 2 == 1 && e.IsDown) { - if (engine != null) + foreach(var sp in allEnvs.Keys) { - engine.SendEvent(new KeyEvent() { Key = (int)e.Key }); + foreach (var f in sp.Handlers) + { + if (f is KeyEventHandler) + { + var key = (int)e.Key; + if (key == ((KeyEventHandler)f).Key) + { + ExecutionEnvironment playEnv = allEnvs[sp]; + new Thread(() => + { + f.Execute(playEnv); + }).Start(); + } + } + } } } @@ -182,7 +210,17 @@ private void OnMouseLeftDown(object sender, MouseButtonEventArgs e) dragLayer = Canvas.GetZIndex(child); if (engine != null) { - engine.SendEvent(DragObj.Tag as Instance, new ClickEvent()); + Sprite sp = (DragObj.Tag as Instance).Class as Sprite; + foreach(var f in sp.Handlers) + { + if(f is ClickEventHandler) + { + new Thread(() => + { + f.Execute(allEnvs[sp]); + }).Start(); + } + } } } } diff --git a/ScratchNet/SpriteList.xaml b/demo/ScratchNet/SpriteList.xaml similarity index 100% rename from ScratchNet/SpriteList.xaml rename to demo/ScratchNet/SpriteList.xaml diff --git a/ScratchNet/SpriteList.xaml.cs b/demo/ScratchNet/SpriteList.xaml.cs similarity index 100% rename from ScratchNet/SpriteList.xaml.cs rename to demo/ScratchNet/SpriteList.xaml.cs diff --git a/ScratchControl/app.config b/demo/ScratchNet/app.config similarity index 100% rename from ScratchControl/app.config rename to demo/ScratchNet/app.config diff --git a/ScratchNet/appearance/HideStatement.cs b/demo/ScratchNet/appearance/HideStatement.cs similarity index 54% rename from ScratchNet/appearance/HideStatement.cs rename to demo/ScratchNet/appearance/HideStatement.cs index b49b76a..9c76705 100644 --- a/ScratchNet/appearance/HideStatement.cs +++ b/demo/ScratchNet/appearance/HideStatement.cs @@ -13,6 +13,15 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (sp.Visible) + { + sp.Visible = false; ; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + } return Completion.Void; } @@ -44,39 +53,6 @@ public bool IsClosing { get { return false; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - if (sp.Visible) - { - ((_env.This as Instance).Class as Sprite).Visible = false; ; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - } - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback,ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } } diff --git a/ScratchNet/appearance/LogStatement.cs b/demo/ScratchNet/appearance/LogStatement.cs similarity index 60% rename from ScratchNet/appearance/LogStatement.cs rename to demo/ScratchNet/appearance/LogStatement.cs index db29882..66fd49f 100644 --- a/ScratchNet/appearance/LogStatement.cs +++ b/demo/ScratchNet/appearance/LogStatement.cs @@ -6,7 +6,7 @@ namespace ScratchNet { - public class LogStatement : Statement, Execution2 + public class LogStatement : Statement { public LogStatement() { @@ -19,6 +19,15 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (Message == null) + return Completion.Void; + var c = Message.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + object logValue = c.ReturnValue; + Console.ForegroundColor = ConsoleColor.Red; + Console.Error.WriteLine(DateTime.Now + ":" + DateTime.Now.Millisecond + " " + logValue); + Console.ForegroundColor = ConsoleColor.White; return Completion.Void; } @@ -53,36 +62,5 @@ public bool IsClosing get { return false; } } - //execution - object logValue = null; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.Error.WriteLine(DateTime.Now+":"+DateTime.Now.Millisecond+" "+ logValue); - Console.ForegroundColor = ConsoleColor.White; - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Message; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - logValue = value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScratchNet/appearance/ResizeStatement.cs b/demo/ScratchNet/appearance/ResizeStatement.cs similarity index 56% rename from ScratchNet/appearance/ResizeStatement.cs rename to demo/ScratchNet/appearance/ResizeStatement.cs index f1bb5d4..9a3b628 100644 --- a/ScratchNet/appearance/ResizeStatement.cs +++ b/demo/ScratchNet/appearance/ResizeStatement.cs @@ -18,6 +18,25 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (Size == null) + return Completion.Void; + var c = Size.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + int s = 0; + try + { + s = TypeConverters.GetValue(c.ReturnValue); + }catch(Exception e) + { + return Completion.Exception("Wrong number format", Size); + } + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + sp.Size = s; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); return Completion.Void; } @@ -50,40 +69,5 @@ public bool IsClosing { get { return false; } } - //execution - - int size = 100; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - size = 100; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - ((_env.This as Instance).Class as Sprite).Size = size; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - object result = size; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Size; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - size = int.Parse(value + ""); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScratchNet/appearance/SayStatement.cs b/demo/ScratchNet/appearance/SayStatement.cs similarity index 100% rename from ScratchNet/appearance/SayStatement.cs rename to demo/ScratchNet/appearance/SayStatement.cs diff --git a/ScratchNet/appearance/SetImageStatement.cs b/demo/ScratchNet/appearance/SetImageStatement.cs similarity index 62% rename from ScratchNet/appearance/SetImageStatement.cs rename to demo/ScratchNet/appearance/SetImageStatement.cs index 00f9e67..d9372e3 100644 --- a/ScratchNet/appearance/SetImageStatement.cs +++ b/demo/ScratchNet/appearance/SetImageStatement.cs @@ -17,6 +17,44 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (ImageIndex == null) + return Completion.Void; + var c = ImageIndex.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + int currentIndex = 0; + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (TypeConverters.IsNumber(c.ReturnValue)) + { + try + { + currentIndex = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", ImageIndex); + } + } + else + { + string name = c.ReturnValue + ""; + int i = 0; + foreach (Resource r in sp.Images) + { + if (r.DisplayName == name) + currentIndex = i; + i++; + } + } + if (currentIndex < 0) + currentIndex = 0; + if (currentIndex >= sp.Images.Count) + currentIndex = 0; + sp.CurrentImage = currentIndex; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); return Completion.Void; } @@ -50,59 +88,5 @@ public bool IsClosing { get { return false; } } - //execution - - int currentIndex = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - currentIndex = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment e) - { - object result = currentIndex; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = ImageIndex; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment _env) - { - Sprite sp=(_env.This as Instance).Class as Sprite; - if (value is double) - { - currentIndex = int.Parse(value + ""); - } - else - { - string name = value + ""; - int i=0; - foreach (Resource r in sp.Images) - { - if (r.DisplayName == name) - currentIndex = i; - i++; - } - } - if (currentIndex < 0) - currentIndex = 0; - if (currentIndex >= sp.Images.Count) - currentIndex = 0; - sp.CurrentImage = currentIndex; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScratchNet/appearance/SetNextImageStatement.cs b/demo/ScratchNet/appearance/SetNextImageStatement.cs similarity index 59% rename from ScratchNet/appearance/SetNextImageStatement.cs rename to demo/ScratchNet/appearance/SetNextImageStatement.cs index 9018a20..d8b28ed 100644 --- a/ScratchNet/appearance/SetNextImageStatement.cs +++ b/demo/ScratchNet/appearance/SetNextImageStatement.cs @@ -13,6 +13,16 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + int current = sp.CurrentImage; + current++; + if (current == sp.Images.Count) + current = 0; + sp.CurrentImage = current; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); return Completion.Void; } @@ -44,40 +54,5 @@ public bool IsClosing { get { return false; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - int current = sp.CurrentImage; - current++; - if (current == sp.Images.Count) - current = 0; - sp.CurrentImage = current; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScratchNet/appearance/ShowStatement.cs b/demo/ScratchNet/appearance/ShowStatement.cs similarity index 54% rename from ScratchNet/appearance/ShowStatement.cs rename to demo/ScratchNet/appearance/ShowStatement.cs index 630652f..e3f6f45 100644 --- a/ScratchNet/appearance/ShowStatement.cs +++ b/demo/ScratchNet/appearance/ShowStatement.cs @@ -13,6 +13,15 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (!sp.Visible) + { + sp.Visible = true; ; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + } return Completion.Void; } @@ -44,40 +53,5 @@ public bool IsClosing { get { return false; } } - //execution - - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - if (!sp.Visible) - { - ((_env.This as Instance).Class as Sprite).Visible = true; ; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - } - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/demo/ScratchNet/appearance/SizeExpression.cs b/demo/ScratchNet/appearance/SizeExpression.cs new file mode 100644 index 0000000..bac9240 --- /dev/null +++ b/demo/ScratchNet/appearance/SizeExpression.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class SizeExpression : Expression + { + public string ReturnType + { + get { return "number"; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + return new Completion(sp.Size); + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "Size")); + return desc; + } + } + + public string Type + { + get { return "XPositionExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScratchNet/appearance/ThinkStatement.cs b/demo/ScratchNet/appearance/ThinkStatement.cs similarity index 100% rename from ScratchNet/appearance/ThinkStatement.cs rename to demo/ScratchNet/appearance/ThinkStatement.cs diff --git a/ScratchNet/character/Background.cs b/demo/ScratchNet/character/Background.cs similarity index 100% rename from ScratchNet/character/Background.cs rename to demo/ScratchNet/character/Background.cs diff --git a/ScratchNet/character/CharacterRotationMode.cs b/demo/ScratchNet/character/CharacterRotationMode.cs similarity index 100% rename from ScratchNet/character/CharacterRotationMode.cs rename to demo/ScratchNet/character/CharacterRotationMode.cs diff --git a/ScratchNet/character/Game.cs b/demo/ScratchNet/character/Game.cs similarity index 100% rename from ScratchNet/character/Game.cs rename to demo/ScratchNet/character/Game.cs diff --git a/ScratchNet/character/ResourceList.cs b/demo/ScratchNet/character/ResourceList.cs similarity index 100% rename from ScratchNet/character/ResourceList.cs rename to demo/ScratchNet/character/ResourceList.cs diff --git a/ScratchNet/character/Sprite.cs b/demo/ScratchNet/character/Sprite.cs similarity index 100% rename from ScratchNet/character/Sprite.cs rename to demo/ScratchNet/character/Sprite.cs diff --git a/ScratchNet/control/CurrentEnviroment.cs b/demo/ScratchNet/control/CurrentEnviroment.cs similarity index 100% rename from ScratchNet/control/CurrentEnviroment.cs rename to demo/ScratchNet/control/CurrentEnviroment.cs diff --git a/ScratchEditor/convertor/ActualWidthMinusConverter.cs b/demo/ScratchNet/convertor/ActualWidthMinusConverter.cs similarity index 100% rename from ScratchEditor/convertor/ActualWidthMinusConverter.cs rename to demo/ScratchNet/convertor/ActualWidthMinusConverter.cs diff --git a/ScratchEditor/convertor/ActualWidthMinusConverter2.cs b/demo/ScratchNet/convertor/ActualWidthMinusConverter2.cs similarity index 100% rename from ScratchEditor/convertor/ActualWidthMinusConverter2.cs rename to demo/ScratchNet/convertor/ActualWidthMinusConverter2.cs diff --git a/ScratchEditor/convertor/ScriptContainerWidthConverter.cs b/demo/ScratchNet/convertor/ScriptContainerWidthConverter.cs similarity index 100% rename from ScratchEditor/convertor/ScriptContainerWidthConverter.cs rename to demo/ScratchNet/convertor/ScriptContainerWidthConverter.cs diff --git a/ScratchNet/convertor/SpriteToImageConverter.cs b/demo/ScratchNet/convertor/SpriteToImageConverter.cs similarity index 100% rename from ScratchNet/convertor/SpriteToImageConverter.cs rename to demo/ScratchNet/convertor/SpriteToImageConverter.cs diff --git a/ScratchNet/event/ClickEventHandler.cs b/demo/ScratchNet/event/ClickEventHandler.cs similarity index 100% rename from ScratchNet/event/ClickEventHandler.cs rename to demo/ScratchNet/event/ClickEventHandler.cs diff --git a/ScratchNet/event/Events.cs b/demo/ScratchNet/event/Events.cs similarity index 100% rename from ScratchNet/event/Events.cs rename to demo/ScratchNet/event/Events.cs diff --git a/ScratchNet/event/KeyEventHandler.cs b/demo/ScratchNet/event/KeyEventHandler.cs similarity index 100% rename from ScratchNet/event/KeyEventHandler.cs rename to demo/ScratchNet/event/KeyEventHandler.cs diff --git a/ScratchNet/event/MessageEvent.cs b/demo/ScratchNet/event/MessageEvent.cs similarity index 100% rename from ScratchNet/event/MessageEvent.cs rename to demo/ScratchNet/event/MessageEvent.cs diff --git a/ScratchNet/event/MessageEvetHandler.cs b/demo/ScratchNet/event/MessageEvetHandler.cs similarity index 100% rename from ScratchNet/event/MessageEvetHandler.cs rename to demo/ScratchNet/event/MessageEvetHandler.cs diff --git a/ScratchNet/event/StartEventHandler.cs b/demo/ScratchNet/event/StartEventHandler.cs similarity index 100% rename from ScratchNet/event/StartEventHandler.cs rename to demo/ScratchNet/event/StartEventHandler.cs diff --git a/ScratchNet/images/backdrop1.png b/demo/ScratchNet/images/backdrop1.png similarity index 100% rename from ScratchNet/images/backdrop1.png rename to demo/ScratchNet/images/backdrop1.png diff --git a/ScratchNet/images/run.png b/demo/ScratchNet/images/run.png similarity index 100% rename from ScratchNet/images/run.png rename to demo/ScratchNet/images/run.png diff --git a/ScratchNet/images/th.jpg b/demo/ScratchNet/images/th.jpg similarity index 100% rename from ScratchNet/images/th.jpg rename to demo/ScratchNet/images/th.jpg diff --git a/ScratchNet/localization/Localize.cs b/demo/ScratchNet/localization/Localize.cs similarity index 100% rename from ScratchNet/localization/Localize.cs rename to demo/ScratchNet/localization/Localize.cs diff --git a/ScratchNet/localization/Strings.Designer.cs b/demo/ScratchNet/localization/Strings.Designer.cs similarity index 100% rename from ScratchNet/localization/Strings.Designer.cs rename to demo/ScratchNet/localization/Strings.Designer.cs diff --git a/ScratchEditor/localization/Strings.ja-JP.Designer.cs b/demo/ScratchNet/localization/Strings.ja-JP.Designer.cs similarity index 100% rename from ScratchEditor/localization/Strings.ja-JP.Designer.cs rename to demo/ScratchNet/localization/Strings.ja-JP.Designer.cs diff --git a/ScratchNet/localization/Strings.ja-JP.resx b/demo/ScratchNet/localization/Strings.ja-JP.resx similarity index 100% rename from ScratchNet/localization/Strings.ja-JP.resx rename to demo/ScratchNet/localization/Strings.ja-JP.resx diff --git a/ScratchNet/localization/Strings.resx b/demo/ScratchNet/localization/Strings.resx similarity index 100% rename from ScratchNet/localization/Strings.resx rename to demo/ScratchNet/localization/Strings.resx diff --git a/ScratchEditor/localization/Strings.zh-CN.Designer.cs b/demo/ScratchNet/localization/Strings.zh-CN.Designer.cs similarity index 100% rename from ScratchEditor/localization/Strings.zh-CN.Designer.cs rename to demo/ScratchNet/localization/Strings.zh-CN.Designer.cs diff --git a/ScratchNet/localization/Strings.zh-CN.resx b/demo/ScratchNet/localization/Strings.zh-CN.resx similarity index 100% rename from ScratchNet/localization/Strings.zh-CN.resx rename to demo/ScratchNet/localization/Strings.zh-CN.resx diff --git a/demo/ScratchNet/movement/DegreeExpression.cs b/demo/ScratchNet/movement/DegreeExpression.cs new file mode 100644 index 0000000..ea7ef54 --- /dev/null +++ b/demo/ScratchNet/movement/DegreeExpression.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class DegreeExpression: Expression + { + public string ReturnType + { + get { return "number"; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + return new Completion(sp.Direction); + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "Angle")); + return desc; + } + } + + public string Type + { + get { return "DegreeExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScratchNet/movement/MoveStatement.cs b/demo/ScratchNet/movement/MoveStatement.cs similarity index 65% rename from ScratchNet/movement/MoveStatement.cs rename to demo/ScratchNet/movement/MoveStatement.cs index 0b415b3..0af0e26 100644 --- a/ScratchNet/movement/MoveStatement.cs +++ b/demo/ScratchNet/movement/MoveStatement.cs @@ -18,54 +18,26 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; - } - - public Descriptor Descriptor - { - get + if (Step == null) + return Completion.Void; + double degree = 0; + try { - Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, Localize.GetString("m_Move"))); - desc.Add(new ExpressionDescriptor(this, "Step", "number")); - desc.Add(new TextItemDescriptor(this, Localize.GetString("m_Step"))); - return desc; + var c = Step.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + degree = TypeConverters.GetValue(c.ReturnValue); } - } - public string Type - { - get + catch { - return "MoveStatement"; + return Completion.Exception("Wrong number format", Step); } - } - - - public BlockDescriptor BlockDescriptor - { - get { return null; } - } - - - public bool IsClosing - { - get { return false; } - } - double degree = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - degree = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { bool reflection = false; - if (_env.This.States.ContainsKey("$$ReflectionOnTouchSide&&") && (bool)_env.This.States["$$ReflectionOnTouchSide&&"]) + if (enviroment.HasValue("$$ReflectionOnTouchSide&&") && enviroment.GetValue("$$ReflectionOnTouchSide&&")) reflection = true; - Sprite sp = (_env.This as Instance).Class as Sprite; - int x=sp.X + (int)(Math.Cos(sp.Direction*Math.PI/180) * degree); - int y=sp.Y + (int)(Math.Sin(sp.Direction * Math.PI / 180) * degree); + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + int x = sp.X + (int)(Math.Cos(sp.Direction * Math.PI / 180) * degree); + int y = sp.Y + (int)(Math.Sin(sp.Direction * Math.PI / 180) * degree); int direction = sp.Direction; if (reflection) { @@ -95,25 +67,40 @@ public Completion EndCall(ExecutionEnvironment _env) sp.Direction = direction; App.Current.Dispatcher.InvokeAsync(new Action(() => { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); })); return Completion.Void; } - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, Localize.GetString("m_Move"))); + desc.Add(new ExpressionDescriptor(this, "Step", "number")); + desc.Add(new TextItemDescriptor(this, Localize.GetString("m_Step"))); + return desc; + } + } + public string Type { - execution = Step; - callback = Callback; - return false; + get + { + return "MoveStatement"; + } } - Nullable Callback(object value, object exception, ExecutionEnvironment e) + + + public BlockDescriptor BlockDescriptor { - degree = (double)value; - return null; + get { return null; } } - public bool HandleException(object exception) + + + public bool IsClosing { - throw new NotImplementedException(); + get { return false; } } } } diff --git a/ScratchNet/movement/ReflectionModeStatement.cs b/demo/ScratchNet/movement/ReflectionModeStatement.cs similarity index 57% rename from ScratchNet/movement/ReflectionModeStatement.cs rename to demo/ScratchNet/movement/ReflectionModeStatement.cs index 6319849..dda9e30 100644 --- a/ScratchNet/movement/ReflectionModeStatement.cs +++ b/demo/ScratchNet/movement/ReflectionModeStatement.cs @@ -17,6 +17,7 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + enviroment.SetValue("$$ReflectionOnTouchSide&&", true); return Completion.Void; } @@ -47,32 +48,6 @@ public BlockDescriptor BlockDescriptor public bool IsClosing { get { return false; } - }//execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - _env.This.States.Add("$$ReflectionOnTouchSide&&",true); - - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/ScratchNet/movement/RotationStatement.cs b/demo/ScratchNet/movement/RotationStatement.cs similarity index 59% rename from ScratchNet/movement/RotationStatement.cs rename to demo/ScratchNet/movement/RotationStatement.cs index e78ba40..e813ec4 100644 --- a/ScratchNet/movement/RotationStatement.cs +++ b/demo/ScratchNet/movement/RotationStatement.cs @@ -15,7 +15,31 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Degree == null) + return Completion.Void; + double degree = 0; + try + { + var c = Degree.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + degree = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Degree); + } + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (Direction == RotationDirection.Clockwise) + sp.Direction += (int)degree; + else + sp.Direction -= (int)degree; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + double result = sp.Direction; + return new Completion(result); } public Descriptor Descriptor @@ -54,44 +78,7 @@ public bool IsClosing { get { return false; } } - //execution - - double degree = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - degree = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - if(Direction==RotationDirection.Clockwise) - ((_env.This as Instance).Class as Sprite).Direction +=(int)degree; - else - ((_env.This as Instance).Class as Sprite).Direction -= (int)degree; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - double result = ((_env.This as Instance).Class as Sprite).Direction; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Degree; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - degree = (double)value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } public enum RotationDirection { diff --git a/ScratchNet/movement/SetDegreeStatement.cs b/demo/ScratchNet/movement/SetDegreeStatement.cs similarity index 58% rename from ScratchNet/movement/SetDegreeStatement.cs rename to demo/ScratchNet/movement/SetDegreeStatement.cs index 77b9707..fd98f48 100644 --- a/ScratchNet/movement/SetDegreeStatement.cs +++ b/demo/ScratchNet/movement/SetDegreeStatement.cs @@ -18,6 +18,30 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (Degree == null) + return Completion.Void; + double degree = 0; + try + { + var c = Degree.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + degree = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Degree); + } + + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (sp.Direction != (int)degree) + { + sp.Direction = (int)degree; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + } return Completion.Void; } @@ -51,44 +75,6 @@ public bool IsClosing { get { return false; } } - //execution - - double degree = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - degree = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - if (sp.Direction != (int)degree) - { - ((_env.This as Instance).Class as Sprite).Direction = (int)degree; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - } - - return new Completion(degree); - } - - public bool PopStack(out object execution, out ExecutionCallback callback,ExecutionEnvironment e) - { - execution = Degree; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - degree = (double)value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } } diff --git a/ScratchNet/movement/SetPositionStatement.cs b/demo/ScratchNet/movement/SetPositionStatement.cs similarity index 53% rename from ScratchNet/movement/SetPositionStatement.cs rename to demo/ScratchNet/movement/SetPositionStatement.cs index a116560..af1f450 100644 --- a/ScratchNet/movement/SetPositionStatement.cs +++ b/demo/ScratchNet/movement/SetPositionStatement.cs @@ -21,6 +21,42 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (X == null) + return Completion.Void; + double x = 0; + try + { + var c = X.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + x = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", X); + } + if (Y == null) + return Completion.Void; + double y = 0; + try + { + var c = Y.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + y = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Y); + } + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + sp.X = (int)x; + sp.Y = (int)y; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + return Completion.Void; } @@ -54,58 +90,6 @@ public BlockDescriptor BlockDescriptor public bool IsClosing { get { return false; } - }//execution - - double x = 0; - double y = 0; - int current = 0; - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - x = 0; - y = 0; - current = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - ((_env.This as Instance).Class as Sprite).X = (int)x; - ((_env.This as Instance).Class as Sprite).Y = (int)y; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = X; - callback = Callback; - return true; - } - else - { - execution = Y; - callback = Callback; - return false; - } - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if (current == 0) - x = (double)value; - else - y = (double)value; - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/ScratchNet/movement/SetPositionXStatement.cs b/demo/ScratchNet/movement/SetPositionXStatement.cs similarity index 57% rename from ScratchNet/movement/SetPositionXStatement.cs rename to demo/ScratchNet/movement/SetPositionXStatement.cs index 9ea3469..418caf4 100644 --- a/ScratchNet/movement/SetPositionXStatement.cs +++ b/demo/ScratchNet/movement/SetPositionXStatement.cs @@ -19,6 +19,27 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (X == null) + return Completion.Void; + double x = 0; + try + { + var c = X.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + x = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", X); + } + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + sp.X = (int)x; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + return Completion.Void; } @@ -50,41 +71,6 @@ public BlockDescriptor BlockDescriptor public bool IsClosing { get { return false; } - }//execution - - double x = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - x = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - ((_env.This as Instance).Class as Sprite).X = (int)x; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = X; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - x = (double)value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/ScratchNet/movement/SetPositionYStatement.cs b/demo/ScratchNet/movement/SetPositionYStatement.cs similarity index 57% rename from ScratchNet/movement/SetPositionYStatement.cs rename to demo/ScratchNet/movement/SetPositionYStatement.cs index e44ca86..539c622 100644 --- a/ScratchNet/movement/SetPositionYStatement.cs +++ b/demo/ScratchNet/movement/SetPositionYStatement.cs @@ -19,7 +19,28 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + if (Y == null) + return Completion.Void; + double y = 0; + try + { + var c = Y.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + y = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Y); + } + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + sp.Y = (int)y; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); return Completion.Void; + } public Descriptor Descriptor @@ -50,40 +71,6 @@ public BlockDescriptor BlockDescriptor public bool IsClosing { get { return false; } - }//execution - - double y = 0; - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - y = 0; - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - ((_env.This as Instance).Class as Sprite).Y = (int)y; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Y; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - y = (double)value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/ScratchNet/movement/SetRotationModeStatement.cs b/demo/ScratchNet/movement/SetRotationModeStatement.cs similarity index 64% rename from ScratchNet/movement/SetRotationModeStatement.cs rename to demo/ScratchNet/movement/SetRotationModeStatement.cs index 7ff6d8c..2842655 100644 --- a/ScratchNet/movement/SetRotationModeStatement.cs +++ b/demo/ScratchNet/movement/SetRotationModeStatement.cs @@ -19,6 +19,16 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + if (sp.RotationMode != RotationMode) + { + sp.RotationMode = RotationMode; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + } + return Completion.Void; } @@ -51,40 +61,6 @@ public BlockDescriptor BlockDescriptor public bool IsClosing { get { return false; } - }//execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - Sprite sp = (_env.This as Instance).Class as Sprite; - if (sp.RotationMode != RotationMode) - { - ((_env.This as Instance).Class as Sprite).RotationMode = RotationMode; - App.Current.Dispatcher.InvokeAsync(new Action(() => - { - (_env.GetValue("$$Player") as ScriptPlayer).DrawScript(); - })); - } - - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/demo/ScratchNet/movement/TimedMoveStatement.cs b/demo/ScratchNet/movement/TimedMoveStatement.cs new file mode 100644 index 0000000..00dd574 --- /dev/null +++ b/demo/ScratchNet/movement/TimedMoveStatement.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; + +namespace ScratchNet +{ + public class TimedMoveStatement : Statement + { + public TimedMoveStatement() + { + Time = new Literal() { Raw = "2" }; + } + public Expression Time { get; set; } + public Expression X { get; set; } + public Expression Y { get; set; } + public string ReturnType + { + get { return "void"; } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + DateTime startTime; + DateTime finishTime; + double orgin_x; + double orgin_y; + double totalTime; + if (X == null) + return Completion.Void; + double x = 0; + try + { + var c = X.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + x = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", X); + } + if (Y == null) + return Completion.Void; + double y = 0; + try + { + var c = Y.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + y = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Y); + } + if (Time == null) + return Completion.Void; + double time = 0; + try + { + var c = Time.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + time = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("Wrong number format", Time); + } + + Sprite sp = enviroment.GetValue("$$INSTANCE$$") as Sprite; + + if (x < 0) + x = 0; + if (x > CurrentEnviroment.ScreenWidth) + x = CurrentEnviroment.ScreenWidth; + if (y < 0) + y = 0; + if (y > CurrentEnviroment.ScreenHeight) + y = CurrentEnviroment.ScreenHeight; + orgin_x = sp.X; + orgin_y = sp.Y; + startTime = DateTime.Now; + finishTime = DateTime.Now.AddSeconds(time); + totalTime = (finishTime - startTime).TotalMilliseconds; + + while (true) + { + if (DateTime.Now > finishTime) + break; + double duration = (DateTime.Now - startTime).TotalMilliseconds; + + sp.X = (int)(orgin_x + (x - orgin_x) * duration / totalTime); + sp.Y = (int)(orgin_y + (y - orgin_y) * duration / totalTime); + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + Thread.Sleep(100); + } + + sp.X = (int)x; + sp.Y = (int)y; + App.Current.Dispatcher.InvokeAsync(new Action(() => + { + (enviroment.GetValue("$$Player") as ScriptPlayer).DrawScript(); + })); + return Completion.Void; + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, Localize.GetString("cs_In"))); + desc.Add(new ExpressionDescriptor(this, "Time", "number")); + desc.Add(new TextItemDescriptor(this, Localize.GetString("cs_MoveXinSec"))); + desc.Add(new ExpressionDescriptor(this, "X", "number")); + desc.Add(new TextItemDescriptor(this, ", Y ")); + desc.Add(new ExpressionDescriptor(this, "Y", "number")); + return desc; + } + } + public string Type + { + get + { + return "MoveStatement"; + } + } + + + public BlockDescriptor BlockDescriptor + { + get { return null; } + } + + + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScratchNet/movement/XPositionExpression.cs b/demo/ScratchNet/movement/XPositionExpression.cs similarity index 50% rename from ScratchNet/movement/XPositionExpression.cs rename to demo/ScratchNet/movement/XPositionExpression.cs index 18694ed..9c05ed4 100644 --- a/ScratchNet/movement/XPositionExpression.cs +++ b/demo/ScratchNet/movement/XPositionExpression.cs @@ -14,7 +14,8 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + double result = (enviroment.GetValue("$$INSTANCE$$") as Sprite).X; + return new Completion(result); } public Descriptor Descriptor @@ -35,31 +36,5 @@ public bool IsClosing { get { return false; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - public Completion EndCall(ExecutionEnvironment _env) - { - double result = ((_env.This as Instance).Class as Sprite).X; - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/demo/ScratchNet/movement/YPositionExpression.cs b/demo/ScratchNet/movement/YPositionExpression.cs new file mode 100644 index 0000000..7a2fcb5 --- /dev/null +++ b/demo/ScratchNet/movement/YPositionExpression.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + + public class YPositionExpression : Expression + { + public string ReturnType + { + get { return "number"; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + double result = (enviroment.GetValue("$$INSTANCE$$") as Sprite).Y; + return new Completion(result); ; + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "Y")); + return desc; + } + } + + public string Type + { + get { return "YPositionExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScratchNet/runtime/ArgumentExpression.cs b/demo/ScratchNet/runtime/ArgumentExpression.cs similarity index 100% rename from ScratchNet/runtime/ArgumentExpression.cs rename to demo/ScratchNet/runtime/ArgumentExpression.cs diff --git a/ScratchNet/runtime/BinaryExpression.cs b/demo/ScratchNet/runtime/BinaryExpression.cs similarity index 100% rename from ScratchNet/runtime/BinaryExpression.cs rename to demo/ScratchNet/runtime/BinaryExpression.cs diff --git a/ScratchNet/runtime/BreakStatement.cs b/demo/ScratchNet/runtime/BreakStatement.cs similarity index 100% rename from ScratchNet/runtime/BreakStatement.cs rename to demo/ScratchNet/runtime/BreakStatement.cs diff --git a/ScratchNet/runtime/CallExpression.cs b/demo/ScratchNet/runtime/CallExpression.cs similarity index 100% rename from ScratchNet/runtime/CallExpression.cs rename to demo/ScratchNet/runtime/CallExpression.cs diff --git a/ScratchNet/runtime/CompareExpression.cs b/demo/ScratchNet/runtime/CompareExpression.cs similarity index 100% rename from ScratchNet/runtime/CompareExpression.cs rename to demo/ScratchNet/runtime/CompareExpression.cs diff --git a/ScratchNet/runtime/ConditionalExpression.cs b/demo/ScratchNet/runtime/ConditionalExpression.cs similarity index 100% rename from ScratchNet/runtime/ConditionalExpression.cs rename to demo/ScratchNet/runtime/ConditionalExpression.cs diff --git a/ScratchNet/runtime/ExpressionStatement.cs b/demo/ScratchNet/runtime/ExpressionStatement.cs similarity index 100% rename from ScratchNet/runtime/ExpressionStatement.cs rename to demo/ScratchNet/runtime/ExpressionStatement.cs diff --git a/ScratchNet/runtime/ForInStatement.cs b/demo/ScratchNet/runtime/ForInStatement.cs similarity index 100% rename from ScratchNet/runtime/ForInStatement.cs rename to demo/ScratchNet/runtime/ForInStatement.cs diff --git a/ScratchNet/runtime/ForStatement.cs b/demo/ScratchNet/runtime/ForStatement.cs similarity index 100% rename from ScratchNet/runtime/ForStatement.cs rename to demo/ScratchNet/runtime/ForStatement.cs diff --git a/ScratchNet/runtime/FunctionDeclaration.cs b/demo/ScratchNet/runtime/FunctionDeclaration.cs similarity index 100% rename from ScratchNet/runtime/FunctionDeclaration.cs rename to demo/ScratchNet/runtime/FunctionDeclaration.cs diff --git a/ScratchNet/runtime/Identifier.cs b/demo/ScratchNet/runtime/Identifier.cs similarity index 100% rename from ScratchNet/runtime/Identifier.cs rename to demo/ScratchNet/runtime/Identifier.cs diff --git a/ScratchNet/runtime/IfStatement.cs b/demo/ScratchNet/runtime/IfStatement.cs similarity index 100% rename from ScratchNet/runtime/IfStatement.cs rename to demo/ScratchNet/runtime/IfStatement.cs diff --git a/ScratchNet/runtime/Literal.cs b/demo/ScratchNet/runtime/Literal.cs similarity index 100% rename from ScratchNet/runtime/Literal.cs rename to demo/ScratchNet/runtime/Literal.cs diff --git a/ScratchNet/runtime/LogicExpression.cs b/demo/ScratchNet/runtime/LogicExpression.cs similarity index 100% rename from ScratchNet/runtime/LogicExpression.cs rename to demo/ScratchNet/runtime/LogicExpression.cs diff --git a/ScratchNet/runtime/NotExpression.cs b/demo/ScratchNet/runtime/NotExpression.cs similarity index 100% rename from ScratchNet/runtime/NotExpression.cs rename to demo/ScratchNet/runtime/NotExpression.cs diff --git a/ScratchNet/runtime/ReturnStatement.cs b/demo/ScratchNet/runtime/ReturnStatement.cs similarity index 100% rename from ScratchNet/runtime/ReturnStatement.cs rename to demo/ScratchNet/runtime/ReturnStatement.cs diff --git a/ScratchNet/runtime/TryCatchStatement.cs b/demo/ScratchNet/runtime/TryCatchStatement.cs similarity index 100% rename from ScratchNet/runtime/TryCatchStatement.cs rename to demo/ScratchNet/runtime/TryCatchStatement.cs diff --git a/ScratchNet/runtime/VariableAssignmentExpression.cs b/demo/ScratchNet/runtime/VariableAssignmentExpression.cs similarity index 100% rename from ScratchNet/runtime/VariableAssignmentExpression.cs rename to demo/ScratchNet/runtime/VariableAssignmentExpression.cs diff --git a/ScratchNet/runtime/WaitStatement.cs b/demo/ScratchNet/runtime/WaitStatement.cs similarity index 100% rename from ScratchNet/runtime/WaitStatement.cs rename to demo/ScratchNet/runtime/WaitStatement.cs diff --git a/ScratchNet/runtime/WhileStatement.cs b/demo/ScratchNet/runtime/WhileStatement.cs similarity index 100% rename from ScratchNet/runtime/WhileStatement.cs rename to demo/ScratchNet/runtime/WhileStatement.cs diff --git a/ScratchNet/script/Declaration.cs b/demo/ScratchNet/script/Declaration.cs similarity index 100% rename from ScratchNet/script/Declaration.cs rename to demo/ScratchNet/script/Declaration.cs diff --git a/ScratchNet/script/Event.cs b/demo/ScratchNet/script/Event.cs similarity index 100% rename from ScratchNet/script/Event.cs rename to demo/ScratchNet/script/Event.cs diff --git a/ScratchNet/script/Execution.cs b/demo/ScratchNet/script/Execution.cs similarity index 100% rename from ScratchNet/script/Execution.cs rename to demo/ScratchNet/script/Execution.cs diff --git a/ScratchNet/script/ExecutionEnvironment.cs b/demo/ScratchNet/script/ExecutionEnvironment.cs similarity index 100% rename from ScratchNet/script/ExecutionEnvironment.cs rename to demo/ScratchNet/script/ExecutionEnvironment.cs diff --git a/ScratchNet/script/Expression.cs b/demo/ScratchNet/script/Expression.cs similarity index 100% rename from ScratchNet/script/Expression.cs rename to demo/ScratchNet/script/Expression.cs diff --git a/ScratchNet/script/Function.cs b/demo/ScratchNet/script/Function.cs similarity index 100% rename from ScratchNet/script/Function.cs rename to demo/ScratchNet/script/Function.cs diff --git a/ScratchNet/script/Script.cs b/demo/ScratchNet/script/Script.cs similarity index 100% rename from ScratchNet/script/Script.cs rename to demo/ScratchNet/script/Script.cs diff --git a/ScratchNet/script/Statement.cs b/demo/ScratchNet/script/Statement.cs similarity index 100% rename from ScratchNet/script/Statement.cs rename to demo/ScratchNet/script/Statement.cs diff --git a/ScratchNet/script/Types.cs b/demo/ScratchNet/script/Types.cs similarity index 100% rename from ScratchNet/script/Types.cs rename to demo/ScratchNet/script/Types.cs diff --git a/ScratchNet/script/Variable.cs b/demo/ScratchNet/script/Variable.cs similarity index 100% rename from ScratchNet/script/Variable.cs rename to demo/ScratchNet/script/Variable.cs diff --git a/ScratchNet/script/descriptor/BlockDescriptor.cs b/demo/ScratchNet/script/descriptor/BlockDescriptor.cs similarity index 100% rename from ScratchNet/script/descriptor/BlockDescriptor.cs rename to demo/ScratchNet/script/descriptor/BlockDescriptor.cs diff --git a/ScratchNet/script/descriptor/Descriptor.cs b/demo/ScratchNet/script/descriptor/Descriptor.cs similarity index 100% rename from ScratchNet/script/descriptor/Descriptor.cs rename to demo/ScratchNet/script/descriptor/Descriptor.cs diff --git a/ScratchNet/util/Serialization.cs b/demo/ScratchNet/util/Serialization.cs similarity index 100% rename from ScratchNet/util/Serialization.cs rename to demo/ScratchNet/util/Serialization.cs diff --git a/ScratchControl/App.xaml b/src/ScratchControl/App.xaml similarity index 100% rename from ScratchControl/App.xaml rename to src/ScratchControl/App.xaml diff --git a/ScratchControl/App.xaml.cs b/src/ScratchControl/App.xaml.cs similarity index 100% rename from ScratchControl/App.xaml.cs rename to src/ScratchControl/App.xaml.cs diff --git a/ScratchControl/MainWindow.xaml b/src/ScratchControl/MainWindow.xaml similarity index 100% rename from ScratchControl/MainWindow.xaml rename to src/ScratchControl/MainWindow.xaml diff --git a/ScratchControl/MainWindow.xaml.cs b/src/ScratchControl/MainWindow.xaml.cs similarity index 100% rename from ScratchControl/MainWindow.xaml.cs rename to src/ScratchControl/MainWindow.xaml.cs diff --git a/ScratchControl/Properties/AssemblyInfo.cs b/src/ScratchControl/Properties/AssemblyInfo.cs similarity index 100% rename from ScratchControl/Properties/AssemblyInfo.cs rename to src/ScratchControl/Properties/AssemblyInfo.cs diff --git a/ScratchControl/Properties/Resources.Designer.cs b/src/ScratchControl/Properties/Resources.Designer.cs similarity index 100% rename from ScratchControl/Properties/Resources.Designer.cs rename to src/ScratchControl/Properties/Resources.Designer.cs diff --git a/ScrachEditor/Properties/Resources.resx b/src/ScratchControl/Properties/Resources.resx similarity index 100% rename from ScrachEditor/Properties/Resources.resx rename to src/ScratchControl/Properties/Resources.resx diff --git a/ScratchControl/Properties/Settings.Designer.cs b/src/ScratchControl/Properties/Settings.Designer.cs similarity index 100% rename from ScratchControl/Properties/Settings.Designer.cs rename to src/ScratchControl/Properties/Settings.Designer.cs diff --git a/ScratchEditor/Properties/Settings.settings b/src/ScratchControl/Properties/Settings.settings similarity index 100% rename from ScratchEditor/Properties/Settings.settings rename to src/ScratchControl/Properties/Settings.settings diff --git a/ScratchControl/ScratchControl.csproj b/src/ScratchControl/ScratchControl.csproj similarity index 100% rename from ScratchControl/ScratchControl.csproj rename to src/ScratchControl/ScratchControl.csproj diff --git a/ScratchNet/app.config b/src/ScratchControl/app.config similarity index 100% rename from ScratchNet/app.config rename to src/ScratchControl/app.config diff --git a/ScratchControl/expression/BooleanExpressionControl.xaml b/src/ScratchControl/expression/BooleanExpressionControl.xaml similarity index 100% rename from ScratchControl/expression/BooleanExpressionControl.xaml rename to src/ScratchControl/expression/BooleanExpressionControl.xaml diff --git a/ScratchControl/expression/BooleanExpressionControl.xaml.cs b/src/ScratchControl/expression/BooleanExpressionControl.xaml.cs similarity index 100% rename from ScratchControl/expression/BooleanExpressionControl.xaml.cs rename to src/ScratchControl/expression/BooleanExpressionControl.xaml.cs diff --git a/ScratchControl/expression/BooleanExpressionHolder.xaml b/src/ScratchControl/expression/BooleanExpressionHolder.xaml similarity index 100% rename from ScratchControl/expression/BooleanExpressionHolder.xaml rename to src/ScratchControl/expression/BooleanExpressionHolder.xaml diff --git a/ScratchControl/expression/BooleanExpressionHolder.xaml.cs b/src/ScratchControl/expression/BooleanExpressionHolder.xaml.cs similarity index 100% rename from ScratchControl/expression/BooleanExpressionHolder.xaml.cs rename to src/ScratchControl/expression/BooleanExpressionHolder.xaml.cs diff --git a/ScratchControl/expression/ExpressionControl.cs b/src/ScratchControl/expression/ExpressionControl.cs similarity index 100% rename from ScratchControl/expression/ExpressionControl.cs rename to src/ScratchControl/expression/ExpressionControl.cs diff --git a/ScratchControl/expression/ExpressionHelper.cs b/src/ScratchControl/expression/ExpressionHelper.cs similarity index 100% rename from ScratchControl/expression/ExpressionHelper.cs rename to src/ScratchControl/expression/ExpressionHelper.cs diff --git a/ScratchControl/expression/ExpressionHolder.cs b/src/ScratchControl/expression/ExpressionHolder.cs similarity index 100% rename from ScratchControl/expression/ExpressionHolder.cs rename to src/ScratchControl/expression/ExpressionHolder.cs diff --git a/ScratchControl/expression/NumberExpressionControl.xaml b/src/ScratchControl/expression/NumberExpressionControl.xaml similarity index 100% rename from ScratchControl/expression/NumberExpressionControl.xaml rename to src/ScratchControl/expression/NumberExpressionControl.xaml diff --git a/ScratchControl/expression/NumberExpressionControl.xaml.cs b/src/ScratchControl/expression/NumberExpressionControl.xaml.cs similarity index 100% rename from ScratchControl/expression/NumberExpressionControl.xaml.cs rename to src/ScratchControl/expression/NumberExpressionControl.xaml.cs diff --git a/ScratchControl/expression/NumberExpressionHolder.xaml b/src/ScratchControl/expression/NumberExpressionHolder.xaml similarity index 100% rename from ScratchControl/expression/NumberExpressionHolder.xaml rename to src/ScratchControl/expression/NumberExpressionHolder.xaml diff --git a/ScratchControl/expression/NumberExpressionHolder.xaml.cs b/src/ScratchControl/expression/NumberExpressionHolder.xaml.cs similarity index 100% rename from ScratchControl/expression/NumberExpressionHolder.xaml.cs rename to src/ScratchControl/expression/NumberExpressionHolder.xaml.cs diff --git a/ScratchControl/expression/ObjectExpressionControl.xaml b/src/ScratchControl/expression/ObjectExpressionControl.xaml similarity index 100% rename from ScratchControl/expression/ObjectExpressionControl.xaml rename to src/ScratchControl/expression/ObjectExpressionControl.xaml diff --git a/ScratchControl/expression/ObjectExpressionControl.xaml.cs b/src/ScratchControl/expression/ObjectExpressionControl.xaml.cs similarity index 100% rename from ScratchControl/expression/ObjectExpressionControl.xaml.cs rename to src/ScratchControl/expression/ObjectExpressionControl.xaml.cs diff --git a/ScratchControl/expression/SelectionItemControl.xaml b/src/ScratchControl/expression/SelectionItemControl.xaml similarity index 100% rename from ScratchControl/expression/SelectionItemControl.xaml rename to src/ScratchControl/expression/SelectionItemControl.xaml diff --git a/ScratchControl/expression/SelectionItemControl.xaml.cs b/src/ScratchControl/expression/SelectionItemControl.xaml.cs similarity index 100% rename from ScratchControl/expression/SelectionItemControl.xaml.cs rename to src/ScratchControl/expression/SelectionItemControl.xaml.cs diff --git a/ScratchControl/global/GlobalResource.cs b/src/ScratchControl/global/GlobalResource.cs similarity index 100% rename from ScratchControl/global/GlobalResource.cs rename to src/ScratchControl/global/GlobalResource.cs diff --git a/ScratchEditor/ActualSizeAdjustment.cs b/src/ScratchEditor/ActualSizeAdjustment.cs similarity index 100% rename from ScratchEditor/ActualSizeAdjustment.cs rename to src/ScratchEditor/ActualSizeAdjustment.cs diff --git a/ScratchEditor/BlockIndicator.xaml b/src/ScratchEditor/BlockIndicator.xaml similarity index 100% rename from ScratchEditor/BlockIndicator.xaml rename to src/ScratchEditor/BlockIndicator.xaml diff --git a/ScratchEditor/BlockIndicator.xaml.cs b/src/ScratchEditor/BlockIndicator.xaml.cs similarity index 100% rename from ScratchEditor/BlockIndicator.xaml.cs rename to src/ScratchEditor/BlockIndicator.xaml.cs diff --git a/ScratchEditor/BlockStatementControl.xaml b/src/ScratchEditor/BlockStatementControl.xaml similarity index 100% rename from ScratchEditor/BlockStatementControl.xaml rename to src/ScratchEditor/BlockStatementControl.xaml diff --git a/ScratchEditor/BlockStatementControl.xaml.cs b/src/ScratchEditor/BlockStatementControl.xaml.cs similarity index 100% rename from ScratchEditor/BlockStatementControl.xaml.cs rename to src/ScratchEditor/BlockStatementControl.xaml.cs diff --git a/ScratchEditor/CreateFunctionDlg.xaml b/src/ScratchEditor/CreateFunctionDlg.xaml similarity index 100% rename from ScratchEditor/CreateFunctionDlg.xaml rename to src/ScratchEditor/CreateFunctionDlg.xaml diff --git a/ScratchEditor/CreateFunctionDlg.xaml.cs b/src/ScratchEditor/CreateFunctionDlg.xaml.cs similarity index 100% rename from ScratchEditor/CreateFunctionDlg.xaml.cs rename to src/ScratchEditor/CreateFunctionDlg.xaml.cs diff --git a/ScratchEditor/ExpressionControl.xaml b/src/ScratchEditor/ExpressionControl.xaml similarity index 100% rename from ScratchEditor/ExpressionControl.xaml rename to src/ScratchEditor/ExpressionControl.xaml diff --git a/ScratchEditor/ExpressionControl.xaml.cs b/src/ScratchEditor/ExpressionControl.xaml.cs similarity index 83% rename from ScratchEditor/ExpressionControl.xaml.cs rename to src/ScratchEditor/ExpressionControl.xaml.cs index 7d12153..889769e 100644 --- a/ScratchEditor/ExpressionControl.xaml.cs +++ b/src/ScratchEditor/ExpressionControl.xaml.cs @@ -1,9 +1,12 @@ -using System; +using ScratchEditor; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -19,7 +22,7 @@ namespace ScratchNet /// /// Interaction logic for ExpressionControl.xaml /// - public partial class ExpressionControl : UserControl + public partial class ExpressionControl : UserControl, IErrorHighlight { public ExpressionControl() { @@ -66,7 +69,15 @@ private void OnExprCtrlDragOver(object sender, DragEventArgs e) e.Handled = true; } } + public void HighlightError() + { + HighlightHelper.HighlightError(this); + } + public void ClearHighlightError() + { + HighlightHelper.ClearHighlightError(); + } } } diff --git a/ScratchEditor/FunctionControl.xaml b/src/ScratchEditor/FunctionControl.xaml similarity index 100% rename from ScratchEditor/FunctionControl.xaml rename to src/ScratchEditor/FunctionControl.xaml diff --git a/ScratchEditor/FunctionControl.xaml.cs b/src/ScratchEditor/FunctionControl.xaml.cs similarity index 100% rename from ScratchEditor/FunctionControl.xaml.cs rename to src/ScratchEditor/FunctionControl.xaml.cs diff --git a/ScratchEditor/GraphicScriptEditor.xaml b/src/ScratchEditor/GraphicScriptEditor.xaml similarity index 100% rename from ScratchEditor/GraphicScriptEditor.xaml rename to src/ScratchEditor/GraphicScriptEditor.xaml diff --git a/ScratchEditor/GraphicScriptEditor.xaml.cs b/src/ScratchEditor/GraphicScriptEditor.xaml.cs similarity index 98% rename from ScratchEditor/GraphicScriptEditor.xaml.cs rename to src/ScratchEditor/GraphicScriptEditor.xaml.cs index 9316918..385b6f7 100644 --- a/ScratchEditor/GraphicScriptEditor.xaml.cs +++ b/src/ScratchEditor/GraphicScriptEditor.xaml.cs @@ -51,6 +51,15 @@ public GraphicScriptEditor() functionGroup = null; } + public INode FindParent(INode node) + { + return Utility.FindParents(Script, node); + } + public Control FindEditorFor(INode node) + { + return Utility.FindControl(this.ScriptBoard, node); + } + public void SetToolBar(List groups) { GenerateGroupList(groups); @@ -199,12 +208,16 @@ void AddFunctionCallStatement(Function func) { ScriptStepGroup item = CreateFunctionButton.Tag as ScriptStepGroup; CallStatement callFunc = new CallStatement() { Function = func.Name, FunctionNameFormat = func.Format }; + CallExpression callExp = new CallExpression() { Function = func.Name, FunctionNameFormat = func.Format }; foreach (Parameter p in func.Params) { callFunc.ArgTyps.Add(p.Type); callFunc.Args.Add(null); + callExp.ArgTyps.Add(p.Type); + callExp.Args.Add(null); } item.Types.Insert(1, callFunc); + item.Types.Insert(1, callExp); } void CreateFunctionButton_Click(object sender, RoutedEventArgs e) { @@ -735,6 +748,7 @@ bool CallCommandInObject(string func, object script) } private bool CanDrop(string targetType, string sourceType) { + return true; if (targetType == null || sourceType == null) return true; string[] targets = targetType.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); @@ -880,6 +894,15 @@ private void OnGlobalMouseButtonEventHandler(object sender, MouseButtonEventArgs break; } } + if (obj is CallExpression) + { + CallExpression cfs = obj as CallExpression; + if (cfs.Function == func.Name) + { + functionGroup.Types.Remove(cfs); + break; + } + } } } foreach (object obj in StepList.Children) diff --git a/src/ScratchEditor/IErrorHighlight.cs b/src/ScratchEditor/IErrorHighlight.cs new file mode 100644 index 0000000..c863e2d --- /dev/null +++ b/src/ScratchEditor/IErrorHighlight.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace ScratchNet +{ + public interface IErrorHighlight + { + void HighlightError(); + void ClearHighlightError(); + } + public class HighlightHelper + { + static Brush c; + static bool hightLight = true; + static int maxHightTime = 30; + static Task hightTask; + static Control currentControl; + public static void HighlightError(Control control) + { + if(hightTask!=null && !hightTask.IsCompleted) + { + hightLight = false; + hightTask.Wait(); + } + c = control.Background; + hightLight = true; + currentControl = control; + hightTask=Task.Run(() => + { + DateTime timeout = DateTime.Now.AddSeconds(maxHightTime); + while (hightLight) + { + + Application.Current.Dispatcher.InvokeAsync(() => + { + currentControl.Background = new SolidColorBrush(Colors.Red); + }); + Thread.Sleep(300); + + Application.Current.Dispatcher.InvokeAsync(() => + { + currentControl.Background = c; + }); + Thread.Sleep(500); + if (DateTime.Now > timeout) + return; + } + }); + } + + public static void ClearHighlightError() + { + hightLight = false; + } + } +} diff --git a/ScratchEditor/ParameterIndicator.xaml b/src/ScratchEditor/ParameterIndicator.xaml similarity index 100% rename from ScratchEditor/ParameterIndicator.xaml rename to src/ScratchEditor/ParameterIndicator.xaml diff --git a/ScratchEditor/ParameterIndicator.xaml.cs b/src/ScratchEditor/ParameterIndicator.xaml.cs similarity index 100% rename from ScratchEditor/ParameterIndicator.xaml.cs rename to src/ScratchEditor/ParameterIndicator.xaml.cs diff --git a/ScratchEditor/Properties/AssemblyInfo.cs b/src/ScratchEditor/Properties/AssemblyInfo.cs similarity index 100% rename from ScratchEditor/Properties/AssemblyInfo.cs rename to src/ScratchEditor/Properties/AssemblyInfo.cs diff --git a/ScratchEditor/Properties/Resources.Designer.cs b/src/ScratchEditor/Properties/Resources.Designer.cs similarity index 100% rename from ScratchEditor/Properties/Resources.Designer.cs rename to src/ScratchEditor/Properties/Resources.Designer.cs diff --git a/ScratchEditor/Properties/Resources.resx b/src/ScratchEditor/Properties/Resources.resx similarity index 100% rename from ScratchEditor/Properties/Resources.resx rename to src/ScratchEditor/Properties/Resources.resx diff --git a/ScratchEditor/Properties/Settings.Designer.cs b/src/ScratchEditor/Properties/Settings.Designer.cs similarity index 100% rename from ScratchEditor/Properties/Settings.Designer.cs rename to src/ScratchEditor/Properties/Settings.Designer.cs diff --git a/ScratchNet/Properties/Settings.settings b/src/ScratchEditor/Properties/Settings.settings similarity index 100% rename from ScratchNet/Properties/Settings.settings rename to src/ScratchEditor/Properties/Settings.settings diff --git a/ScratchEditor/Properties/colors.txt b/src/ScratchEditor/Properties/colors.txt similarity index 100% rename from ScratchEditor/Properties/colors.txt rename to src/ScratchEditor/Properties/colors.txt diff --git a/ScratchEditor/ScriptControlDataTemplateSelector.cs b/src/ScratchEditor/ScriptControlDataTemplateSelector.cs similarity index 100% rename from ScratchEditor/ScriptControlDataTemplateSelector.cs rename to src/ScratchEditor/ScriptControlDataTemplateSelector.cs diff --git a/ScratchEditor/ScriptEditor.csproj b/src/ScratchEditor/ScriptEditor.csproj similarity index 98% rename from ScratchEditor/ScriptEditor.csproj rename to src/ScratchEditor/ScriptEditor.csproj index b078ebe..1e1b516 100644 --- a/ScratchEditor/ScriptEditor.csproj +++ b/src/ScratchEditor/ScriptEditor.csproj @@ -90,6 +90,7 @@ GraphicScriptEditor.xaml + True @@ -156,7 +157,7 @@ - + {7006ac9f-d218-4d7b-98eb-5d2d91f69c57} FontAwesome.WPF diff --git a/ScratchEditor/SetVariableNameDialog.xaml b/src/ScratchEditor/SetVariableNameDialog.xaml similarity index 100% rename from ScratchEditor/SetVariableNameDialog.xaml rename to src/ScratchEditor/SetVariableNameDialog.xaml diff --git a/ScratchEditor/SetVariableNameDialog.xaml.cs b/src/ScratchEditor/SetVariableNameDialog.xaml.cs similarity index 100% rename from ScratchEditor/SetVariableNameDialog.xaml.cs rename to src/ScratchEditor/SetVariableNameDialog.xaml.cs diff --git a/ScratchEditor/StatementControl.xaml b/src/ScratchEditor/StatementControl.xaml similarity index 99% rename from ScratchEditor/StatementControl.xaml rename to src/ScratchEditor/StatementControl.xaml index d26b004..1fd4be9 100644 --- a/ScratchEditor/StatementControl.xaml +++ b/src/ScratchEditor/StatementControl.xaml @@ -234,7 +234,7 @@ - + @@ -346,7 +346,7 @@ - + /// Interaction logic for StatementControl.xaml /// - public partial class StatementControl : UserControl, ActualSizeAdjustment + public partial class StatementControl : UserControl, ActualSizeAdjustment, IErrorHighlight { public StatementControl() { @@ -89,6 +91,15 @@ public bool HoverOnBottom this.SetValue(HoverOnBottomProperty, value); } } + public void HighlightError() + { + HighlightHelper.HighlightError(this); + } + + public void ClearHighlightError() + { + HighlightHelper.ClearHighlightError(); + } } } diff --git a/ScratchEditor/TextBoxExpressionHolder.xaml b/src/ScratchEditor/TextBoxExpressionHolder.xaml similarity index 100% rename from ScratchEditor/TextBoxExpressionHolder.xaml rename to src/ScratchEditor/TextBoxExpressionHolder.xaml diff --git a/ScratchEditor/TextBoxExpressionHolder.xaml.cs b/src/ScratchEditor/TextBoxExpressionHolder.xaml.cs similarity index 89% rename from ScratchEditor/TextBoxExpressionHolder.xaml.cs rename to src/ScratchEditor/TextBoxExpressionHolder.xaml.cs index 0aaaf0d..5c7b465 100644 --- a/ScratchEditor/TextBoxExpressionHolder.xaml.cs +++ b/src/ScratchEditor/TextBoxExpressionHolder.xaml.cs @@ -1,8 +1,11 @@ -using System; +using ScratchEditor; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -18,7 +21,7 @@ namespace ScratchNet /// /// Interaction logic for TextBoxExpressionHolder.xaml /// - public partial class TextBoxExpressionHolder : UserControl + public partial class TextBoxExpressionHolder : UserControl, IErrorHighlight { public TextBoxExpressionHolder() { @@ -104,5 +107,14 @@ private void TextBoxHolder_PreviewTextInput(object sender, TextCompositionEventA e.Handled = !IsTextAllowed(e.Text); } } + public void HighlightError() + { + HighlightHelper.HighlightError(this); + } + + public void ClearHighlightError() + { + HighlightHelper.ClearHighlightError(); + } } } diff --git a/ScratchEditor/control/CurrentEnviroment.cs b/src/ScratchEditor/control/CurrentEnviroment.cs similarity index 100% rename from ScratchEditor/control/CurrentEnviroment.cs rename to src/ScratchEditor/control/CurrentEnviroment.cs diff --git a/ScratchEditor/control/ScriptStepGroup.cs b/src/ScratchEditor/control/ScriptStepGroup.cs similarity index 100% rename from ScratchEditor/control/ScriptStepGroup.cs rename to src/ScratchEditor/control/ScriptStepGroup.cs diff --git a/ScratchNet/convertor/ActualWidthMinusConverter.cs b/src/ScratchEditor/convertor/ActualWidthMinusConverter.cs similarity index 100% rename from ScratchNet/convertor/ActualWidthMinusConverter.cs rename to src/ScratchEditor/convertor/ActualWidthMinusConverter.cs diff --git a/ScratchNet/convertor/ActualWidthMinusConverter2.cs b/src/ScratchEditor/convertor/ActualWidthMinusConverter2.cs similarity index 100% rename from ScratchNet/convertor/ActualWidthMinusConverter2.cs rename to src/ScratchEditor/convertor/ActualWidthMinusConverter2.cs diff --git a/ScratchEditor/convertor/BooleanVisiblityConverter.cs b/src/ScratchEditor/convertor/BooleanVisiblityConverter.cs similarity index 100% rename from ScratchEditor/convertor/BooleanVisiblityConverter.cs rename to src/ScratchEditor/convertor/BooleanVisiblityConverter.cs diff --git a/ScratchEditor/convertor/CanBooleanConverter.cs b/src/ScratchEditor/convertor/CanBooleanConverter.cs similarity index 100% rename from ScratchEditor/convertor/CanBooleanConverter.cs rename to src/ScratchEditor/convertor/CanBooleanConverter.cs diff --git a/ScratchEditor/convertor/EventHandlerVisibilityConverter.cs b/src/ScratchEditor/convertor/EventHandlerVisibilityConverter.cs similarity index 100% rename from ScratchEditor/convertor/EventHandlerVisibilityConverter.cs rename to src/ScratchEditor/convertor/EventHandlerVisibilityConverter.cs diff --git a/ScratchEditor/convertor/ExpressionBarBackground.cs b/src/ScratchEditor/convertor/ExpressionBarBackground.cs similarity index 100% rename from ScratchEditor/convertor/ExpressionBarBackground.cs rename to src/ScratchEditor/convertor/ExpressionBarBackground.cs diff --git a/ScratchEditor/convertor/ExpressionHolderBorderConverter.cs b/src/ScratchEditor/convertor/ExpressionHolderBorderConverter.cs similarity index 100% rename from ScratchEditor/convertor/ExpressionHolderBorderConverter.cs rename to src/ScratchEditor/convertor/ExpressionHolderBorderConverter.cs diff --git a/ScratchEditor/convertor/ImageConverter.cs b/src/ScratchEditor/convertor/ImageConverter.cs similarity index 100% rename from ScratchEditor/convertor/ImageConverter.cs rename to src/ScratchEditor/convertor/ImageConverter.cs diff --git a/ScratchEditor/convertor/IsExpressionConverter.cs b/src/ScratchEditor/convertor/IsExpressionConverter.cs similarity index 100% rename from ScratchEditor/convertor/IsExpressionConverter.cs rename to src/ScratchEditor/convertor/IsExpressionConverter.cs diff --git a/ScratchEditor/convertor/IsNullVisibilityConverter.cs b/src/ScratchEditor/convertor/IsNullVisibilityConverter.cs similarity index 100% rename from ScratchEditor/convertor/IsNullVisibilityConverter.cs rename to src/ScratchEditor/convertor/IsNullVisibilityConverter.cs diff --git a/ScratchNet/convertor/ScriptContainerWidthConverter.cs b/src/ScratchEditor/convertor/ScriptContainerWidthConverter.cs similarity index 100% rename from ScratchNet/convertor/ScriptContainerWidthConverter.cs rename to src/ScratchEditor/convertor/ScriptContainerWidthConverter.cs diff --git a/ScratchEditor/convertor/StringLiteralConverter.cs b/src/ScratchEditor/convertor/StringLiteralConverter.cs similarity index 100% rename from ScratchEditor/convertor/StringLiteralConverter.cs rename to src/ScratchEditor/convertor/StringLiteralConverter.cs diff --git a/ScratchEditor/convertor/TextNotEmptyConverter.cs b/src/ScratchEditor/convertor/TextNotEmptyConverter.cs similarity index 100% rename from ScratchEditor/convertor/TextNotEmptyConverter.cs rename to src/ScratchEditor/convertor/TextNotEmptyConverter.cs diff --git a/ScratchEditor/images/delete-512.png b/src/ScratchEditor/images/delete-512.png similarity index 100% rename from ScratchEditor/images/delete-512.png rename to src/ScratchEditor/images/delete-512.png diff --git a/ScratchEditor/localization/Localize.cs b/src/ScratchEditor/localization/Localize.cs similarity index 100% rename from ScratchEditor/localization/Localize.cs rename to src/ScratchEditor/localization/Localize.cs diff --git a/ScratchEditor/localization/Strings.Designer.cs b/src/ScratchEditor/localization/Strings.Designer.cs similarity index 100% rename from ScratchEditor/localization/Strings.Designer.cs rename to src/ScratchEditor/localization/Strings.Designer.cs diff --git a/ScratchNet/localization/Strings.ja-JP.Designer.cs b/src/ScratchEditor/localization/Strings.ja-JP.Designer.cs similarity index 100% rename from ScratchNet/localization/Strings.ja-JP.Designer.cs rename to src/ScratchEditor/localization/Strings.ja-JP.Designer.cs diff --git a/ScratchEditor/localization/Strings.ja-JP.resx b/src/ScratchEditor/localization/Strings.ja-JP.resx similarity index 100% rename from ScratchEditor/localization/Strings.ja-JP.resx rename to src/ScratchEditor/localization/Strings.ja-JP.resx diff --git a/ScratchEditor/localization/Strings.resx b/src/ScratchEditor/localization/Strings.resx similarity index 100% rename from ScratchEditor/localization/Strings.resx rename to src/ScratchEditor/localization/Strings.resx diff --git a/ScratchNet/localization/Strings.zh-CN.Designer.cs b/src/ScratchEditor/localization/Strings.zh-CN.Designer.cs similarity index 100% rename from ScratchNet/localization/Strings.zh-CN.Designer.cs rename to src/ScratchEditor/localization/Strings.zh-CN.Designer.cs diff --git a/ScratchEditor/localization/Strings.zh-CN.resx b/src/ScratchEditor/localization/Strings.zh-CN.resx similarity index 100% rename from ScratchEditor/localization/Strings.zh-CN.resx rename to src/ScratchEditor/localization/Strings.zh-CN.resx diff --git a/ScratchEditor/util/Utility.cs b/src/ScratchEditor/util/Utility.cs similarity index 76% rename from ScratchEditor/util/Utility.cs rename to src/ScratchEditor/util/Utility.cs index b593f2d..60fe994 100644 --- a/ScratchEditor/util/Utility.cs +++ b/src/ScratchEditor/util/Utility.cs @@ -6,13 +6,140 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; using System.Windows.Media; namespace ScratchNet { class Utility { - + + public static INode FindParents(Class script, INode node) + { + foreach (var f in script.Functions) + { + if (f.Equals(node)) + return f; + var p = FindParentsNode(f, node); + if (p != null) + return p; + } + + return null; + } + public static INode FindParentsNode(INode container, INode node) + { + PropertyInfo[] pinfo = container.GetType().GetProperties(); + foreach(var p in pinfo) + { + if (!p.CanWrite || !p.CanRead) + continue; + var value = p.GetValue(container); + if(value is INode) + { + if (value.Equals(node)) + return container; + var f = FindParentsNode(value as INode, node); + if (f != null) + return f; + } + if (value is BlockStatement) + { + foreach (var px in ((BlockStatement)value).Body) + { + if (px.Equals(node)) + return container; + var f = FindParentsNode(px as INode, node); + if (f != null) + return f; + } + } + } + return null; + } + public static Control FindControl(FrameworkElement depObj, INode node) + { + List elements = new List(); + elements.Add(depObj as FrameworkElement); + do + { + FrameworkElement current = elements[0]; + elements.RemoveAt(0); + if (current == null) + { + continue; + } + /* + if(current is TextBox) + { + if (current.Visibility != Visibility.Visible) + continue; + TextBoxExpressionHolder txt = current.DataContext as TextBoxExpressionHolder; + if (txt != null) + { + ExpressionDescriptor d = txt.ExpressionDescriptor; + if (d != null) + { + try + { + var m = d.Source.GetType().GetProperty(d.Name).GetValue(d.Source); + if (node.Equals(m)) + return current as Control; + } + catch { } + } + } + } + */ + if(current is TextBoxExpressionHolder) + { + if (current.Visibility != Visibility.Visible) + continue; + TextBoxExpressionHolder txt = current as TextBoxExpressionHolder; + if (txt != null) + { + ExpressionDescriptor d = txt.ExpressionDescriptor; + if (d != null) + { + try + { + var m = d.Source.GetType().GetProperty(d.Name).GetValue(d.Source); + if (node.Equals(m)) + return current as Control; + } + catch { } + } + } + } + if(current is FunctionControl) + { + INode value = (current as FunctionControl).Function; + if (node.Equals(value)) + return current as Control; + } + else if(current is StatementControl) + { + INode value = (current as StatementControl).Statement; + if (node.Equals(value)) + return current as Control; + } + else if(current is ExpressionControl) + { + INode value = (current as ExpressionControl).Expression; + if (value is Literal) + Console.WriteLine(current); + if (node.Equals(value)) + return current as Control; + } + + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(current); i++) + { + FrameworkElement child = VisualTreeHelper.GetChild(current, i) as FrameworkElement; + elements.Add(child); + } + } while (elements.Count > 0); + return null; + } public static T GetChildAtPoint(DependencyObject depObj, Point pt, out Rect region, DependencyObject excludObject = null) diff --git a/ScriptEngine/Properties/AssemblyInfo.cs b/src/ScriptEngine/Properties/AssemblyInfo.cs similarity index 100% rename from ScriptEngine/Properties/AssemblyInfo.cs rename to src/ScriptEngine/Properties/AssemblyInfo.cs diff --git a/ScriptEngine/Properties/Resources.Designer.cs b/src/ScriptEngine/Properties/Resources.Designer.cs similarity index 100% rename from ScriptEngine/Properties/Resources.Designer.cs rename to src/ScriptEngine/Properties/Resources.Designer.cs diff --git a/ScriptEngine/Properties/Resources.ja-JP.resx b/src/ScriptEngine/Properties/Resources.ja-JP.resx similarity index 100% rename from ScriptEngine/Properties/Resources.ja-JP.resx rename to src/ScriptEngine/Properties/Resources.ja-JP.resx diff --git a/ScriptEngine/Properties/Resources.resx b/src/ScriptEngine/Properties/Resources.resx similarity index 100% rename from ScriptEngine/Properties/Resources.resx rename to src/ScriptEngine/Properties/Resources.resx diff --git a/ScriptEngine/Properties/Resources.zh-CN.resx b/src/ScriptEngine/Properties/Resources.zh-CN.resx similarity index 100% rename from ScriptEngine/Properties/Resources.zh-CN.resx rename to src/ScriptEngine/Properties/Resources.zh-CN.resx diff --git a/ScriptEngine/ScriptEngine.csproj b/src/ScriptEngine/ScriptEngine.csproj similarity index 89% rename from ScriptEngine/ScriptEngine.csproj rename to src/ScriptEngine/ScriptEngine.csproj index a6b4687..16da822 100644 --- a/ScriptEngine/ScriptEngine.csproj +++ b/src/ScriptEngine/ScriptEngine.csproj @@ -43,7 +43,14 @@ - + + + + + + + + True @@ -62,12 +69,12 @@ - + - + @@ -82,20 +89,21 @@ - - + - + + + diff --git a/src/ScriptEngine/execute/Completion.cs b/src/ScriptEngine/execute/Completion.cs new file mode 100644 index 0000000..640f383 --- /dev/null +++ b/src/ScriptEngine/execute/Completion.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public enum CompletionType + { + Value, + Continue, + Break, + Return, + Exception + } + public class Completion + { + public static Completion Void = new Completion(); + public static Completion Exception(object value, INode location) + { + return new Completion(value, CompletionType.Exception) { Location = location }; + } + public Completion() + { + ReturnValue = null; + } + public Completion(object value) + { + ReturnValue = value; + } + public Completion(object value, CompletionType type) + { + ReturnValue = value; + Type = type; + } + public Completion(object value, CompletionType type, INode location) + { + ReturnValue = value; + Type = type; + Location = location; + } + public INode Location { get; internal set; } = null; + public CompletionType Type { get; internal set; } = CompletionType.Value; + public object ReturnValue { get; internal set; } = null; + + } +} diff --git a/src/ScriptEngine/execute/Delegate.cs b/src/ScriptEngine/execute/Delegate.cs new file mode 100644 index 0000000..4700c80 --- /dev/null +++ b/src/ScriptEngine/execute/Delegate.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class DelegateFunction + { + // + // Summary: + // Gets the method represented by the delegate. + // + // Returns: + // A System.Reflection.MethodInfo describing the method represented by the delegate. + // + // Exceptions: + // T:System.MemberAccessException: + // The caller does not have access to the method represented by the delegate (for + // example, if the method is private). + public MethodInfo Method { get; } + // + // Summary: + // Gets the class instance on which the current delegate invokes the instance method. + // + // Returns: + // The object on which the current delegate invokes the instance method, if the + // delegate represents an instance method; null if the delegate represents a static + // method. + public object Target { get; } + DelegateFunction(object target, MethodInfo method) + { + Target = target; + Method = method; + } + public static DelegateFunction CreateDelegate(object target, string method) + { + MethodInfo m = target.GetType().GetMethod(method); + + if(m!=null) + return new DelegateFunction(target, m); + return null; + } + public static DelegateFunction CreateDelegate(object target, string method, bool ignoreCase = false) + { + MethodInfo[] ms = target.GetType().GetMethods(); + foreach (var m in ms) + { + if (ignoreCase) + { + if(m.Name.Equals(method, StringComparison.OrdinalIgnoreCase)) + return new DelegateFunction(target, m); + } + else + { + if (m.Name.Equals(method)) + return new DelegateFunction(target, m); + } + } + return null; + } + public object Invoke(params object[] parameters) + { + return Method.Invoke(Target, parameters); + } + } +} diff --git a/src/ScriptEngine/execute/ExcutionEnvironment.cs b/src/ScriptEngine/execute/ExcutionEnvironment.cs new file mode 100644 index 0000000..5939d7c --- /dev/null +++ b/src/ScriptEngine/execute/ExcutionEnvironment.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public delegate void ExecutionEnvironmentEventHandler(object engine, T arg); + public class ExecutionEnvironment + { + public event ExecutionEnvironmentEventHandler ExecutionCompleted; + public event ExecutionEnvironmentEventHandler ExecutionStarted; + public event ExecutionEnvironmentEventHandler ExecutionAborted; + public bool IsCompleted { get; internal set; } = false; + + ExecutionEnvironment _parent=null; + Class _current; + public int Level + { + get + { + int level = 1; + ExecutionEnvironment p = this; ; + while ((p = p.Parent) != null) + level++; + return level; + } + } + public ExecutionEnvironment Parent + { + get + { + return _parent; + } + } + public Class Module + { + get + { + if (_current != null) + return _current; + if (Parent != null) + { + return Parent.Module; + } + return null; + } + } + public void ExecuteAsync(Class m) + { + new Thread(() => + { + Execute(m); + }).Start(); + } + public Completion Execute(Class m) + { + _current = m; + if (_current == null) + return null; + Completion c = Completion.Void; + foreach (var func in _current.Functions) + { + if ("main".Equals(func.Format, StringComparison.OrdinalIgnoreCase)) + { + foreach(var v in _current.Variables) + { + RegisterValue(v.Name, v.Value); + } + var parameter = func.Params; + ExecutionEnvironment current = new ExecutionEnvironment(this); + ExecutionStarted?.Invoke(this, null); + foreach(var p in parameter) + { + current.RegisterValue(p.Name, null); + } + try + { + IsCompleted = false; + c=func.Execute(current); + break; + }catch(Exception e) + { + IsCompleted = true; + Console.WriteLine(e.Message); + Console.WriteLine(e.StackTrace); + ExecutionAborted?.Invoke(this, new Completion(e.Message, CompletionType.Exception)); + return Completion.Void; + + } + } + } + IsCompleted = true; + if (c.Type == CompletionType.Value) + ExecutionCompleted?.Invoke(this, c); + else if (c.Type == CompletionType.Exception) + ExecutionAborted?.Invoke(this, c); + else + ExecutionAborted?.Invoke(this, Completion.Exception("Unknown exception", null)); + return c; + } + + public ExecutionEnvironment() + { + _parent = null; + } + public ExecutionEnvironment(ExecutionEnvironment parent) + { + _parent = parent; + } + public void Dump(StreamWriter writer) + { + writer.WriteLine("Environment level " + Level); + foreach (var key in currentVariables.Keys) + { + object value = currentVariables[key]; + writer.WriteLine("{0}={1} type={2}", key, value, value == null ? "Null" : value.GetType().ToString()); + } + if (Parent != null) + { + Parent.Dump(writer); + } + } + Dictionary currentVariables = new Dictionary(); + Dictionary currentFunctions = new Dictionary(); + Dictionary currentModules = new Dictionary(); + + public DelegateFunction GetFunction(string name) + { + if (currentFunctions.ContainsKey(name)) + return currentFunctions[name]; + if (_parent != null) + return _parent.GetFunction(name); + return null; + } + public void RegisterFunction(string name, DelegateFunction func) + { + currentFunctions[name] = func; + } + public bool HasFunction(string name) + { + if (currentVariables.ContainsKey(name)) + return true; + if (_parent != null) + return _parent.HasFunction(name); + return false; + } + public bool HasValue(string variable) + { + if (currentVariables.ContainsKey(variable)) + return true; + if (_parent != null) + return _parent.HasValue(variable); + return false; + } + public void RegisterValue(string variable, object value) + { + currentVariables[variable]=value; + } + /// + /// get function and variable value + /// + /// + /// + public object GetValue(string variable) + { + if (currentVariables.ContainsKey(variable)) + { + return currentVariables[variable]; + } + if (_parent != null) + return _parent.GetValue(variable); + return null; + } + public T GetValue(string variable) + { + object value = GetValue(variable); + if (value == null) + { + return default(T); + } + return TypeConverters.GetValue(value); + + } + public void SetValue(string variable, object value) + { + if (currentVariables.ContainsKey(variable)) + { + currentVariables[variable] = value; + return; + } + if (_parent != null) + { + _parent.SetValue(variable, value); + return; + } + currentVariables[variable]=value; + } + } +} diff --git a/src/ScriptEngine/execute/Execution.cs b/src/ScriptEngine/execute/Execution.cs new file mode 100644 index 0000000..cbd597d --- /dev/null +++ b/src/ScriptEngine/execute/Execution.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + //用于定义如何执行 + public interface Execution + { + Completion Execute(ExecutionEnvironment enviroment); + } +} diff --git a/src/ScriptEngine/execute/ScriptValue.cs b/src/ScriptEngine/execute/ScriptValue.cs new file mode 100644 index 0000000..f1da27c --- /dev/null +++ b/src/ScriptEngine/execute/ScriptValue.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class ScriptValue + { + public Type Type { get; internal set; } + object value; + public object Value + { + get + { + return value; + } + } + public T GetValue() + { + TypeConverter tc = TypeDescriptor.GetConverter(typeof(T)); + if (tc.CanConvertFrom(Type)) + return (T)tc.ConvertFrom(value); + else + { + TypeConverter tc2 = TypeDescriptor.GetConverter(Type); + if (tc.CanConvertTo(typeof(T))) + return (T)tc2.ConvertTo(value, typeof(T)); + else + try + { + return (T)tc.ConvertFromString(tc2.ConvertToString(value)); + } + catch { } + } + throw new NotSupportedException(string.Format("can not convert {0} to {1}", Type, typeof(T))); + + } + public object GetArrayValue(int index) + { + return GetArrayValue(index); + } + public T GetArrayValue(int index) + { + if (value is IList) + { + var array = value as IList; + if (array != null) + { + if (array.Count > index && index >= 0) + return (T)array[index]; + else + throw new IndexOutOfRangeException(); + } + } + throw new NotSupportedException("object in not a array"); + } + ScriptValue(object v, Type type) + { + value = v; + Type = type; + } + public static ScriptValue New(T v) + { + return new ScriptValue(v, typeof(T)); + } + } +} diff --git a/src/ScriptEngine/execute/TypeConverters.cs b/src/ScriptEngine/execute/TypeConverters.cs new file mode 100644 index 0000000..162074a --- /dev/null +++ b/src/ScriptEngine/execute/TypeConverters.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class TypeConverters + { + public static Type GetNumberTypes(object a, object b) + { + var ac = (int)(a as IConvertible).GetTypeCode(); + var bc = (int)(b as IConvertible).GetTypeCode(); + var t = (TypeCode)Math.Max(ac, bc); + switch (t) + { + case TypeCode.Int32: + return typeof(int); + case TypeCode.UInt32: + return typeof(uint); + case TypeCode.Single: + return typeof(float); + case TypeCode.Double: + return typeof(double); + case TypeCode.Decimal: + return typeof(decimal); + case TypeCode.Int16: + return typeof(short); + case TypeCode.UInt16: + return typeof(ushort); + case TypeCode.Int64: + return typeof(long); + case TypeCode.UInt64: + return typeof(ulong); + default: + return null; + } + } + public static bool IsNumber(object value) + { + if (value == null) + return false; + var c = value as IConvertible; + if (c == null) + return false; + switch (c.GetTypeCode()) + { + case TypeCode.Int32: + case TypeCode.UInt32: + case TypeCode.Single: + case TypeCode.Double: + case TypeCode.Decimal: + case TypeCode.Int16: + case TypeCode.Int64: + return true; + default: + return false; + } + + } + public static object GetValue(object value, Type T) + { + if (value == null) + { + return null; + } + if (T.Equals(value.GetType())) + return value; + TypeConverter tc = TypeDescriptor.GetConverter(T); + if (tc.CanConvertFrom(value.GetType())) + return tc.ConvertFrom(value); + else + { + TypeConverter tc2 = TypeDescriptor.GetConverter(value.GetType()); + if (tc.CanConvertTo(T)) + return tc2.ConvertTo(value, T); + else + try + { + return tc.ConvertFromString(tc2.ConvertToString(value)); + } + catch { } + } + throw new NotSupportedException(string.Format("can not convert {0} to {1}", value.GetType(), T)); + } + public static T GetValue(object value) + { + if (value == null) + { + return default(T); + } + if (typeof(T).Equals(value.GetType())) + return (T)value; + TypeConverter tc = TypeDescriptor.GetConverter(typeof(T)); + if (tc.CanConvertFrom(value.GetType())) + return (T)tc.ConvertFrom(value); + else + { + TypeConverter tc2 = TypeDescriptor.GetConverter(value.GetType()); + if (tc.CanConvertTo(typeof(T))) + return (T)tc2.ConvertTo(value, typeof(T)); + else + try + { + return (T)tc.ConvertFromString(tc2.ConvertToString(value)); + } + catch { } + } + throw new NotSupportedException(string.Format("can not convert {0} to {1}", value.GetType(), typeof(T))); + + } + } +} diff --git a/ScriptEngine/runtime/AssignmentStatement.cs b/src/ScriptEngine/runtime/AssignmentStatement.cs similarity index 50% rename from ScriptEngine/runtime/AssignmentStatement.cs rename to src/ScriptEngine/runtime/AssignmentStatement.cs index 8d60b19..40459f5 100644 --- a/ScriptEngine/runtime/AssignmentStatement.cs +++ b/src/ScriptEngine/runtime/AssignmentStatement.cs @@ -5,7 +5,7 @@ namespace ScratchNet { - public class AssignmentStatement : Statement + public class AssignmentStatement : Statement, Expression { public AssignmentStatement() { @@ -20,7 +20,24 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Right == null) + return Completion.Void; + var right = Right.Execute(enviroment); + if (right.Type != CompletionType.Value) + return right; + if (Left == null) + return right; + if(Left is Identifier) + { + enviroment.SetValue(((Identifier)Left).Variable, right.ReturnValue); + return right; + } + else + { + return new Completion("invliad format before =", CompletionType.Exception); + } + //var left = Left.Execute(enviroment); + } public Descriptor Descriptor @@ -50,47 +67,5 @@ public bool IsClosing get { return false; } } - //execution - object result; - int current = 0; - string variable; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = null; - current = 0; - variable = null; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = Right; - callback = Callback; - return false; - } - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment _env) - { - variable = (Left as Identifier).Variable; - result = value; - _env.SetValue(variable, value); - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/ExpressionStatement.cs b/src/ScriptEngine/runtime/ExpressionStatement.cs similarity index 54% rename from ScriptEngine/runtime/ExpressionStatement.cs rename to src/ScriptEngine/runtime/ExpressionStatement.cs index 5120a88..5f23cd5 100644 --- a/ScriptEngine/runtime/ExpressionStatement.cs +++ b/src/ScriptEngine/runtime/ExpressionStatement.cs @@ -14,7 +14,10 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Expression == null) + return new Completion(null); + return Expression.Execute(enviroment); + } public Descriptor Descriptor @@ -45,34 +48,5 @@ public bool IsClosing { get { return false; } } - //execution - object result; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = null; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Expression; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - result = value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/src/ScriptEngine/runtime/Identifier.cs b/src/ScriptEngine/runtime/Identifier.cs new file mode 100644 index 0000000..ffbc348 --- /dev/null +++ b/src/ScriptEngine/runtime/Identifier.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class Identifier:Expression + { + public String Variable { get; set; } + public string VarType { get; set; } + public string ReturnType + { + get { return VarType; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + var value = enviroment.GetValue(Variable); + return new Completion(value); + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, Variable)); + return desc; + } + } + + public string Type + { + get { return VarType; } + } + + } +} diff --git a/ScriptEngine/runtime/Literal.cs b/src/ScriptEngine/runtime/Literal.cs similarity index 52% rename from ScriptEngine/runtime/Literal.cs rename to src/ScriptEngine/runtime/Literal.cs index 4a5fb81..e139f38 100644 --- a/ScriptEngine/runtime/Literal.cs +++ b/src/ScriptEngine/runtime/Literal.cs @@ -14,7 +14,23 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - throw new NotImplementedException(); + if (Raw == null) + return new Completion(null); + int intValue = 0; + float floatValue = 0; + double doubleValue = 0; + Boolean b = false; + if (int.TryParse(Raw, out intValue)) + return new Completion(intValue); + if (float.TryParse(Raw, out floatValue)) + return new Completion(floatValue); + if (double.TryParse(Raw, out doubleValue)) + return new Completion(doubleValue); + if (Boolean.TryParse(Raw, out b)) + return new Completion(b); + if (Raw.StartsWith("\"") && Raw.EndsWith("\"")) + return new Completion(Raw.Substring(1, Raw.Length - 2)); + return Completion.Exception(Raw + " is not valid", this); } public Descriptor Descriptor @@ -46,32 +62,5 @@ public string Raw set; } - //execution - - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(Value); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/VariableDeclarationcs.cs b/src/ScriptEngine/runtime/VariableDeclarationcs.cs similarity index 67% rename from ScriptEngine/runtime/VariableDeclarationcs.cs rename to src/ScriptEngine/runtime/VariableDeclarationcs.cs index a8956e0..635f5a4 100644 --- a/ScriptEngine/runtime/VariableDeclarationcs.cs +++ b/src/ScriptEngine/runtime/VariableDeclarationcs.cs @@ -17,7 +17,10 @@ public object Value public Completion Execute(ExecutionEnvironment enviroment) { - throw new NotImplementedException(); + if (string.IsNullOrEmpty(Name)) + return new Completion("Variable name can not be null", CompletionType.Exception); + enviroment.RegisterValue(Name, Value); + return new Completion(Value, CompletionType.Value); } public string Name diff --git a/ScriptEngine/runtime/event/EventHandlerDelcaration.cs b/src/ScriptEngine/runtime/event/EventHandlerDelcaration.cs similarity index 73% rename from ScriptEngine/runtime/event/EventHandlerDelcaration.cs rename to src/ScriptEngine/runtime/event/EventHandlerDelcaration.cs index 6216449..7c140da 100644 --- a/ScriptEngine/runtime/event/EventHandlerDelcaration.cs +++ b/src/ScriptEngine/runtime/event/EventHandlerDelcaration.cs @@ -18,7 +18,14 @@ public EventHandlerDelcaration() public virtual Completion Execute(ExecutionEnvironment enviroment) { - throw new NotImplementedException(); + if (Body == null) + return Completion.Void; + var c = Body.Execute(enviroment); + if (c.Type == CompletionType.Value || c.Type == CompletionType.Exception) + return c; + if (c.Type == CompletionType.Return) + return new Completion(c.ReturnValue); + return Completion.Void; } public string ReturnType @@ -80,31 +87,5 @@ public string Format get; set; } - - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Body; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/exception/TryCatchStatement.cs b/src/ScriptEngine/runtime/exception/TryCatchStatement.cs similarity index 61% rename from ScriptEngine/runtime/exception/TryCatchStatement.cs rename to src/ScriptEngine/runtime/exception/TryCatchStatement.cs index c9c67ad..5f7cb01 100644 --- a/ScriptEngine/runtime/exception/TryCatchStatement.cs +++ b/src/ScriptEngine/runtime/exception/TryCatchStatement.cs @@ -25,6 +25,11 @@ public BlockStatement Catch get; set; } + public BlockStatement Finally + { + get; + set; + } public List Exception { get; @@ -36,7 +41,31 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Try == null || Try.Body.Count == 0) + return Completion.Void; + ExecutionEnvironment te = new ExecutionEnvironment(enviroment); + var c = Try.Execute(te); + if(c.Type== CompletionType.Exception) + { + if(Catch!=null && Catch.Body.Count > 0) + { + ExecutionEnvironment ee = new ExecutionEnvironment(enviroment); + c = Catch.Execute(ee); + } + } + Completion fc = Completion.Void; + if(Finally!=null && Finally.Body.Count>0) + { + ExecutionEnvironment fe = new ExecutionEnvironment(enviroment); + fc = Finally.Execute(fe); + } + if (c.Type == CompletionType.Return) + return c; + else if (c.Type == CompletionType.Value) + return fc; + if (fc.Type == CompletionType.Return) + return fc; + return c; } public Descriptor Descriptor @@ -62,6 +91,11 @@ public BlockDescriptor BlockDescriptor desc.Add(new ExpressionStatementDescription(this, "catchFunc",d)); desc.Add(new BlockStatementDescriptor(this, "Catch")); + if (Finally != null) + { + desc.Add(new TextBlockStatementDescritor(this, "Finally", "Finally")); + desc.Add(new BlockStatementDescriptor(this, "Finally")); + } return desc; } } @@ -77,61 +111,5 @@ public bool IsClosing get { return false; } } - //execution - bool hasException = false; - object exception = null; - object result; - int current = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - hasException = false; - result = null; - exception = null; - current = 0; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current==0) - { - execution = Try; ; - callback = Callback; - return true; - } - else - { - if (hasException) - { - execution = Catch; - callback = Callback; - } - else - { - execution = null; - callback = null; - } - return false; - } - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - current++; - result = value; - return null; - } - public bool HandleException(object e) - { - Console.WriteLine("exception found"); - exception = e; - hasException = true; - return true; - } } } diff --git a/ScriptEngine/runtime/flow/BreakStatement.cs b/src/ScriptEngine/runtime/flow/BreakStatement.cs similarity index 53% rename from ScriptEngine/runtime/flow/BreakStatement.cs rename to src/ScriptEngine/runtime/flow/BreakStatement.cs index 34ae6d2..21cfe20 100644 --- a/ScriptEngine/runtime/flow/BreakStatement.cs +++ b/src/ScriptEngine/runtime/flow/BreakStatement.cs @@ -5,7 +5,7 @@ namespace ScratchNet { - public class BreakStatement : Statement, Execution2 + public class BreakStatement : Statement { public BreakStatement() { @@ -16,7 +16,7 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + return new Completion(null, CompletionType.Break); } public Descriptor Descriptor @@ -46,31 +46,6 @@ public bool IsClosing { get { return true; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } } diff --git a/ScriptEngine/runtime/flow/ContinueStatement.cs b/src/ScriptEngine/runtime/flow/ContinueStatement.cs similarity index 54% rename from ScriptEngine/runtime/flow/ContinueStatement.cs rename to src/ScriptEngine/runtime/flow/ContinueStatement.cs index f788f6e..5d2e6bf 100644 --- a/ScriptEngine/runtime/flow/ContinueStatement.cs +++ b/src/ScriptEngine/runtime/flow/ContinueStatement.cs @@ -5,7 +5,7 @@ namespace ScratchNet { - public class ContinueStatement : Statement, Execution2 + public class ContinueStatement : Statement { public ContinueStatement() { @@ -16,7 +16,7 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + return new Completion(null, CompletionType.Continue); } public Descriptor Descriptor @@ -46,31 +46,5 @@ public bool IsClosing { get { return true; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/flow/ForInStatement.cs b/src/ScriptEngine/runtime/flow/ForInStatement.cs similarity index 100% rename from ScriptEngine/runtime/flow/ForInStatement.cs rename to src/ScriptEngine/runtime/flow/ForInStatement.cs diff --git a/src/ScriptEngine/runtime/flow/ForStatement.cs b/src/ScriptEngine/runtime/flow/ForStatement.cs new file mode 100644 index 0000000..e37759e --- /dev/null +++ b/src/ScriptEngine/runtime/flow/ForStatement.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class ForStatement : Loop + { + public Expression Init { get; set; } + public Expression Test { get; set; } + public Expression Update { get; set; } + public BlockStatement Body { get; set; } = new BlockStatement(); + + public string ReturnType => "any"; + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "For(")); + desc.Add(new ExpressionDescriptor(this, "Init", "number")); + desc.Add(new TextItemDescriptor(this, ";")); + desc.Add(new ExpressionDescriptor(this, "Test", "boolean")); + desc.Add(new TextItemDescriptor(this, ";")); + desc.Add(new ExpressionDescriptor(this, "Update", "number")); + desc.Add(new TextItemDescriptor(this, ")")); + return desc; + } + } + public BlockDescriptor BlockDescriptor + { + get + { + BlockDescriptor blockDescript = new BlockDescriptor(); + blockDescript.Add(new BlockStatementDescriptor(this, "Body")); + return blockDescript; + } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Init != null) + { + var c = Init.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + } + Completion cx = Completion.Void; + while (true) + { + bool next = true; + if (Test != null) + { + var c = Test.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + } + if (next) + { + var current = new ExecutionEnvironment(enviroment); + cx = Body.Execute(current); + if (cx.Type == CompletionType.Exception) + return cx; + if (cx.Type == CompletionType.Return) + return cx; + if(cx.Type== CompletionType.Break) + { + return Completion.Void; + } + if (Update != null) + { + var c = Update.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + } + } + } + } + public string Type + { + get + { + return "ForStatement"; + } + } + public bool IsClosing + { + get { return false; } + } + + } +} diff --git a/src/ScriptEngine/runtime/flow/IfStatement.cs b/src/ScriptEngine/runtime/flow/IfStatement.cs new file mode 100644 index 0000000..4fb7de8 --- /dev/null +++ b/src/ScriptEngine/runtime/flow/IfStatement.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class IfStatement : Statement + { + public IfStatement() + { + Consequent = new BlockStatement(); + } + public Expression Test { get; set; } + public BlockStatement Consequent + { + get; + set; + } + BlockStatement _alternate; + public BlockStatement Alternate { get + { + return _alternate; + } + set + { + _alternate = value; + } + } + + public string ReturnType + { + get { return "void"; } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Test == null) + return Completion.Void; + var t = Test.Execute(enviroment); + if (t.ReturnValue is bool) + { + if ((bool)t.ReturnValue) + { + if (Consequent == null) + return Completion.Void; + ExecutionEnvironment current = new ExecutionEnvironment(enviroment); + return Consequent.Execute(current); + } + else + { + if (Alternate == null) + return Completion.Void; + ExecutionEnvironment current = new ExecutionEnvironment(enviroment); + return Alternate.Execute(current); + } + } + else + return new Completion("Test return not boolean value", CompletionType.Exception); + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "If ")); + desc.Add(new ExpressionDescriptor(this, "Test", "boolean")); + desc.Add(new TextItemDescriptor(this, " then")); + return desc; + } + } + public BlockDescriptor BlockDescriptor + { + get + { + BlockDescriptor block = new BlockDescriptor(); + block.Add(new BlockStatementDescriptor(this, "Consequent")); + if (Alternate != null) + { + block.Add(new TextBlockStatementDescritor(this, "Alternate", "Else")); + block.Add(new BlockStatementDescriptor(this, "Alternate")); + } + return block; + } + } + public string Type + { + get + { + return "IfStatement"; + } + } + public bool IsClosing + { + get { return false; } + } + + } +} diff --git a/src/ScriptEngine/runtime/flow/LoopStatement.cs b/src/ScriptEngine/runtime/flow/LoopStatement.cs new file mode 100644 index 0000000..59e967d --- /dev/null +++ b/src/ScriptEngine/runtime/flow/LoopStatement.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class LoopStatement : Loop + { + public LoopStatement() + { + Body = new BlockStatement(); + } + public Expression Loop { get; set; } + public BlockStatement Body + { + get; + set; + } + public string ReturnType + { + get { return "void"; } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Loop == null || Body == null || Body.Body.Count == 0) + return Completion.Void; + var c = Loop.Execute(enviroment); + if(c.Type== CompletionType.Value) + { + + int cycle = 0; + try + { + cycle = TypeConverters.GetValue(c.ReturnValue); + } + catch + { + return Completion.Exception("loop parameter is not a number", Loop); + } + for(int i = 0; i < cycle; i++) + { + ExecutionEnvironment current = new ExecutionEnvironment(enviroment); + var cx = Body.Execute(current); + if (cx.Type == CompletionType.Exception ) + { + return cx; + } + if (cx.Type == CompletionType.Break) + { + return Completion.Void; + } + if (cx.Type == CompletionType.Return) + return cx; + } + } + return c; + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "Loop ")); + desc.Add(new ExpressionDescriptor(this, "Loop", "number")); + desc.Add(new TextItemDescriptor(this, " time")); + return desc; + } + } + public BlockDescriptor BlockDescriptor + { + get + { + BlockDescriptor desc = new BlockDescriptor(); + desc.Add(new BlockStatementDescriptor(this, "Body")); + return desc; + } + } + public string Type + { + get + { + return "WhileStatement"; + } + } + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScriptEngine/runtime/flow/ReturnStatement.cs b/src/ScriptEngine/runtime/flow/ReturnStatement.cs similarity index 53% rename from ScriptEngine/runtime/flow/ReturnStatement.cs rename to src/ScriptEngine/runtime/flow/ReturnStatement.cs index 1bf63c1..dd9ce1a 100644 --- a/ScriptEngine/runtime/flow/ReturnStatement.cs +++ b/src/ScriptEngine/runtime/flow/ReturnStatement.cs @@ -5,19 +5,26 @@ namespace ScratchNet { - public class ReturnStatement : Statement, Execution2 + public class ReturnStatement : Statement { public ReturnStatement() { } - + public Expression Expression { get; set; } public string ReturnType { get { return "void"; } } public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if(Expression==null) + return new Completion(null, CompletionType.Return); + var c = Expression.Execute(enviroment); + if(c.Type== CompletionType.Value) + { + return new Completion(c.ReturnValue, CompletionType.Return); + } + return c; } public Descriptor Descriptor @@ -47,31 +54,5 @@ public bool IsClosing { get { return true; } } - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/src/ScriptEngine/runtime/flow/WhileStatement.cs b/src/ScriptEngine/runtime/flow/WhileStatement.cs new file mode 100644 index 0000000..98e30bb --- /dev/null +++ b/src/ScriptEngine/runtime/flow/WhileStatement.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + + public class WhileStatement : Loop + { + public WhileStatement() + { + Body = new BlockStatement(); + } + public Expression Test { get; set; } + public BlockStatement Body + { + get; + set; + } + public string ReturnType + { + get { return "void"; } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Test == null || Body == null || Body.Body.Count == 0) + return Completion.Void; + var c = Test.Execute(enviroment); + if (c.Type == CompletionType.Value) + { + if (c.ReturnValue is bool) + { + Completion cx = Completion.Void; + while ((bool)c.ReturnValue) + { + ExecutionEnvironment current = new ExecutionEnvironment(enviroment); + cx = Body.Execute(current); + if (cx.Type == CompletionType.Exception) + { + return cx; + } + if (cx.Type == CompletionType.Break) + { + return Completion.Void; + } + if (cx.Type == CompletionType.Return) + return cx; + c = Test.Execute(enviroment); + if (!(c.ReturnValue is bool)) + return Completion.Exception("value is not boolean", Test); + } + return cx; + } + else + return Completion.Exception("test variable is not boolean", Test); + } + return c; + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new TextItemDescriptor(this, "While(")); + desc.Add(new ExpressionDescriptor(this, "Test", "boolean")); + desc.Add(new TextItemDescriptor(this, " )")); + return desc; + } + } + public BlockDescriptor BlockDescriptor + { + get + { + BlockDescriptor desc = new BlockDescriptor(); + desc.Add(new BlockStatementDescriptor(this, "Body")); + return desc; + } + } + public string Type + { + get + { + return "WhileStatement"; + } + } + public bool IsClosing + { + get { return false; } + } + + } +} diff --git a/ScriptEngine/runtime/function/ArgumentExpression.cs b/src/ScriptEngine/runtime/function/ArgumentExpression.cs similarity index 51% rename from ScriptEngine/runtime/function/ArgumentExpression.cs rename to src/ScriptEngine/runtime/function/ArgumentExpression.cs index f13d0be..aff1585 100644 --- a/ScriptEngine/runtime/function/ArgumentExpression.cs +++ b/src/ScriptEngine/runtime/function/ArgumentExpression.cs @@ -16,7 +16,7 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + return new Completion(enviroment.GetValue(Variable)); } public Descriptor Descriptor @@ -36,33 +36,6 @@ public string Type public bool IsClosing { get { return false; } - }//execution - - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment _env) - { - object result = _env.GetValue(Variable); - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/src/ScriptEngine/runtime/function/CallExpression.cs b/src/ScriptEngine/runtime/function/CallExpression.cs new file mode 100644 index 0000000..5a5b340 --- /dev/null +++ b/src/ScriptEngine/runtime/function/CallExpression.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class CallExpression : Expression + { + public string Function + { + get; + set; + } + public string FunctionNameFormat { get; set; } + public CallExpression() + { + Args = new List(); + ArgTyps = new List(); + } + public List Args { get; set; } + public List ArgTyps { get; set; } + public string ReturnType + { + get { return "number|boolean|string"; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + ExecutionEnvironment current = new ExecutionEnvironment(); + + foreach (var f in enviroment.Module.Functions) + { + if (Function.Equals(f.Name)) + { + for (int i = 0; i < Args.Count; i++) + { + Expression e = Args[i]; + string name = ArgTyps[i]; + + Completion cp = e.Execute(enviroment); + if (cp.Type != CompletionType.Value) + return cp; + current.RegisterValue(f.Params[i].Name, cp.ReturnValue); + } + var c = f.Execute(current); + return c; + } + } + DelegateFunction func = enviroment.GetFunction(Function); + List parameters = new List(); + if (func != null) + { + try + { + for (int i = 0; i < Args.Count; i++) + { + Expression e = Args[i]; + string name = ArgTyps[i]; + + Completion cp = e.Execute(enviroment); + if (cp.Type != CompletionType.Value) + return cp; + parameters.Add(cp.ReturnValue); + } + return new Completion(func.Invoke(parameters.ToArray())); + } + catch (Exception e) + { + return Completion.Exception(e.Message, this); + } + } + return Completion.Void; + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + if (string.IsNullOrEmpty(FunctionNameFormat)) + { + desc.Add(new TextItemDescriptor(this, Function + "(")); + if (Args != null && Args.Count > 0) + { + int i = 0; + foreach (Expression p in Args) + { + if (i != 0) + desc.Add(new TextItemDescriptor(this, ", ")); + string t = ""; + if (ArgTyps != null && ArgTyps.Count >= i + 1) + t = ArgTyps[i]; + desc.Add(new ArgumentDescriptor(this, i, "Args", t)); + i++; + } + } + desc.Add(new TextItemDescriptor(this, ")")); + } + else + { + string[] part = FunctionNameFormat.Split(new string[] { "[[", "]]" }, StringSplitOptions.RemoveEmptyEntries); + int i = 0; + foreach (string s in part) + { + if (s.StartsWith("{{") && s.EndsWith("}}")) + { + int length = s.Length; + int index = int.Parse(s.Substring(2).Substring(0, length - 4)); + string t = ""; + if (ArgTyps != null && ArgTyps.Count >= i + 1) + t = ArgTyps[i]; + desc.Add(new ArgumentDescriptor(this, i, "Args", t)); + i++; + } + else + desc.Add(new TextItemDescriptor(this, s)); + } + } + return desc; + } + } + + public string Type + { + get { return ""; } + } + + public BlockDescriptor BlockDescriptor + { + get { return null; } + } + public bool IsClosing + { + get { return false; } + } + + } +} diff --git a/ScriptEngine/runtime/function/CallExpression.cs b/src/ScriptEngine/runtime/function/CallStatement.cs similarity index 66% rename from ScriptEngine/runtime/function/CallExpression.cs rename to src/ScriptEngine/runtime/function/CallStatement.cs index 3818198..2a25249 100644 --- a/ScriptEngine/runtime/function/CallExpression.cs +++ b/src/ScriptEngine/runtime/function/CallStatement.cs @@ -27,6 +27,48 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { + ExecutionEnvironment current = new ExecutionEnvironment(); + + foreach(var f in enviroment.Module.Functions) + { + if (Function.Equals(f.Name)) + { + for (int i = 0; i < Args.Count; i++) + { + Expression e = Args[i]; + string name = ArgTyps[i]; + + Completion cp = e.Execute(enviroment); + if (cp.Type != CompletionType.Value) + return cp; + current.RegisterValue(f.Params[i].Name, cp.ReturnValue); + } + var c = f.Execute(current); + return c; + } + } + DelegateFunction func = enviroment.GetFunction(Function); + List parameters = new List(); + if (func != null) + { + try + { + for (int i = 0; i < Args.Count; i++) + { + Expression e = Args[i]; + string name = ArgTyps[i]; + + Completion cp = e.Execute(enviroment); + if (cp.Type != CompletionType.Value) + return cp; + parameters.Add(cp.ReturnValue); + } + return new Completion(func.Invoke(parameters.ToArray())); + }catch(Exception e) + { + return Completion.Exception(e.Message, this); + } + } return Completion.Void; } @@ -91,63 +133,6 @@ public bool IsClosing { get { return false; } } - //execution - int current = 0; - List pVals; - object result; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - current = 0; - pVals = new List(); - result = null; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment _env) - { - callback = Callback; - if (Args != null && current < Args.Count) - { - execution = Args[current]; - return true; - } - else - { - Function func = null; - Instance This = _env.This; - foreach (Function f in This.Class.Functions) - { - if (f.Name == Function) - func = f; - } - int i = 0; - foreach (object v in pVals) - { - func.Params[i].Value = v; - i++; - } - execution = func; - return false; - } - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if (Args != null && current < Args.Count) - pVals.Add( value); - else - result = value; - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } + } } diff --git a/ScriptEngine/runtime/function/FunctionDeclaration.cs b/src/ScriptEngine/runtime/function/FunctionDeclaration.cs similarity index 100% rename from ScriptEngine/runtime/function/FunctionDeclaration.cs rename to src/ScriptEngine/runtime/function/FunctionDeclaration.cs diff --git a/ScriptEngine/runtime/function/FunctionDeclarationEx.cs b/src/ScriptEngine/runtime/function/FunctionDeclarationEx.cs similarity index 72% rename from ScriptEngine/runtime/function/FunctionDeclarationEx.cs rename to src/ScriptEngine/runtime/function/FunctionDeclarationEx.cs index 1655e4d..44cb1d7 100644 --- a/ScriptEngine/runtime/function/FunctionDeclarationEx.cs +++ b/src/ScriptEngine/runtime/function/FunctionDeclarationEx.cs @@ -19,7 +19,14 @@ public FunctionDeclarationEx() public Completion Execute(ExecutionEnvironment enviroment) { - throw new NotImplementedException(); + if (Body == null) + return Completion.Void; + var c = Body.Execute(enviroment); + if (c.Type == CompletionType.Value || c.Type == CompletionType.Exception) + return c; + if (c.Type == CompletionType.Return) + return new Completion(c.ReturnValue); + return Completion.Void; } public string ReturnType @@ -87,37 +94,5 @@ public bool IsClosing get { return false; } } - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - ExecutionEnvironment _env = new ExecutionEnvironment(new ExecutionEnvironment(e.Engine.BaseEnvironment, e.This)); - if (Params != null) - { - foreach (Parameter p in Params) - { - _env.RegisterValue(p.Name, p.Value); - } - } - return _env; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Body; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/src/ScriptEngine/runtime/logic/CompareExpression.cs b/src/ScriptEngine/runtime/logic/CompareExpression.cs new file mode 100644 index 0000000..fa6a5f4 --- /dev/null +++ b/src/ScriptEngine/runtime/logic/CompareExpression.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class CompareExpression : Expression + { + public Expression Left { get; set; } + public Operator Operator { get; set; } + public Expression Right { get; set; } + + public CompareExpression() + { + Operator = Operator.Equal; + } + + public string ReturnType + { + get { return "boolean"; } + } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Left == null || Right == null) + return new Completion("Null Exception", CompletionType.Exception); + var left = Left.Execute(enviroment); + if (left.Type != CompletionType.Value) + return left; + var right = Right.Execute(enviroment); + + if (right.Type != CompletionType.Value) + return right; + + Type T = TypeConverters.GetNumberTypes(left.ReturnValue, right.ReturnValue); + if (T == null) + return Completion.Exception("Only nuber can accepted", this); + if (T.Equals(typeof(int))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return new Completion(l + r); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + if (T.Equals(typeof(float))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return new Completion(l + r); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + if (T.Equals(typeof(long))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return new Completion(l + r); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return new Completion(l + r); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new ExpressionDescriptor(this, "Left", "number")); + desc.Add(new TextItemDescriptor(this, " ")); + desc.Add(new SelectionItemDescriptor(this, "Operator", + new object[]{"==","!=",">",">=","<","<="}, + new object[]{Operator.Equal, Operator.NotEqual, Operator.Great, Operator.GreatOrEqual, Operator.Less, Operator.LessOrEqual})); + + desc.Add(new TextItemDescriptor(this, " ")); + desc.Add(new ExpressionDescriptor(this, "Right", "number")); + return desc; + } + } + + public string Type + { + get { return "BinaryExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } +} diff --git a/ScriptEngine/runtime/logic/LogicExpression.cs b/src/ScriptEngine/runtime/logic/LogicExpression.cs similarity index 51% rename from ScriptEngine/runtime/logic/LogicExpression.cs rename to src/ScriptEngine/runtime/logic/LogicExpression.cs index 00626f3..b27aec3 100644 --- a/ScriptEngine/runtime/logic/LogicExpression.cs +++ b/src/ScriptEngine/runtime/logic/LogicExpression.cs @@ -21,7 +21,36 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Left == null || Right == null) + return new Completion("Null Exception", CompletionType.Exception); + var left = Left.Execute(enviroment); + if (left.Type != CompletionType.Value) + return left; + if (!(left.ReturnValue is bool)) + return Completion.Exception("left value is not a boolean", Left); + var right = Right.Execute(enviroment); + + if (right.Type != CompletionType.Value) + return right; + if (!(right.ReturnValue is bool)) + return Completion.Exception("right value is not a boolean", Right); + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.And: + return new Completion(l && r); + case Operator.Or: + return new Completion(l || r); + } + return Completion.Exception("Unknow Exception", this); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } } public Descriptor Descriptor @@ -30,7 +59,7 @@ public Descriptor Descriptor { Descriptor desc = new Descriptor(); desc.Add(new ExpressionDescriptor(this, "Left", "boolean")); - desc.Add(new SelectionItemDescriptor(this, "Operator", new object[] { "And", "OR"}, + desc.Add(new SelectionItemDescriptor(this, "Operator", new object[] { "&&", "||"}, new object[] { Operator.And, Operator.Or })); desc.Add(new TextItemDescriptor(this, " ")); desc.Add(new ExpressionDescriptor(this, "Right", "boolean")); @@ -49,61 +78,5 @@ public bool IsClosing bool result; bool leftResult; int current; - //execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = false; - leftResult = false; - current = 0; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = Left; - callback = Callback; - return true; - } - if (current == 1) - { - execution = Right; - callback = Callback; - return false; - } - execution = null; - callback = null; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if (current == 0) - leftResult = (bool)value; - else if(current==1) - { - switch (Operator) - { - case Operator.And: - result=leftResult&&(bool)value; - break; - case Operator.Or: - result=leftResult||(bool)value; - break; - } - } - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/logic/NotExpression.cs b/src/ScriptEngine/runtime/logic/NotExpression.cs similarity index 52% rename from ScriptEngine/runtime/logic/NotExpression.cs rename to src/ScriptEngine/runtime/logic/NotExpression.cs index f6c5d8a..af8506d 100644 --- a/ScriptEngine/runtime/logic/NotExpression.cs +++ b/src/ScriptEngine/runtime/logic/NotExpression.cs @@ -15,7 +15,12 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Argument == null) + return new Completion("value can not be null", CompletionType.Exception); + var a = Argument.Execute(enviroment); + if (a.Type != CompletionType.Value || !(a.ReturnValue is bool)) + return new Completion("value is not a boolean value", CompletionType.Exception); + return new Completion(!(bool)a.ReturnValue); } public Descriptor Descriptor @@ -36,33 +41,6 @@ public string Type public bool IsClosing { get { return false; } - }//execution - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - result = false; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - execution = Argument; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - result = !(bool)value; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); } } } diff --git a/src/ScriptEngine/runtime/math/RandomExpression.cs b/src/ScriptEngine/runtime/math/RandomExpression.cs new file mode 100644 index 0000000..37d0718 --- /dev/null +++ b/src/ScriptEngine/runtime/math/RandomExpression.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public class RandomExpression : Expression + { + public string ReturnType + { + get { return "number"; } + } + public Expression Min { get; set; } + public Expression Max { get; set; } + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Min == null) + return Completion.Exception("parameter of random can not be null", Min); + if (Max == null) + return Completion.Exception("parameter of random can not be null", Max); + var left = Min.Execute(enviroment); + if (left.Type != CompletionType.Value) + return left; + var right = Max.Execute(enviroment); + if (right.Type != CompletionType.Value) + return right; + if (right.Type != CompletionType.Value) + return right; + if (!TypeConverters.IsNumber(left.ReturnValue)) + { + return Completion.Exception("value is not a number", Min); + } + if (!TypeConverters.IsNumber(right.ReturnValue)) + { + return Completion.Exception("value is not a number", Max); + } + Type T = TypeConverters.GetNumberTypes(left.ReturnValue, right.ReturnValue); + if (T == null) + return Completion.Exception("Only nuber can accepted", this); + + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + return new Completion(new Random(1437).Next(l, r)); + } + catch (Exception e) + { + return Completion.Exception(e.Message, this); + } + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new ExpressionDescriptor(this, "Min", "number")); + //desc.Add(new TextItemDescriptor(this, "和")); + desc.Add(new TextItemDescriptor(this, Properties.Resources.random1)); + desc.Add(new ExpressionDescriptor(this, "Max", "number")); + //desc.Add(new TextItemDescriptor(this, "之间的随机数")); + desc.Add(new TextItemDescriptor(this, Properties.Resources.random2)); + return desc; + } + } + public string Type + { + get { return "RandomExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } + +} diff --git a/src/ScriptEngine/runtime/operator/BinaryExpression.cs b/src/ScriptEngine/runtime/operator/BinaryExpression.cs new file mode 100644 index 0000000..ec65b50 --- /dev/null +++ b/src/ScriptEngine/runtime/operator/BinaryExpression.cs @@ -0,0 +1,213 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ScratchNet +{ + public class BinaryExpression : Expression + { + public Expression Left { get; set; } + public Operator Operator { get; set; } + public Expression Right { get; set; } + public BinaryExpression() + { + Operator = Operator.Add; + } + + public string ReturnType + { + get { return "number"; } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Left == null || Right == null) + return new Completion("Null Exception", CompletionType.Exception); + var left = Left.Execute(enviroment); + if (left.Type != CompletionType.Value) + return left; + var right = Right.Execute(enviroment); + + if (right.Type != CompletionType.Value) + return right; + Type T = TypeConverters.GetNumberTypes(left.ReturnValue, right.ReturnValue); + if (T == null) + return Completion.Exception("Only nuber can accepted", this); + if (T.Equals(typeof(int))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Add: + return new Completion(l + r); + case Operator.Minus: + return new Completion(l - r); + case Operator.Mulitiply: + return new Completion(l * r); + case Operator.Divide: + return new Completion(l / r); + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return Completion.Exception("Unknow Exception", this); + } + catch(Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + if(T.Equals(typeof(float))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Add: + return new Completion(l + r); + case Operator.Minus: + return new Completion(l - r); + case Operator.Mulitiply: + return new Completion(l * r); + case Operator.Divide: + return new Completion(l / r); + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return Completion.Exception("Unknow Exception", this); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + if(T.Equals(typeof(long))) + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Add: + return new Completion(l + r); + case Operator.Minus: + return new Completion(l - r); + case Operator.Mulitiply: + return new Completion(l * r); + case Operator.Divide: + return new Completion(l / r); + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return Completion.Exception("Unknow Exception", this); + } + catch (Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } + } + { + try + { + var l = TypeConverters.GetValue(left.ReturnValue); + var r = TypeConverters.GetValue(right.ReturnValue); + switch (Operator) + { + case Operator.Add: + return new Completion(l + r); + case Operator.Minus: + return new Completion(l - r); + case Operator.Mulitiply: + return new Completion(l * r); + case Operator.Divide: + return new Completion(l / r); + case Operator.Great: + return new Completion(l > r); + case Operator.GreatOrEqual: + return new Completion(l >= r); + case Operator.Less: + return new Completion(l < r); + case Operator.LessOrEqual: + return new Completion(l <= r); + case Operator.Equal: + return new Completion(l == r); + } + return Completion.Exception("Unknow Exception", this); + } + catch (Exception e) + { + return Completion.Exception(e.Message, this); + } + } + } + + public Descriptor Descriptor + { + get + { + Descriptor desc = new Descriptor(); + desc.Add(new ExpressionDescriptor(this, "Left", "number") ); + desc.Add(new TextItemDescriptor(this, " ")); + desc.Add(new SelectionItemDescriptor(this, "Operator", new object[] { "+", "-", "*", "/" }, + new object[] { Operator.Add, Operator.Minus, Operator.Mulitiply, Operator.Divide })); + desc.Add(new TextItemDescriptor(this, " ")); + desc.Add(new ExpressionDescriptor(this, "Right", "number")); + return desc; + } + } + + public string Type + { + get { return "BinaryExpression"; } + } + public bool IsClosing + { + get { return false; } + } + } + public enum Operator + { + Add, + Minus, + Mulitiply, + Divide, + Equal, + Great, + Less, + NotEqual, + GreatOrEqual, + LessOrEqual, + And, + Or + } +} diff --git a/ScriptEngine/runtime/operator/ConditionalExpression.cs b/src/ScriptEngine/runtime/operator/ConditionalExpression.cs similarity index 50% rename from ScriptEngine/runtime/operator/ConditionalExpression.cs rename to src/ScriptEngine/runtime/operator/ConditionalExpression.cs index 30177b2..d8fc2f3 100644 --- a/ScriptEngine/runtime/operator/ConditionalExpression.cs +++ b/src/ScriptEngine/runtime/operator/ConditionalExpression.cs @@ -17,7 +17,26 @@ public string ReturnType public Completion Execute(ExecutionEnvironment enviroment) { - return Completion.Void; + if (Test == null) + return Completion.Exception("Test can not be null", this); + var t = Test.Execute(enviroment); + if (t.ReturnValue is bool) + { + if ((bool)t.ReturnValue) + { + if (Consequent == null) + return Completion.Exception("Consequent can not be null", this); + return Consequent.Execute(enviroment); + } + else + { + if (Alternate == null) + return Completion.Exception("Alternate can not be null", this); + return Alternate.Execute(enviroment); + } + } + else + return new Completion("Test return not boolean value", CompletionType.Exception, this); } public Descriptor Descriptor @@ -42,54 +61,5 @@ public bool IsClosing { get { return false; } } - //execution - bool testResult; - object result; - int current = 0; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - testResult = false; - result = null; - current = 0; - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return new Completion(result); - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - if (current == 0) - { - execution = Test; - callback = Callback; - return true; - } - else - { - if (testResult) - execution = Consequent; - else - execution = Alternate; - } - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - if (current == 0) - testResult = (bool)value; - else - result = value; - current++; - return null; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/ScriptEngine/runtime/string/ConcateExpression.cs b/src/ScriptEngine/runtime/string/ConcateExpression.cs similarity index 88% rename from ScriptEngine/runtime/string/ConcateExpression.cs rename to src/ScriptEngine/runtime/string/ConcateExpression.cs index a45b92b..281bf32 100644 --- a/ScriptEngine/runtime/string/ConcateExpression.cs +++ b/src/ScriptEngine/runtime/string/ConcateExpression.cs @@ -26,9 +26,9 @@ public Descriptor Descriptor get { Descriptor desc = new Descriptor(); - desc.Add(new TextItemDescriptor(this, "Concate ")); + desc.Add(new TextItemDescriptor(this, "Concate (")); desc.Add(new ExpressionDescriptor(this, "Left", "string")); - desc.Add(new TextItemDescriptor(this, " and ")); + desc.Add(new TextItemDescriptor(this, " , )")); desc.Add(new ExpressionDescriptor(this, "Right", "string")); return desc; } diff --git a/ScriptEngine/runtime/thread/WaitStatement.cs b/src/ScriptEngine/runtime/thread/WaitStatement.cs similarity index 57% rename from ScriptEngine/runtime/thread/WaitStatement.cs rename to src/ScriptEngine/runtime/thread/WaitStatement.cs index 45ecf3a..9b19cf0 100644 --- a/ScriptEngine/runtime/thread/WaitStatement.cs +++ b/src/ScriptEngine/runtime/thread/WaitStatement.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; namespace ScratchNet { @@ -15,6 +16,17 @@ public string ReturnType } public Completion Execute(ExecutionEnvironment enviroment) { + var c = Duration.Execute(enviroment); + if (c.Type != CompletionType.Value) + return c; + try + { + float t = TypeConverters.GetValue(c.ReturnValue); + Thread.Sleep((int)(t * 1000)); + }catch(Exception e) + { + return new Completion(e.Message, CompletionType.Exception); + } return Completion.Void; } @@ -46,34 +58,5 @@ public bool IsClosing { get { return false; } } - //execution - DateTime startWaitTime; - - public ExecutionEnvironment StartCall(ExecutionEnvironment e) - { - return e; - } - - public Completion EndCall(ExecutionEnvironment e) - { - return Completion.Void; - } - - public bool PopStack(out object execution, out ExecutionCallback callback, ExecutionEnvironment e) - { - - execution = Duration; - callback = Callback; - return false; - } - Nullable Callback(object value, object exception, ExecutionEnvironment e) - { - startWaitTime = DateTime.Now.AddSeconds(double.Parse(value+"")); - return startWaitTime; - } - public bool HandleException(object exception) - { - throw new NotImplementedException(); - } } } diff --git a/src/ScriptEngine/script/BlockStatement.cs b/src/ScriptEngine/script/BlockStatement.cs new file mode 100644 index 0000000..0f6fb47 --- /dev/null +++ b/src/ScriptEngine/script/BlockStatement.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + + //定义代码块和flow control, 比如if, while + public class BlockStatement : Execution, INode + { + ObservableCollection _body = new ObservableCollection(); + public ObservableCollection Body + { + get { return _body; } + set + { + _body = value; + } + } + + public Completion Execute(ExecutionEnvironment enviroment) + { + if (Body == null || Body.Count == 0) + return Completion.Void; + Completion c = Completion.Void; + for (int i = 0; i < Body.Count; i++) + { + Statement stat = Body[i]; + c = stat.Execute(enviroment); + if(c.Type!= CompletionType.Value) + { + return c; + } + } + return c; + } + } +} diff --git a/ScriptEngine/script/Class.cs b/src/ScriptEngine/script/Class.cs similarity index 100% rename from ScriptEngine/script/Class.cs rename to src/ScriptEngine/script/Class.cs diff --git a/ScriptEngine/script/Declaration.cs b/src/ScriptEngine/script/Declaration.cs similarity index 70% rename from ScriptEngine/script/Declaration.cs rename to src/ScriptEngine/script/Declaration.cs index 01ac0be..db568f1 100644 --- a/ScriptEngine/script/Declaration.cs +++ b/src/ScriptEngine/script/Declaration.cs @@ -5,7 +5,7 @@ namespace ScratchNet { - public interface Declaration : Execution + public interface Declaration : Execution, INode { } } diff --git a/ScriptEngine/script/EventHandler.cs b/src/ScriptEngine/script/EventHandler.cs similarity index 100% rename from ScriptEngine/script/EventHandler.cs rename to src/ScriptEngine/script/EventHandler.cs diff --git a/ScriptEngine/script/Expression.cs b/src/ScriptEngine/script/Expression.cs similarity index 86% rename from ScriptEngine/script/Expression.cs rename to src/ScriptEngine/script/Expression.cs index 40221b4..f1a5dce 100644 --- a/ScriptEngine/script/Expression.cs +++ b/src/ScriptEngine/script/Expression.cs @@ -7,7 +7,7 @@ namespace ScratchNet { //定义表达式 //expression中不能有statement - public interface Expression : Execution, Execution2 + public interface Expression : Execution, INode { string ReturnType { get; } diff --git a/ScriptEngine/script/Function.cs b/src/ScriptEngine/script/Function.cs similarity index 93% rename from ScriptEngine/script/Function.cs rename to src/ScriptEngine/script/Function.cs index 39df1e6..801ac0f 100644 --- a/ScriptEngine/script/Function.cs +++ b/src/ScriptEngine/script/Function.cs @@ -5,7 +5,7 @@ namespace ScratchNet { - public interface Function : Declaration, Execution2 + public interface Function : Declaration { string ReturnType { get; } diff --git a/ExecutionEngine/ExecutionMode.cs b/src/ScriptEngine/script/INode.cs similarity index 68% rename from ExecutionEngine/ExecutionMode.cs rename to src/ScriptEngine/script/INode.cs index a4887ac..bf7ccac 100644 --- a/ExecutionEngine/ExecutionMode.cs +++ b/src/ScriptEngine/script/INode.cs @@ -6,9 +6,7 @@ namespace ScratchNet { - public enum ExecutionMode + public interface INode { - ExitWhenFinish, - Infinite } } diff --git a/ScriptEngine/script/Instance.cs b/src/ScriptEngine/script/Instance.cs similarity index 100% rename from ScriptEngine/script/Instance.cs rename to src/ScriptEngine/script/Instance.cs diff --git a/ScriptEngine/script/Loop.cs b/src/ScriptEngine/script/Loop.cs similarity index 100% rename from ScriptEngine/script/Loop.cs rename to src/ScriptEngine/script/Loop.cs diff --git a/src/ScriptEngine/script/Module.cs b/src/ScriptEngine/script/Module.cs new file mode 100644 index 0000000..50b6ad2 --- /dev/null +++ b/src/ScriptEngine/script/Module.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScratchNet +{ + public interface Module : Class + { + } +} diff --git a/ScriptEngine/script/Statement.cs b/src/ScriptEngine/script/Statement.cs similarity index 89% rename from ScriptEngine/script/Statement.cs rename to src/ScriptEngine/script/Statement.cs index 61cc582..fee2c25 100644 --- a/ScriptEngine/script/Statement.cs +++ b/src/ScriptEngine/script/Statement.cs @@ -7,7 +7,7 @@ namespace ScratchNet { //定义程序步骤,单步可执行语句 - public interface Statement: Execution, Execution2 + public interface Statement: Execution, INode { string ReturnType { get; } diff --git a/ScriptEngine/script/Types.cs b/src/ScriptEngine/script/Types.cs similarity index 100% rename from ScriptEngine/script/Types.cs rename to src/ScriptEngine/script/Types.cs diff --git a/ScriptEngine/script/Variable.cs b/src/ScriptEngine/script/Variable.cs similarity index 100% rename from ScriptEngine/script/Variable.cs rename to src/ScriptEngine/script/Variable.cs diff --git a/ScriptEngine/script/descriptor/BlockDescriptor.cs b/src/ScriptEngine/script/descriptor/BlockDescriptor.cs similarity index 95% rename from ScriptEngine/script/descriptor/BlockDescriptor.cs rename to src/ScriptEngine/script/descriptor/BlockDescriptor.cs index ee7d5b2..e4b64fb 100644 --- a/ScriptEngine/script/descriptor/BlockDescriptor.cs +++ b/src/ScriptEngine/script/descriptor/BlockDescriptor.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Reflection; @@ -7,7 +8,7 @@ namespace ScratchNet { - public class BlockDescriptor : List + public class BlockDescriptor : ObservableCollection { } public class BlockItemDescriptor : INotifyPropertyChanged diff --git a/ScriptEngine/script/descriptor/Descriptor.cs b/src/ScriptEngine/script/descriptor/Descriptor.cs similarity index 100% rename from ScriptEngine/script/descriptor/Descriptor.cs rename to src/ScriptEngine/script/descriptor/Descriptor.cs diff --git a/ScriptEngine/script/descriptor/SelectionExpressionItemDescriptor.cs b/src/ScriptEngine/script/descriptor/SelectionExpressionItemDescriptor.cs similarity index 100% rename from ScriptEngine/script/descriptor/SelectionExpressionItemDescriptor.cs rename to src/ScriptEngine/script/descriptor/SelectionExpressionItemDescriptor.cs diff --git a/test/UnitTestProject/AstExectuion.cs b/test/UnitTestProject/AstExectuion.cs new file mode 100644 index 0000000..93e736e --- /dev/null +++ b/test/UnitTestProject/AstExectuion.cs @@ -0,0 +1,212 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScratchNet; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UnitTestProject +{ + [TestClass] + [TestCategory("Ast Execution")] + public class AstExectuion + { + [TestMethod] + public void TestRandomExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 1); + e.RegisterValue("b", 7); + e.RegisterValue("c", 5); + Identifier a = new Identifier() { Variable = "a" }; + Identifier b = new Identifier() { Variable = "b" }; + Identifier c = new Identifier() { Variable = "c" }; + RandomExpression s = new RandomExpression() { Min = a, Max = b }; + var c1 = s.Execute(e); + Assert.AreEqual(c1.Type, CompletionType.Value); + e.SetValue("a", 3); + var c2 = s.Execute(e); + Assert.AreEqual(c2.Type, CompletionType.Value); + } + [TestMethod] + public void TestCondictionalExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", false); + e.RegisterValue("c", 5); + Identifier a = new Identifier() { Variable = "a" }; + Identifier b = new Identifier() { Variable = "b" }; + Identifier c = new Identifier() { Variable = "c" }; + ConditionalExpression s = new ConditionalExpression() + { + Test = a, + Consequent = b, + Alternate = c + }; + var c1 = s.Execute(e); + Assert.AreEqual(c1.ReturnValue, false); + e.SetValue("a", false); + var c2 = s.Execute(e); + Assert.AreEqual(c2.ReturnValue, 5); + } + [TestMethod] + public void TestLogicalExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", false); + e.RegisterValue("c", 5); + Identifier a = new Identifier() { Variable = "a" }; + Identifier b = new Identifier() { Variable = "b" }; + Identifier c = new Identifier() { Variable = "c" }; + + Assert.AreEqual(new LogicExpression() { Left = a, Right = b, Operator = Operator.And }.Execute(e).ReturnValue, false); + Assert.AreEqual(new LogicExpression() { Left = a, Right = b, Operator = Operator.Or }.Execute(e).ReturnValue, true); + Assert.AreEqual(new LogicExpression() { Left = a, Right = c, Operator = Operator.Or }.Execute(e).Type, CompletionType.Exception); + } + [TestMethod] + public void TestNotExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + Identifier a = new Identifier() { Variable = "a" }; + NotExpression s = new NotExpression() { Argument = a }; + Assert.AreEqual(s.Execute(e).ReturnValue, false); + e.SetValue("a", 5); + Assert.AreEqual(s.Execute(e).Type, CompletionType.Exception); + } + [TestMethod] + public void TestICompareExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 5.2); + Identifier a = new Identifier() { Variable = "a" }; + Literal l = new Literal(); + l.Raw = "15"; + Literal r = new Literal() { Raw = "5.2" }; + + Assert.AreEqual(new CompareExpression() { Left = l, Right = r, Operator = Operator.Great }.Execute(e).ReturnValue, true); + Assert.AreEqual(new CompareExpression() { Left = l, Right = r, Operator = Operator.GreatOrEqual }.Execute(e).ReturnValue, true); + Assert.AreEqual(new CompareExpression() { Left = l, Right = r, Operator = Operator.Less }.Execute(e).ReturnValue, false); + Assert.AreEqual(new CompareExpression() { Left = l, Right = r, Operator = Operator.LessOrEqual }.Execute(e).ReturnValue, false); + Assert.AreEqual(new CompareExpression() { Left = a, Right = r, Operator = Operator.Equal }.Execute(e).ReturnValue, false); + } + [TestMethod] + public void TestIBindaryExpression() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + + Literal l = new Literal(); + l.Raw = "15"; + Literal r = new Literal() { Raw = "5.2" }; + + Assert.IsTrue(Math.Abs((float)(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Add }.Execute(e).ReturnValue)-(15+5.2f))<0.0001); + Assert.IsTrue(Math.Abs((float)(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Minus }.Execute(e).ReturnValue) - (15 - 5.2f)) < 0.0001); + Assert.IsTrue(Math.Abs((float)(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Mulitiply }.Execute(e).ReturnValue) - (15 * 5.2f)) < 0.0001); + Assert.IsTrue(Math.Abs((float)(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Divide }.Execute(e).ReturnValue) - (15 / 5.2f)) < 0.0001); + + Assert.AreEqual(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Great }.Execute(e).ReturnValue, true); + Assert.AreEqual(new BinaryExpression() { Left = l, Right = r, Operator = Operator.GreatOrEqual }.Execute(e).ReturnValue, true); + Assert.AreEqual(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Less }.Execute(e).ReturnValue, false); + Assert.AreEqual(new BinaryExpression() { Left = l, Right = r, Operator = Operator.LessOrEqual }.Execute(e).ReturnValue, false); + Assert.AreEqual(new BinaryExpression() { Left = l, Right = r, Operator = Operator.Equal }.Execute(e).ReturnValue, false); + } + [TestMethod] + public void TestIsNumber() + { + int a = 5; + Assert.IsTrue(TypeConverters.IsNumber(a)); + float b = 5; + double c = 1; + Assert.IsTrue(TypeConverters.IsNumber(b)); + Assert.IsTrue(TypeConverters.IsNumber(c)); + } + [TestMethod] + public void TestWaitStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 1); + Identifier i = new Identifier(); + i.Variable = "a"; + WaitStatement w = new WaitStatement(); + w.Duration = i; + var c = w.Execute(e); + Assert.IsNull(c.ReturnValue); + } + [TestMethod] + public void TestAssignmentStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 5); + Identifier i = new Identifier(); + i.Variable = "a"; + AssignmentStatement s = new AssignmentStatement(); + s.Left = i; + Literal l = new Literal() { Raw = "7" }; + s.Right = l; + var c = s.Execute(e); + Assert.AreEqual(c.ReturnValue, 7); + e.RegisterValue("c", 5); + var dd = new AssignmentStatement() { Left = new Identifier() { Variable = "c" }, Right = new BinaryExpression() { Left = new Identifier() { Variable = "c" }, Operator = Operator.Add, Right = new Literal() { Raw = "2" } } }; + var cx = dd.Execute(e); + Assert.AreEqual(cx.ReturnValue, 7); + } + [TestMethod] + public void TestExpressionStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 5); + Identifier i = new Identifier(); + i.Variable = "a"; + ExpressionStatement s = new ExpressionStatement(); + s.Expression = i; + var c = s.Execute(e); + Assert.AreEqual(c.ReturnValue, 5); + } + [TestMethod] + public void TestIndentifier() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 5); + Identifier i = new Identifier(); + i.Variable = "a"; + var c = i.Execute(e); + Assert.AreEqual(c.ReturnValue, 5); + } + [TestMethod] + public void TestVariableDeclarationcs() + { + VariableDeclarationcs v = new VariableDeclarationcs(); + v.Name = "v"; + v.Value = 5; + ExecutionEnvironment e = new ExecutionEnvironment(); + var r=v.Execute(e); + Assert.AreEqual(r.ReturnValue, 5); + Assert.AreEqual(r.Type, CompletionType.Value); + Assert.AreEqual(e.GetValue("v"), 5); + } + [TestMethod] + public void TestLiteral() + { + Literal v = new Literal(); + v.Raw = "5"; + ExecutionEnvironment e = new ExecutionEnvironment(); + var r = v.Execute(e); + Assert.AreEqual(r.ReturnValue, 5); + { + Literal a = new Literal() { Raw = "6.0" }; + var ra = a.Execute(e); + Assert.AreEqual(ra.Type, CompletionType.Value); + Assert.AreEqual(ra.ReturnValue, 6.0f); + } + { + Literal a = new Literal() { Raw = "\"6.0\"" }; + var ra = a.Execute(e); + Assert.AreEqual(ra.Type, CompletionType.Value); + Assert.AreEqual(ra.ReturnValue, "6.0"); + } + } + } +} diff --git a/test/UnitTestProject/AstExecutionTest.cs b/test/UnitTestProject/AstExecutionTest.cs new file mode 100644 index 0000000..4dc6f0e --- /dev/null +++ b/test/UnitTestProject/AstExecutionTest.cs @@ -0,0 +1,98 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScratchNet; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UnitTestProject +{ + [TestClass] + public class AstExecutionTest + { + [TestMethod] + public void TestIfStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", false); + e.RegisterValue("c", 5); + e.RegisterValue("d", 6); + IfStatement s = new IfStatement(); + s.Test = new LogicExpression() { Left = new Identifier() { Variable = "a" }, Right = new Identifier() { Variable = "b" }, Operator = Operator.And }; + s.Consequent = new BlockStatement(); + s.Consequent.Body.Add(new AssignmentStatement() { Left=new Identifier() { Variable = "c" }, Right = new Identifier() { Variable = "d" } }); + s.Alternate = new BlockStatement(); + s.Alternate.Body.Add(new ExpressionStatement() { Expression = new Identifier() { Variable = "d" } }); + Assert.AreEqual(s.Execute(e).ReturnValue, 6); + + e.SetValue("b", true); + Assert.AreEqual(s.Execute(e).ReturnValue, 6); + } + [TestMethod] + public void TestLoopStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", true); + e.RegisterValue("c", 5); + e.RegisterValue("d", 6); + LoopStatement s = new LoopStatement(); + s.Loop = new LogicExpression() { Left = new Identifier() { Variable = "a" }, Right = new Identifier() { Variable = "b" }, Operator = Operator.And }; + s.Body = new BlockStatement(); + s.Body.Body.Add(new AssignmentStatement() { Left=new Identifier() { Variable = "c" }, Right = new BinaryExpression() { Left = new Identifier() { Variable = "c" }, Operator=Operator.Add, Right=new Literal() { Raw = "2" } } }); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "a" }, Right = new Literal() { Raw = "false" } }); + var c = s.Execute(e); + Assert.AreEqual(c.Type, CompletionType.Exception); + } + [TestMethod] + public void TestWhileStatement() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", true); + e.RegisterValue("c", 5); + e.RegisterValue("d", 6); + WhileStatement s = new WhileStatement(); + s.Test = new LogicExpression() { Left = new Identifier() { Variable = "a" }, Right = new Identifier() { Variable = "b" }, Operator = Operator.And }; + s.Body = new BlockStatement(); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "c" }, Right = new BinaryExpression() { Left = new Identifier() { Variable = "c" }, Operator = Operator.Add, Right = new Literal() { Raw = "2" } } }); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "a" }, Right = new Literal() { Raw = "false" } }); + var c = s.Execute(e); + Assert.AreEqual(e.GetValue("c"), 7); + } + [TestMethod] + public void TestWhileStatement2() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", true); + e.RegisterValue("c", 5); + e.RegisterValue("d", 6); + WhileStatement s = new WhileStatement(); + s.Test = new Identifier() { Variable = "c" }; + s.Body = new BlockStatement(); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "c" }, Right = new BinaryExpression() { Left = new Identifier() { Variable = "c" }, Operator = Operator.Add, Right = new Literal() { Raw = "2" } } }); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "a" }, Right = new Literal() { Raw = "false" } }); + var c = s.Execute(e); + Assert.AreEqual(c.Type, CompletionType.Exception); + } + [TestMethod] + public void TesLoopStatement2() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", true); + e.RegisterValue("b", true); + e.RegisterValue("c", 5); + e.RegisterValue("d", 6); + LoopStatement s = new LoopStatement(); + s.Loop = new Identifier() { Variable = "c" }; + s.Body = new BlockStatement(); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "c" }, Right = new BinaryExpression() { Left = new Identifier() { Variable = "c" }, Operator = Operator.Add, Right = new Literal() { Raw = "2" } } }); + s.Body.Body.Add(new AssignmentStatement() { Left = new Identifier() { Variable = "a" }, Right = new Literal() { Raw = "false" } }); + var c = s.Execute(e); + Assert.AreEqual(e.GetValue("c"), 5+5*2); + } + } +} diff --git a/test/UnitTestProject/Properties/AssemblyInfo.cs b/test/UnitTestProject/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9f16753 --- /dev/null +++ b/test/UnitTestProject/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("UnitTestProject")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("UnitTestProject")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("584aaafe-1eae-4f99-9e9b-c375098b7a9e")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/UnitTestProject/TestEnvronment.cs b/test/UnitTestProject/TestEnvronment.cs new file mode 100644 index 0000000..e5752c1 --- /dev/null +++ b/test/UnitTestProject/TestEnvronment.cs @@ -0,0 +1,63 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScratchNet; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UnitTestProject +{ + [TestClass] + public class TestEnvronment + { + [TestMethod] + public void TestVariable() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", null); + Assert.IsNull(e.GetValue("a")); + e.RegisterValue("b", "5"); + Assert.AreEqual(e.GetValue("b"), "5"); + } + [TestMethod] + public void TestIntConvetion() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("a", 1); + Assert.AreEqual(e.GetValue("a"), "1"); + Assert.AreEqual(e.GetValue("a"), 1); + Assert.AreEqual(e.GetValue("a"), 1); + } + [TestMethod] + public void TestStringConvertion() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterValue("b", "5"); + Assert.AreEqual(e.GetValue("b"), "5"); + Assert.AreEqual(e.GetValue("b"), 5); + Assert.AreEqual(e.GetValue("b"), 5); + e.RegisterValue("c", "false"); + Assert.AreEqual(e.GetValue("c"), false); + } + [TestMethod] + public void TestFunction() + { + ExecutionEnvironment e = new ExecutionEnvironment(); + e.RegisterFunction("a", DelegateFunction.CreateDelegate(this, "Test")); + e.RegisterFunction("b", DelegateFunction.CreateDelegate(this, "Test2")); + DelegateFunction f = e.GetFunction("a"); + DelegateFunction f1 = e.GetFunction("b"); + Assert.AreEqual(f.Invoke(), "a"); + Assert.AreEqual(f1.Invoke(2), 2); + } + public string Test() + { + return "a"; + } + public int Test2(int a) + { + return a; + } + } +} diff --git a/test/UnitTestProject/TestExpression.cs b/test/UnitTestProject/TestExpression.cs new file mode 100644 index 0000000..4834ba8 --- /dev/null +++ b/test/UnitTestProject/TestExpression.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ScratchNet; + +namespace UnitTestProject +{ + [TestClass] + public class TestExpression + { + [TestMethod] + public void IntValueTest() + { + ScriptValue v = ScriptValue.New(5); + Assert.AreEqual(v.GetValue(), 5.0); + Assert.AreEqual(v.GetValue(), "5"); + } + [TestMethod] + public void StringTest() + { + + ScriptValue a = ScriptValue.New("5"); + Assert.AreEqual(a.GetValue(), 5); + Assert.AreEqual(a.GetValue(), 5.0); + } + [TestMethod] + public void ArrayTest() + { + ScriptValue b = ScriptValue.New>(new List() { "a", "b" }); + Assert.AreEqual(b.GetArrayValue(0), "a"); + } + + + } +} diff --git a/test/UnitTestProject/UnitTestProject.csproj b/test/UnitTestProject/UnitTestProject.csproj new file mode 100644 index 0000000..4745c87 --- /dev/null +++ b/test/UnitTestProject/UnitTestProject.csproj @@ -0,0 +1,77 @@ + + + + + + Debug + AnyCPU + {584AAAFE-1EAE-4F99-9E9B-C375098B7A9E} + Library + Properties + UnitTestProject + UnitTestProject + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + + {9efe2134-8015-4957-a9e1-f7d2fbb4cda7} + ScriptEngine + + + + + + + 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/test/UnitTestProject/packages.config b/test/UnitTestProject/packages.config new file mode 100644 index 0000000..2f7c5a1 --- /dev/null +++ b/test/UnitTestProject/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file